PluginManager/PluginRepositoryDialog.py

changeset 3190
a9a94491c4fd
parent 3189
9a21c547de5f
child 3200
83bde5e6f146
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
64 """ 64 """
65 super().__init__(parent) 65 super().__init__(parent)
66 self.setupUi(self) 66 self.setupUi(self)
67 67
68 self.__updateButton = self.buttonBox.addButton( 68 self.__updateButton = self.buttonBox.addButton(
69 self.trUtf8("Update"), QDialogButtonBox.ActionRole) 69 self.tr("Update"), QDialogButtonBox.ActionRole)
70 self.__downloadButton = self.buttonBox.addButton( 70 self.__downloadButton = self.buttonBox.addButton(
71 self.trUtf8("Download"), QDialogButtonBox.ActionRole) 71 self.tr("Download"), QDialogButtonBox.ActionRole)
72 self.__downloadButton.setEnabled(False) 72 self.__downloadButton.setEnabled(False)
73 self.__downloadInstallButton = self.buttonBox.addButton( 73 self.__downloadInstallButton = self.buttonBox.addButton(
74 self.trUtf8("Download && Install"), 74 self.tr("Download && Install"),
75 QDialogButtonBox.ActionRole) 75 QDialogButtonBox.ActionRole)
76 self.__downloadInstallButton.setEnabled(False) 76 self.__downloadInstallButton.setEnabled(False)
77 self.__downloadCancelButton = self.buttonBox.addButton( 77 self.__downloadCancelButton = self.buttonBox.addButton(
78 self.trUtf8("Cancel"), QDialogButtonBox.ActionRole) 78 self.tr("Cancel"), QDialogButtonBox.ActionRole)
79 self.__installButton = \ 79 self.__installButton = \
80 self.buttonBox.addButton(self.trUtf8("Close && Install"), 80 self.buttonBox.addButton(self.tr("Close && Install"),
81 QDialogButtonBox.ActionRole) 81 QDialogButtonBox.ActionRole)
82 self.__downloadCancelButton.setEnabled(False) 82 self.__downloadCancelButton.setEnabled(False)
83 self.__installButton.setEnabled(False) 83 self.__installButton.setEnabled(False)
84 84
85 self.repositoryUrlEdit.setText( 85 self.repositoryUrlEdit.setText(
271 else: 271 else:
272 ui = None 272 ui = None
273 if ui and ui.notificationsEnabled(): 273 if ui and ui.notificationsEnabled():
274 ui.showNotification( 274 ui.showNotification(
275 UI.PixmapCache.getPixmap("plugin48.png"), 275 UI.PixmapCache.getPixmap("plugin48.png"),
276 self.trUtf8("Download Plugin Files"), 276 self.tr("Download Plugin Files"),
277 self.trUtf8("""The requested plugins were downloaded.""")) 277 self.tr("""The requested plugins were downloaded."""))
278 278
279 if self.__isDownloadInstall: 279 if self.__isDownloadInstall:
280 self.closeAndInstall.emit() 280 self.closeAndInstall.emit()
281 else: 281 else:
282 if ui is None or not ui.notificationsEnabled(): 282 if ui is None or not ui.notificationsEnabled():
283 E5MessageBox.information( 283 E5MessageBox.information(
284 self, 284 self,
285 self.trUtf8("Download Plugin Files"), 285 self.tr("Download Plugin Files"),
286 self.trUtf8("""The requested plugins were downloaded.""")) 286 self.tr("""The requested plugins were downloaded."""))
287 self.downloadProgress.setValue(0) 287 self.downloadProgress.setValue(0)
288 288
289 # repopulate the list to update the refresh icons 289 # repopulate the list to update the refresh icons
290 self.__populateList() 290 self.__populateList()
291 291
323 url = Preferences.getUI("PluginRepositoryUrl5") 323 url = Preferences.getUI("PluginRepositoryUrl5")
324 if url != self.repositoryUrlEdit.text(): 324 if url != self.repositoryUrlEdit.text():
325 self.repositoryUrlEdit.setText(url) 325 self.repositoryUrlEdit.setText(url)
326 E5MessageBox.warning( 326 E5MessageBox.warning(
327 self, 327 self,
328 self.trUtf8("Plugins Repository URL Changed"), 328 self.tr("Plugins Repository URL Changed"),
329 self.trUtf8( 329 self.tr(
330 """The URL of the Plugins Repository has""" 330 """The URL of the Plugins Repository has"""
331 """ changed. Select the "Update" button to get""" 331 """ changed. Select the "Update" button to get"""
332 """ the new repository file.""")) 332 """ the new repository file."""))
333 else: 333 else:
334 E5MessageBox.critical( 334 E5MessageBox.critical(
335 self, 335 self,
336 self.trUtf8("Read plugins repository file"), 336 self.tr("Read plugins repository file"),
337 self.trUtf8("<p>The plugins repository file <b>{0}</b> " 337 self.tr("<p>The plugins repository file <b>{0}</b> "
338 "could not be read. Select Update</p>") 338 "could not be read. Select Update</p>")
339 .format(self.pluginRepositoryFile)) 339 .format(self.pluginRepositoryFile))
340 else: 340 else:
341 self.__repositoryMissing = True 341 self.__repositoryMissing = True
342 QTreeWidgetItem( 342 QTreeWidgetItem(
343 self.repositoryList, 343 self.repositoryList,
344 ["", self.trUtf8( 344 ["", self.tr(
345 "No plugin repository file available.\nSelect Update.") 345 "No plugin repository file available.\nSelect Update.")
346 ]) 346 ])
347 self.repositoryList.resizeColumnToContents(1) 347 self.repositoryList.resizeColumnToContents(1)
348 348
349 def __downloadFile(self, url, filename, doneMethod=None): 349 def __downloadFile(self, url, filename, doneMethod=None):
391 if reply.error() != QNetworkReply.NoError: 391 if reply.error() != QNetworkReply.NoError:
392 ok = False 392 ok = False
393 if not self.__downloadCancelled: 393 if not self.__downloadCancelled:
394 E5MessageBox.warning( 394 E5MessageBox.warning(
395 self, 395 self,
396 self.trUtf8("Error downloading file"), 396 self.tr("Error downloading file"),
397 self.trUtf8( 397 self.tr(
398 """<p>Could not download the requested file""" 398 """<p>Could not download the requested file"""
399 """ from {0}.</p><p>Error: {1}</p>""" 399 """ from {0}.</p><p>Error: {1}</p>"""
400 ).format(self.__downloadURL, reply.errorString()) 400 ).format(self.__downloadURL, reply.errorString())
401 ) 401 )
402 self.downloadProgress.setValue(0) 402 self.downloadProgress.setValue(0)
463 """ 463 """
464 if status == "stable": 464 if status == "stable":
465 if self.__stableItem is None: 465 if self.__stableItem is None:
466 self.__stableItem = \ 466 self.__stableItem = \
467 QTreeWidgetItem(self.repositoryList, 467 QTreeWidgetItem(self.repositoryList,
468 [self.trUtf8("Stable")]) 468 [self.tr("Stable")])
469 self.__stableItem.setExpanded(True) 469 self.__stableItem.setExpanded(True)
470 parent = self.__stableItem 470 parent = self.__stableItem
471 elif status == "unstable": 471 elif status == "unstable":
472 if self.__unstableItem is None: 472 if self.__unstableItem is None:
473 self.__unstableItem = \ 473 self.__unstableItem = \
474 QTreeWidgetItem(self.repositoryList, 474 QTreeWidgetItem(self.repositoryList,
475 [self.trUtf8("Unstable")]) 475 [self.tr("Unstable")])
476 self.__unstableItem.setExpanded(True) 476 self.__unstableItem.setExpanded(True)
477 parent = self.__unstableItem 477 parent = self.__unstableItem
478 else: 478 else:
479 if self.__unknownItem is None: 479 if self.__unknownItem is None:
480 self.__unknownItem = \ 480 self.__unknownItem = \
481 QTreeWidgetItem(self.repositoryList, 481 QTreeWidgetItem(self.repositoryList,
482 [self.trUtf8("Unknown")]) 482 [self.tr("Unknown")])
483 self.__unknownItem.setExpanded(True) 483 self.__unknownItem.setExpanded(True)
484 parent = self.__unknownItem 484 parent = self.__unknownItem
485 itm = QTreeWidgetItem(parent, [name, version, short]) 485 itm = QTreeWidgetItem(parent, [name, version, short])
486 486
487 itm.setData(0, urlRole, url) 487 itm.setData(0, urlRole, url)
631 631
632 if not os.path.isfile(applPath) or \ 632 if not os.path.isfile(applPath) or \
633 not proc.startDetached(sys.executable, args): 633 not proc.startDetached(sys.executable, args):
634 E5MessageBox.critical( 634 E5MessageBox.critical(
635 self, 635 self,
636 self.trUtf8('Process Generation Error'), 636 self.tr('Process Generation Error'),
637 self.trUtf8( 637 self.tr(
638 '<p>Could not start the process.<br>' 638 '<p>Could not start the process.<br>'
639 'Ensure that it is available as <b>{0}</b>.</p>' 639 'Ensure that it is available as <b>{0}</b>.</p>'
640 ).format(applPath), 640 ).format(applPath),
641 self.trUtf8('OK')) 641 self.tr('OK'))
642 642
643 self.close() 643 self.close()

eric ide

mercurial