PluginManager/PluginRepositoryDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3022
57179e4cdadd
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
70 self.__updateButton = self.buttonBox.addButton( 70 self.__updateButton = self.buttonBox.addButton(
71 self.trUtf8("Update"), QDialogButtonBox.ActionRole) 71 self.trUtf8("Update"), QDialogButtonBox.ActionRole)
72 self.__downloadButton = self.buttonBox.addButton( 72 self.__downloadButton = self.buttonBox.addButton(
73 self.trUtf8("Download"), QDialogButtonBox.ActionRole) 73 self.trUtf8("Download"), QDialogButtonBox.ActionRole)
74 self.__downloadButton.setEnabled(False) 74 self.__downloadButton.setEnabled(False)
75 self.__downloadInstallButton = \ 75 self.__downloadInstallButton = self.buttonBox.addButton(
76 self.buttonBox.addButton(self.trUtf8("Download && Install"), 76 self.trUtf8("Download && Install"),
77 QDialogButtonBox.ActionRole) 77 QDialogButtonBox.ActionRole)
78 self.__downloadInstallButton.setEnabled(False) 78 self.__downloadInstallButton.setEnabled(False)
79 self.__downloadCancelButton = self.buttonBox.addButton( 79 self.__downloadCancelButton = self.buttonBox.addButton(
80 self.trUtf8("Cancel"), QDialogButtonBox.ActionRole) 80 self.trUtf8("Cancel"), QDialogButtonBox.ActionRole)
81 self.__installButton = \ 81 self.__installButton = \
169 """ 169 """
170 if self.__repositoryMissing or current is None: 170 if self.__repositoryMissing or current is None:
171 return 171 return
172 172
173 self.urlEdit.setText(current.data(0, urlRole) or "") 173 self.urlEdit.setText(current.data(0, urlRole) or "")
174 self.descriptionEdit.setPlainText(current.data(0, descrRole) and \ 174 self.descriptionEdit.setPlainText(
175 current.data(0, descrRole) and \
175 self.__formatDescription(current.data(0, descrRole)) or "") 176 self.__formatDescription(current.data(0, descrRole)) or "")
176 self.authorEdit.setText(current.data(0, authorRole) or "") 177 self.authorEdit.setText(current.data(0, authorRole) or "")
177 178
178 def __selectedItems(self): 179 def __selectedItems(self):
179 """ 180 """
270 if not self.__external: 271 if not self.__external:
271 ui = e5App().getObject("UserInterface") 272 ui = e5App().getObject("UserInterface")
272 else: 273 else:
273 ui = None 274 ui = None
274 if ui and ui.notificationsEnabled(): 275 if ui and ui.notificationsEnabled():
275 ui.showNotification(UI.PixmapCache.getPixmap("plugin48.png"), 276 ui.showNotification(
277 UI.PixmapCache.getPixmap("plugin48.png"),
276 self.trUtf8("Download Plugin Files"), 278 self.trUtf8("Download Plugin Files"),
277 self.trUtf8("""The requested plugins were downloaded.""")) 279 self.trUtf8("""The requested plugins were downloaded."""))
278 280
279 if self.__isDownloadInstall: 281 if self.__isDownloadInstall:
280 self.closeAndInstall.emit() 282 self.closeAndInstall.emit()
281 else: 283 else:
282 if ui is None or not ui.notificationsEnabled(): 284 if ui is None or not ui.notificationsEnabled():
283 E5MessageBox.information(self, 285 E5MessageBox.information(
286 self,
284 self.trUtf8("Download Plugin Files"), 287 self.trUtf8("Download Plugin Files"),
285 self.trUtf8("""The requested plugins were downloaded.""")) 288 self.trUtf8("""The requested plugins were downloaded."""))
286 self.downloadProgress.setValue(0) 289 self.downloadProgress.setValue(0)
287 290
288 # repopulate the list to update the refresh icons 291 # repopulate the list to update the refresh icons
320 self.repositoryList.resizeColumnToContents(2) 323 self.repositoryList.resizeColumnToContents(2)
321 self.__resortRepositoryList() 324 self.__resortRepositoryList()
322 url = Preferences.getUI("PluginRepositoryUrl5") 325 url = Preferences.getUI("PluginRepositoryUrl5")
323 if url != self.repositoryUrlEdit.text(): 326 if url != self.repositoryUrlEdit.text():
324 self.repositoryUrlEdit.setText(url) 327 self.repositoryUrlEdit.setText(url)
325 E5MessageBox.warning(self, 328 E5MessageBox.warning(
329 self,
326 self.trUtf8("Plugins Repository URL Changed"), 330 self.trUtf8("Plugins Repository URL Changed"),
327 self.trUtf8( 331 self.trUtf8(
328 """The URL of the Plugins Repository has""" 332 """The URL of the Plugins Repository has"""
329 """ changed. Select the "Update" button to get""" 333 """ changed. Select the "Update" button to get"""
330 """ the new repository file.""")) 334 """ the new repository file."""))
331 else: 335 else:
332 E5MessageBox.critical(self, 336 E5MessageBox.critical(
337 self,
333 self.trUtf8("Read plugins repository file"), 338 self.trUtf8("Read plugins repository file"),
334 self.trUtf8("<p>The plugins repository file <b>{0}</b> " 339 self.trUtf8("<p>The plugins repository file <b>{0}</b> "
335 "could not be read. Select Update</p>")\ 340 "could not be read. Select Update</p>")\
336 .format(self.pluginRepositoryFile)) 341 .format(self.pluginRepositoryFile))
337 else: 342 else:
338 self.__repositoryMissing = True 343 self.__repositoryMissing = True
339 QTreeWidgetItem(self.repositoryList, 344 QTreeWidgetItem(
345 self.repositoryList,
340 ["", self.trUtf8( 346 ["", self.trUtf8(
341 "No plugin repository file available.\nSelect Update.") 347 "No plugin repository file available.\nSelect Update.")
342 ]) 348 ])
343 self.repositoryList.resizeColumnToContents(1) 349 self.repositoryList.resizeColumnToContents(1)
344 350
385 if reply in self.__replies: 391 if reply in self.__replies:
386 self.__replies.remove(reply) 392 self.__replies.remove(reply)
387 if reply.error() != QNetworkReply.NoError: 393 if reply.error() != QNetworkReply.NoError:
388 ok = False 394 ok = False
389 if not self.__downloadCancelled: 395 if not self.__downloadCancelled:
390 E5MessageBox.warning(self, 396 E5MessageBox.warning(
397 self,
391 self.trUtf8("Error downloading file"), 398 self.trUtf8("Error downloading file"),
392 self.trUtf8( 399 self.trUtf8(
393 """<p>Could not download the requested file""" 400 """<p>Could not download the requested file"""
394 """ from {0}.</p><p>Error: {1}</p>""" 401 """ from {0}.</p><p>Error: {1}</p>"""
395 ).format(self.__downloadURL, reply.errorString()) 402 ).format(self.__downloadURL, reply.errorString())
622 args.append(applPath) 629 args.append(applPath)
623 args += self.cw.getDownloadedPlugins() 630 args += self.cw.getDownloadedPlugins()
624 631
625 if not os.path.isfile(applPath) or \ 632 if not os.path.isfile(applPath) or \
626 not proc.startDetached(sys.executable, args): 633 not proc.startDetached(sys.executable, args):
627 E5MessageBox.critical(self, 634 E5MessageBox.critical(
635 self,
628 self.trUtf8('Process Generation Error'), 636 self.trUtf8('Process Generation Error'),
629 self.trUtf8( 637 self.trUtf8(
630 '<p>Could not start the process.<br>' 638 '<p>Could not start the process.<br>'
631 'Ensure that it is available as <b>{0}</b>.</p>' 639 'Ensure that it is available as <b>{0}</b>.</p>'
632 ).format(applPath), 640 ).format(applPath),

eric ide

mercurial