Skip to content

Commit 2c3dd11

Browse files
committed
Check installation success
1 parent 63cda6f commit 2c3dd11

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

oqtopus/gui/plugin_widget.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,34 @@ def __installClicked(self):
7575
# Check if the package exists
7676
asset_plugin = self.__current_module_package.asset_plugin
7777
if not os.path.exists(asset_plugin.package_zip):
78-
self.info_label.setText(
79-
self.tr(f"Plugin zip file '{asset_plugin.package_zip}' does not exist.")
78+
QMessageBox.critical(
79+
self,
80+
self.tr("Error"),
81+
self.tr(f"Plugin zip file '{asset_plugin.package_zip}' does not exist."),
8082
)
81-
QtUtils.setForegroundColor(self.info_label, PluginUtils.COLOR_WARNING)
82-
QtUtils.setFontItalic(self.info_label, True)
8383
return
8484

8585
try:
8686
from pyplugin_installer import instance as plugin_installer_instance
87+
from qgis.core import Qgis
8788

8889
installer = plugin_installer_instance()
89-
installer.installFromZipFile(asset_plugin.package_zip)
90+
success = installer.installFromZipFile(asset_plugin.package_zip)
91+
92+
# installFromZipFile return success from QGIS 3.44.08
93+
if not success and Qgis.QGIS_VERSION_INT > 34407:
94+
QMessageBox.critical(
95+
self,
96+
self.tr("Error"),
97+
self.tr(f"Plugin '{asset_plugin.name}' installation failed."),
98+
)
99+
return
100+
else:
101+
QMessageBox.information(
102+
self,
103+
self.tr("Success"),
104+
self.tr(f"Plugin '{asset_plugin.name}' installed successfully."),
105+
)
90106

91107
return
92108

0 commit comments

Comments
 (0)