Preferences/ConfigurationPages/EditorAPIsPage.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3190
a9a94491c4fd
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
19 from .ConfigurationPageBase import ConfigurationPageBase 19 from .ConfigurationPageBase import ConfigurationPageBase
20 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage 20 from .Ui_EditorAPIsPage import Ui_EditorAPIsPage
21 21
22 import Preferences 22 import Preferences
23 import Utilities 23 import Utilities
24 import UI.PixmapCache
24 25
25 26
26 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage): 27 class EditorAPIsPage(ConfigurationPageBase, Ui_EditorAPIsPage):
27 """ 28 """
28 Class implementing the Editor APIs configuration page. 29 Class implementing the Editor APIs configuration page.
33 """ 34 """
34 super(EditorAPIsPage, self).__init__() 35 super(EditorAPIsPage, self).__init__()
35 self.setupUi(self) 36 self.setupUi(self)
36 self.setObjectName("EditorAPIsPage") 37 self.setObjectName("EditorAPIsPage")
37 38
38 self.prepareApiButton.setText(self.trUtf8("Compile APIs")) 39 self.apiFileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
40
41 self.prepareApiButton.setText(self.tr("Compile APIs"))
39 self.__currentAPI = None 42 self.__currentAPI = None
40 self.__inPreparation = False 43 self.__inPreparation = False
41 44
42 self.apiFileCompleter = E5FileCompleter(self.apiFileEdit) 45 self.apiFileCompleter = E5FileCompleter(self.apiFileEdit)
43 46
135 """ 138 """
136 Private method to select an api file. 139 Private method to select an api file.
137 """ 140 """
138 file = E5FileDialog.getOpenFileName( 141 file = E5FileDialog.getOpenFileName(
139 self, 142 self,
140 self.trUtf8("Select API file"), 143 self.tr("Select API file"),
141 self.apiFileEdit.text(), 144 self.apiFileEdit.text(),
142 self.trUtf8("API File (*.api);;All Files (*)")) 145 self.tr("API File (*.api);;All Files (*)"))
143 146
144 if file: 147 if file:
145 self.apiFileEdit.setText(Utilities.toNativeSeparators(file)) 148 self.apiFileEdit.setText(Utilities.toNativeSeparators(file))
146 149
147 @pyqtSlot() 150 @pyqtSlot()
179 for installedAPIFile in installedAPIFiles: 182 for installedAPIFile in installedAPIFiles:
180 installedAPIFilesShort.append( 183 installedAPIFilesShort.append(
181 QFileInfo(installedAPIFile).fileName()) 184 QFileInfo(installedAPIFile).fileName())
182 file, ok = QInputDialog.getItem( 185 file, ok = QInputDialog.getItem(
183 self, 186 self,
184 self.trUtf8("Add from installed APIs"), 187 self.tr("Add from installed APIs"),
185 self.trUtf8("Select from the list of installed API files"), 188 self.tr("Select from the list of installed API files"),
186 installedAPIFilesShort, 189 installedAPIFilesShort,
187 0, False) 190 0, False)
188 if ok: 191 if ok:
189 self.apiList.addItem(Utilities.toNativeSeparators( 192 self.apiList.addItem(Utilities.toNativeSeparators(
190 QFileInfo(QDir(installedAPIFilesPath), file) 193 QFileInfo(QDir(installedAPIFilesPath), file)
191 .absoluteFilePath())) 194 .absoluteFilePath()))
192 else: 195 else:
193 E5MessageBox.warning( 196 E5MessageBox.warning(
194 self, 197 self,
195 self.trUtf8("Add from installed APIs"), 198 self.tr("Add from installed APIs"),
196 self.trUtf8("""There are no APIs installed yet.""" 199 self.tr("""There are no APIs installed yet."""
197 """ Selection is not available.""")) 200 """ Selection is not available."""))
198 self.addInstalledApiFileButton.setEnabled(False) 201 self.addInstalledApiFileButton.setEnabled(False)
199 self.prepareApiButton.setEnabled(self.apiList.count() > 0) 202 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
200 203
201 @pyqtSlot() 204 @pyqtSlot()
202 def on_addPluginApiFileButton_clicked(self): 205 def on_addPluginApiFileButton_clicked(self):
209 pluginAPIFilesDict = {} 212 pluginAPIFilesDict = {}
210 for apiFile in pluginAPIFiles: 213 for apiFile in pluginAPIFiles:
211 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile 214 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile
212 file, ok = QInputDialog.getItem( 215 file, ok = QInputDialog.getItem(
213 self, 216 self,
214 self.trUtf8("Add from Plugin APIs"), 217 self.tr("Add from Plugin APIs"),
215 self.trUtf8( 218 self.tr(
216 "Select from the list of API files installed by plugins"), 219 "Select from the list of API files installed by plugins"),
217 sorted(pluginAPIFilesDict.keys()), 220 sorted(pluginAPIFilesDict.keys()),
218 0, False) 221 0, False)
219 if ok: 222 if ok:
220 self.apiList.addItem(Utilities.toNativeSeparators( 223 self.apiList.addItem(Utilities.toNativeSeparators(
240 Private method called after the API preparation has finished. 243 Private method called after the API preparation has finished.
241 """ 244 """
242 self.prepareApiProgressBar.reset() 245 self.prepareApiProgressBar.reset()
243 self.prepareApiProgressBar.setRange(0, 100) 246 self.prepareApiProgressBar.setRange(0, 100)
244 self.prepareApiProgressBar.setValue(0) 247 self.prepareApiProgressBar.setValue(0)
245 self.prepareApiButton.setText(self.trUtf8("Compile APIs")) 248 self.prepareApiButton.setText(self.tr("Compile APIs"))
246 self.__inPreparation = False 249 self.__inPreparation = False
247 250
248 def __apiPreparationCancelled(self): 251 def __apiPreparationCancelled(self):
249 """ 252 """
250 Private slot called after the API preparation has been cancelled. 253 Private slot called after the API preparation has been cancelled.
255 """ 258 """
256 Private method called after the API preparation has started. 259 Private method called after the API preparation has started.
257 """ 260 """
258 self.prepareApiProgressBar.setRange(0, 0) 261 self.prepareApiProgressBar.setRange(0, 0)
259 self.prepareApiProgressBar.setValue(0) 262 self.prepareApiProgressBar.setValue(0)
260 self.prepareApiButton.setText(self.trUtf8("Cancel compilation")) 263 self.prepareApiButton.setText(self.tr("Cancel compilation"))
261 self.__inPreparation = True 264 self.__inPreparation = True
262 265
263 def saveState(self): 266 def saveState(self):
264 """ 267 """
265 Public method to save the current state of the widget. 268 Public method to save the current state of the widget.

eric ide

mercurial