eric6/QScintilla/EditorOutlineModel.py

changeset 7686
379d402162ca
parent 7685
0b6e8c0d6403
child 7690
a59680062837
equal deleted inserted replaced
7685:0b6e8c0d6403 7686:379d402162ca
34 """ 34 """
35 super(EditorOutlineModel, self).__init__(nopopulate=True) 35 super(EditorOutlineModel, self).__init__(nopopulate=True)
36 36
37 self.__editor = editor 37 self.__editor = editor
38 38
39 self.__filename = self.__editor.getFileName()
40 self.__module = os.path.basename(self.__filename)
41
42 self.__populated = False 39 self.__populated = False
43 40
44 rootData = QCoreApplication.translate("EditorOutlineModel", "Name") 41 rootData = QCoreApplication.translate("EditorOutlineModel", "Name")
45 self.rootItem = BrowserItem(None, rootData) 42 self.rootItem = BrowserItem(None, rootData)
46 43
51 Private slot to populate the model. 48 Private slot to populate the model.
52 49
53 @param repopulate flag indicating a repopulation 50 @param repopulate flag indicating a repopulation
54 @type bool 51 @type bool
55 """ 52 """
53 self.__filename = self.__editor.getFileName()
54 self.__module = os.path.basename(self.__filename)
55
56 language = self.__editor.getLanguage() 56 language = self.__editor.getLanguage()
57 if language in EditorOutlineModel.SupportedLanguages: 57 if language in EditorOutlineModel.SupportedLanguages:
58 if language in ("Python3", "MicroPython"): 58 if language in ("Python3", "MicroPython"):
59 from Utilities.ClassBrowsers import pyclbr 59 from Utilities.ClassBrowsers import pyclbr
60 dictionary = pyclbr.scan(self.__editor.text(), self.__filename, 60 dictionary = pyclbr.scan(self.__editor.text(), self.__filename,
143 """ 143 """
144 Public slot to repopulate the model. 144 Public slot to repopulate the model.
145 """ 145 """
146 self.clear() 146 self.clear()
147 self.__populateModel(repopulate=True) 147 self.__populateModel(repopulate=True)
148
149 def editor(self):
150 """
151 Public method to retrieve a reference to the editor.
152
153 @return reference to the editor
154 @rtype Editor
155 """
156 return self.__editor
157
158 def fileName(self):
159 """
160 Public method to retrieve the file name of the editor.
161
162 @return file name of the editor
163 @rtype str
164 """
165 return self.__filename

eric ide

mercurial