fix the optional GUI
This commit is contained in:
parent
97d6cead18
commit
c9df354ed6
@ -1,21 +1,54 @@
|
||||
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
|
||||
diff --git a/align.py b/align.py
|
||||
index c5a66fe..9067676 100755
|
||||
--- a/align.py
|
||||
+++ b/align.py
|
||||
@@ -241,8 +241,13 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".aligndialog")
|
||||
|
||||
+ 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
|
||||
+ ui = import_module(ui_package + ".aligndialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
#try:
|
||||
if 1:
|
||||
diff --git a/base/queues.py b/base/queues.py
|
||||
index 04c37b1..dec7fe9 100755
|
||||
--- a/base/queues.py
|
||||
+++ b/base/queues.py
|
||||
@@ -375,8 +375,14 @@ def main_function(passwordObj = None, mode = GUI_MODE, ui_toolkit= UI_TOOLKIT_QT
|
||||
sys.exit(1)
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".queuesconf")
|
||||
- setupdialog = import_module(ui_package + ".setupdialog")
|
||||
+
|
||||
return True
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".queuesconf")
|
||||
+ setupdialog = import_module(ui_package + ".setupdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
|
||||
@@ -734,6 +740,13 @@ def checkPyQtImport(): # qt3
|
||||
app = QApplication(sys.argv)
|
||||
dialog = ui.QueuesDiagnose(None, "","",QUEUES_MSG_SENDING,passwordObj)
|
||||
diff --git a/base/utils.py b/base/utils.py
|
||||
index cde819f..0d6e9ff 100644
|
||||
--- a/base/utils.py
|
||||
+++ b/base/utils.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# (c) Copyright 2001-2018 HP Development Company, L.P.
|
||||
@@ -734,6 +734,13 @@ def checkPyQtImport(): # qt3
|
||||
if os.getenv('DISPLAY') and os.getenv('STARTED_FROM_MENU'):
|
||||
no_qt_message_gtk()
|
||||
|
||||
@ -29,7 +62,7 @@ index 98437a3..4192189 100644
|
||||
log.error("PyQt not installed. GUI not available. Exiting.")
|
||||
return False
|
||||
|
||||
@@ -784,7 +797,8 @@ def checkPyQtImport4():
|
||||
@@ -784,7 +791,8 @@ def checkPyQtImport4():
|
||||
import PyQt5
|
||||
import ui5
|
||||
else:
|
||||
@ -39,7 +72,7 @@ index 98437a3..4192189 100644
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -2456,6 +2470,7 @@ def checkPyQtImport45():
|
||||
@@ -2456,6 +2464,7 @@ def checkPyQtImport45():
|
||||
except ImportError as e:
|
||||
log.debug(e)
|
||||
|
||||
@ -47,7 +80,7 @@ index 98437a3..4192189 100644
|
||||
raise ImportError("GUI Modules PyQt4 and PyQt5 are not installed")
|
||||
|
||||
|
||||
@@ -2477,6 +2492,7 @@ def import_dialog(ui_toolkit):
|
||||
@@ -2477,6 +2486,7 @@ def import_dialog(ui_toolkit):
|
||||
return (QApplication, "ui4")
|
||||
except ImportError as e:
|
||||
log.error(e)
|
||||
@ -55,7 +88,7 @@ index 98437a3..4192189 100644
|
||||
sys.exit(1)
|
||||
elif ui_toolkit == "qt5":
|
||||
try:
|
||||
@@ -2485,9 +2501,7 @@ def import_dialog(ui_toolkit):
|
||||
@@ -2485,9 +2495,7 @@ def import_dialog(ui_toolkit):
|
||||
return (QApplication, "ui5")
|
||||
except ImportError as e:
|
||||
log.error(e)
|
||||
@ -66,38 +99,307 @@ index 98437a3..4192189 100644
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
diff --git a/clean.py b/clean.py
|
||||
index 3d41f04..0141f23 100755
|
||||
--- a/clean.py
|
||||
+++ b/clean.py
|
||||
@@ -193,8 +193,13 @@ try:
|
||||
else:
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".cleandialog")
|
||||
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".cleandialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
#try:
|
||||
if 1:
|
||||
diff --git a/devicesettings.py b/devicesettings.py
|
||||
index 0710519..ac42db5 100755
|
||||
--- a/devicesettings.py
|
||||
+++ b/devicesettings.py
|
||||
@@ -75,7 +75,13 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".devicesetupdialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".devicesetupdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dlg = ui.DeviceSetupDialog(None, device_uri)
|
||||
diff --git a/diagnose_plugin.py b/diagnose_plugin.py
|
||||
index e4e6ebd..1bcd8c3 100755
|
||||
--- a/diagnose_plugin.py
|
||||
+++ b/diagnose_plugin.py
|
||||
@@ -94,7 +94,14 @@ if mode == GUI_MODE:
|
||||
# sys.exit(1)
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".plugindiagnose")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".plugindiagnose")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
+
|
||||
from installer import pluginhandler
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
diff --git a/fab.py b/fab.py
|
||||
index 9bd6166..e11ebc4 100755
|
||||
--- a/fab.py
|
||||
+++ b/fab.py
|
||||
@@ -854,8 +854,13 @@ if mode == GUI_MODE:
|
||||
else: # qt4
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".fabwindow")
|
||||
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".fabwindow")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
log.set_module("hp-fab(qt4)")
|
||||
|
||||
diff --git a/faxsetup.py b/faxsetup.py
|
||||
index dd704d2..b8b3e6e 100755
|
||||
--- a/faxsetup.py
|
||||
+++ b/faxsetup.py
|
||||
@@ -73,7 +73,13 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".faxsetupdialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".faxsetupdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dlg = ui.FaxSetupDialog(None, device_uri)
|
||||
diff --git a/firmware.py b/firmware.py
|
||||
index 33e044d..a38058b 100755
|
||||
--- a/firmware.py
|
||||
+++ b/firmware.py
|
||||
@@ -118,7 +118,13 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".firmwaredialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".firmwaredialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
if ui_toolkit == 'qt3':
|
||||
try:
|
||||
diff --git a/info.py b/info.py
|
||||
index 6c28531..5b05eda 100755
|
||||
--- a/info.py
|
||||
+++ b/info.py
|
||||
@@ -172,7 +172,13 @@ try:
|
||||
|
||||
else: # GUI mode
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".infodialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".infodialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
if 1:
|
||||
app = QApplication(sys.argv)
|
||||
diff --git a/plugin.py b/plugin.py
|
||||
index c833c55..74f93ef 100755
|
||||
index f54f726..58d6006 100755
|
||||
--- a/plugin.py
|
||||
+++ b/plugin.py
|
||||
@@ -252,7 +252,11 @@ if mode == GUI_MODE:
|
||||
@@ -252,7 +252,14 @@ 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)
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
+
|
||||
if ui_toolkit == "qt5":
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
elif ui_toolkit == "qt4":
|
||||
diff --git a/print.py b/print.py
|
||||
index ab37047..f98e5bd 100755
|
||||
--- a/print.py
|
||||
+++ b/print.py
|
||||
@@ -140,7 +140,12 @@ else: # qt4
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".printdialog")
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".printdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
if 1:
|
||||
app = QApplication(sys.argv)
|
||||
diff --git a/printsettings.py b/printsettings.py
|
||||
index 76b662e..7a1b416 100755
|
||||
--- a/printsettings.py
|
||||
+++ b/printsettings.py
|
||||
@@ -85,7 +85,12 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".printsettingsdialog")
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".printsettingsdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dialog = ui.PrintSettingsDialog(None, printer_name, fax_mode)
|
||||
diff --git a/sendfax.py b/sendfax.py
|
||||
index 491c8f9..0815ee7 100755
|
||||
--- a/sendfax.py
|
||||
+++ b/sendfax.py
|
||||
@@ -211,7 +211,13 @@ if mode == GUI_MODE:
|
||||
# sys.exit(1)
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".sendfaxdialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".sendfaxdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dlg = ui.SendFaxDialog(None, printer_name, device_uri, mod.args)
|
||||
diff --git a/setup.py b/setup.py
|
||||
index ba1b519..ac4afa2 100755
|
||||
index 2608f95..b09a8ef 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)
|
||||
@@ -310,7 +310,12 @@ if mode == GUI_MODE:
|
||||
# clean_exit(1)
|
||||
|
||||
if mode == GUI_MODE:
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".setupdialog")
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".setupdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
log.debug("Sys.argv=%s printer_name=%s param=%s jd_port=%s device_uri=%s remove=%s" % (sys.argv, printer_name, param, jd_port, device_uri, remove))
|
||||
diff --git a/testpage.py b/testpage.py
|
||||
index a5ed2bc..2a707a1 100755
|
||||
--- a/testpage.py
|
||||
+++ b/testpage.py
|
||||
@@ -77,7 +77,13 @@ try:
|
||||
# log.error("Unable to load Qt4 support. Is it installed?")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".printtestpagedialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".printtestpagedialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
log.set_module("%s(UI)" % __mod__)
|
||||
|
||||
diff --git a/toolbox.py b/toolbox.py
|
||||
index 2a67504..4e57b9e 100755
|
||||
--- a/toolbox.py
|
||||
+++ b/toolbox.py
|
||||
@@ -267,9 +267,13 @@ else: # qt4
|
||||
# log.error("Unable to load Qt support")
|
||||
# sys.exit(1)
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".devmgr5")
|
||||
-
|
||||
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".devmgr5")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
log.set_module("hp-toolbox(UI)")
|
||||
|
||||
diff --git a/uiscan.py b/uiscan.py
|
||||
index 6301c1f..9f42c52 100755
|
||||
--- a/uiscan.py
|
||||
+++ b/uiscan.py
|
||||
@@ -55,7 +55,13 @@ if __name__ == "__main__":
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
|
||||
- ui = import_module(ui_package + ".scandialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".scandialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
obj=ui.SetupDialog()
|
||||
#obk=obj.setupUi(devicelist)
|
||||
diff --git a/wificonfig.py b/wificonfig.py
|
||||
index b21e83a..21b11c7 100755
|
||||
--- a/wificonfig.py
|
||||
+++ b/wificonfig.py
|
||||
@@ -72,7 +72,13 @@ try:
|
||||
# sys.exit(1)
|
||||
|
||||
QApplication, ui_package = utils.import_dialog(ui_toolkit)
|
||||
- ui = import_module(ui_package + ".wifisetupdialog")
|
||||
+
|
||||
+ try:
|
||||
+ ui = import_module(ui_package + ".wifisetupdialog")
|
||||
+ except ModuleNotFoundError:
|
||||
+ log.error('HPLIP GUI is not available - use interactive mode '
|
||||
+ '(option \'-i\') or install hplip-gui package.')
|
||||
+ sys.exit(1)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dlg = ui.WifiSetupDialog(None, device_uri, standalone=True)
|
||||
|
@ -7,7 +7,7 @@
|
||||
Summary: HP Linux Imaging and Printing Project
|
||||
Name: hplip
|
||||
Version: 3.20.5
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC
|
||||
|
||||
Url: https://developers.hp.com/hp-linux-imaging-and-printing
|
||||
@ -720,6 +720,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio
|
||||
|
||||
%changelog
|
||||
* Tue Jun 16 2020 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.5-5
|
||||
- fix the optional GUI
|
||||
|
||||
* Fri Jun 05 2020 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.5-4
|
||||
- 1833308 - hp-clean cannot clean HP PSC1410 - Device I/O error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user