101 pluginName = self.pluginNameCombo.currentText() |
101 pluginName = self.pluginNameCombo.currentText() |
102 pluginFile = self.pluginNameCombo\ |
102 pluginFile = self.pluginNameCombo\ |
103 .itemData(self.pluginNameCombo.currentIndex()) |
103 .itemData(self.pluginNameCombo.currentIndex()) |
104 |
104 |
105 if not self.__pluginManager.unloadPlugin(pluginName): |
105 if not self.__pluginManager.unloadPlugin(pluginName): |
106 E5MessageBox.critical(self, |
106 E5MessageBox.critical( |
|
107 self, |
107 self.trUtf8("Plugin Uninstallation"), |
108 self.trUtf8("Plugin Uninstallation"), |
108 self.trUtf8( |
109 self.trUtf8( |
109 """<p>The plugin <b>{0}</b> could not be unloaded.""" |
110 """<p>The plugin <b>{0}</b> could not be unloaded.""" |
110 """ Aborting...</p>""").format(pluginName)) |
111 """ Aborting...</p>""").format(pluginName)) |
111 return False |
112 return False |
112 |
113 |
113 if not pluginDirectory in sys.path: |
114 if not pluginDirectory in sys.path: |
114 sys.path.insert(2, pluginDirectory) |
115 sys.path.insert(2, pluginDirectory) |
115 module = imp.load_source(pluginName, pluginFile) |
116 module = imp.load_source(pluginName, pluginFile) |
116 if not hasattr(module, "packageName"): |
117 if not hasattr(module, "packageName"): |
117 E5MessageBox.critical(self, |
118 E5MessageBox.critical( |
|
119 self, |
118 self.trUtf8("Plugin Uninstallation"), |
120 self.trUtf8("Plugin Uninstallation"), |
119 self.trUtf8( |
121 self.trUtf8( |
120 """<p>The plugin <b>{0}</b> has no 'packageName'""" |
122 """<p>The plugin <b>{0}</b> has no 'packageName'""" |
121 """ attribute. Aborting...</p>""").format(pluginName)) |
123 """ attribute. Aborting...</p>""").format(pluginName)) |
122 return False |
124 return False |
164 pluginDirCache, "{0}*.pyc".format(pluginFileName))): |
166 pluginDirCache, "{0}*.pyc".format(pluginFileName))): |
165 os.remove(fnamec) |
167 os.remove(fnamec) |
166 |
168 |
167 os.remove(pluginFile) |
169 os.remove(pluginFile) |
168 except OSError as err: |
170 except OSError as err: |
169 E5MessageBox.critical(self, |
171 E5MessageBox.critical( |
|
172 self, |
170 self.trUtf8("Plugin Uninstallation"), |
173 self.trUtf8("Plugin Uninstallation"), |
171 self.trUtf8( |
174 self.trUtf8( |
172 """<p>The plugin package <b>{0}</b> could not be""" |
175 """<p>The plugin package <b>{0}</b> could not be""" |
173 """ removed. Aborting...</p>""" |
176 """ removed. Aborting...</p>""" |
174 """<p>Reason: {1}</p>""").format(packageDir, str(err))) |
177 """<p>Reason: {1}</p>""").format(packageDir, str(err))) |
175 return False |
178 return False |
176 |
179 |
177 if not self.__external: |
180 if not self.__external: |
178 ui = e5App().getObject("UserInterface") |
181 ui = e5App().getObject("UserInterface") |
179 if ui.notificationsEnabled(): |
182 if ui.notificationsEnabled(): |
180 ui.showNotification(UI.PixmapCache.getPixmap("plugin48.png"), |
183 ui.showNotification( |
181 self.trUtf8("Plugin Uninstallation"), |
184 UI.PixmapCache.getPixmap("plugin48.png"), |
182 self.trUtf8( |
185 self.trUtf8("Plugin Uninstallation"), |
183 """<p>The plugin <b>{0}</b> was uninstalled successfully""" |
186 self.trUtf8( |
184 """ from {1}.</p>""")\ |
187 """<p>The plugin <b>{0}</b> was uninstalled""" |
|
188 """ successfully from {1}.</p>""")\ |
185 .format(pluginName, pluginDirectory)) |
189 .format(pluginName, pluginDirectory)) |
186 return True |
190 return True |
187 |
191 |
188 E5MessageBox.information(self, |
192 E5MessageBox.information( |
|
193 self, |
189 self.trUtf8("Plugin Uninstallation"), |
194 self.trUtf8("Plugin Uninstallation"), |
190 self.trUtf8( |
195 self.trUtf8( |
191 """<p>The plugin <b>{0}</b> was uninstalled successfully""" |
196 """<p>The plugin <b>{0}</b> was uninstalled successfully""" |
192 """ from {1}.</p>""")\ |
197 """ from {1}.</p>""")\ |
193 .format(pluginName, pluginDirectory)) |
198 .format(pluginName, pluginDirectory)) |