69 Private slot to populate the plugin name combo upon a change of the |
69 Private slot to populate the plugin name combo upon a change of the |
70 plugin area. |
70 plugin area. |
71 |
71 |
72 @param index index of the selected item (integer) |
72 @param index index of the selected item (integer) |
73 """ |
73 """ |
74 pluginDirectory = self.pluginDirectoryCombo\ |
74 pluginDirectory = self.pluginDirectoryCombo.itemData(index) |
75 .itemData(index) |
|
76 pluginNames = sorted(self.__pluginManager.getPluginModules( |
75 pluginNames = sorted(self.__pluginManager.getPluginModules( |
77 pluginDirectory)) |
76 pluginDirectory)) |
78 self.pluginNameCombo.clear() |
77 self.pluginNameCombo.clear() |
79 for pluginName in pluginNames: |
78 for pluginName in pluginNames: |
80 fname = "{0}.py".format(os.path.join(pluginDirectory, pluginName)) |
79 fname = "{0}.py".format(os.path.join(pluginDirectory, pluginName)) |
95 Private slot to uninstall the selected plugin. |
94 Private slot to uninstall the selected plugin. |
96 |
95 |
97 @return flag indicating success (boolean) |
96 @return flag indicating success (boolean) |
98 """ |
97 """ |
99 pluginDirectory = self.pluginDirectoryCombo\ |
98 pluginDirectory = self.pluginDirectoryCombo\ |
100 .itemData(self.pluginDirectoryCombo.currentIndex()) |
99 .itemData(self.pluginDirectoryCombo.currentIndex()) |
101 pluginName = self.pluginNameCombo.currentText() |
100 pluginName = self.pluginNameCombo.currentText() |
102 pluginFile = self.pluginNameCombo\ |
101 pluginFile = self.pluginNameCombo\ |
103 .itemData(self.pluginNameCombo.currentIndex()) |
102 .itemData(self.pluginNameCombo.currentIndex()) |
104 |
103 |
105 if not self.__pluginManager.unloadPlugin(pluginName): |
104 if not self.__pluginManager.unloadPlugin(pluginName): |
106 E5MessageBox.critical( |
105 E5MessageBox.critical( |
107 self, |
106 self, |
108 self.trUtf8("Plugin Uninstallation"), |
107 self.trUtf8("Plugin Uninstallation"), |
132 if hasattr(module, "prepareUninstall"): |
131 if hasattr(module, "prepareUninstall"): |
133 module.prepareUninstall() |
132 module.prepareUninstall() |
134 internalPackages = [] |
133 internalPackages = [] |
135 if hasattr(module, "internalPackages"): |
134 if hasattr(module, "internalPackages"): |
136 # it is a comma separated string |
135 # it is a comma separated string |
137 internalPackages = [p.strip() for p in |
136 internalPackages = [p.strip() for p in |
138 module.internalPackages.split(",")] |
137 module.internalPackages.split(",")] |
139 del module |
138 del module |
140 |
139 |
141 # clean sys.modules |
140 # clean sys.modules |
142 self.__pluginManager.removePluginFromSysModules( |
141 self.__pluginManager.removePluginFromSysModules( |
183 ui.showNotification( |
182 ui.showNotification( |
184 UI.PixmapCache.getPixmap("plugin48.png"), |
183 UI.PixmapCache.getPixmap("plugin48.png"), |
185 self.trUtf8("Plugin Uninstallation"), |
184 self.trUtf8("Plugin Uninstallation"), |
186 self.trUtf8( |
185 self.trUtf8( |
187 """<p>The plugin <b>{0}</b> was uninstalled""" |
186 """<p>The plugin <b>{0}</b> was uninstalled""" |
188 """ successfully from {1}.</p>""")\ |
187 """ successfully from {1}.</p>""") |
189 .format(pluginName, pluginDirectory)) |
188 .format(pluginName, pluginDirectory)) |
190 return True |
189 return True |
191 |
190 |
192 E5MessageBox.information( |
191 E5MessageBox.information( |
193 self, |
192 self, |
194 self.trUtf8("Plugin Uninstallation"), |
193 self.trUtf8("Plugin Uninstallation"), |
195 self.trUtf8( |
194 self.trUtf8( |
196 """<p>The plugin <b>{0}</b> was uninstalled successfully""" |
195 """<p>The plugin <b>{0}</b> was uninstalled successfully""" |
197 """ from {1}.</p>""")\ |
196 """ from {1}.</p>""") |
198 .format(pluginName, pluginDirectory)) |
197 .format(pluginName, pluginDirectory)) |
199 return True |
198 return True |
200 |
199 |
201 |
200 |
202 class PluginUninstallDialog(QDialog): |
201 class PluginUninstallDialog(QDialog): |
203 """ |
202 """ |