Preferences/ConfigurationPages/EditorAPIsPage.py

changeset 3190
a9a94491c4fd
parent 3186
a05eff845522
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
34 self.setupUi(self) 34 self.setupUi(self)
35 self.setObjectName("EditorAPIsPage") 35 self.setObjectName("EditorAPIsPage")
36 36
37 self.apiFileButton.setIcon(UI.PixmapCache.getIcon("open.png")) 37 self.apiFileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
38 38
39 self.prepareApiButton.setText(self.trUtf8("Compile APIs")) 39 self.prepareApiButton.setText(self.tr("Compile APIs"))
40 self.__currentAPI = None 40 self.__currentAPI = None
41 self.__inPreparation = False 41 self.__inPreparation = False
42 42
43 self.apiFileCompleter = E5FileCompleter(self.apiFileEdit) 43 self.apiFileCompleter = E5FileCompleter(self.apiFileEdit)
44 44
136 """ 136 """
137 Private method to select an api file. 137 Private method to select an api file.
138 """ 138 """
139 file = E5FileDialog.getOpenFileName( 139 file = E5FileDialog.getOpenFileName(
140 self, 140 self,
141 self.trUtf8("Select API file"), 141 self.tr("Select API file"),
142 self.apiFileEdit.text(), 142 self.apiFileEdit.text(),
143 self.trUtf8("API File (*.api);;All Files (*)")) 143 self.tr("API File (*.api);;All Files (*)"))
144 144
145 if file: 145 if file:
146 self.apiFileEdit.setText(Utilities.toNativeSeparators(file)) 146 self.apiFileEdit.setText(Utilities.toNativeSeparators(file))
147 147
148 @pyqtSlot() 148 @pyqtSlot()
180 for installedAPIFile in installedAPIFiles: 180 for installedAPIFile in installedAPIFiles:
181 installedAPIFilesShort.append( 181 installedAPIFilesShort.append(
182 QFileInfo(installedAPIFile).fileName()) 182 QFileInfo(installedAPIFile).fileName())
183 file, ok = QInputDialog.getItem( 183 file, ok = QInputDialog.getItem(
184 self, 184 self,
185 self.trUtf8("Add from installed APIs"), 185 self.tr("Add from installed APIs"),
186 self.trUtf8("Select from the list of installed API files"), 186 self.tr("Select from the list of installed API files"),
187 installedAPIFilesShort, 187 installedAPIFilesShort,
188 0, False) 188 0, False)
189 if ok: 189 if ok:
190 self.apiList.addItem(Utilities.toNativeSeparators( 190 self.apiList.addItem(Utilities.toNativeSeparators(
191 QFileInfo(QDir(installedAPIFilesPath), file) 191 QFileInfo(QDir(installedAPIFilesPath), file)
192 .absoluteFilePath())) 192 .absoluteFilePath()))
193 else: 193 else:
194 E5MessageBox.warning( 194 E5MessageBox.warning(
195 self, 195 self,
196 self.trUtf8("Add from installed APIs"), 196 self.tr("Add from installed APIs"),
197 self.trUtf8("""There are no APIs installed yet.""" 197 self.tr("""There are no APIs installed yet."""
198 """ Selection is not available.""")) 198 """ Selection is not available."""))
199 self.addInstalledApiFileButton.setEnabled(False) 199 self.addInstalledApiFileButton.setEnabled(False)
200 self.prepareApiButton.setEnabled(self.apiList.count() > 0) 200 self.prepareApiButton.setEnabled(self.apiList.count() > 0)
201 201
202 @pyqtSlot() 202 @pyqtSlot()
203 def on_addPluginApiFileButton_clicked(self): 203 def on_addPluginApiFileButton_clicked(self):
210 pluginAPIFilesDict = {} 210 pluginAPIFilesDict = {}
211 for apiFile in pluginAPIFiles: 211 for apiFile in pluginAPIFiles:
212 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile 212 pluginAPIFilesDict[QFileInfo(apiFile).fileName()] = apiFile
213 file, ok = QInputDialog.getItem( 213 file, ok = QInputDialog.getItem(
214 self, 214 self,
215 self.trUtf8("Add from Plugin APIs"), 215 self.tr("Add from Plugin APIs"),
216 self.trUtf8( 216 self.tr(
217 "Select from the list of API files installed by plugins"), 217 "Select from the list of API files installed by plugins"),
218 sorted(pluginAPIFilesDict.keys()), 218 sorted(pluginAPIFilesDict.keys()),
219 0, False) 219 0, False)
220 if ok: 220 if ok:
221 self.apiList.addItem(Utilities.toNativeSeparators( 221 self.apiList.addItem(Utilities.toNativeSeparators(
241 Private method called after the API preparation has finished. 241 Private method called after the API preparation has finished.
242 """ 242 """
243 self.prepareApiProgressBar.reset() 243 self.prepareApiProgressBar.reset()
244 self.prepareApiProgressBar.setRange(0, 100) 244 self.prepareApiProgressBar.setRange(0, 100)
245 self.prepareApiProgressBar.setValue(0) 245 self.prepareApiProgressBar.setValue(0)
246 self.prepareApiButton.setText(self.trUtf8("Compile APIs")) 246 self.prepareApiButton.setText(self.tr("Compile APIs"))
247 self.__inPreparation = False 247 self.__inPreparation = False
248 248
249 def __apiPreparationCancelled(self): 249 def __apiPreparationCancelled(self):
250 """ 250 """
251 Private slot called after the API preparation has been cancelled. 251 Private slot called after the API preparation has been cancelled.
256 """ 256 """
257 Private method called after the API preparation has started. 257 Private method called after the API preparation has started.
258 """ 258 """
259 self.prepareApiProgressBar.setRange(0, 0) 259 self.prepareApiProgressBar.setRange(0, 0)
260 self.prepareApiProgressBar.setValue(0) 260 self.prepareApiProgressBar.setValue(0)
261 self.prepareApiButton.setText(self.trUtf8("Cancel compilation")) 261 self.prepareApiButton.setText(self.tr("Cancel compilation"))
262 self.__inPreparation = True 262 self.__inPreparation = True
263 263
264 def saveState(self): 264 def saveState(self):
265 """ 265 """
266 Public method to save the current state of the widget. 266 Public method to save the current state of the widget.

eric ide

mercurial