1 Star 0 Fork 14

mds.lanruo/hplip

forked from src-openEuler/hplip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
hplip-ui-optional.patch 2.84 KB
一键复制 编辑 原始数据 按行查看 历史
jackie_wu123 提交于 2020-02-17 18:58 . package init
diff -up hplip-3.18.4/base/utils.py.ui-optional hplip-3.18.4/base/utils.py
--- hplip-3.18.4/base/utils.py.ui-optional 2018-04-25 12:34:16.000000000 +0200
+++ hplip-3.18.4/base/utils.py 2018-04-26 09:27:26.487258888 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# (c) Copyright 2001-2015 HP Development Company, L.P.
@@ -733,6 +733,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
@@ -783,7 +790,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
@@ -2434,6 +2442,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")
@@ -2455,6 +2464,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:
@@ -2463,9 +2473,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 -up hplip-3.18.4/plugin.py.ui-optional hplip-3.18.4/plugin.py
--- hplip-3.18.4/plugin.py.ui-optional 2018-05-11 10:06:02.925579534 +0200
+++ hplip-3.18.4/plugin.py 2018-05-11 10:25:08.576302069 +0200
@@ -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":
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mdslanruo/hplip.git
git@gitee.com:mdslanruo/hplip.git
mdslanruo
hplip
hplip
master

搜索帮助