source: trunk/tools/Writing Editor/scripts/dialogMap.py @ 242

Revision 234, 2.0 KB checked in by bretzel_parpg, 10 years ago (diff)

Started on the parser and dialog map

Line 
1#!/usr/bin/python
2
3#   This file is part of PARPG.
4
5#   PARPG is free software: you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation, either version 3 of the License, or
8#   (at your option) any later version.
9
10#   PARPG is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#   GNU General Public License for more details.
14
15#   You should have received a copy of the GNU General Public License
16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
17
18from PyQt4 import QtGui, QtCore
19from scripts.parser import Parser
20
21class DialogMap(QtGui.QTreeWidget):
22    """
23    The dialog map which will show the flow of the dialog
24    """
25    def __init__(self, settings, main_edit, parent):
26        """
27        Initialize the dialog map
28        @type settings: settings.Settings
29        @param settings: the settings for the editor
30        @type main_edit: QtGui.QTextEdit
31        @param main_edit: The main text editor
32        @type parent: Any Qt widget
33        @param parent: The widgets' parent
34        @return: None
35        """
36        QtGui.QWidget.__init__(self, parent)
37       
38        self.settings = settings
39        self.parent = parent
40        self.resize(int(self.settings.res_width), int(self.settings.res_height))
41        self.parser = Parser(main_edit.document())
42
43        self.setColumnCount(1)
44        self.setEditTriggers(self.NoEditTriggers)
45        self.model = QtGui.QTreeWidgetItem()
46        self.items = []
47        for i in xrange(10):
48            item = QtGui.QTreeWidgetItem()
49            item.setText(0, str(i))
50            item2 = QtGui.QTreeWidgetItem()
51            item2.setText(0, str(i + 1))
52            item.addChild(item2)
53            self.items.append(item)
54        self.insertTopLevelItems(0, self.items)
55        self.setHeaderLabel("Dialog Map")
Note: See TracBrowser for help on using the repository browser.