Commit 66cd3216 authored by Julian Andres Klode's avatar Julian Andres Klode

Imported Upstream version 3.16.5

parent f5c6afb8

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -376,6 +376,17 @@ dist_noinst_DATA += ui4/*.ui
endif
endif
#ui5 (qt5)
if GUI_BUILD
if QT5_INSTALL
ui5dir=$(hplipdir)/ui5
dist_ui5_DATA = ui5/*.py
dist_noinst_DATA += ui5/*.ui
endif
endif
# ui plugins (qt3)
if GUI_BUILD
if QT3_INSTALL
......@@ -393,6 +404,15 @@ dist_plugins4_SCRIPTS =
endif
endif
# ui plugins (qt5)
if GUI_BUILD
if QT5_INSTALL
plugins5dir = $(hplipdir)/ui5/plugins
dist_plugins5_SCRIPTS =
endif
endif
# PolicyKit
if POLICYKIT_INSTALL
policykit_dbus_etcdir = /etc/dbus-1/system.d
......
This diff is collapsed.
......@@ -31,12 +31,18 @@ import re
import getopt
import operator
import os
#from __future__ import absolute_import
# Local
from base.g import *
from base import device, status, utils, maint, tui, module
from prnt import cups
try:
from importlib import import_module
except ImportError as e:
log.debug(e)
from base.utils import dyn_import_mod as import_module
def enterAlignmentNumber(letter, hortvert, colors, line_count, maximum):
ok, value = tui.enter_range("From the printed Alignment page, Enter the best aligned value for line %s (1-%d): " %
......@@ -130,7 +136,7 @@ def aioUI2():
try:
mod = module.Module(__mod__, __title__, __version__, __doc__, None,
(INTERACTIVE_MODE, GUI_MODE), (UI_TOOLKIT_QT4,))
(INTERACTIVE_MODE, GUI_MODE), (UI_TOOLKIT_QT4, UI_TOOLKIT_QT5))
mod.setUsage(module.USAGE_FLAG_DEVICE_ARGS,
see_also_list=['hp-clean', 'hp-colorcal', 'hp-linefeedcal',
......@@ -228,18 +234,20 @@ try:
d.close()
else: # GUI_MODE (qt4)
try:
from PyQt4.QtGui import QApplication
from ui4.aligndialog import AlignDialog
except ImportError:
log.error("Unable to load Qt4 support. Is it installed?")
sys.exit(1)
# try:
# from PyQt4.QtGui import QApplication
# from ui4.aligndialog import AlignDialog
# except ImportError:
# 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:
if 1:
app = QApplication(sys.argv)
dlg = AlignDialog(None, device_uri)
dlg = ui.AlignDialog(None, device_uri)
dlg.show()
try:
log.debug("Starting GUI loop...")
......
......@@ -66,5 +66,3 @@ def detectNetworkDevices(ttl=4, timeout=10):
log.debug("Found %d devices" % len(found_devices))
return found_devices
......@@ -33,7 +33,8 @@ BROWSER_MODE = 3 # -w
# Supported UI toolkits
UI_TOOLKIT_QT3 = 0
UI_TOOLKIT_QT4 = 1
UI_TOOLKIT_GTK = 2 # Not used
UI_TOOLKIT_QT5 = 2
UI_TOOLKIT_GTK = 3 # Not used
# device types (CUPS queue or SANE types)
DEVICE_TYPE_UNKNOWN = 0
......
......@@ -26,7 +26,7 @@ import re
import gzip
import os.path
import time
from .sixext.moves import urllib_request, urllib_parse, urllib_error # TODO: Replace with urllib2 (urllib is deprecated in Python 3.0)
from .sixext.moves import urllib_request, urllib_parse, urllib_error
import io
from io import BytesIO
from .sixext.moves import http_client
......
......@@ -117,6 +117,8 @@ TECH_CLASSES = [
"Kapan",
"MimasTDR",
"Saipan15B",
"Gemstone",
"SPDOfficejetProAsize",
]
TECH_CLASSES.sort()
......@@ -183,6 +185,8 @@ TECH_CLASS_PDLS = {
"Kapan" : 'pcl3',
"MimasTDR" : 'pcl3',
"Saipan15B" : 'pcl3',
"Gemstone" : 'pcl3',
"SPDOfficejetProAsize" : 'pcl3',
}
PDL_TYPE_PCL = 0 # less preferred
......
......@@ -79,6 +79,10 @@ class Module(object):
self.installed_ui_toolkits.append(UI_TOOLKIT_QT4)
self.num_installed_ui_toolkits += 1
if utils.to_bool(sys_conf.get('configure', 'qt5', '0')):
self.installed_ui_toolkits.append(UI_TOOLKIT_QT5)
self.num_installed_ui_toolkits += 1
self.default_mode = INTERACTIVE_MODE
self.num_valid_modes = 0
......@@ -109,8 +113,8 @@ class Module(object):
self.default_ui_toolkit = 'none'
elif (UI_TOOLKIT_QT4 in self.supported_ui_toolkits and self.default_ui_toolkit == 'qt4' and UI_TOOLKIT_QT4 in self.installed_ui_toolkits) or \
(UI_TOOLKIT_QT3 in self.supported_ui_toolkits and self.default_ui_toolkit == 'qt3' and UI_TOOLKIT_QT3 in self.installed_ui_toolkits):
(UI_TOOLKIT_QT3 in self.supported_ui_toolkits and self.default_ui_toolkit == 'qt3' and UI_TOOLKIT_QT3 in self.installed_ui_toolkits) or \
(UI_TOOLKIT_QT5 in self.supported_ui_toolkits and self.default_ui_toolkit == 'qt5' and UI_TOOLKIT_QT5 in self.installed_ui_toolkits):
self.default_mode = GUI_MODE
elif self.default_ui_toolkit == 'qt3' and UI_TOOLKIT_QT3 not in self.supported_ui_toolkits:
......@@ -118,6 +122,9 @@ class Module(object):
if UI_TOOLKIT_QT4 in self.supported_ui_toolkits and UI_TOOLKIT_QT4 in self.installed_ui_toolkits: # (e.g, hp-linefeedcal?)
self.default_ui_toolkit = 'qt4'
self.default_mode = GUI_MODE
if UI_TOOLKIT_QT5 in self.supported_ui_toolkits and UI_TOOLKIT_QT5 in self.installed_ui_toolkits:
self.default_ui_toolkit = 'qt5'
self.default_mode = GUI_MODE
elif INTERACTIVE_MODE in self.avail_modes:
self.default_mode = INTERACTIVE_MODE
......@@ -205,6 +212,10 @@ class Module(object):
if UI_TOOLKIT_QT4 in self.supported_ui_toolkits and UI_TOOLKIT_QT4 in self.installed_ui_toolkits:
content.append(utils.USAGE_USE_QT4)
if UI_TOOLKIT_QT5 in self.supported_ui_toolkits and UI_TOOLKIT_QT5 in self.installed_ui_toolkits:
content.append(utils.USAGE_USE_QT5)
content.append(utils.USAGE_LOGGING1)
content.append(utils.USAGE_LOGGING2)
if include_flags & USAGE_FLAG_SUPRESS_G_DEBUG_FLAG != USAGE_FLAG_SUPRESS_G_DEBUG_FLAG:
......@@ -379,6 +390,18 @@ class Module(object):
ui_toolkit = 'qt4'
else:
error_msg.append("%s does not support Qt4. Unable to enter GUI mode." % self.mod)
elif o in ('--qt5', '--use-qt5'):
if self.avail_modes is not None and GUI_MODE in self.avail_modes:
if self.supported_ui_toolkits is not None and \
UI_TOOLKIT_QT5 in self.supported_ui_toolkits and prop.gui_build and \
UI_TOOLKIT_QT5 in self.installed_ui_toolkits:
mode = GUI_MODE
ui_toolkit = 'qt5'
else:
error_msg.append("%s does not support Qt4. Unable to enter GUI mode." % self.mod)
#elif o in ('--lang', '--loc'):
# if a.strip() == '?':
......
......@@ -110,11 +110,12 @@ class Password(object):
self.__readAuthType() #self.__authType
self.__expectList =[]
if not utils.to_bool(sys_conf.get('configure','qt4', '0')) and utils.to_bool(sys_conf.get('configure','qt3', '0')):
if not utils.to_bool(sys_conf.get('configure','qt5', '0')) and not not utils.to_bool(sys_conf.get('configure','qt4', '0')) and utils.to_bool(sys_conf.get('configure','qt3', '0')):
self.__ui_toolkit = 'qt3'
else:
elif not utils.to_bool(sys_conf.get('configure','qt5', '0')) and not utils.to_bool(sys_conf.get('configure','qt3', '0')) and utils.to_bool(sys_conf.get('configure','qt4', '0')):
self.__ui_toolkit = 'qt4'
elif not utils.to_bool(sys_conf.get('configure','qt3', '0')) and not utils.to_bool(sys_conf.get('configure','qt4', '0')) and utils.to_bool(sys_conf.get('configure','qt5', '0')):
self.__ui_toolkit = 'qt5'
for s in utils.EXPECT_WORD_LIST:
try:
......@@ -171,6 +172,9 @@ class Password(object):
if self.__ui_toolkit == "qt3":
from ui.setupform import showPasswordUI
username, password = showPasswordUI(pswd_msg, user, False)
elif self.__ui_toolkit == "qt5":
from ui5.setupdialog import showPasswordUI
username, password = showPasswordUI(pswd_msg, user, False)
else: #self.__ui_toolkit == "qt4" --> default qt4
from ui4.setupdialog import showPasswordUI
username, password = showPasswordUI(pswd_msg, user, False)
......@@ -273,7 +277,9 @@ class Password(object):
if self.__mode == GUI_MODE:
if self.__ui_toolkit == "qt4":
from ui4.setupdialog import FailureMessageUI
if self.__ui_toolkit == "qt3":
elif self.__ui_toolkit == "qt5":
from ui5.setupdialog import FailureMessageUI
elif self.__ui_toolkit == "qt3":
from ui.setupform import FailureMessageUI
......
......@@ -32,6 +32,12 @@ from prnt import cups
from installer import core_install
from .sixext import to_string_utf8
try:
from importlib import import_module
except ImportError as e:
log.debug(e)
from .utils import dyn_import_mod as import_module