56 [''] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
56 [''] + list(QScintilla.Lexers.getSupportedApiLanguages())) |
57 for lang in apiLanguages: |
57 for lang in apiLanguages: |
58 self.apiLanguageComboBox.addItem( |
58 self.apiLanguageComboBox.addItem( |
59 QScintilla.Lexers.getLanguageIcon(lang, False), |
59 QScintilla.Lexers.getLanguageIcon(lang, False), |
60 lang) |
60 lang) |
61 apiProjectTypes = sorted( |
|
62 [("", "")] + |
|
63 [(trans, ptype) for ptype, trans in |
|
64 e5App().getObject("Project").getProjectTypes().items() |
|
65 ] |
|
66 ) |
|
67 for projectTypeStr, projectType in apiProjectTypes: |
|
68 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
|
69 self.__currentApiLanguage = "" |
61 self.__currentApiLanguage = "" |
70 self.__currentApiProjectTypeIndex = 0 |
|
71 self.__currentApiProjectType = "" |
|
72 self.on_apiLanguageComboBox_activated(self.__currentApiLanguage) |
62 self.on_apiLanguageComboBox_activated(self.__currentApiLanguage) |
73 self.on_projectTypeComboBox_activated( |
|
74 self.__currentApiProjectTypeIndex) |
|
75 |
63 |
76 def __apiKey(self, language, projectType): |
64 def __apiKey(self, language, projectType): |
77 """ |
65 """ |
78 Private method to generate a key for the apis dictionary. |
66 Private method to generate a key for the apis dictionary. |
79 |
67 |
124 @pyqtSlot(str) |
112 @pyqtSlot(str) |
125 def on_apiLanguageComboBox_activated(self, language): |
113 def on_apiLanguageComboBox_activated(self, language): |
126 """ |
114 """ |
127 Private slot to fill the api listbox of the api page. |
115 Private slot to fill the api listbox of the api page. |
128 |
116 |
129 @param language selected API language (string) |
117 @param language selected API language |
|
118 @type str |
130 """ |
119 """ |
131 if self.__currentApiLanguage == language: |
120 if self.__currentApiLanguage == language: |
132 return |
121 return |
133 |
122 |
134 self.__fillApisList() |
123 self.__fillProjectTypeComboBox(language) |
|
124 |
|
125 def __fillProjectTypeComboBox(self, language): |
|
126 """ |
|
127 Private slot to fill the selection of available project types for the |
|
128 given language. |
|
129 |
|
130 @param language selected API language |
|
131 @type str |
|
132 """ |
|
133 self.projectTypeComboBox.clear() |
|
134 |
|
135 apiProjectTypes = sorted( |
|
136 [("", "")] + |
|
137 [(trans, ptype) for ptype, trans in |
|
138 e5App().getObject("Project").getProjectTypes(language).items() |
|
139 ] |
|
140 ) |
|
141 for projectTypeStr, projectType in apiProjectTypes: |
|
142 self.projectTypeComboBox.addItem(projectTypeStr, projectType) |
|
143 |
|
144 self.__currentApiProjectTypeIndex = -1 |
|
145 self.__currentApiProjectType = "" |
|
146 |
|
147 self.on_projectTypeComboBox_activated(0) |
135 |
148 |
136 def __fillApisList(self): |
149 def __fillApisList(self): |
137 """ |
150 """ |
138 Private slot to fill the list of API files. |
151 Private slot to fill the list of API files. |
139 """ |
152 """ |
332 Public method to set the state of the widget. |
345 Public method to set the state of the widget. |
333 |
346 |
334 @param state state data generated by saveState |
347 @param state state data generated by saveState |
335 """ |
348 """ |
336 self.apiLanguageComboBox.setCurrentIndex(state[0]) |
349 self.apiLanguageComboBox.setCurrentIndex(state[0]) |
337 self.projectTypeComboBox.setCurrentIndex(state[1]) |
|
338 self.on_apiLanguageComboBox_activated( |
350 self.on_apiLanguageComboBox_activated( |
339 self.apiLanguageComboBox.currentText()) |
351 self.apiLanguageComboBox.currentText()) |
|
352 |
|
353 self.projectTypeComboBox.setCurrentIndex(state[1]) |
340 self.on_projectTypeComboBox_activated(state[1]) |
354 self.on_projectTypeComboBox_activated(state[1]) |
341 |
355 |
342 @pyqtSlot() |
356 @pyqtSlot() |
343 def on_apiList_itemSelectionChanged(self): |
357 def on_apiList_itemSelectionChanged(self): |
344 """ |
358 """ |