Changeset 230


Ignore:
Timestamp:
08/09/09 05:08:21 (10 years ago)
Author:
bretzel_parpg
Message:

Fixed some connecting issues between signals and functions. Added a lot to the help.

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

Legend:

Unmodified
Added
Removed
  • trunk/PARPG/tools/Writing Editor/docs/html/index.html

    r227 r230  
    11<html> 
    2  
    32<head> 
    43<link rel="stylesheet" href="main.css" type="text/css" /> 
    54</head> 
    6  
    75<body> 
    86<center><h1>Help</h1></center> 
    97<p>Welcome to the main help page for the PARPG Writing Editor</p> 
     8<h2>Getting Started</h2> 
     9<p>A good place to start learning the scripting language is to look at the example.<br/>The editor is rather straightforward, and it should be easy to figure out.<br/>For further information, click on the topics in the left pane.</p> 
     10<h2>Further Help/Contacting</h2> 
     11<p>If you need more help, you can ask at the PARPG Forums (http://forums.parpg.net), or join us on IRC.</p> 
     12<p>IRC Details:<br/>Server: irc.freenode.net<br/>Port: 6667<br/>Channel: #parpg</p> 
     13<p>To report a bug, open a ticket at the Trac (http://parpg-trac.cvsdude.com/parpg).</p> 
    1014</body> 
    11  
    1215</html> 
  • trunk/PARPG/tools/Writing Editor/docs/html/main.css

    r226 r230  
    22font-weight:bold; 
    33} 
     4 
     5h2 { 
     6size:20px; 
     7} 
  • trunk/PARPG/tools/Writing Editor/scripts/syntaxHighlight.py

    r229 r230  
    4747                "option", "OPTION", "endoption", "ENDOPTION", "playsound", 
    4848                "PLAYSOUND", "say", "SAY", "attack", "ATTACK", "return", 
    49                 "RETURN","#", "/\*", "\""] 
     49                "RETURN","IF", "if", "ELIF", "elif", "ELSE", "else", 
     50                "#", "/\*", "\""] 
    5051 
    5152        for cmd in cmds: 
  • trunk/PARPG/tools/Writing Editor/scripts/writingEditor.py

    r228 r230  
    3636        self.ui.setupUi(self) 
    3737        self.syntax = SyntaxHighlighter(self.ui.main_edit.document()) 
     38        self.syntaxCreated = True 
    3839        self.connectSignals() 
    3940        self.setupMenus() 
     
    124125        @return: None 
    125126        """ 
    126         QtCore.QObject.connect(self.ui.menubar, QtCore.SIGNAL("currentChanged(int)"), 
    127                                self, QtCore.SIGNAL("enableFunctionsByTabs(int)")) 
     127        QtCore.QObject.connect(self.ui.main_tabs, QtCore.SIGNAL("currentChanged(int)"), 
     128                               self.enableFunctionsByTabs) 
    128129        QtCore.QObject.connect(self.ui.main_edit, QtCore.SIGNAL("textChanged()"), 
    129130                               self.onTextChanged) 
     
    162163        Function called when text is changed 
    163164        """ 
    164         self.saveEnabled(True) 
    165         if (self.windowTitle() == "PARPG Writing Editor - Untitled"): 
    166             return 
    167  
    168         if (self.open_file_name == None): 
    169             self.setWindowTitle("PARPG Writing Editor - Untitled") 
    170             return 
    171  
    172         if (self.title_asterisk == False): 
    173             self.setWindowTitle(self.windowTitle() + " *") 
    174             self.title_asterisk = True 
    175  
     165        if (self.syntaxCreated): 
     166            self.syntaxCreated = False 
     167 
     168        else: 
     169            self.saveEnabled(True) 
     170            if (self.windowTitle() == "PARPG Writing Editor - Untitled"): 
     171                return 
     172 
     173            if (self.open_file_name == None): 
     174                self.setWindowTitle("PARPG Writing Editor - Untitled") 
     175                return 
     176 
     177            if (self.title_asterisk == False): 
     178                self.setWindowTitle(self.windowTitle() + " *") 
     179                self.title_asterisk = True 
     180             
    176181    def enableFunctionsByTabs(self, index): 
    177182        """ 
     
    186191            self.ui.actionCut.setEnabled(True) 
    187192            self.ui.actionPaste.setEnabled(True) 
    188  
     193            self.saveEnabled(True) 
    189194        elif (index == 1): 
    190195            self.ui.actionCopy.setEnabled(False) 
     
    329334        """ 
    330335        if (not hasattr(self, "about_window")): 
    331             self.about_window = AboutWindow() 
     336            self.about_window = AboutWindow(self.ui.writingEditor, self) 
    332337        self.about_window.show() 
    333338 
     
    348353        """ 
    349354        if (not hasattr(self, "help_window")): 
    350             self.help_window = HelpWindow(self.settings) 
     355            self.help_window = HelpWindow(self.settings, self) 
    351356        self.help_window.show() 
    352357 
  • trunk/PARPG/tools/Writing Editor/ui/popupWindows.py

    r227 r230  
    1717 
    1818from PyQt4 import QtGui, QtCore 
     19from scripts.syntaxHighlight import SyntaxHighlighter 
    1920 
    2021class AboutWindow(QtGui.QMainWindow): 
     
    211212        self.setWindowIcon(QtGui.QIcon("data/images/help.png")) 
    212213 
     214        self.file_names = {"Home":"docs/html/index.html", 
     215                           "Scripting":"docs/html/scripting.html", 
     216                           "Dialog Example":"docs/html/example.html"} 
     217 
    213218        self.central_widget = QtGui.QWidget(self) 
    214219        self.central_widget.setGeometry(QtCore.QRect(0,0,width-10,height-50)) 
     
    220225        self.list_layout = QtGui.QVBoxLayout() 
    221226 
     227        self.list_label = QtGui.QLabel() 
     228        self.list_label.setText("Topics:") 
     229        self.list_layout.addWidget(self.list_label) 
     230 
     231        self.list = QtGui.QStandardItemModel() 
     232        self.list.appendRow([QtGui.QStandardItem("Home")]) 
     233        self.list.appendRow([QtGui.QStandardItem("Scripting")]) 
     234        self.list.appendRow([QtGui.QStandardItem("Dialog Example")]) 
    222235 
    223236        self.list_view = QtGui.QListView() 
    224237        self.list_view.setMinimumHeight(height-150) 
    225238        self.list_view.setMinimumWidth(self.list_pane.width()) 
     239        self.list_view.setModel(self.list) 
     240        self.list_view.setEditTriggers(self.list_view.NoEditTriggers) 
    226241        self.list_layout.addWidget(self.list_view) 
    227242        self.list_pane.setLayout(self.list_layout) 
     
    233248 
    234249        self.central_widget.setLayout(self.main_layout)         
    235          
     250        self.syntax = SyntaxHighlighter(self.main_help_window) 
    236251        self.connectSignals() 
     252         
     253    def openFile(self, index): 
     254        """ 
     255        Open the html file according to its index in the list 
     256        @type index: int 
     257        @param index: the index in self.list_view 
     258        @return: None 
     259        """ 
     260        page_name = index.data().toString() 
     261        file_name = self.file_names[str(page_name)] 
     262        self.main_help_window.setHtml(open(file_name, 'r').read()) 
     263         
    237264 
    238265    def connectSignals(self): 
     
    241268        @return: None 
    242269        """ 
    243         pass 
    244          
    245     def search(self): 
    246         """ 
    247         Search through the documentation for the contents of self.search_bar 
    248         @return: None 
    249         """ 
    250         self.search_text = self.search_bar.text() 
     270        QtCore.QObject.connect(self.list_view, QtCore.SIGNAL("clicked(QModelIndex)"), 
     271                               self.openFile) 
Note: See TracChangeset for help on using the changeset viewer.