rework optional gui messages
This commit is contained in:
parent
2dc288f050
commit
bb45ee25cc
31
hplip-fedora-gui.patch
Normal file
31
hplip-fedora-gui.patch
Normal file
@ -0,0 +1,31 @@
|
||||
diff --git a/base/utils.py b/base/utils.py
|
||||
index d493b54..401dc41 100644
|
||||
--- a/base/utils.py
|
||||
+++ b/base/utils.py
|
||||
@@ -727,8 +727,8 @@ def canEnterGUIMode4(): # qt4
|
||||
except ImportError:
|
||||
try:
|
||||
import ui5
|
||||
- except ImportError as e:
|
||||
- log.warn(e)
|
||||
+ except ImportError:
|
||||
+ log.error("hplip-gui not installed. GUI not available.")
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -746,6 +746,7 @@ def checkPyQtImport(): # qt3
|
||||
try:
|
||||
import ui
|
||||
except ImportError:
|
||||
+ log.error("hplip-gui not installed. GUI not available.")
|
||||
return False
|
||||
|
||||
log.error("PyQt not installed. GUI not available. Exiting.")
|
||||
@@ -800,6 +801,7 @@ def checkPyQtImport4():
|
||||
import ui5
|
||||
except ImportError:
|
||||
log.debug('GUI not available.')
|
||||
+ log.error('hplip-gui not installed. GUI not available.')
|
||||
return False
|
||||
|
||||
return True
|
||||
@ -1,6 +1,6 @@
|
||||
diff -up hplip-3.17.11/firmware.py.typo hplip-3.17.11/firmware.py
|
||||
--- hplip-3.17.11/firmware.py.typo 2018-01-12 16:50:10.338366719 +0100
|
||||
+++ hplip-3.17.11/firmware.py 2018-01-12 16:50:33.563184939 +0100
|
||||
diff -up hplip-3.20.11/firmware.py.typo hplip-3.20.11/firmware.py
|
||||
--- hplip-3.20.11/firmware.py.typo 2021-02-03 10:53:34.311743805 +0100
|
||||
+++ hplip-3.20.11/firmware.py 2021-02-03 10:54:13.229386257 +0100
|
||||
@@ -99,7 +99,7 @@ try:
|
||||
if mode == GUI_MODE and (ui_toolkit == 'qt4' or ui_toolkit == 'qt5'):
|
||||
if not utils.canEnterGUIMode4():
|
||||
|
||||
@ -1,273 +1,96 @@
|
||||
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:
|
||||
+ 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")
|
||||
diff --git a/base/module.py b/base/module.py
|
||||
index dd3efa3..04ac5b8 100644
|
||||
--- a/base/module.py
|
||||
+++ b/base/module.py
|
||||
@@ -432,6 +432,12 @@ class Module(object):
|
||||
if show_usage is not None:
|
||||
sys.exit(0)
|
||||
|
||||
+ if mode == GUI_MODE:
|
||||
+ if not utils.canEnterGUIMode4():
|
||||
+ log.warn("GUI mode not available - switching to interactive mode.")
|
||||
+ mode = INTERACTIVE_MODE
|
||||
+ ui_toolkit = 'none'
|
||||
+
|
||||
+ 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)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
dialog = ui.QueuesDiagnose(None, "","",QUEUES_MSG_SENDING,passwordObj)
|
||||
self.mode = mode
|
||||
return opts, device_uri, printer_name, mode, ui_toolkit, lang
|
||||
|
||||
diff --git a/base/utils.py b/base/utils.py
|
||||
index cde819f..0d6e9ff 100644
|
||||
index 98437a3..9b8813b 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
|
||||
@@ -722,6 +722,15 @@ def canEnterGUIMode4(): # qt4
|
||||
log.warn(e)
|
||||
return False
|
||||
|
||||
+ try:
|
||||
+ import ui4
|
||||
+ except ImportError:
|
||||
+ try:
|
||||
+ import ui5
|
||||
+ except ImportError as e:
|
||||
+ log.warn(e)
|
||||
+ return False
|
||||
+
|
||||
return True
|
||||
|
||||
|
||||
@@ -734,6 +743,11 @@ 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 +791,8 @@ def checkPyQtImport4():
|
||||
import PyQt5
|
||||
import ui5
|
||||
else:
|
||||
|
||||
@@ -781,11 +795,13 @@ def checkPyQtImport4():
|
||||
import PyQt4
|
||||
import ui4
|
||||
except ImportError:
|
||||
- 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 False
|
||||
+ try:
|
||||
+ import PyQt5
|
||||
+ import ui5
|
||||
+ except ImportError:
|
||||
+ log.debug('GUI not available.')
|
||||
+ return False
|
||||
+
|
||||
return True
|
||||
|
||||
@@ -2456,6 +2464,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 +2486,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 +2495,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/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/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)
|
||||
|
||||
# def checkPyQtImport5():
|
||||
diff --git a/fab.py b/fab.py
|
||||
index 9bd6166..e11ebc4 100755
|
||||
index 5577af5..194ceed 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/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 f54f726..58d6006 100755
|
||||
--- a/plugin.py
|
||||
+++ b/plugin.py
|
||||
@@ -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 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/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 2608f95..b09a8ef 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -310,7 +310,12 @@ if mode == GUI_MODE:
|
||||
# clean_exit(1)
|
||||
|
||||
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__)
|
||||
|
||||
@@ -776,14 +776,15 @@ mod.setUsage(module.USAGE_FLAG_NONE)
|
||||
opts, device_uri, printer_name, mode, ui_toolkit, loc = \
|
||||
mod.parseStdOpts(handle_device_printer=False)
|
||||
|
||||
-if ui_toolkit == 'qt3':
|
||||
- if not utils.canEnterGUIMode():
|
||||
- log.error("%s GUI mode requires GUI support (try running with --qt4). Entering interactive mode." % __mod__)
|
||||
- mode = INTERACTIVE_MODE
|
||||
-else:
|
||||
- if not utils.canEnterGUIMode4():
|
||||
- log.error("%s GUI mode requires GUI support (try running with --qt3). Entering interactive mode." % __mod__)
|
||||
- mode = INTERACTIVE_MODE
|
||||
+if ui_toolkit != 'none':
|
||||
+ if ui_toolkit == 'qt3':
|
||||
+ if not utils.canEnterGUIMode():
|
||||
+ log.error("%s GUI mode requires GUI support (try running with --qt4). Entering interactive mode." % __mod__)
|
||||
+ mode = INTERACTIVE_MODE
|
||||
+ else:
|
||||
+ if not utils.canEnterGUIMode4():
|
||||
+ log.error("%s GUI mode requires GUI support (try running with --qt3). Entering interactive mode." % __mod__)
|
||||
+ mode = INTERACTIVE_MODE
|
||||
|
||||
|
||||
if mode == GUI_MODE:
|
||||
|
||||
17
hplip.spec
17
hplip.spec
@ -169,6 +169,11 @@ Patch58: hplip-timeb-removed.patch
|
||||
# reported upstream https://bugs.launchpad.net/hplip/+bug/1904888
|
||||
Patch59: hplip-check-userperms.patch
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} <= 8
|
||||
# mention hplip-gui if you want to have GUI
|
||||
Patch1000: hplip-fedora-gui.patch
|
||||
%endif
|
||||
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
%if 0%{?rhel} <= 8 || 0%{?fedora}
|
||||
@ -452,6 +457,11 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h
|
||||
# 1899410 - non-sudoers cannot authenticate because of bad username in prompt
|
||||
%patch59 -p1 -b .check-userperms
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel} <= 8
|
||||
# mention hplip-gui should be installed if you want GUI
|
||||
%patch1000 -p1 -b .fedora-gui
|
||||
%endif
|
||||
|
||||
sed -i.duplex-constraints \
|
||||
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
|
||||
prnt/drv/hpcups.drv.in
|
||||
@ -536,6 +546,7 @@ rm -f %{buildroot}%{_bindir}/foomatic-rip \
|
||||
%if 0%{?rhel} > 8
|
||||
rm -rf %{buildroot}%{_bindir}/hp-check \
|
||||
%{buildroot}%{_bindir}/hp-devicesettings \
|
||||
%{buildroot}%{_bindir}/hp-diagnose_plugin \
|
||||
%{buildroot}%{_bindir}/hp-faxsetup \
|
||||
%{buildroot}%{_bindir}/hp-linefeedcal \
|
||||
%{buildroot}%{_bindir}/hp-makecopies \
|
||||
@ -552,6 +563,7 @@ rm -rf %{buildroot}%{_bindir}/hp-check \
|
||||
%{buildroot}%{_datadir}/hplip/base/imageprocessing.py* \
|
||||
%{buildroot}%{_datadir}/hplip/check.py* \
|
||||
%{buildroot}%{_datadir}/hplip/devicesettings.py* \
|
||||
%{buildroot}%{_datadir}/hplip/diagnose_plugin.py* \
|
||||
%{buildroot}%{_datadir}/hplip/faxsetup.py* \
|
||||
%{buildroot}%{_datadir}/hplip/linefeedcal.py* \
|
||||
%{buildroot}%{_datadir}/hplip/makecopies.py* \
|
||||
@ -661,7 +673,6 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%{_bindir}/hp-clean
|
||||
%{_bindir}/hp-colorcal
|
||||
%{_bindir}/hp-config_usb_printer
|
||||
%{_bindir}/hp-diagnose_plugin
|
||||
%{_bindir}/hp-diagnose_queues
|
||||
%{_bindir}/hp-fab
|
||||
%{_bindir}/hp-firmware
|
||||
@ -695,7 +706,6 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%{_datadir}/hplip/clean.py*
|
||||
%{_datadir}/hplip/colorcal.py*
|
||||
%{_datadir}/hplip/config_usb_printer.py*
|
||||
%{_datadir}/hplip/diagnose_plugin.py*
|
||||
%{_datadir}/hplip/diagnose_queues.py*
|
||||
%{_datadir}/hplip/fab.py*
|
||||
%{_datadir}/hplip/fax
|
||||
@ -761,6 +771,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%files gui
|
||||
%{_bindir}/hp-check
|
||||
%{_bindir}/hp-devicesettings
|
||||
%{_bindir}/hp-diagnose_plugin
|
||||
%{_bindir}/hp-faxsetup
|
||||
%{_bindir}/hp-linefeedcal
|
||||
%{_bindir}/hp-makecopies
|
||||
@ -776,6 +787,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%{_datadir}/icons/hicolor/*/apps/*
|
||||
%{_datadir}/hplip/check.py*
|
||||
%{_datadir}/hplip/devicesettings.py*
|
||||
%{_datadir}/hplip/diagnose_plugin.py*
|
||||
%{_datadir}/hplip/faxsetup.py*
|
||||
%{_datadir}/hplip/linefeedcal.py*
|
||||
%{_datadir}/hplip/makecopies.py*
|
||||
@ -799,6 +811,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
||||
%changelog
|
||||
* Tue Feb 02 2021 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.11-4
|
||||
- 1912147 - Enable matching for '<model>_series' drivers in PPD search algorithm
|
||||
- rework optional gui messages
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.20.11-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
Loading…
Reference in New Issue
Block a user