104 lines
3.7 KiB
Diff
104 lines
3.7 KiB
Diff
diff --git a/base/utils.py b/base/utils.py
|
|
index 98437a3..4192189 100644
|
|
--- a/base/utils.py
|
|
+++ b/base/utils.py
|
|
@@ -722,6 +722,12 @@ def canEnterGUIMode4(): # qt4
|
|
log.warn(e)
|
|
return False
|
|
|
|
+ try:
|
|
+ import ui
|
|
+ except ImportError:
|
|
+ log.error('HPLIP UI module not installed - run the command with \'-i\' option for interactive mode or install hplip-gui package.')
|
|
+ return False
|
|
+
|
|
return True
|
|
|
|
|
|
@@ -734,6 +740,13 @@ def checkPyQtImport(): # qt3
|
|
if os.getenv('DISPLAY') and os.getenv('STARTED_FROM_MENU'):
|
|
no_qt_message_gtk()
|
|
|
|
+ # hplip-gui sub-package (Fedora)
|
|
+ try:
|
|
+ import ui
|
|
+ except ImportError:
|
|
+ log.error("hplip-gui not installed. GUI not available. Exiting.")
|
|
+ return False
|
|
+
|
|
log.error("PyQt not installed. GUI not available. Exiting.")
|
|
return False
|
|
|
|
@@ -784,7 +797,8 @@ def checkPyQtImport4():
|
|
import PyQt5
|
|
import ui5
|
|
else:
|
|
- log.debug("HPLIP is not installed properly or is installed without graphical support. Please reinstall HPLIP again")
|
|
+ # hplip-gui sub-package (Fedora) requires python3-qt5
|
|
+ log.error("Install the hplip-gui package for graphical support.")
|
|
return False
|
|
return True
|
|
|
|
@@ -2456,6 +2470,7 @@ def checkPyQtImport45():
|
|
except ImportError as e:
|
|
log.debug(e)
|
|
|
|
+ log.error("Install the hplip-gui package for graphical support.")
|
|
raise ImportError("GUI Modules PyQt4 and PyQt5 are not installed")
|
|
|
|
|
|
@@ -2477,6 +2492,7 @@ def import_dialog(ui_toolkit):
|
|
return (QApplication, "ui4")
|
|
except ImportError as e:
|
|
log.error(e)
|
|
+ log.error("Unable to load Qt support. Is hplip-gui package installed?")
|
|
sys.exit(1)
|
|
elif ui_toolkit == "qt5":
|
|
try:
|
|
@@ -2485,9 +2501,7 @@ def import_dialog(ui_toolkit):
|
|
return (QApplication, "ui5")
|
|
except ImportError as e:
|
|
log.error(e)
|
|
- sys.exit(1)
|
|
- else:
|
|
- log.error("Unable to load Qt support. Is it installed?")
|
|
+ log.error("Unable to load Qt support. Is hplip-gui package installed?")
|
|
sys.exit(1)
|
|
|
|
|
|
diff --git a/plugin.py b/plugin.py
|
|
index c833c55..74f93ef 100755
|
|
--- a/plugin.py
|
|
+++ b/plugin.py
|
|
@@ -252,7 +252,11 @@ if mode == GUI_MODE:
|
|
# clean_exit(1)
|
|
|
|
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
|
- ui = import_module(ui_package + ".plugindialog")
|
|
+ try:
|
|
+ ui = import_module(ui_package + ".plugindialog")
|
|
+ except ModuleNotFoundError:
|
|
+ log.error("hplip-gui not installed. GUI not available. Exiting.")
|
|
+ clean_exit(1)
|
|
if ui_toolkit == "qt5":
|
|
from PyQt5.QtWidgets import QMessageBox
|
|
elif ui_toolkit == "qt4":
|
|
diff --git a/setup.py b/setup.py
|
|
index ba1b519..ac4afa2 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -218,11 +218,11 @@ if mode == GUI_MODE:
|
|
log.warning("-p or -f option is not supported")
|
|
if ui_toolkit == 'qt3':
|
|
if not utils.canEnterGUIMode():
|
|
- log.error("%s requires GUI support (try running with --qt4). Also, try using interactive (-i) mode." % __mod__)
|
|
+ log.error("%s requires GUI support (try running with --qt3). Also, try using interactive (-i) mode." % __mod__)
|
|
clean_exit(1)
|
|
else:
|
|
if not utils.canEnterGUIMode4():
|
|
- log.error("%s requires GUI support (try running with --qt3). Also, try using interactive (-i) mode." % __mod__)
|
|
+ log.error("%s requires GUI support (try running with --qt4). Also, try using interactive (-i) mode." % __mod__)
|
|
clean_exit(1)
|
|
|
|
if mode == GUI_MODE:
|