8 the editor widget. |
8 the editor widget. |
9 """ |
9 """ |
10 |
10 |
11 from PyQt4.QtCore import QTimer |
11 from PyQt4.QtCore import QTimer |
12 from PyQt4.QtGui import QWidget, QGridLayout, QComboBox |
12 from PyQt4.QtGui import QWidget, QGridLayout, QComboBox |
13 |
|
14 from .Editor import Editor |
|
15 |
|
16 from Utilities.ModuleParser import Module, Function, getTypeFromTypeName |
|
17 |
13 |
18 import UI.PixmapCache |
14 import UI.PixmapCache |
19 |
15 |
20 |
16 |
21 class EditorAssembly(QWidget): |
17 class EditorAssembly(QWidget): |
41 self.__layout.setContentsMargins(0, 0, 0, 0) |
37 self.__layout.setContentsMargins(0, 0, 0, 0) |
42 self.__layout.setSpacing(1) |
38 self.__layout.setSpacing(1) |
43 |
39 |
44 self.__globalsCombo = QComboBox() |
40 self.__globalsCombo = QComboBox() |
45 self.__membersCombo = QComboBox() |
41 self.__membersCombo = QComboBox() |
|
42 from .Editor import Editor |
46 self.__editor = Editor(dbs, fn, vm, filetype, editor, tv) |
43 self.__editor = Editor(dbs, fn, vm, filetype, editor, tv) |
47 |
44 |
48 self.__layout.addWidget(self.__globalsCombo, 0, 0) |
45 self.__layout.addWidget(self.__globalsCombo, 0, 0) |
49 self.__layout.addWidget(self.__membersCombo, 0, 1) |
46 self.__layout.addWidget(self.__membersCombo, 0, 1) |
50 self.__layout.addWidget(self.__editor, 1, 0, 1, -1) |
47 self.__layout.addWidget(self.__editor, 1, 0, 1, -1) |
123 self.__membersCombo.addItem(itm[0], key, itm[1]) |
120 self.__membersCombo.addItem(itm[0], key, itm[1]) |
124 else: |
121 else: |
125 return |
122 return |
126 |
123 |
127 # step 2.1: add class methods |
124 # step 2.1: add class methods |
|
125 from Utilities.ModuleParser import Function |
128 items = {} |
126 items = {} |
129 for meth in entry.methods.values(): |
127 for meth in entry.methods.values(): |
130 if meth.modifier == Function.Static: |
128 if meth.modifier == Function.Static: |
131 icon = UI.PixmapCache.getIcon("method_static.png") |
129 icon = UI.PixmapCache.getIcon("method_static.png") |
132 elif meth.modifier == Function.Class: |
130 elif meth.modifier == Function.Class: |
188 |
186 |
189 def __parseEditor(self): |
187 def __parseEditor(self): |
190 """ |
188 """ |
191 Private method to parse the editor source and repopulate the globals combo. |
189 Private method to parse the editor source and repopulate the globals combo. |
192 """ |
190 """ |
|
191 from Utilities.ModuleParser import Module, getTypeFromTypeName |
|
192 |
193 self.__module = None |
193 self.__module = None |
194 sourceType = getTypeFromTypeName(self.__editor.determineFileType()) |
194 sourceType = getTypeFromTypeName(self.__editor.determineFileType()) |
195 if sourceType != -1: |
195 if sourceType != -1: |
196 src = self.__editor.text() |
196 src = self.__editor.text() |
197 if src: |
197 if src: |