88 |
88 |
89 if not self.__pluginManager.unloadPlugin(pluginName, pluginDirectory): |
89 if not self.__pluginManager.unloadPlugin(pluginName, pluginDirectory): |
90 QMessageBox.critical(None, |
90 QMessageBox.critical(None, |
91 self.trUtf8("Plugin Uninstallation"), |
91 self.trUtf8("Plugin Uninstallation"), |
92 self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" |
92 self.trUtf8("""<p>The plugin <b>{0}</b> could not be unloaded.""" |
93 """ Aborting...</p>""").format(pluginName), |
93 """ Aborting...</p>""").format(pluginName)) |
94 QMessageBox.StandardButtons(\ |
|
95 QMessageBox.Ok)) |
|
96 return False |
94 return False |
97 |
95 |
98 if not pluginDirectory in sys.path: |
96 if not pluginDirectory in sys.path: |
99 sys.path.insert(2, pluginDirectory) |
97 sys.path.insert(2, pluginDirectory) |
100 module = imp.load_source(pluginName, pluginFile) |
98 module = imp.load_source(pluginName, pluginFile) |
101 if not hasattr(module, "packageName"): |
99 if not hasattr(module, "packageName"): |
102 QMessageBox.critical(None, |
100 QMessageBox.critical(None, |
103 self.trUtf8("Plugin Uninstallation"), |
101 self.trUtf8("Plugin Uninstallation"), |
104 self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" |
102 self.trUtf8("""<p>The plugin <b>{0}</b> has no 'packageName' attribute.""" |
105 """ Aborting...</p>""").format(pluginName), |
103 """ Aborting...</p>""").format(pluginName)) |
106 QMessageBox.StandardButtons(\ |
|
107 QMessageBox.Ok)) |
|
108 return False |
104 return False |
109 |
105 |
110 package = getattr(module, "packageName") |
106 package = getattr(module, "packageName") |
111 if package is None: |
107 if package is None: |
112 package = "None" |
108 package = "None" |
141 except OSError as err: |
137 except OSError as err: |
142 QMessageBox.critical(None, |
138 QMessageBox.critical(None, |
143 self.trUtf8("Plugin Uninstallation"), |
139 self.trUtf8("Plugin Uninstallation"), |
144 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |
140 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |
145 """ removed. Aborting...</p>""" |
141 """ removed. Aborting...</p>""" |
146 """<p>Reason: {1}</p>""").format(packageDir, str(err)), |
142 """<p>Reason: {1}</p>""").format(packageDir, str(err))) |
147 QMessageBox.StandardButtons(\ |
|
148 QMessageBox.Ok)) |
|
149 return False |
143 return False |
150 |
144 |
151 QMessageBox.information(None, |
145 QMessageBox.information(None, |
152 self.trUtf8("Plugin Uninstallation"), |
146 self.trUtf8("Plugin Uninstallation"), |
153 self.trUtf8("""<p>The plugin <b>{0}</b> was uninstalled successfully""" |
147 self.trUtf8("""<p>The plugin <b>{0}</b> was uninstalled successfully""" |
154 """ from {1}.</p>""")\ |
148 """ from {1}.</p>""")\ |
155 .format(pluginName, pluginDirectory), |
149 .format(pluginName, pluginDirectory)) |
156 QMessageBox.StandardButtons(\ |
|
157 QMessageBox.Ok)) |
|
158 return True |
150 return True |
159 |
151 |
160 class PluginUninstallDialog(QDialog): |
152 class PluginUninstallDialog(QDialog): |
161 """ |
153 """ |
162 Class for the dialog variant. |
154 Class for the dialog variant. |