Ignore:
Timestamp:
08/08/09 04:51:58 (10 years ago)
Author:
bretzel_parpg
Message:

Merged help with the editor and help with scripting into one help. Added syntax highlighting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/tools/Writing Editor/scripts/writingEditor.py

    r226 r227  
    2121from ui.editor_ui import Ui_writingEditor 
    2222from ui.popupWindows import * 
     23from scripts.syntaxHighlight import SyntaxHighlighter 
    2324from scripts.settings import Settings 
    2425 
     
    3435        self.ui = Ui_writingEditor() 
    3536        self.ui.setupUi(self) 
     37        self.syntax = SyntaxHighlighter(self.ui.main_edit.document()) 
    3638        self.connectSignals() 
    3739        self.setupMenus() 
     
    6769        self.ui.actionPaste.setText('&Paste\tCtrl+V') 
    6870        self.ui.actionPreferences.setText('P&references\tCtrl+Shift+P') 
    69         self.ui.actionHelp_with_Editor.setText('Help With &Editor\tF10') 
    70         self.ui.actionHelp_With_Scripting.setText('Help With &Scripting\tF11') 
    71         self.ui.actionAbout.setText('&About\tF12') 
     71        self.ui.actionHelp.setText("&Help\tF1") 
     72        self.ui.actionAbout.setText('&About\tF2') 
    7273        self.ui.actionNone.setText('None') 
    7374 
     
    8485        self.ui.actionPaste.setShortcut(QtGui.QKeySequence('Ctrl+V')) 
    8586        self.ui.actionPreferences.setShortcut(QtGui.QKeySequence('Ctrl+Shift+P')) 
    86         self.ui.actionHelp_with_Editor.setShortcut(QtGui.QKeySequence('F10')) 
    87         self.ui.actionHelp_With_Scripting.setShortcut(QtGui.QKeySequence('F11')) 
    88         self.ui.actionAbout.setShortcut(QtGui.QKeySequence('F12')) 
     87        self.ui.actionHelp.setShortcut(QtGui.QKeySequence('F1')) 
     88        self.ui.actionAbout.setShortcut(QtGui.QKeySequence('F2')) 
    8989 
    9090        self.ui.actionNew_File.setIcon(self.createIcon('new.png')) 
     
    100100        self.ui.actionPaste.setIcon(self.createIcon('paste.png')) 
    101101        self.ui.actionPreferences.setIcon(self.createIcon('preferences.png')) 
    102         self.ui.actionHelp_with_Editor.setIcon(self.createIcon('help.png')) 
    103         self.ui.actionHelp_With_Scripting.setIcon(self.createIcon('help.png')) 
     102        self.ui.actionHelp.setIcon(self.createIcon('help.png')) 
    104103        self.ui.actionAbout.setIcon(self.createIcon('about.png')) 
    105104 
     
    116115        self.ui.actionPaste.setStatusTip('Paste the text on the clipboard') 
    117116        self.ui.actionPreferences.setStatusTip('Edit preferences with the editor') 
    118         self.ui.actionHelp_with_Editor.setStatusTip('Help with the editor itself') 
    119         self.ui.actionHelp_With_Scripting.setStatusTip('Help with the scripting language') 
     117        self.ui.actionHelp.setStatusTip('Help with the editor and scripting language itself') 
    120118        self.ui.actionAbout.setStatusTip('About the editor') 
    121119        self.ui.actionNone.setStatusTip('There are no recent files') 
     
    157155        QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL("triggered()"), 
    158156                               self.createAboutWindow) 
    159         QtCore.QObject.connect(self.ui.actionHelp_with_Editor, QtCore.SIGNAL("triggered()"), 
    160                                self.createEditorHelpWindow) 
    161         QtCore.QObject.connect(self.ui.actionHelp_With_Scripting, QtCore.SIGNAL("triggered()"), 
    162                                self.createScriptingHelpWindow) 
     157        QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL("triggered()"), 
     158                               self.createHelpWindow) 
    163159 
    164160    def onTextChanged(self): 
     
    166162        Function called when text is changed 
    167163        """ 
    168         self.saveEnabled(True) 
     164        if (not self.ui.actionSave.isEnabled): 
     165            self.saveEnabled(True) 
    169166        if (self.windowTitle() == "PARPG Writing Editor - Untitled"): 
    170167            return 
     
    346343        self.pref_window.button_apply.setEnabled(True) 
    347344 
    348     def createEditorHelpWindow(self): 
    349         """ 
    350         Create the editor help window 
    351         @return: None 
    352         """ 
    353         if (not hasattr(self, "help_editor_window")): 
    354             self.help_editor_window = HelpWindow("editor", self.settings) 
    355         self.help_editor_window.show() 
    356  
    357     def createScriptingHelpWindow(self): 
    358         """ 
    359         Create the scripting help window 
    360         @return: None 
    361         """ 
    362         if (not hasattr(self, "help_scripting_window")): 
    363             self.help_scripting_window = HelpWindow("scripting", self.settings) 
    364         self.help_scripting_window.show() 
     345    def createHelpWindow(self): 
     346        """ 
     347        Create the help window 
     348        @return: None 
     349        """ 
     350        if (not hasattr(self, "help_window")): 
     351            self.help_window = HelpWindow(self.settings) 
     352        self.help_window.show() 
    365353 
    366354    def getRecentItems(self, filename): 
     
    540528        @return: None 
    541529        """ 
    542         # if save is enabled we know there have been changes 
    543         if (self.ui.actionSave.isEnabled()): 
    544             window = ChangesWindow() 
    545             ret = window.run() 
    546  
    547             if (ret == QtGui.QMessageBox.Save): 
    548                 self.saveFile() 
    549                 return 
    550              
    551             elif (ret == QtGui.QMessageBox.Discard): 
    552                 return 
    553              
    554             elif (ret == QtGui.QMessageBox.Cancel): 
    555                 window.close() 
    556                 return 
    557  
    558         self.writeRecentItems(filename) 
    559530        self.ui.writingEditor.close() 
Note: See TracChangeset for help on using the changeset viewer.