This Plugin imports Python plugins from zip files.
diff --git a/plugins/python/plugin_importer/plugin_importer.action b/plugins/python/plugin_importer/plugin_importer.action new file mode 100644 index 0000000000..aa3d140b36 --- /dev/null +++ b/plugins/python/plugin_importer/plugin_importer.action @@ -0,0 +1,19 @@ + +', + i18n('The following plugins were imported:'), + '
', + '') + txt.append(i18n( + 'Please restart Krita and activate the plugins in ' + 'Settings -> Configure Krita -> ' + 'Python Plugin Manager.')) + txt.append('
') + return ('\n').join(txt) + + def get_resources_dir(self): + return QStandardPaths.writableLocation( + QStandardPaths.AppDataLocation) + + def import_plugin(self): + zipfile = QFileDialog.getOpenFileName( + self.parent.activeWindow().qwindow(), + i18n('Import Plugin'), + os.path.expanduser('~'), + '%s (*.zip)' % i18n('Zip Archives'), + )[0] + + if not zipfile: + return + + try: + imported = PluginImporter( + zipfile, + self.get_resources_dir(), + self.confirm_overwrite + ).import_all() + except PluginImportError as e: + msg = '%s
%s' % ( + i18n('Error during import:'), str(e)) + QMessageBox.warning( + self.parent.activeWindow().qwindow(), + i18n('Error'), + msg) + return + + if imported: + QMessageBox.information( + self.parent.activeWindow().qwindow(), + i18n('Import successful'), + self.get_success_text(imported))