Changeset 227


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

Location:
trunk/PARPG/tools/Writing Editor
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/tools/Writing Editor/docs/examples/example.dialog

    r226 r227  
    77Guard SAY "You cannot pass." # [who says it] SAY [what to say] 
    88 
    9 OPTION leaveOrFight # OPTION [option_name]x 
     9OPTION leaveOrFight # OPTION [option_name] 
    10101 "Fine." leaveGuard # [option_number] [what_to_say] [what_section_to_run] 
    11112 "I must pass." attackGuard 
     
    1818   guardDead = False 
    1919   PLAYSOUND "testsound.wav" 1 # PLAYSOUND [sound_file] [number_of_times] 
    20    ENDSCRIPT # End the script 
     20   RETURN # End the script 
    2121ENDSECTION 
    2222 
  • trunk/PARPG/tools/Writing Editor/docs/html/index.html

    r226 r227  
    22 
    33<head> 
    4 <title>Help</title> 
    54<link rel="stylesheet" href="main.css" type="text/css" /> 
    65</head> 
    76 
    87<body> 
    9 <center><h1>Help with the Editor</h1></center> 
     8<center><h1>Help</h1></center> 
    109<p>Welcome to the main help page for the PARPG Writing Editor</p> 
    1110</body> 
  • 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() 
  • trunk/PARPG/tools/Writing Editor/ui/editor_ui.py

    r217 r227  
    5454        self.menuHelp = QtGui.QMenu(self.menubar) 
    5555        self.menuHelp.setObjectName("menuHelp") 
    56         self.menuHelp_2 = QtGui.QMenu(self.menuHelp) 
    57         self.menuHelp_2.setObjectName("menuHelp_2") 
    5856        self.writingEditor.setMenuBar(self.menubar) 
    5957 
     
    8886        self.actionPreferences.setObjectName("actionPreferences") 
    8987 
    90         self.actionHelp_with_Editor = QtGui.QAction(self.writingEditor) 
    91         self.actionHelp_with_Editor.setObjectName("actionHelp_with_Editor") 
    92         self.actionHelp_With_Scripting = QtGui.QAction(self.writingEditor) 
    93         self.actionHelp_With_Scripting.setObjectName("actionHelp_With_Scripting") 
     88        self.actionHelp = QtGui.QAction(self.writingEditor) 
     89        self.actionHelp.setObjectName("actionHelp") 
    9490        self.actionAbout = QtGui.QAction(self.writingEditor) 
    9591        self.actionAbout.setObjectName("actionAbout") 
     
    118114        self.menuEdit.addAction(self.actionPreferences) 
    119115 
    120         self.menuHelp_2.addAction(self.actionHelp_with_Editor) 
    121         self.menuHelp_2.addAction(self.actionHelp_With_Scripting) 
    122         self.menuHelp.addAction(self.menuHelp_2.menuAction()) 
     116        self.menuHelp.addAction(self.actionHelp) 
    123117        self.menuHelp.addAction(self.actionAbout) 
    124118 
     
    143137        self.menuEdit.setTitle(QtGui.QApplication.translate("writingEditor", "Edit", None, QtGui.QApplication.UnicodeUTF8)) 
    144138        self.menuHelp.setTitle(QtGui.QApplication.translate("writingEditor", "Help", None, QtGui.QApplication.UnicodeUTF8)) 
    145         self.menuHelp_2.setTitle(QtGui.QApplication.translate("writingEditor", "Help", None, QtGui.QApplication.UnicodeUTF8)) 
    146139 
  • trunk/PARPG/tools/Writing Editor/ui/popupWindows.py

    r226 r227  
    195195    The help window 
    196196    """ 
    197     def __init__(self, help_type, settings, parent=None): 
    198         """ 
    199         @type help_type: string 
    200         @param help_type: whether the window should be for help with the editor or scripting 
    201                           can be either "editor" or "scripting" 
     197    def __init__(self, settings, parent=None): 
     198        """ 
    202199        @type settings: settings.Settings 
    203200        @param settings: The editor's settings 
     
    207204        self.settings = settings 
    208205 
    209         if (help_type == "editor"): 
    210             self.setWindowTitle("Help with the Editor") 
    211  
    212         elif (help_type == "scripting"): 
    213             self.setWindowTitle("Help with Scripting") 
    214  
    215         else: 
    216             print "Invalid argument for help_type. Should be either \"editor\" or \"scripting\"" 
     206        self.setWindowTitle("Help") 
    217207 
    218208        width = int(self.settings.res_width) 
Note: See TracChangeset for help on using the changeset viewer.