46 def __init__(self, pluginManager, pluginFileNames, parent=None): |
46 def __init__(self, pluginManager, pluginFileNames, parent=None): |
47 """ |
47 """ |
48 Constructor |
48 Constructor |
49 |
49 |
50 @param pluginManager reference to the plugin manager object |
50 @param pluginManager reference to the plugin manager object |
|
51 @type PluginManager |
51 @param pluginFileNames list of plugin files suggested for |
52 @param pluginFileNames list of plugin files suggested for |
52 installation (list of strings) |
53 installation |
53 @param parent parent of this dialog (QWidget) |
54 @type list of str |
|
55 @param parent parent of this dialog |
|
56 @type QWidget |
54 """ |
57 """ |
55 super().__init__(parent) |
58 super().__init__(parent) |
56 self.setupUi(self) |
59 self.setupUi(self) |
57 |
60 |
58 if pluginManager is None: |
61 if pluginManager is None: |
108 |
111 |
109 def restartNeeded(self): |
112 def restartNeeded(self): |
110 """ |
113 """ |
111 Public method to check, if a restart of the IDE is required. |
114 Public method to check, if a restart of the IDE is required. |
112 |
115 |
113 @return flag indicating a restart is required (boolean) |
116 @return flag indicating a restart is required |
|
117 @rtype bool |
114 """ |
118 """ |
115 return self.__restartNeeded |
119 return self.__restartNeeded |
116 |
120 |
117 def __createArchivesList(self): |
121 def __createArchivesList(self): |
118 """ |
122 """ |
119 Private method to create a list of plugin archive names. |
123 Private method to create a list of plugin archive names. |
120 |
124 |
121 @return list of plugin archive names (list of strings) |
125 @return list of plugin archive names |
|
126 @rtype list of str |
122 """ |
127 """ |
123 archivesList = [] |
128 archivesList = [] |
124 for row in range(self.archivesList.count()): |
129 for row in range(self.archivesList.count()): |
125 archivesList.append(self.archivesList.item(row).text()) |
130 archivesList.append(self.archivesList.item(row).text()) |
126 return archivesList |
131 return archivesList |
204 @pyqtSlot(QAbstractButton) |
209 @pyqtSlot(QAbstractButton) |
205 def on_buttonBox_clicked(self, button): |
210 def on_buttonBox_clicked(self, button): |
206 """ |
211 """ |
207 Private slot to handle the click of a button of the button box. |
212 Private slot to handle the click of a button of the button box. |
208 |
213 |
209 @param button reference to the button pressed (QAbstractButton) |
214 @param button reference to the button pressed |
|
215 @type QAbstractButton |
210 """ |
216 """ |
211 if button == self.__backButton: |
217 if button == self.__backButton: |
212 self.__currentIndex -= 1 |
218 self.__currentIndex -= 1 |
213 self.__selectPage() |
219 self.__selectPage() |
214 elif button == self.__nextButton: |
220 elif button == self.__nextButton: |
225 |
231 |
226 def __installPlugins(self): |
232 def __installPlugins(self): |
227 """ |
233 """ |
228 Private method to install the selected plugin archives. |
234 Private method to install the selected plugin archives. |
229 |
235 |
230 @return flag indicating success (boolean) |
236 @return flag indicating success |
|
237 @rtype bool |
231 """ |
238 """ |
232 res = True |
239 res = True |
233 self.summaryEdit.clear() |
240 self.summaryEdit.clear() |
234 for archive in self.__createArchivesList(): |
241 for archive in self.__createArchivesList(): |
235 self.summaryEdit.append(self.tr("Installing {0} ...").format(archive)) |
242 self.summaryEdit.append(self.tr("Installing {0} ...").format(archive)) |
254 def __installPlugin(self, archiveFilename): |
261 def __installPlugin(self, archiveFilename): |
255 """ |
262 """ |
256 Private slot to install the selected plugin. |
263 Private slot to install the selected plugin. |
257 |
264 |
258 @param archiveFilename name of the plugin archive |
265 @param archiveFilename name of the plugin archive |
259 file (string) |
266 file |
|
267 @type str |
260 @return flag indicating success (boolean), error message |
268 @return flag indicating success (boolean), error message |
261 upon failure (string) and flag indicating a restart |
269 upon failure (string) and flag indicating a restart |
262 of the IDE is required (boolean) |
270 of the IDE is required |
|
271 @rtype bool |
263 """ |
272 """ |
264 installedPluginName = "" |
273 installedPluginName = "" |
265 |
274 |
266 archive = archiveFilename |
275 archive = archiveFilename |
267 destination = self.destinationCombo.itemData( |
276 destination = self.destinationCombo.itemData( |
541 Private method to create a directory and all intermediate ones. |
550 Private method to create a directory and all intermediate ones. |
542 |
551 |
543 This is an extended version of the Python one in order to |
552 This is an extended version of the Python one in order to |
544 record the created directories. |
553 record the created directories. |
545 |
554 |
546 @param name name of the directory to create (string) |
555 @param name name of the directory to create |
547 @param mode permission to set for the new directory (integer) |
556 @type str |
|
557 @param mode permission to set for the new directory |
|
558 @type int |
548 """ |
559 """ |
549 head, tail = os.path.split(name) |
560 head, tail = os.path.split(name) |
550 if not tail: |
561 if not tail: |
551 head, tail = os.path.split(head) |
562 head, tail = os.path.split(head) |
552 if head and tail and not os.path.exists(head): |
563 if head and tail and not os.path.exists(head): |
560 def __uninstallPackage(self, destination, pluginFileName, packageName): |
571 def __uninstallPackage(self, destination, pluginFileName, packageName): |
561 """ |
572 """ |
562 Private method to uninstall an already installed plugin to prepare |
573 Private method to uninstall an already installed plugin to prepare |
563 the update. |
574 the update. |
564 |
575 |
565 @param destination name of the plugin directory (string) |
576 @param destination name of the plugin directory |
566 @param pluginFileName name of the plugin file (string) |
577 @type str |
567 @param packageName name of the plugin package (string) |
578 @param pluginFileName name of the plugin file |
|
579 @type str |
|
580 @param packageName name of the plugin package |
|
581 @type str |
568 """ |
582 """ |
569 packageDir = ( |
583 packageDir = ( |
570 None |
584 None |
571 if packageName in ("", "None") |
585 if packageName in ("", "None") |
572 else os.path.join(destination, packageName) |
586 else os.path.join(destination, packageName) |
608 def __init__(self, pluginManager, pluginFileNames, parent=None): |
622 def __init__(self, pluginManager, pluginFileNames, parent=None): |
609 """ |
623 """ |
610 Constructor |
624 Constructor |
611 |
625 |
612 @param pluginManager reference to the plugin manager object |
626 @param pluginManager reference to the plugin manager object |
613 @param pluginFileNames list of plugin files suggested for |
627 @type PluginManager |
614 installation (list of strings) |
628 @param pluginFileNames list of plugin files suggested for installation |
615 @param parent reference to the parent widget (QWidget) |
629 @type list of str |
|
630 @param parent reference to the parent widget |
|
631 @type QWidget |
616 """ |
632 """ |
617 super().__init__(parent) |
633 super().__init__(parent) |
618 self.setSizeGripEnabled(True) |
634 self.setSizeGripEnabled(True) |
619 |
635 |
620 self.__layout = QVBoxLayout(self) |
636 self.__layout = QVBoxLayout(self) |
632 |
648 |
633 def restartNeeded(self): |
649 def restartNeeded(self): |
634 """ |
650 """ |
635 Public method to check, if a restart of the IDE is required. |
651 Public method to check, if a restart of the IDE is required. |
636 |
652 |
637 @return flag indicating a restart is required (boolean) |
653 @return flag indicating a restart is required |
|
654 @rtype bool |
638 """ |
655 """ |
639 return self.cw.restartNeeded() |
656 return self.cw.restartNeeded() |
640 |
657 |
641 |
658 |
642 class PluginInstallWindow(EricMainWindow): |
659 class PluginInstallWindow(EricMainWindow): |
647 def __init__(self, pluginFileNames, parent=None): |
664 def __init__(self, pluginFileNames, parent=None): |
648 """ |
665 """ |
649 Constructor |
666 Constructor |
650 |
667 |
651 @param pluginFileNames list of plugin files suggested for |
668 @param pluginFileNames list of plugin files suggested for |
652 installation (list of strings) |
669 installation |
653 @param parent reference to the parent widget (QWidget) |
670 @type list of str |
|
671 @param parent reference to the parent widget |
|
672 @type QWidget |
654 """ |
673 """ |
655 super().__init__(parent) |
674 super().__init__(parent) |
656 self.cw = PluginInstallWidget(None, pluginFileNames, self) |
675 self.cw = PluginInstallWidget(None, pluginFileNames, self) |
657 size = self.cw.size() |
676 size = self.cw.size() |
658 self.setCentralWidget(self.cw) |
677 self.setCentralWidget(self.cw) |