87 pluginName = self.pluginNameCombo.currentText() |
87 pluginName = self.pluginNameCombo.currentText() |
88 pluginFile = self.pluginNameCombo\ |
88 pluginFile = self.pluginNameCombo\ |
89 .itemData(self.pluginNameCombo.currentIndex()) |
89 .itemData(self.pluginNameCombo.currentIndex()) |
90 |
90 |
91 if not self.__pluginManager.unloadPlugin(pluginName, pluginDirectory): |
91 if not self.__pluginManager.unloadPlugin(pluginName, pluginDirectory): |
92 QMessageBox.critical(None, |
92 E5MessageBox.critical(self, |
93 self.trUtf8("Plugin Uninstallation"), |
93 self.trUtf8("Plugin Uninstallation"), |
94 self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" |
94 self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" |
95 """ Aborting...</p>""").format(pluginName)) |
95 """ Aborting...</p>""").format(pluginName)) |
96 return False |
96 return False |
97 |
97 |
98 if not pluginDirectory in sys.path: |
98 if not pluginDirectory in sys.path: |
99 sys.path.insert(2, pluginDirectory) |
99 sys.path.insert(2, pluginDirectory) |
100 module = imp.load_source(pluginName, pluginFile) |
100 module = imp.load_source(pluginName, pluginFile) |
101 if not hasattr(module, "packageName"): |
101 if not hasattr(module, "packageName"): |
102 QMessageBox.critical(None, |
102 E5MessageBox.critical(self, |
103 self.trUtf8("Plugin Uninstallation"), |
103 self.trUtf8("Plugin Uninstallation"), |
104 self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" |
104 self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" |
105 """ Aborting...</p>""").format(pluginName)) |
105 """ Aborting...</p>""").format(pluginName)) |
106 return False |
106 return False |
107 |
107 |
135 if os.path.exists(fnamec): |
135 if os.path.exists(fnamec): |
136 os.remove(fnamec) |
136 os.remove(fnamec) |
137 |
137 |
138 os.remove(pluginFile) |
138 os.remove(pluginFile) |
139 except OSError as err: |
139 except OSError as err: |
140 QMessageBox.critical(self, |
140 E5MessageBox.critical(self, |
141 self.trUtf8("Plugin Uninstallation"), |
141 self.trUtf8("Plugin Uninstallation"), |
142 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |
142 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |
143 """ removed. Aborting...</p>""" |
143 """ removed. Aborting...</p>""" |
144 """<p>Reason: {1}</p>""").format(packageDir, str(err))) |
144 """<p>Reason: {1}</p>""").format(packageDir, str(err))) |
145 return False |
145 return False |