summaryrefslogtreecommitdiff
path: root/ui5
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-05-06 14:27:25 +0200
committerJulian Andres Klode <jak@debian.org>2016-05-06 14:27:25 +0200
commit66cd3216fa88509be6aeabd4a020e8a84145d0c7 (patch)
treea2d23d8509ee324fe17f883aa4a81577910e1940 /ui5
parentf5c6afb8deed038452916505b5f4f415329c1350 (diff)
Imported Upstream version 3.16.5
Diffstat (limited to 'ui5')
-rw-r--r--ui5/__init__.py19
-rw-r--r--ui5/aboutdialog.py58
-rw-r--r--ui5/aboutdialog_base.py129
-rw-r--r--ui5/aboutdialog_base.ui274
-rw-r--r--ui5/aligndialog.py793
-rw-r--r--ui5/aligndialog_base.py385
-rw-r--r--ui5/aligndialog_base.ui850
-rw-r--r--ui5/cleandialog.py395
-rw-r--r--ui5/cleandialog_base.py176
-rw-r--r--ui5/cleandialog_base.ui313
-rw-r--r--ui5/colorcaldialog.py438
-rw-r--r--ui5/colorcaldialog_base.py332
-rw-r--r--ui5/colorcaldialog_base.ui810
-rw-r--r--ui5/devicesetupdialog.py296
-rw-r--r--ui5/devicesetupdialog_base.py85
-rw-r--r--ui5/devicesetupdialog_base.ui179
-rw-r--r--ui5/deviceuricombobox.py169
-rw-r--r--ui5/devmgr5.py2324
-rw-r--r--ui5/devmgr5_base.py409
-rw-r--r--ui5/devmgr5_base.ui728
-rw-r--r--ui5/devmgr_ext.py45
-rw-r--r--ui5/fabgrouptable.py80
-rw-r--r--ui5/fabnametable.py39
-rw-r--r--ui5/fabwindow.py616
-rw-r--r--ui5/fabwindow_base.py161
-rw-r--r--ui5/fabwindow_base.ui235
-rw-r--r--ui5/faxsetupdialog.py298
-rw-r--r--ui5/faxsetupdialog_base.py102
-rw-r--r--ui5/faxsetupdialog_base.ui170
-rw-r--r--ui5/filetable.py431
-rw-r--r--ui5/firmwaredialog.py111
-rw-r--r--ui5/firmwaredialog_base.py67
-rw-r--r--ui5/firmwaredialog_base.ui114
-rw-r--r--ui5/infodialog.py311
-rw-r--r--ui5/infodialog_base.py103
-rw-r--r--ui5/infodialog_base.ui179
-rw-r--r--ui5/linefeedcaldialog.py125
-rw-r--r--ui5/linefeedcaldialog_base.py57
-rw-r--r--ui5/linefeedcaldialog_base.ui102
-rw-r--r--ui5/loadpapergroupbox.py104
-rw-r--r--ui5/makecopiesdialog.py92
-rw-r--r--ui5/makecopiesdialog_base.py52
-rw-r--r--ui5/makecopiesdialog_base.ui89
-rw-r--r--ui5/mimetypesdialog.py59
-rw-r--r--ui5/mimetypesdialog_base.py72
-rw-r--r--ui5/mimetypesdialog_base.ui123
-rw-r--r--ui5/nodevicesdialog.py81
-rw-r--r--ui5/nodevicesdialog_base.py72
-rw-r--r--ui5/nodevicesdialog_base.ui136
-rw-r--r--ui5/plugindiagnose.py107
-rw-r--r--ui5/plugindiagnose_base.py64
-rw-r--r--ui5/plugindiagnose_base.ui85
-rw-r--r--ui5/plugindialog.py332
-rw-r--r--ui5/plugindialog_base.py118
-rw-r--r--ui5/plugindialog_base.ui219
-rw-r--r--ui5/pluginlicensedialog.py50
-rw-r--r--ui5/pluginlicensedialog_base.py87
-rw-r--r--ui5/pluginlicensedialog_base.ui179
-rw-r--r--ui5/pqdiagdialog.py124
-rw-r--r--ui5/pqdiagdialog_base.py57
-rw-r--r--ui5/pqdiagdialog_base.ui102
-rw-r--r--ui5/printdialog.py217
-rw-r--r--ui5/printdialog_base.py109
-rw-r--r--ui5/printdialog_base.ui169
-rw-r--r--ui5/printernamecombobox.py163
-rw-r--r--ui5/printsettings_base.py8
-rw-r--r--ui5/printsettingsdialog.py116
-rw-r--r--ui5/printsettingsdialog_base.py57
-rw-r--r--ui5/printsettingsdialog_base.ui91
-rw-r--r--ui5/printsettingstoolbox.py1999
-rw-r--r--ui5/printtestpagedialog.py159
-rw-r--r--ui5/printtestpagedialog_base.py78
-rw-r--r--ui5/printtestpagedialog_base.ui142
-rw-r--r--ui5/queuesconf.py258
-rw-r--r--ui5/readonlyradiobutton.py64
-rw-r--r--ui5/sendfaxdialog.py1060
-rw-r--r--ui5/sendfaxdialog_base.py392
-rw-r--r--ui5/sendfaxdialog_base.ui711
-rw-r--r--ui5/settingsdialog.py109
-rw-r--r--ui5/settingsdialog_base.py253
-rw-r--r--ui5/settingsdialog_base.ui542
-rw-r--r--ui5/setupdialog.py1381
-rw-r--r--ui5/setupdialog_base.py387
-rw-r--r--ui5/setupdialog_base.ui654
-rw-r--r--ui5/setupdialog_base5.py387
-rw-r--r--ui5/systemtray.py862
-rw-r--r--ui5/systrayframe.py218
-rw-r--r--ui5/systrayframe_base.py110
-rw-r--r--ui5/systrayframe_base.ui246
-rw-r--r--ui5/ui_utils.py607
-rw-r--r--ui5/upgradedialog.py128
-rw-r--r--ui5/upgradedialog_base.py67
-rw-r--r--ui5/upgradedialog_base.ui143
-rw-r--r--ui5/wifisetupdialog.py859
-rw-r--r--ui5/wifisetupdialog_base.py596
-rw-r--r--ui5/wifisetupdialog_base.ui1102
96 files changed, 29356 insertions, 0 deletions
diff --git a/ui5/__init__.py b/ui5/__init__.py
new file mode 100644
index 000000000..c740ead61
--- /dev/null
+++ b/ui5/__init__.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
diff --git a/ui5/aboutdialog.py b/ui5/aboutdialog.py
new file mode 100644
index 000000000..227184f8f
--- /dev/null
+++ b/ui5/aboutdialog.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Local
+from base.g import *
+#from base import device, utils
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .aboutdialog_base import Ui_AboutDlg_base
+
+
+class AboutDialog(QDialog, Ui_AboutDlg_base):
+ def __init__(self, parent, hplip_version, toolbox_version):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.initUi(hplip_version, toolbox_version)
+
+
+ def initUi(self, hplip_version, toolbox_version):
+ self.CloseButton.clicked.connect(self.CloseButton_clicked)
+
+ self.HPLIPVersionText.setText(hplip_version)
+ self.ToolboxVersionText.setText(toolbox_version)
+ self.PythonPixmap.setPixmap(load_pixmap('powered_by_python.png'))
+ self.OsiPixmap.setPixmap(load_pixmap('opensource-75x65.png'))
+ self.HPLIPLogo.setPixmap(load_pixmap('hp-tux-printer.png'))
+
+
+
+ def CloseButton_clicked(self):
+ self.close()
+
+
+
diff --git a/ui5/aboutdialog_base.py b/ui5/aboutdialog_base.py
new file mode 100644
index 000000000..6b3951253
--- /dev/null
+++ b/ui5/aboutdialog_base.py
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/aboutdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_AboutDlg_base(object):
+ def setupUi(self, AboutDlg_base):
+ AboutDlg_base.setObjectName("AboutDlg_base")
+ AboutDlg_base.resize(537, 543)
+ self.gridlayout = QtWidgets.QGridLayout(AboutDlg_base)
+ self.gridlayout.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout.setSpacing(6)
+ self.gridlayout.setObjectName("gridlayout")
+ self.textLabel1 = QtWidgets.QLabel(AboutDlg_base)
+ self.textLabel1.setWordWrap(False)
+ self.textLabel1.setObjectName("textLabel1")
+ self.gridlayout.addWidget(self.textLabel1, 0, 0, 1, 2)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setContentsMargins(11, 11, 11, 11)
+ self.hboxlayout.setSpacing(6)
+ self.hboxlayout.setObjectName("hboxlayout")
+ spacerItem = QtWidgets.QSpacerItem(150, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem)
+ self.HPLIPLogo = QtWidgets.QLabel(AboutDlg_base)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.HPLIPLogo.sizePolicy().hasHeightForWidth())
+ self.HPLIPLogo.setSizePolicy(sizePolicy)
+ self.HPLIPLogo.setMinimumSize(QtCore.QSize(100, 110))
+ self.HPLIPLogo.setMaximumSize(QtCore.QSize(100, 110))
+ self.HPLIPLogo.setScaledContents(True)
+ self.HPLIPLogo.setWordWrap(False)
+ self.HPLIPLogo.setObjectName("HPLIPLogo")
+ self.hboxlayout.addWidget(self.HPLIPLogo)
+ spacerItem1 = QtWidgets.QSpacerItem(151, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem1)
+ self.gridlayout.addLayout(self.hboxlayout, 1, 0, 1, 2)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setContentsMargins(11, 11, 11, 11)
+ self.hboxlayout1.setSpacing(6)
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.textLabel4 = QtWidgets.QLabel(AboutDlg_base)
+ self.textLabel4.setWordWrap(False)
+ self.textLabel4.setObjectName("textLabel4")
+ self.hboxlayout1.addWidget(self.textLabel4)
+ self.HPLIPVersionText = QtWidgets.QLabel(AboutDlg_base)
+ self.HPLIPVersionText.setWordWrap(False)
+ self.HPLIPVersionText.setObjectName("HPLIPVersionText")
+ self.hboxlayout1.addWidget(self.HPLIPVersionText)
+ self.gridlayout.addLayout(self.hboxlayout1, 2, 0, 1, 2)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setContentsMargins(11, 11, 11, 11)
+ self.hboxlayout2.setSpacing(6)
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.textLabel4_2 = QtWidgets.QLabel(AboutDlg_base)
+ self.textLabel4_2.setWordWrap(False)
+ self.textLabel4_2.setObjectName("textLabel4_2")
+ self.hboxlayout2.addWidget(self.textLabel4_2)
+ self.ToolboxVersionText = QtWidgets.QLabel(AboutDlg_base)
+ self.ToolboxVersionText.setWordWrap(False)
+ self.ToolboxVersionText.setObjectName("ToolboxVersionText")
+ self.hboxlayout2.addWidget(self.ToolboxVersionText)
+ self.gridlayout.addLayout(self.hboxlayout2, 3, 0, 1, 2)
+ self.textLabel3 = QtWidgets.QLabel(AboutDlg_base)
+ self.textLabel3.setWordWrap(True)
+ self.textLabel3.setObjectName("textLabel3")
+ self.gridlayout.addWidget(self.textLabel3, 4, 0, 1, 2)
+ self.textLabel2 = QtWidgets.QLabel(AboutDlg_base)
+ self.textLabel2.setWordWrap(True)
+ self.textLabel2.setObjectName("textLabel2")
+ self.gridlayout.addWidget(self.textLabel2, 5, 0, 1, 2)
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setContentsMargins(11, 11, 11, 11)
+ self.hboxlayout3.setSpacing(6)
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.PythonPixmap = QtWidgets.QLabel(AboutDlg_base)
+ self.PythonPixmap.setMinimumSize(QtCore.QSize(200, 62))
+ self.PythonPixmap.setMaximumSize(QtCore.QSize(200, 62))
+ self.PythonPixmap.setScaledContents(True)
+ self.PythonPixmap.setWordWrap(False)
+ self.PythonPixmap.setObjectName("PythonPixmap")
+ self.hboxlayout3.addWidget(self.PythonPixmap)
+ self.OsiPixmap = QtWidgets.QLabel(AboutDlg_base)
+ self.OsiPixmap.setMinimumSize(QtCore.QSize(75, 65))
+ self.OsiPixmap.setMaximumSize(QtCore.QSize(75, 65))
+ self.OsiPixmap.setScaledContents(True)
+ self.OsiPixmap.setWordWrap(False)
+ self.OsiPixmap.setObjectName("OsiPixmap")
+ self.hboxlayout3.addWidget(self.OsiPixmap)
+ self.gridlayout.addLayout(self.hboxlayout3, 6, 0, 1, 2)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem2, 7, 0, 1, 2)
+ spacerItem3 = QtWidgets.QSpacerItem(411, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 8, 0, 1, 1)
+ self.CloseButton = QtWidgets.QPushButton(AboutDlg_base)
+ self.CloseButton.setObjectName("CloseButton")
+ self.gridlayout.addWidget(self.CloseButton, 8, 1, 1, 1)
+
+ self.retranslateUi(AboutDlg_base)
+ self.CloseButton.clicked.connect(AboutDlg_base.close)
+ QtCore.QMetaObject.connectSlotsByName(AboutDlg_base)
+
+ def retranslateUi(self, AboutDlg_base):
+ _translate = QtCore.QCoreApplication.translate
+ AboutDlg_base.setWindowTitle(_translate("AboutDlg_base", "HP Device Manager - About"))
+ self.textLabel1.setText(_translate("AboutDlg_base", "<font size=\"+3\"><p align=\"center\">HP Linux Imaging and Printing (HPLIP)</p></font>"))
+ self.textLabel4.setText(_translate("AboutDlg_base", "<b>HPLIP Software Version:</b>"))
+ self.HPLIPVersionText.setText(_translate("AboutDlg_base", "0.0.0"))
+ self.textLabel4_2.setText(_translate("AboutDlg_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Device Manager Version:</span></p></body></html>"))
+ self.ToolboxVersionText.setText(_translate("AboutDlg_base", "0.0.0"))
+ self.textLabel3.setText(_translate("AboutDlg_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">License and Copyright:</span> (c) Copyright 2015 HP Development Company, L.P. This software is licensed under the GNU General Public License (GPL), BSD, and MIT licenses. See the software sources for details.</p></body></html>"))
+ self.textLabel2.setText(_translate("AboutDlg_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Authors and Contributors:</span> David Suffield, Don Welch, Shiyun Yie, Raghothama Cauligi, John Oleinik, Cory Meisch, Foster Nuffer, Pete Parks, Jacqueline Pitter, David Paschal, Steve DeRoos, Mark Overton, Aaron Albright, Smith Kennedy, John Hosszu, Chris Wiesner, Henrique M. Holschuh, Till Kamppeter, Linus Araque, Mark Crawford, Charlie Moore, Jason Callough, Stan Dolson, Don Mackliet, Paul Leclerc, Naga Samrat Choudary, Suma Byrappa, Yashwant Sahu, Sanjay Kumar, Sarbeswar Meher, Goutam Kodu, Gaurav Sood, Srikant Lokare, Parul Singh, Raghavendra Chitpadi</p></body></html>"))
+ self.CloseButton.setText(_translate("AboutDlg_base", "Close"))
+
diff --git a/ui5/aboutdialog_base.ui b/ui5/aboutdialog_base.ui
new file mode 100644
index 000000000..2f6830f51
--- /dev/null
+++ b/ui5/aboutdialog_base.ui
@@ -0,0 +1,274 @@
+<ui version="4.0" >
+ <class>AboutDlg_base</class>
+ <widget class="QDialog" name="AboutDlg_base" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>537</width>
+ <height>543</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - About</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>&lt;font size="+3">&lt;p align="center">HP Linux Imaging and Printing (HPLIP)&lt;/p>&lt;/font></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>150</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="HPLIPLogo" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>100</width>
+ <height>110</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>100</width>
+ <height>110</height>
+ </size>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>151</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="textLabel4" >
+ <property name="text" >
+ <string>&lt;b>HPLIP Software Version:&lt;/b></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="HPLIPVersionText" >
+ <property name="text" >
+ <string>0.0.0</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="textLabel4_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Device Manager Version:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="ToolboxVersionText" >
+ <property name="text" >
+ <string>0.0.0</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel3" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">License and Copyright:&lt;/span> (c) Copyright 2015 HP Development Company, L.P. This software is licensed under the GNU General Public License (GPL), BSD, and MIT licenses. See the software sources for details.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Authors and Contributors:&lt;/span> David Suffield, Don Welch, Shiyun Yie, Raghothama Cauligi, John Oleinik, Cory Meisch, Foster Nuffer, Pete Parks, Jacqueline Pitter, David Paschal, Steve DeRoos, Mark Overton, Aaron Albright, Smith Kennedy, John Hosszu, Chris Wiesner, Henrique M. Holschuh, Till Kamppeter, Linus Araque, Mark Crawford, Charlie Moore, Jason Callough, Stan Dolson, Don Mackliet, Paul Leclerc, Naga Samrat Choudary, Suma Byrappa, Yashwant Sahu, Sanjay Kumar, Sarbeswar Meher, Goutam Kodu, Gaurav Sood, Srikant Lokare, Parul Singh, Raghavendra Chitpadi&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="PythonPixmap" >
+ <property name="minimumSize" >
+ <size>
+ <width>200</width>
+ <height>62</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>200</width>
+ <height>62</height>
+ </size>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="OsiPixmap" >
+ <property name="minimumSize" >
+ <size>
+ <width>75</width>
+ <height>65</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>75</width>
+ <height>65</height>
+ </size>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="7" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>411</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="1" >
+ <widget class="QPushButton" name="CloseButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>CloseButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AboutDlg_base</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/aligndialog.py b/ui5/aligndialog.py
new file mode 100644
index 000000000..aab17cbab
--- /dev/null
+++ b/ui5/aligndialog.py
@@ -0,0 +1,793 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch, Naga Samrat Chowdary Narla,
+#
+
+# StdLib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, maint, status
+#from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .aligndialog_base import Ui_Dialog
+
+PAGE_START = 0
+PAGE_LOAD_PAPER = 1
+PAGE_EDGE = 2
+PAGE_ALIGNMENT_NUMBER = 3
+PAGE_COLOR_ADJ = 4 # types 4, 5 & 7
+PAGE_LBOW = 5 # types 10 & 11
+PAGE_AIO = 6 # Place on scanner, ...
+PAGE_FRONT_PANEL = 7 # Use front panel menu
+
+BUTTON_ALIGN = 0
+BUTTON_NEXT = 1
+BUTTON_FINISH = 2
+
+ALIGN_TYPE_INITIAL = 1000
+ALIGN_TYPE_TEST = 1001
+
+# xBow offset types
+ALIGN_TYPE_XBOW_OFFSET = 100
+ALIGN_TYPE_XBOW_BLACK_ONLY = ALIGN_TYPE_XBOW_OFFSET + AGENT_CONFIG_BLACK_ONLY
+ALIGN_TYPE_XBOW_PHOTO_ONLY = ALIGN_TYPE_XBOW_OFFSET + AGENT_CONFIG_PHOTO_ONLY
+ALIGN_TYPE_XBOW_COLOR_ONLY = ALIGN_TYPE_XBOW_OFFSET + AGENT_CONFIG_COLOR_ONLY
+ALIGN_TYPE_XBOW_COLOR_AND_BLACK = ALIGN_TYPE_XBOW_OFFSET + AGENT_CONFIG_COLOR_AND_BLACK
+ALIGN_TYPE_XBOW_COLOR_AND_PHOTO = ALIGN_TYPE_XBOW_OFFSET + AGENT_CONFIG_COLOR_AND_PHOTO
+
+
+def true():
+ return True
+
+
+class AlignDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.device_uri = device_uri
+ self.mq = {}
+ self.step_max = 0
+ self.align_type = ALIGN_TYPE_INITIAL
+ self.step = 1
+ self.a, self.b, self.c, self.d, self.zca = 0, 0, 0, 0, 0
+ self.e, self.f, self.g = 0, 0, 0
+ self.num_inks = 0 # type 8
+ self.pattern = 0 # type 10
+ self.values = [] # type 10
+ self.abort = False
+ self.seq_index = 0
+
+ self.max_steps = {
+ ALIGN_TYPE_UNSUPPORTED : 1,
+ ALIGN_TYPE_AUTO : 2,
+ ALIGN_TYPE_9XX : 7,
+ ALIGN_TYPE_8XX : 7,
+ ALIGN_TYPE_LIDIL_0_3_8 : 0,
+ ALIGN_TYPE_LIDIL_0_4_3 : 0,
+ ALIGN_TYPE_LIDIL_AIO : 3,
+ ALIGN_TYPE_LIDIL_VIP : 0,
+ ALIGN_TYPE_DESKJET_450 : 0,
+ ALIGN_TYPE_9XX_NO_EDGE_ALIGN : 6,
+ ALIGN_TYPE_LBOW : 0,
+ ALIGN_TYPE_LIDIL_0_5_4 : 0,
+ ALIGN_TYPE_OJ_PRO : 0,
+ ALIGN_TYPE_TEST : 0,
+ ALIGN_TYPE_AIO : 3,
+ ALIGN_TYPE_LIDIL_DJ_D1600: 0,
+ ALIGN_TYPE_LEDM: 0,
+ ALIGN_TYPE_LEDM_MANUAL: 0,
+ ALIGN_TYPE_LEDM_FF_CC_0: 0,
+ }
+
+ self.seq = { # (func|method, tuple of params|None)
+ ALIGN_TYPE_TEST : [ # testing only
+ (self.showColorAdjustPage, ('F', 21)),
+ (self.endColorAdjustPage, ('F',)),
+ (self.showColorAdjustPage, ('G', 11)),
+ (self.endColorAdjustPage, ('G',)),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_INITIAL : [ # (used when starting up and align-type isn't known)
+ (self.showStartPage, None),
+ (self.endStartPage, None), # switch to a valid align-type here
+ ],
+
+ ALIGN_TYPE_UNSUPPORTED : [ # -1
+ (self.showFrontPanelPage, None),
+ (self.endFronPanelPage, None),
+ (self.close, None),
+ ],
+
+# ALIGN_TYPE_NONE : [ # 0
+# (self.close, None)
+# ],
+
+ ALIGN_TYPE_AUTO : [ # 1
+ (self.showLoadPaperPage, None),
+ (maint.AlignType1PML, (lambda : self.dev, lambda: true)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_8XX : [ # 2
+ (self.checkType2PenConfig, None),
+ (self.showLoadPaperPage, None),
+ (maint.alignType2Phase1, (lambda: self.dev,)),
+ (self.showAlignmentNumberPage, ('A', 'h', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('A',)),
+ (self.showAlignmentNumberPage, ('B', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'kc', 2, 5)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'c', 2, 5)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showLoadPaperPage, (lambda: True,)),
+ (maint.alignType2Phase2, (lambda: self.dev, lambda: self.a, lambda: self.b,
+ lambda: self.c, lambda: self.d)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_9XX : [ # 3
+ (self.showLoadPaperPage, None),
+ (self.showAlignmentNumberPage, ('A', 'h', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('A',)),
+ (self.showAlignmentNumberPage, ('B', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (maint.alignType3Phase2, (lambda: self.dev, lambda: self.a, lambda: self.b,
+ lambda: self.c, lambda: self.d)),
+ (maint.alignType3Phase3, (lambda: self.dev,)),
+ (self.showPageEdgePage, None),
+ (self.endPageEdgePage, None),
+ (maint.alignType3Phase4, (lambda: self.dev, lambda: self.zca)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LIDIL_0_3_8 : [ # 4
+ (self.showLoadPaperPage, None),
+ (self.setPenConfig, None),
+ (maint.alignType4Phase1, (lambda: self.dev,)),
+ (self.setXBow, None),
+ # switches to offset align_type here
+ ],
+
+ ALIGN_TYPE_LIDIL_0_4_3 : [ # 5
+ (self.showLoadPaperPage, None),
+ (self.setPenConfig, None),
+ (maint.alignType5Phase1, (lambda: self.dev,)),
+ (self.showPageEdgePage, ('A',)),
+ (self.endPageEdgePage, None),
+ (self.setXBow, None),
+ # switches to offset align_type here
+ ],
+
+ ALIGN_TYPE_LIDIL_VIP : [ # 7
+ (self.showLoadPaperPage, None),
+ (self.setPenConfig, None),
+ (maint.alignType7Phase1, (lambda: self.dev,)),
+ (self.showPageEdgePage, ('A',)),
+ (self.endPageEdgePage, None),
+ (self.setXBow, None),
+ # switches to offset align_type here (next 5 types)
+ ],
+
+ # xBow offset alignment type
+ ALIGN_TYPE_XBOW_BLACK_ONLY : [ # 4, 5 & 7
+ (self.showAlignmentNumberPage, ('B', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.setXBowValues, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ # xBow offset alignment type
+ ALIGN_TYPE_XBOW_PHOTO_ONLY : [ # 4, 5 & 7
+ (self.showAlignmentNumberPage, ('B', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.setXBowValues, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ # xBow offset alignment type
+ ALIGN_TYPE_XBOW_COLOR_ONLY : [ # 4, 5 & 7
+ (self.showAlignmentNumberPage, ('B', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.setXBowValues, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ # xBow offset alignment type
+ ALIGN_TYPE_XBOW_COLOR_AND_BLACK : [ # 4, 5 & 7
+ (self.showAlignmentNumberPage, ('B', 'h', 'kc', 2, 17)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'kc', 2, 17)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (self.showAlignmentNumberPage, ('E', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('E',)),
+ (self.setXBowValues, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ # xBow offset alignment type
+ ALIGN_TYPE_XBOW_COLOR_AND_PHOTO : [ # 4, 5 & 7
+ (self.showAlignmentNumberPage, ('B', 'h', 'kc', 2, 17)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'kc', 2, 17)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (self.showAlignmentNumberPage, ('E', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('E',)),
+ (self.showColorAdjustPage, ('F', 21)),
+ (self.endColorAdjustPage, ('F',)),
+ (self.showColorAdjustPage, ('G', 21)),
+ (self.endColorAdjustPage, ('G',)),
+ (self.setXBowValues, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LIDIL_AIO : [ # 6 (semi-auto)
+ (self.showLoadPaperPage, None),
+ (maint.alignType6Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showAioPage, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_DESKJET_450 : [ # 8
+ (self.showLoadPaperPage, None),
+ (self.alignType8Phase1, None), # sets num_inks
+ (self.showAlignmentNumberPage, ('A', 'v', 'k', 3, 9)),
+ (self.endAlignmentNumberPage, ('A',)),
+ (self.showAlignmentNumberPage, ('B', 'v', 'c', 3, 9)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'kc', 3, 9)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showAlignmentNumberPage, ('D', 'h', 'kc', 3, 9)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (maint.alignType3Phase2, (lambda: self.dev, lambda: self.num_inks, lambda: self.a,
+ lambda: self.b, lambda: self.c, lambda: self.d)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_9XX_NO_EDGE_ALIGN : [ # 9
+ (self.showLoadPaperPage, None),
+ (self.showAlignmentNumberPage, ('A', 'h', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('A',)),
+ (self.showAlignmentNumberPage, ('B', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'k', 2, 11)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'kc', 2, 11)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (maint.alignType3Phase2, (lambda: self.dev, lambda: self.a, lambda: self.b,
+ lambda: self.c, lambda: self.d)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LBOW : [ # 10
+ (self.showLoadPaperPage, None),
+ (maint.alignType10Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showLBowPage, (lambda: self.pattern,)),
+ (self.endLBowPage, None), # sets values
+ (maint.alignType10Phase2, (lambda: self.dev, lambda: self.values,
+ lambda: self.pattern)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showLoadPaperPage, (lambda: True,)),
+ (maint.alignType10Phase3, (lambda: self.dev,)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LIDIL_0_5_4 : [ # 11
+ (self.showLoadPaperPage, None),
+ (maint.alignType11Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showLBowPage, (lambda: self.pattern,)),
+ (self.endLBowPage, None), # sets values
+ (maint.alignType11Phase2, (lambda: self.dev, lambda: self.values,
+ lambda: self.pattern, lambda: self.dev.pen_config)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showLoadPaperPage, (lambda: True,)),
+ (maint.alignType11Phase3, (lambda: self.dev,)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_OJ_PRO : [ # 12
+ (self.showLoadPaperPage, None),
+ (maint.AlignType12, (lambda : self.dev, lambda: true)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_AIO : [ #13
+ (self.showLoadPaperPage, None),
+ (maint.alignType13Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showAioPage, None),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LIDIL_DJ_D1600 : [ # 14
+ (self.showLoadPaperPage, None),
+ (maint.alignType14Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_ALIGN,)),
+ (self.showLBowPage, (lambda: self.pattern,)),
+ (self.endLBowPage, None), # sets values
+ (maint.alignType14Phase2, (lambda: self.dev, lambda: self.values,
+ lambda: self.pattern, lambda: self.dev.pen_config)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showLoadPaperPage, (lambda: True,)),
+ (maint.alignType14Phase3, (lambda: self.dev,)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LEDM : [ # 15
+ (self.showLoadPaperPage, None),
+ (maint.AlignType15Phase1, (lambda : self.dev, lambda: self.showAioPage)),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_LEDM_MANUAL : [ # 16
+ (self.showLoadPaperPage, None),
+ (maint.AlignType15Phase1, (lambda : self.dev, lambda: true)),
+ (self.showAlignmentNumberPage, ('A', 'v', 'kc', 3, 23)),
+ (self.endAlignmentNumberPage, ('A',)),
+ (self.showAlignmentNumberPage, ('B', 'h', 'kc', 3, 17)),
+ (self.endAlignmentNumberPage, ('B',)),
+ (self.showAlignmentNumberPage, ('C', 'v', 'k', 3, 23)),
+ (self.endAlignmentNumberPage, ('C',)),
+ (self.showAlignmentNumberPage, ('D', 'v', 'c', 3, 23)),
+ (self.endAlignmentNumberPage, ('D',)),
+ (self.showAlignmentNumberPage, ('E', 'h', 'k', 3, 11)),
+ (self.endAlignmentNumberPage, ('E',)),
+ (self.showAlignmentNumberPage, ('F', 'h', 'k', 3, 11)),
+ (self.endAlignmentNumberPage, ('F',)),
+ (self.showAlignmentNumberPage, ('G', 'h', 'k', 3, 11)),
+ (self.endAlignmentNumberPage, ('G',)),
+ (self.showAlignmentNumberPage, ('H', 'v', 'k', 3, 11)),
+ (self.endAlignmentNumberPage, ('H',)),
+ (self.showAlignmentNumberPage, ('I', 'v', 'c', 3, 19)),
+ (self.endAlignmentNumberPage, ('I',)),
+ (self.showAlignmentNumberPage, ('J', 'v', 'c', 3, 19)),
+ (self.endAlignmentNumberPage, ('J',)),
+ (maint.AlignType16Phase1, (lambda: self.dev, lambda: self.a, lambda: self.b,
+ lambda: self.c, lambda: self.d, lambda: self.e,
+ lambda: self.f, lambda: self.g, lambda: self.h,
+ lambda: self.i, lambda: self.j)),
+ (self.closeAll, None),
+ (self.close, None),
+ ],
+ ALIGN_TYPE_LEDM_FF_CC_0 : [ # 17
+ (self.showLoadPaperPage, None),
+ (maint.AlignType17Phase1, (lambda : self.dev, lambda: self.showAioPage)),
+ (self.close, None),
+ ],
+ }
+
+ self.setupUi(self)
+ self.initUi()
+
+ QTimer.singleShot(0, self.nextSequence)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ #self.BackButton.clicked.connect(self.BackButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'align-type': (operator.ne, ALIGN_TYPE_NONE)})
+
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support print cartridge alignment found.</b><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def NextButton_clicked(self):
+ self.nextSequence()
+
+
+ def nextSequence(self):
+ while True:
+ try:
+ seq, params = self.seq[self.align_type][self.seq_index]
+ except IndexError:
+ break
+
+ if seq is None:
+ self.seq_index += 1
+ continue
+
+ self.new_page = False
+
+ t = []
+ if params is not None:
+ for p in params:
+ try:
+ t.append(p())
+ except:
+ t.append(p)
+
+ try:
+ log.debug("%s(%s)" % (seq.__name__, ','.join([repr(x) for x in t])))
+ except AttributeError:
+ pass
+
+ try:
+ seq(*t)
+ except Error:
+ CheckDeviceUI(self)
+ break
+
+ self.seq_index += 1
+
+ if self.new_page:
+ break
+
+ if self.abort:
+ self.close()
+
+
+
+ def showStartPage(self):
+# self.BackButton.setEnabled(False)
+ num_devices = self.DeviceComboBox.setDevices()
+
+ if num_devices == 1:
+ self.skipPage()
+ return
+
+ self.DeviceComboBox.updateUi()
+ self.displayPage(PAGE_START)
+
+
+ def endStartPage(self):
+ self.mq = device.queryModelByURI(self.device_uri)
+ self.align_type = self.mq.get('align-type', ALIGN_TYPE_NONE)
+ self.seq_index = -1
+
+ #self.align_type = ALIGN_TYPE_TEST# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+ log.debug("align-type=%d" % self.align_type)
+ self.step_max = self.max_steps[self.align_type]
+
+ try:
+ self.dev = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+
+ def showLoadPaperPage(self, finish=False):
+ if finish:
+ self.LoadPaper.button_name = self.__tr("Finish >")
+ self.LoadPaper.updateUi()
+ self.displayPage(PAGE_LOAD_PAPER)
+
+
+ def endLoadPaperPage(self):
+ pass
+
+
+ def showAlignmentNumberPage(self, line_id, orientation, colors, line_count, choice_count):
+ # line_id: 'A', 'B', etc.
+ # orientation: 'v' or 'h'
+ # colors: 'k' or 'c' or 'kc'
+ # line_count: 2 or 3
+ # choice_count: 5, 7, 9, 11, etc. (odd)
+ self.AlignmentNumberTitle.setText(self.__tr("From the printed Alignment page, Choose the set of lines in group %s where the line segments are <b>best</b> aligned." % line_id))
+ self.AlignmentNumberIcon.setPixmap(load_pixmap('%s-%s-%d' % (orientation, colors, line_count), 'other'))
+ self.AlignmentNumberComboBox.clear()
+
+ for x in range(choice_count):
+ self.AlignmentNumberComboBox.addItem(str("%s%s"% (line_id, x+1)))
+
+ self.displayPage(PAGE_ALIGNMENT_NUMBER)
+ return
+
+
+ def endAlignmentNumberPage(self, line_id):
+ v = int(str(self.AlignmentNumberComboBox.currentText())[1:])
+
+ if line_id == 'A':
+ self.a = v
+ log.debug("A=%d" % v)
+
+ elif line_id == 'B':
+ self.b = v
+ log.debug("B=%d" % v)
+
+ elif line_id == 'C':
+ self.c = v
+ log.debug("C=%d" % v)
+
+ elif line_id == 'D':
+ self.d = v
+ log.debug("D=%d" % v)
+
+ elif line_id == 'E':
+ self.e = v
+ log.debug("E=%d" % v)
+
+ elif line_id == 'F':
+ self.f = v
+ log.debug("F=%d" % v)
+
+ elif line_id == 'G':
+ self.g = v
+ log.debug("G=%d" % v)
+
+ elif line_id == 'H':
+ self.h = v
+ log.debug("H=%d" % v)
+
+ elif line_id == 'I':
+ self.i = v
+ log.debug("I=%d" % v)
+
+ elif line_id == 'J':
+ self.j = v
+ log.debug("J=%d" % v)
+
+ def showPageEdgePage(self, prefix=None, count=13):
+ self.PageEdgeTitle.setText(self.__tr("Choose the <b>numbered arrow</b> that <b>best </b>marks the edge of the paper."))
+ self.PageEdgeIcon.setPixmap(load_pixmap('zca.png', 'other'))
+
+ self.PageEdgeComboBox.clear()
+ for x in range(count):
+ if prefix is None:
+ self.PageEdgeComboBox.addItem(str("%s" % x+1))
+ else:
+ self.PageEdgeComboBox.addItem(str("%s%s" % (prefix, x+1))) # for xBow
+
+ self.displayPage(PAGE_EDGE)
+
+
+ def endPageEdgePage(self):
+ v = int(str(self.PageEdgeComboBox.currentText())[1:])
+ self.zca = v
+ log.debug("ZCA=%d" % v)
+
+
+ def showLBowPage(self, pattern):
+ self.LBowIcon.setPixmap(load_pixmap('align10', 'other'))
+
+ if self.align_type == ALIGN_TYPE_LBOW:
+ pattern = maint.alignType10SetPattern(self.dev)
+
+ elif self.align_type == ALIGN_TYPE_LIDIL_DJ_D1600:
+ pattern = maint.alignType14SetPattern(self.dev)
+
+ else: # ALIGN_TYPE_LIDIL_0_5_4
+ pattern = maint.alignType11SetPattern(self.dev)
+
+ if pattern is None:
+ log.error("Invalid pattern!")
+ # TODO: ...
+
+ self.controls = maint.align10and11and14Controls(pattern, self.align_type)
+ keys = list(self.controls.keys())
+ keys.sort()
+ max_line = 'A'
+ for line in keys:
+ if self.controls[line][0]:
+ max_line = line
+ else:
+ break
+
+ self.LBowTitle.setText(self.__tr("For each row A - %s, select the label representing the box in which in the inner lines are the <b>least</b> visible." % max_line))
+
+ for line in self.controls:
+ if not self.controls[line][0]:
+ eval('self.%sComboBox.setEnabled(False)' % line.lower())
+ else:
+ for x in range(self.controls[line][1]):
+ eval('self.%sComboBox.addItem("%s%d")' % (line.lower(), line, x + 1))
+
+ self.displayPage(PAGE_LBOW)
+
+
+
+ def endLBowPage(self):
+ self.values = []
+ controls = list(self.controls.keys())
+ controls.sort()
+
+ for line in controls:
+ if not self.controls[line][0]:
+ self.values.append(0)
+ else:
+ exec('selected = unicode(self.%sComboBox.currentText())' % line.lower())
+ try:
+ selected = int(selected[1:])
+ except ValueError:
+ selected = 0
+
+ self.values.append(selected)
+
+
+ def showAioPage(self):
+ self.AioIcon.setPixmap(load_pixmap('aio_align', 'other'))
+ self.displayPage(PAGE_AIO)
+
+
+ def endAioPage(self):
+ pass
+
+
+ def showColorAdjustPage(self, line_id, count=21):
+ self.ColorAdjustComboBox.clear()
+ self.ColorAdjustIcon.setPixmap(load_pixmap('color_adj', 'other'))
+ self.ColorAdjustLabel.setText(self.__tr("Line %s:" % line_id))
+
+ for x in range(count):
+ self.ColorAdjustComboBox.addItem(str("%s%s" % (line_id, x+1)))
+
+ self.displayPage(PAGE_COLOR_ADJ)
+
+
+ def endColorAdjustPage(self, line_id):
+ v = int(str(self.ColorAdjustComboBox.currentText())[1:])
+
+ if line_id == 'F':
+ self.f = v
+ log.debug("F=%d" % v)
+
+ elif line_id == 'G':
+ self.g = v
+ log.debug("G=%d" % v)
+
+
+ def showFrontPanelPage(self):
+# self.BackButton.setEnabled(False)
+ self.setAlignButton(BUTTON_FINISH)
+ self.displayPage(PAGE_FRONT_PANEL)
+
+
+ def endFronPanelPage(self):
+ pass
+
+ #
+ # ALIGN-TYPE SPECIFIC
+ #
+
+ def checkType2PenConfig(self):
+ pass
+ # TODO: set abort if problem
+
+
+ def alignType8Phase1(self):
+ self.num_inks = maint.alignType8Phase1(self.dev)
+
+
+ def setXBow(self):
+ # TODO: set abort if invalid pen config
+ self.real_align_type = self.align_type
+ self.align_type = ALIGN_TYPE_XBOW_OFFSET + self.dev.pen_config
+ self.seq_index = -1
+
+
+ def setXBowValues(self):
+ if self.real_align_type == ALIGN_TYPE_LIDIL_0_3_8:
+ maint.alignType4Phase2(self.dev, self.zca, self.b, self.c, self.d, self.e)
+ maint.alignType4Phase3(self.dev)
+
+ elif self.real_align_type == ALIGN_TYPE_LIDIL_0_4_3:
+ maint.alignType5Phase2(self.dev, self.zca, self.b, self.c, self.d, self.e, self.f, self.g)
+ maint.alignType5Phase3(self.dev)
+
+ elif self.real_align_type == ALIGN_TYPE_LIDIL_VIP:
+ maint.alignType7Phase2(self.dev, self.zca, self.b, self.c, self.d, self.e, self.f, self.g)
+ maint.alignType7Phase3(self.dev)
+
+
+ #
+ # Misc
+ #
+
+ def displayPage(self, page):
+ self.updateStepText(self.step)
+ self.step += 1
+ self.new_page = True
+ self.StackedWidget.setCurrentIndex(page)
+
+
+ def skipPage(self):
+ self.step += 1
+ self.new_page = False
+
+
+ def updateStepText(self, p=None):
+ if p is None or not self.step_max:
+ self.StepText.setText(str(""))
+ else:
+ self.StepText.setText(self.__tr("Step %s of %s" % (p, self.step_max)))
+
+
+ def setAlignButton(self, typ=BUTTON_ALIGN):
+ if typ == BUTTON_ALIGN:
+ self.NextButton.setText(self.__tr("Align"))
+ elif typ == BUTTON_NEXT:
+ self.NextButton.setText(self.__tr("Next >"))
+ elif typ == BUTTON_FINISH:
+ self.NextButton.setText(self.__tr("Finish"))
+
+
+ def setPenConfig(self):
+ self.dev.pen_config = status.getPenConfiguration(self.dev.getStatusFromDeviceID())
+
+
+ def closeAll(self):
+ if self.dev is not None:
+ self.dev.close()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("AlignDialog",s,c)
diff --git a/ui5/aligndialog_base.py b/ui5/aligndialog_base.py
new file mode 100644
index 000000000..ca8f689c6
--- /dev/null
+++ b/ui5/aligndialog_base.py
@@ -0,0 +1,385 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/aligndialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 568)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 3)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 5)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 3, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 4, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(191, 29, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 1, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 4, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 4, 1, 1)
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtWidgets.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.StartPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.DeviceComboBox = DeviceUriComboBox(self.StartPage)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout1.addWidget(self.DeviceComboBox, 0, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.StartPage)
+ self.groupBox.setTitle("")
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtWidgets.QLabel(self.groupBox)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout2.addWidget(self.label_2, 0, 0, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 1, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(564, 161, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.LoadPaperPage = QtWidgets.QWidget()
+ self.LoadPaperPage.setObjectName("LoadPaperPage")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.LoadPaperPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.LoadPaperPage)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 181, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem2, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.LoadPaperPage)
+ self.PaperEdgePage = QtWidgets.QWidget()
+ self.PaperEdgePage.setObjectName("PaperEdgePage")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.PaperEdgePage)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.PageEdgeTitle = QtWidgets.QLabel(self.PaperEdgePage)
+ self.PageEdgeTitle.setText("")
+ self.PageEdgeTitle.setObjectName("PageEdgeTitle")
+ self.gridlayout4.addWidget(self.PageEdgeTitle, 0, 0, 1, 4)
+ spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem3, 1, 1, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem4, 2, 0, 1, 1)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.PageEdgeIcon = QtWidgets.QLabel(self.PaperEdgePage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.PageEdgeIcon.sizePolicy().hasHeightForWidth())
+ self.PageEdgeIcon.setSizePolicy(sizePolicy)
+ self.PageEdgeIcon.setMinimumSize(QtCore.QSize(85, 90))
+ self.PageEdgeIcon.setMaximumSize(QtCore.QSize(85, 90))
+ self.PageEdgeIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.PageEdgeIcon.setObjectName("PageEdgeIcon")
+ self.hboxlayout.addWidget(self.PageEdgeIcon)
+ self.PageEdgeComboBox = QtWidgets.QComboBox(self.PaperEdgePage)
+ self.PageEdgeComboBox.setObjectName("PageEdgeComboBox")
+ self.hboxlayout.addWidget(self.PageEdgeComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout, 2, 1, 1, 2)
+ spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem5, 2, 3, 1, 1)
+ spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem6, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.PaperEdgePage)
+ self.AlignmentNumber = QtWidgets.QWidget()
+ self.AlignmentNumber.setObjectName("AlignmentNumber")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.AlignmentNumber)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.AlignmentNumberTitle = QtWidgets.QLabel(self.AlignmentNumber)
+ self.AlignmentNumberTitle.setText("")
+ self.AlignmentNumberTitle.setObjectName("AlignmentNumberTitle")
+ self.gridlayout5.addWidget(self.AlignmentNumberTitle, 0, 0, 1, 4)
+ spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem7, 1, 1, 1, 1)
+ spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem8, 2, 0, 1, 1)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.AlignmentNumberIcon = QtWidgets.QLabel(self.AlignmentNumber)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AlignmentNumberIcon.sizePolicy().hasHeightForWidth())
+ self.AlignmentNumberIcon.setSizePolicy(sizePolicy)
+ self.AlignmentNumberIcon.setMinimumSize(QtCore.QSize(85, 90))
+ self.AlignmentNumberIcon.setMaximumSize(QtCore.QSize(85, 90))
+ self.AlignmentNumberIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.AlignmentNumberIcon.setObjectName("AlignmentNumberIcon")
+ self.hboxlayout1.addWidget(self.AlignmentNumberIcon)
+ self.AlignmentNumberComboBox = QtWidgets.QComboBox(self.AlignmentNumber)
+ self.AlignmentNumberComboBox.setObjectName("AlignmentNumberComboBox")
+ self.hboxlayout1.addWidget(self.AlignmentNumberComboBox)
+ self.gridlayout5.addLayout(self.hboxlayout1, 2, 1, 1, 2)
+ spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem9, 2, 3, 1, 1)
+ spacerItem10 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem10, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.AlignmentNumber)
+ self.ColorAdjPage = QtWidgets.QWidget()
+ self.ColorAdjPage.setObjectName("ColorAdjPage")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.ColorAdjPage)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_12 = QtWidgets.QLabel(self.ColorAdjPage)
+ self.label_12.setWordWrap(True)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout6.addWidget(self.label_12, 0, 0, 1, 5)
+ spacerItem11 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem11, 1, 1, 1, 1)
+ spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem12, 2, 0, 1, 1)
+ self.ColorAdjustIcon = QtWidgets.QLabel(self.ColorAdjPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ColorAdjustIcon.sizePolicy().hasHeightForWidth())
+ self.ColorAdjustIcon.setSizePolicy(sizePolicy)
+ self.ColorAdjustIcon.setMinimumSize(QtCore.QSize(85, 90))
+ self.ColorAdjustIcon.setMaximumSize(QtCore.QSize(85, 90))
+ self.ColorAdjustIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.ColorAdjustIcon.setText("")
+ self.ColorAdjustIcon.setObjectName("ColorAdjustIcon")
+ self.gridlayout6.addWidget(self.ColorAdjustIcon, 2, 1, 1, 1)
+ spacerItem13 = QtWidgets.QSpacerItem(31, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem13, 2, 2, 1, 1)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.ColorAdjustLabel = QtWidgets.QLabel(self.ColorAdjPage)
+ self.ColorAdjustLabel.setObjectName("ColorAdjustLabel")
+ self.hboxlayout2.addWidget(self.ColorAdjustLabel)
+ self.ColorAdjustComboBox = QtWidgets.QComboBox(self.ColorAdjPage)
+ self.ColorAdjustComboBox.setObjectName("ColorAdjustComboBox")
+ self.hboxlayout2.addWidget(self.ColorAdjustComboBox)
+ self.gridlayout6.addLayout(self.hboxlayout2, 2, 3, 1, 1)
+ spacerItem14 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem14, 2, 4, 1, 1)
+ spacerItem15 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem15, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.ColorAdjPage)
+ self.LBowPage = QtWidgets.QWidget()
+ self.LBowPage.setObjectName("LBowPage")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.LBowPage)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.LBowTitle = QtWidgets.QLabel(self.LBowPage)
+ self.LBowTitle.setText("")
+ self.LBowTitle.setWordWrap(True)
+ self.LBowTitle.setObjectName("LBowTitle")
+ self.gridlayout7.addWidget(self.LBowTitle, 0, 0, 1, 5)
+ spacerItem16 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem16, 1, 1, 1, 1)
+ spacerItem17 = QtWidgets.QSpacerItem(41, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem17, 2, 0, 1, 1)
+ self.LBowIcon = QtWidgets.QLabel(self.LBowPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.LBowIcon.sizePolicy().hasHeightForWidth())
+ self.LBowIcon.setSizePolicy(sizePolicy)
+ self.LBowIcon.setMinimumSize(QtCore.QSize(192, 93))
+ self.LBowIcon.setMaximumSize(QtCore.QSize(192, 93))
+ self.LBowIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.LBowIcon.setText("")
+ self.LBowIcon.setObjectName("LBowIcon")
+ self.gridlayout7.addWidget(self.LBowIcon, 2, 1, 1, 1)
+ spacerItem18 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem18, 2, 2, 1, 1)
+ spacerItem19 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem19, 2, 4, 1, 1)
+ spacerItem20 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem20, 3, 1, 1, 1)
+ self.groupBox_2 = QtWidgets.QGroupBox(self.LBowPage)
+ self.groupBox_2.setTitle("")
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.label_4 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_4.setObjectName("label_4")
+ self.hboxlayout3.addWidget(self.label_4)
+ self.aComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.aComboBox.setObjectName("aComboBox")
+ self.hboxlayout3.addWidget(self.aComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout3, 0, 0, 1, 1)
+ self.hboxlayout4 = QtWidgets.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.label_5 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_5.setObjectName("label_5")
+ self.hboxlayout4.addWidget(self.label_5)
+ self.bComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.bComboBox.setObjectName("bComboBox")
+ self.hboxlayout4.addWidget(self.bComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout4, 1, 0, 1, 1)
+ self.hboxlayout5 = QtWidgets.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.label_6 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout5.addWidget(self.label_6)
+ self.cComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.cComboBox.setObjectName("cComboBox")
+ self.hboxlayout5.addWidget(self.cComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout5, 2, 0, 1, 1)
+ self.hboxlayout6 = QtWidgets.QHBoxLayout()
+ self.hboxlayout6.setObjectName("hboxlayout6")
+ self.label_7 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_7.setObjectName("label_7")
+ self.hboxlayout6.addWidget(self.label_7)
+ self.dComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.dComboBox.setObjectName("dComboBox")
+ self.hboxlayout6.addWidget(self.dComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout6, 3, 0, 1, 1)
+ self.hboxlayout7 = QtWidgets.QHBoxLayout()
+ self.hboxlayout7.setObjectName("hboxlayout7")
+ self.label_8 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_8.setObjectName("label_8")
+ self.hboxlayout7.addWidget(self.label_8)
+ self.eComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.eComboBox.setObjectName("eComboBox")
+ self.hboxlayout7.addWidget(self.eComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout7, 4, 0, 1, 1)
+ self.hboxlayout8 = QtWidgets.QHBoxLayout()
+ self.hboxlayout8.setObjectName("hboxlayout8")
+ self.label_9 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_9.setObjectName("label_9")
+ self.hboxlayout8.addWidget(self.label_9)
+ self.fComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.fComboBox.setObjectName("fComboBox")
+ self.hboxlayout8.addWidget(self.fComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout8, 5, 0, 1, 1)
+ self.hboxlayout9 = QtWidgets.QHBoxLayout()
+ self.hboxlayout9.setObjectName("hboxlayout9")
+ self.label_10 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_10.setObjectName("label_10")
+ self.hboxlayout9.addWidget(self.label_10)
+ self.gComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.gComboBox.setObjectName("gComboBox")
+ self.hboxlayout9.addWidget(self.gComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout9, 6, 0, 1, 1)
+ self.hboxlayout10 = QtWidgets.QHBoxLayout()
+ self.hboxlayout10.setObjectName("hboxlayout10")
+ self.label_11 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_11.setObjectName("label_11")
+ self.hboxlayout10.addWidget(self.label_11)
+ self.hComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.hComboBox.setObjectName("hComboBox")
+ self.hboxlayout10.addWidget(self.hComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout10, 7, 0, 1, 1)
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label_14 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_14.setObjectName("label_14")
+ self.horizontalLayout.addWidget(self.label_14)
+ self.iComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.iComboBox.setObjectName("iComboBox")
+ self.horizontalLayout.addWidget(self.iComboBox)
+ self.gridlayout8.addLayout(self.horizontalLayout, 8, 0, 1, 1)
+ self.gridlayout7.addWidget(self.groupBox_2, 1, 3, 3, 1)
+ self.StackedWidget.addWidget(self.LBowPage)
+ self.AioPage = QtWidgets.QWidget()
+ self.AioPage.setObjectName("AioPage")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.AioPage)
+ self.gridlayout9.setObjectName("gridlayout9")
+ spacerItem21 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem21, 0, 1, 1, 1)
+ spacerItem22 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem22, 1, 0, 1, 1)
+ self.AioIcon = QtWidgets.QLabel(self.AioPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AioIcon.sizePolicy().hasHeightForWidth())
+ self.AioIcon.setSizePolicy(sizePolicy)
+ self.AioIcon.setMinimumSize(QtCore.QSize(92, 120))
+ self.AioIcon.setMaximumSize(QtCore.QSize(92, 120))
+ self.AioIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.AioIcon.setText("")
+ self.AioIcon.setObjectName("AioIcon")
+ self.gridlayout9.addWidget(self.AioIcon, 1, 1, 1, 1)
+ spacerItem23 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem23, 1, 2, 1, 1)
+ self.label_3 = QtWidgets.QLabel(self.AioPage)
+ self.label_3.setWordWrap(True)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout9.addWidget(self.label_3, 1, 3, 1, 1)
+ spacerItem24 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem24, 2, 1, 1, 1)
+ self.StackedWidget.addWidget(self.AioPage)
+ self.FrontPanelPage = QtWidgets.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.FrontPanelPage)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_13 = QtWidgets.QLabel(self.FrontPanelPage)
+ self.label_13.setTextFormat(QtCore.Qt.RichText)
+ self.label_13.setWordWrap(True)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout10.addWidget(self.label_13, 0, 0, 1, 1)
+ spacerItem25 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout10.addItem(spacerItem25, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.FrontPanelPage)
+ self.gridlayout.addWidget(self.StackedWidget, 2, 0, 1, 5)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(5)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Align Print Cartridges"))
+ self.label.setText(_translate("Dialog", "Align Print Cartridges"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+ self.label_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Select the device to align and click <span style=\" font-style:italic;\">Next &gt;</span> to continue.</p></body></html>"))
+ self.label_12.setText(_translate("Dialog", "Choose the numbered colored box that the color <b>best </b>matches the background color of the bar."))
+ self.ColorAdjustLabel.setText(_translate("Dialog", "Line %1:"))
+ self.label_4.setText(_translate("Dialog", "Row A:"))
+ self.label_5.setText(_translate("Dialog", "Row B:"))
+ self.label_6.setText(_translate("Dialog", "Row C:"))
+ self.label_7.setText(_translate("Dialog", "Row D:"))
+ self.label_8.setText(_translate("Dialog", "Row E:"))
+ self.label_9.setText(_translate("Dialog", "Row F:"))
+ self.label_10.setText(_translate("Dialog", "Row G:"))
+ self.label_11.setText(_translate("Dialog", "Row H:"))
+ self.label_14.setText(_translate("Dialog", "Row I:"))
+ self.label_3.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Follow these steps to complete the alignment:</span> </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">1.</span> Place the alignment page, with the printed side facing down, on the scanner. </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">2.</span> Press the <span style=\" font-style:italic;\">Enter</span> or <span style=\" font-style:italic;\">Scan</span> button on the printer. </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">3.</span> \"Alignment Complete\" will be displayed when the process is finished (on some models with a front panel display) or the green light that was blinking during the process will stop blinking and remain green (on some models without a front panel display).</p></body></html>"))
+ self.label_13.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Cartridge alignment on this printer is only available by accessing the front panel of the printer. </span>Please refer to the user guide for the printer for more information. Click <span style=\" font-style:italic;\">Finish</span> to exit.</p></body></html>"))
+
+from .deviceuricombobox import DeviceUriComboBox
+from .loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui5/aligndialog_base.ui b/ui5/aligndialog_base.ui
new file mode 100644
index 000000000..0b575c5c0
--- /dev/null
+++ b/ui5/aligndialog_base.ui
@@ -0,0 +1,850 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>568</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HP Device Manager - Align Print Cartridges</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Align Print Cartridges</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="5">
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="StepText">
+ <property name="text">
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>191</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="3">
+ <widget class="QPushButton" name="NextButton">
+ <property name="text">
+ <string>Next &gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="4">
+ <widget class="QPushButton" name="CancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="5">
+ <widget class="QStackedWidget" name="StackedWidget">
+ <property name="currentIndex">
+ <number>5</number>
+ </property>
+ <widget class="QWidget" name="StartPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="DeviceUriComboBox" name="DeviceComboBox"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Select the device to align and click &lt;span style=&quot; font-style:italic;&quot;&gt;Next &amp;gt;&lt;/span&gt; to continue.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>564</width>
+ <height>161</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="LoadPaperPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="LoadPaperGroupBox" name="LoadPaper">
+ <property name="title">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>181</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="PaperEdgePage">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="4">
+ <widget class="QLabel" name="PageEdgeTitle">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="PageEdgeIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="PageEdgeComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="3">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="AlignmentNumber">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="4">
+ <widget class="QLabel" name="AlignmentNumberTitle">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="AlignmentNumberIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="AlignmentNumberComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="3">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="ColorAdjPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="5">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>Choose the numbered colored box that the color &lt;b&gt;best &lt;/b&gt;matches the background color of the bar.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="ColorAdjustIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="3">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="ColorAdjustLabel">
+ <property name="text">
+ <string>Line %1:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="ColorAdjustComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="4">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="LBowPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="5">
+ <widget class="QLabel" name="LBowTitle">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>41</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="LBowIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>192</width>
+ <height>93</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>192</width>
+ <height>93</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="4">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="3" rowspan="3">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Row A:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="aComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Row B:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="bComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Row C:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="cComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Row D:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="dComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Row E:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="eComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Row F:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="fComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="6" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Row G:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="gComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="7" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Row H:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="hComboBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="8" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Row I:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="iComboBox"/>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="AioPage">
+ <layout class="QGridLayout">
+ <item row="0" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="AioIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>92</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>92</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Follow these steps to complete the alignment:&lt;/span&gt; &lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;1.&lt;/span&gt; Place the alignment page, with the printed side facing down, on the scanner. &lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;2.&lt;/span&gt; Press the &lt;span style=&quot; font-style:italic;&quot;&gt;Enter&lt;/span&gt; or &lt;span style=&quot; font-style:italic;&quot;&gt;Scan&lt;/span&gt; button on the printer. &lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;3.&lt;/span&gt; &quot;Alignment Complete&quot; will be displayed when the process is finished (on some models with a front panel display) or the green light that was blinking during the process will stop blinking and remain green (on some models without a front panel display).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="FrontPanelPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Cartridge alignment on this printer is only available by accessing the front panel of the printer. &lt;/span&gt;Please refer to the user guide for the printer for more information. Click &lt;span style=&quot; font-style:italic;&quot;&gt;Finish&lt;/span&gt; to exit.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/cleandialog.py b/ui5/cleandialog.py
new file mode 100644
index 000000000..ef8d9a7ce
--- /dev/null
+++ b/ui5/cleandialog.py
@@ -0,0 +1,395 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, maint
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .cleandialog_base import Ui_Dialog
+
+
+CLEAN_TYPE_INITIAL = 1000
+CLEAN_TYPE_TEST = 1001
+
+PAGE_START = 0
+PAGE_LEVEL_1 = 1
+PAGE_LEVEL_2 = 2
+PAGE_LEVEL_3 = 3
+PAGE_FRONT_PANEL = 4
+
+BUTTON_CLEAN = 0
+BUTTON_NEXT = 1
+BUTTON_FINISH = 2
+
+LEDM_CLEAN_VERIFY_PAGE_JOB=b"<ipdyn:JobType>cleaningVerificationPage</ipdyn:JobType>"
+
+
+#d = None
+def true():
+ return True
+
+
+
+class CleanDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.clean_type = CLEAN_TYPE_INITIAL
+ self.abort = False
+ self.seq_index = 0
+ self.step = 1
+ self.step_max = 0
+
+ self.max_steps = {
+ CLEAN_TYPE_UNSUPPORTED : 1,
+ CLEAN_TYPE_PCL : 4,
+ CLEAN_TYPE_LIDIL : 4,
+ CLEAN_TYPE_PCL_WITH_PRINTOUT : 4,
+ CLEAN_TYPE_LEDM : 4,
+ }
+
+ self.seq = { # (func|method, tuple of params|None)
+ CLEAN_TYPE_INITIAL: [ # (used when starting up and clean-type isn't known)
+ (self.showStartPage, None),
+ (self.endStartPage, None), # switch to a valid clean-type here
+ ],
+
+ CLEAN_TYPE_UNSUPPORTED : [
+ (self.showFrontPanelPage, None),
+ (self.endFrontPanelPage, None),
+ (self.close, None),
+ ],
+
+ CLEAN_TYPE_PCL : [ # 1
+ (self.showLevel1Page, None),
+ (self.endLevel1Page, None),
+ (self.doClean, (1,)),
+ (self.showLevel2Page, None),
+ (self.endLevel2Page, None),
+ (self.doClean, (2,)),
+ (self.showLevel3Page, None),
+ (self.endLevel3Page, None),
+ (self.doClean, (3,)),
+ (self.close, None),
+ ],
+
+ CLEAN_TYPE_LIDIL : [ # 2
+ (self.showLevel1Page, None),
+ (self.endLevel1Page, None),
+ (self.doClean, (1,)),
+ (self.showLevel2Page, None),
+ (self.endLevel2Page, None),
+ (self.doClean, (2,)),
+ (self.showLevel3Page, None),
+ (self.endLevel3Page, None),
+ (self.doClean, (3,)),
+ (self.close, None),
+ ],
+
+ CLEAN_TYPE_PCL_WITH_PRINTOUT : [ # 3
+ (self.showLevel1Page, None),
+ (self.endLevel1Page, None),
+ (self.doClean, (1,)),
+ (self.showLevel2Page, None),
+ (self.endLevel2Page, None),
+ (self.doClean, (2,)),
+ (self.showLevel3Page, None),
+ (self.endLevel3Page, None),
+ (self.doClean, (3,)),
+ # TODO: Add print-out
+ (self.close, None),
+ ],
+
+ CLEAN_TYPE_LEDM : [ # 4
+ (self.showLevel1Page, None),
+ (self.endLevel1Page, None),
+ (self.doClean, (1,)),
+ (self.showLevel2Page, None),
+ (self.endLevel2Page, None),
+ (self.doClean, (2,)),
+ (self.showLevel3Page, None),
+ (self.endLevel3Page, None),
+ (self.doClean, (3,)),
+ # TODO: Add print-out
+ (self.close, None),
+ ],
+ }
+
+
+ self.initUi()
+ QTimer.singleShot(0, self.nextSequence)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'clean-type': (operator.ne, CLEAN_TYPE_NONE)})
+
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def NextButton_clicked(self):
+ self.nextSequence()
+
+
+ def nextSequence(self):
+ while True:
+ try:
+ seq, params = self.seq[self.clean_type][self.seq_index]
+ except IndexError:
+ break
+
+ if seq is None:
+ self.seq_index += 1
+ continue
+
+ self.new_page = False
+
+ t = []
+ if params is not None:
+ for p in params:
+ try:
+ t.append(p())
+ except:
+ t.append(p)
+
+ try:
+ log.debug("%s(%s)" % (seq.__name__, ','.join([repr(x) for x in t])))
+ except AttributeError:
+ pass
+
+ try:
+ seq(*t)
+ except Error:
+ CheckDeviceUI(self)
+ break
+
+ self.seq_index += 1
+
+ if self.new_page:
+ break
+
+ if self.abort:
+ self.close()
+
+
+ def showStartPage(self):
+ self.setCleanButton(BUTTON_NEXT)
+ num_devices = self.DeviceComboBox.setDevices()
+
+ if num_devices == 1:
+ self.skipPage()
+ return
+
+ self.DeviceComboBox.updateUi()
+ self.displayPage(PAGE_START)
+
+
+ def endStartPage(self):
+ self.mq = device.queryModelByURI(self.device_uri)
+ self.clean_type = self.mq.get('clean-type', CLEAN_TYPE_NONE)
+ self.seq_index = -1
+
+ log.debug("clean-type=%d" % self.clean_type)
+ self.step_max = self.max_steps[self.clean_type]
+
+ try:
+ self.dev = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+
+ def showLevel1Page(self):
+ self.setCleanButton(BUTTON_CLEAN)
+ self.displayPage(PAGE_LEVEL_1)
+
+
+ def endLevel1Page(self):
+ pass
+
+
+ def showLevel2Page(self):
+ self.displayPage(PAGE_LEVEL_2)
+
+
+ def endLevel2Page(self):
+ pass
+
+
+ def showLevel3Page(self):
+ self.displayPage(PAGE_LEVEL_3)
+
+
+ def endLevel3Page(self):
+ pass
+
+
+ def showFrontPanelPage(self):
+ self.setCleanButton(BUTTON_FINISH)
+ self.displayPage(PAGE_FRONT_PANEL)
+
+
+ def endFrontPanelPage(self):
+ pass
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support printhead cleaning found.</b><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def doClean(self, level):
+ try:
+ try:
+ self.dev.open()
+ except Error:
+ CheckDeviceUI(self)
+ else:
+ if self.dev.isIdleAndNoError():
+ if self.clean_type in (CLEAN_TYPE_PCL, # 1
+ CLEAN_TYPE_PCL_WITH_PRINTOUT): # 3
+
+ if level == 1:
+ maint.cleanType1(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+ elif level == 2:
+ maint.primeType1(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+ else: # 3
+ maint.wipeAndSpitType1(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+
+ elif self.clean_type == CLEAN_TYPE_LIDIL: # 2
+ if level == 1:
+ maint.cleanType2(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+ elif level == 2:
+ maint.primeType2(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+ else: # 3
+ maint.wipeAndSpitType2(self.dev)
+ maint.print_clean_test_page(self.dev)
+
+ elif self.clean_type == CLEAN_TYPE_LEDM: # 4
+ IPCap_data = maint.getCleanLedmCapacity(self.dev)
+ print_verification_page = True
+ if LEDM_CLEAN_VERIFY_PAGE_JOB not in IPCap_data:
+ print_verification_page = False
+
+ if level == 1:
+ maint.cleanTypeLedm(self.dev)
+ maint.cleanTypeVerify(self.dev,level, print_verification_page)
+ if print_verification_page is False:
+ self.setCustomMessage(self.Prompt_5,"Cleaning level 1 is Completed. \nPress \"Cancel\" to Finish. Press \"Clean\" for next level clean")
+
+ elif level == 2:
+ maint.cleanTypeLedm1(self.dev)
+ maint.cleanTypeVerify(self.dev,level, print_verification_page)
+ if print_verification_page is False:
+ self.setCustomMessage(self.Prompt_6,"Cleaning level 2 is Completed. \nPress \"Cancel\" to Finish. Press \"Clean\" for next level clean")
+
+ else: # 3
+ maint.cleanTypeLedm2(self.dev)
+ maint.cleanTypeVerify(self.dev,level, print_verification_page)
+
+ else:
+ CheckDeviceUI(self)
+
+ finally:
+ if self.dev is not None:
+ self.dev.close()
+
+
+ #
+ # Misc
+ #
+
+ def displayPage(self, page):
+ self.updateStepText(self.step)
+ self.step += 1
+ self.new_page = True
+ self.StackedWidget.setCurrentIndex(page)
+
+
+ def skipPage(self):
+ self.step += 1
+ self.new_page = False
+
+
+ def updateStepText(self, p=None):
+ if p is None or not self.step_max:
+ self.StepText.setText(str(""))
+ else:
+ self.StepText.setText(self.__tr("Step %s of %s" % (p, self.step_max)))
+
+
+ def setCleanButton(self, typ=BUTTON_CLEAN):
+ if typ == BUTTON_CLEAN:
+ self.NextButton.setText(self.__tr("Clean"))
+ elif typ == BUTTON_NEXT:
+ self.NextButton.setText(self.__tr("Next >"))
+ elif typ == BUTTON_FINISH:
+ self.NextButton.setText(self.__tr("Finish"))
+
+
+ def setCustomMessage(self, button, message):
+ button.setText(self.__tr(message))
+
+ def __tr(self,s,c = None):
+ return qApp.translate("CleanDialog",s,c)
+
+
diff --git a/ui5/cleandialog_base.py b/ui5/cleandialog_base.py
new file mode 100644
index 000000000..71cd75472
--- /dev/null
+++ b/ui5/cleandialog_base.py
@@ -0,0 +1,176 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/cleandialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 2)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 4)
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtWidgets.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.StartPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.DeviceComboBox = DeviceUriComboBox(self.StartPage)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout1.addWidget(self.DeviceComboBox, 0, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.StartPage)
+ self.groupBox.setTitle("")
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.Prompt = QtWidgets.QLabel(self.groupBox)
+ self.Prompt.setObjectName("Prompt")
+ self.gridlayout2.addWidget(self.Prompt, 0, 0, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 1, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.Level1Page = QtWidgets.QWidget()
+ self.Level1Page.setObjectName("Level1Page")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.Level1Page)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.Level1Page)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ self.groupBox_2 = QtWidgets.QGroupBox(self.Level1Page)
+ self.groupBox_2.setTitle("")
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.Prompt_2 = QtWidgets.QLabel(self.groupBox_2)
+ self.Prompt_2.setWordWrap(True)
+ self.Prompt_2.setObjectName("Prompt_2")
+ self.gridlayout4.addWidget(self.Prompt_2, 0, 0, 1, 1)
+ self.gridlayout3.addWidget(self.groupBox_2, 1, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem1, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level1Page)
+ self.Level2Page = QtWidgets.QWidget()
+ self.Level2Page.setObjectName("Level2Page")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.Level2Page)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.LoadPaper_2 = LoadPaperGroupBox(self.Level2Page)
+ self.LoadPaper_2.setTitle("")
+ self.LoadPaper_2.setObjectName("LoadPaper_2")
+ self.gridlayout5.addWidget(self.LoadPaper_2, 0, 0, 1, 1)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.Level2Page)
+ self.groupBox_3.setTitle("")
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.Prompt_5 = QtWidgets.QLabel(self.groupBox_3)
+ self.Prompt_5.setWordWrap(True)
+ self.Prompt_5.setObjectName("Prompt_5")
+ self.gridlayout6.addWidget(self.Prompt_5, 0, 0, 1, 1)
+ self.gridlayout5.addWidget(self.groupBox_3, 1, 0, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 91, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem2, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level2Page)
+ self.Level3Page = QtWidgets.QWidget()
+ self.Level3Page.setObjectName("Level3Page")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.Level3Page)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.LoadPaper_3 = LoadPaperGroupBox(self.Level3Page)
+ self.LoadPaper_3.setTitle("")
+ self.LoadPaper_3.setObjectName("LoadPaper_3")
+ self.gridlayout7.addWidget(self.LoadPaper_3, 0, 0, 1, 1)
+ self.groupBox_4 = QtWidgets.QGroupBox(self.Level3Page)
+ self.groupBox_4.setTitle("")
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_4)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.Prompt_6 = QtWidgets.QLabel(self.groupBox_4)
+ self.Prompt_6.setWordWrap(True)
+ self.Prompt_6.setObjectName("Prompt_6")
+ self.gridlayout8.addWidget(self.Prompt_6, 0, 0, 1, 1)
+ self.gridlayout7.addWidget(self.groupBox_4, 1, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem3, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level3Page)
+ self.FrontPanelPage = QtWidgets.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.FrontPanelPage)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_2 = QtWidgets.QLabel(self.FrontPanelPage)
+ self.label_2.setTextFormat(QtCore.Qt.RichText)
+ self.label_2.setWordWrap(True)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout9.addWidget(self.label_2, 0, 0, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem4, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.FrontPanelPage)
+ self.gridlayout.addWidget(self.StackedWidget, 2, 0, 1, 4)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 4, 0, 1, 4)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 5, 0, 1, 1)
+ spacerItem5 = QtWidgets.QSpacerItem(351, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem5, 5, 1, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 5, 2, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 3, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Clean Printheads"))
+ self.label.setText(_translate("Dialog", "Clean Print Printheads"))
+ self.Prompt.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Click<span style=\" font-style:italic;\"> Next</span> to begin the cleaning process.</p></body></html>"))
+ self.Prompt_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Click <span style=\" font-style:italic;\">Clean</span> to begin the level 1 cleaning process.</p></body></html>"))
+ self.Prompt_5.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Cleaning level 1 is done after the page being printed is complete.</span> If the printed output from level 1 cleaning is acceptable, then click <span style=\" font-style:italic;\">Cancel</span> to exit. Otherwise, click <span style=\" font-style:italic;\">Clean</span> again to begin the level 2 cleaning process.</p></body></html>"))
+ self.Prompt_6.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Cleaning level 2 is done after the page being printed is complete.</span> If the printed output from level 2 cleaning is acceptable, then click <span style=\" font-style:italic;\">Cancel</span> to exit. Otherwise, click <span style=\" font-style:italic;\">Clean</span> again to begin the level 3 cleaning process. </p></body></html>"))
+ self.label_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Cartridge cleaning on this printer is only available by accessing the front panel of the printer. </span>Please refer to the user guide for the printer for more information. Click <span style=\" font-style:italic;\">Finish</span> to exit.</p></body></html>"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
+from .loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui5/cleandialog_base.ui b/ui5/cleandialog_base.ui
new file mode 100644
index 000000000..e47f57937
--- /dev/null
+++ b/ui5/cleandialog_base.ui
@@ -0,0 +1,313 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Clean Printheads</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Clean Print Printheads</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="4" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="StartPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="Prompt" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click&lt;span style=" font-style:italic;"> Next&lt;/span> to begin the cleaning process.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Level1Page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="Prompt_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click &lt;span style=" font-style:italic;">Clean&lt;/span> to begin the level 1 cleaning process.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Level2Page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper_2" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="Prompt_5" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Cleaning level 1 is done after the page being printed is complete.&lt;/span> If the printed output from level 1 cleaning is acceptable, then click &lt;span style=" font-style:italic;">Cancel&lt;/span> to exit. Otherwise, click &lt;span style=" font-style:italic;">Clean&lt;/span> again to begin the level 2 cleaning process.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>91</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Level3Page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper_3" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="groupBox_4" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="Prompt_6" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Cleaning level 2 is done after the page being printed is complete.&lt;/span> If the printed output from level 2 cleaning is acceptable, then click &lt;span style=" font-style:italic;">Cancel&lt;/span> to exit. Otherwise, click &lt;span style=" font-style:italic;">Clean&lt;/span> again to begin the level 3 cleaning process. &lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>71</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="FrontPanelPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Cartridge cleaning on this printer is only available by accessing the front panel of the printer. &lt;/span>Please refer to the user guide for the printer for more information. Click &lt;span style=" font-style:italic;">Finish&lt;/span> to exit.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="4" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>351</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="3" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/colorcaldialog.py b/ui5/colorcaldialog.py
new file mode 100644
index 000000000..f2666e64f
--- /dev/null
+++ b/ui5/colorcaldialog.py
@@ -0,0 +1,438 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, maint
+from prnt import cups
+from base.codes import *
+from base.sixext import to_unicode
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .colorcaldialog_base import Ui_Dialog
+
+
+COLOR_CAL_TYPE_INITIAL = 1000
+COLOR_CAL_TYPE_TEST = 1001
+
+PAGE_START = 0
+PAGE_LOAD_PAPER = 1
+PAGE_DESKJET_450 = 2
+PAGE_CRICK = 3
+PAGE_LBOW = 4
+PAGE_CONNERY = 5
+PAGE_FRONT_PANEL = 6
+
+
+BUTTON_CALIBRATE = 0
+BUTTON_NEXT = 1
+BUTTON_FINISH = 2
+
+
+def true():
+ return True
+
+
+class ColorCalDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.color_cal_type = COLOR_CAL_TYPE_INITIAL
+ self.a, self.b = 0, 0
+ self.step = 1
+ self.abort = False
+ self.seq_index = 0
+ self.value = 0
+ self.values = []
+ self.step_max = 0
+
+ self.max_steps = {
+ COLOR_CAL_TYPE_UNSUPPORTED : 1,
+ COLOR_CAL_TYPE_DESKJET_450 : 2,
+ COLOR_CAL_TYPE_MALIBU_CRICK : 0,
+ COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADO : 0,
+ COLOR_CAL_TYPE_CONNERY : 0,
+ COLOR_CAL_TYPE_COUSTEAU : 0,
+ COLOR_CAL_TYPE_CARRIER : 0,
+ COLOR_CAL_TYPE_TYPHOON : 0,
+ }
+
+ self.seq = { # (func|method, tuple of params|None)
+ COLOR_CAL_TYPE_INITIAL: [ # (used when starting up and align-type isn't known)
+ (self.showStartPage, None),
+ (self.endStartPage, None), # switch to a valid align-type here
+ ],
+
+ COLOR_CAL_TYPE_UNSUPPORTED : [
+ (self.showFrontPanelPage, None),
+ (self.endFrontPanelPage, None),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_DESKJET_450 : [ # 1
+ (self.colorCalType1PenCheck, None),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType1Phase1, (lambda: self.dev,)),
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showDeskjet450Page, None),
+ (self.endDeskjet450Page, None),
+ (maint.colorCalType1Phase2, (lambda: self.dev, lambda: self.value)),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_MALIBU_CRICK : [ # 2
+ (self.colorCalType2PenCheck, None),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType1Phase1, (lambda: self.dev,)),
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showCrick, None),
+ (self.endCrick, None),
+ (maint.colorCalType2Phase2, (lambda: self.dev, lambda: self.value)),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADO : [ # 3
+ (self.colorCalType3PenCheck, None),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType3Phase1, (lambda: self.dev,)),
+ (self.showLBowPage, ('A', 21)),
+ (self.endLBowPage, ('A',)),
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showLBowPage, ('B', 21)),
+ (self.endLBowPage, ('B',)),
+ (maint.colorCalType3Phase2, (lambda: self.dev, lambda: self.a,
+ lambda: self.b)),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_CONNERY : [ #4
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType4Phase1, (lambda: self.dev,)),
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showConneryPage, None),
+ (self.endConneryPage, None), # sets self.values (list)
+ (maint.colorCalType4Phase2, (lambda: self.dev, lambda: self.values)),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType4Phase3, (lambda: self.dev,)),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_COUSTEAU : [ #5
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType5, (lambda: self.dev, lambda: true)),
+ (self.showConneryPage, None),
+ (self.endConneryPage, None),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_CARRIER : [ #6
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType6, (lambda: self.dev, lambda: true)),
+ (self.close, None),
+ ],
+
+ COLOR_CAL_TYPE_TYPHOON : [ #7
+ (self.setColorCalButton, (BUTTON_CALIBRATE,)),
+ (self.showLoadPaperPage, None),
+ (self.endLoadPaperPage, None),
+ (maint.colorCalType7, (lambda: self.dev, lambda: true)),
+ (self.close, None),
+ ],
+ }
+
+
+ self.initUi()
+
+ QTimer.singleShot(0, self.nextSequence)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'color-cal-type': (operator.gt, 0)})
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+ self.updateStepText()
+
+
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support print cartridge alignment found.</b><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def NextButton_clicked(self):
+ self.nextSequence()
+
+
+ def nextSequence(self):
+ while True:
+ try:
+ seq, params = self.seq[self.color_cal_type][self.seq_index]
+ except IndexError:
+ break
+
+ if seq is None:
+ self.seq_index += 1
+ continue
+
+ self.new_page = False
+
+ t = []
+ if params is not None:
+ for p in params:
+ try:
+ t.append(p())
+ except:
+ t.append(p)
+
+ try:
+ log.debug("%s(%s)" % (seq.__name__, ','.join([repr(x) for x in t])))
+ except AttributeError:
+ pass
+
+ try:
+ seq(*t)
+ except Error:
+ CheckDeviceUI(self)
+ break
+
+ self.seq_index += 1
+
+ if self.new_page:
+ break
+
+ if self.abort:
+ self.close()
+
+
+
+ def showStartPage(self):
+ self.BackButton.setEnabled(False)
+ num_devices = self.DeviceComboBox.setDevices()
+
+ if num_devices == 1:
+ self.skipPage()
+ return
+
+ self.DeviceComboBox.updateUi()
+ self.displayPage(PAGE_START)
+
+
+ def endStartPage(self):
+ self.mq = device.queryModelByURI(self.device_uri)
+ self.color_cal_type = self.mq.get('color-cal-type', COLOR_CAL_TYPE_NONE)
+ self.seq_index = -1
+
+ #self.color_cal_type = COLOR_CAL_TYPE_TEST # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+ log.debug("color-cal-type=%d" % self.color_cal_type)
+ self.step_max = self.max_steps[self.color_cal_type]
+
+ try:
+ self.dev = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+
+ def showLoadPaperPage(self):
+ self.LoadPaper.updateUi()
+ self.displayPage(PAGE_LOAD_PAPER)
+
+
+ def endLoadPaperPage(self):
+ pass
+
+
+ def showDeskjet450Page(self):
+ self.displayPage(PAGE_DESKJET_450)
+
+
+ def endDeskjet450Page(self):
+ self.value = int(to_unicode(self.Deskjet450ComboBox.currentText()))
+
+
+ def showCrick(self):
+ self.displayPage(PAGE_CRICK)
+
+
+ def endCrick(self):
+ self.value = self.CrickSpinBox.value()
+
+ def showLBowPage(self, line_id, count=21):
+ self.LBowComboBox.clear()
+ self.LBowIcon.setPixmap(load_pixmap('color_adj', 'other'))
+ self.LBowLabel.setText(self.__tr("Line %s:"%line_id))
+
+ for x in range(count):
+ self.LBowComboBox.addItem(str("%s%s"%(line_id, x+1)))
+
+ self.displayPage(PAGE_LBOW)
+
+
+ def endLBowPage(self, line_id):
+ v = int(str(self.LBowComboBox.currentText())[1:])
+
+ if line_id == 'A':
+ self.a = v
+ log.debug("A=%d" % v)
+
+ elif line_id == 'B':
+ self.b = v
+ log.debug("B=%d" % v)
+
+
+ def showConneryPage(self):
+ self.ConneryGrayPatchIcon.setPixmap(load_pixmap('type4_gray_patch', 'other'))
+ self.ConneryColorPatchIcon.setPixmap(load_pixmap('type4_color_patch', 'other'))
+
+ for x in 'ABCDEFGHIJKLMN':
+ self.ConneryGrayLetterComboBox.addItem(str(x))
+
+ for x in range(13):
+ self.ConneryGrayNumberComboBox.addItem(str("%s"%x+1))
+
+ for x in 'PQRSTUV':
+ self.ConneryColorLetterComboBox.addItem(str(x))
+
+ for x in range(6):
+ self.ConneryColorNumberComboBox.addItem(str("%s"%x+1))
+
+ self.displayPage(PAGE_CONNERY)
+
+
+ def endConneryPage(self):
+ if self.ConneryUseFactoryDefaultsCheckBox.checkState() == Qt.Checked:
+ log.debug("Using factory defaults")
+ self.values = [-1, -1, -1, -1]
+ else:
+ self.values = [
+ (ord(str(self.ConneryGrayLetterComboBox.currentText())) - ord('A')),
+ int(str(self.ConneryGrayNumberComboBox.currentText())),
+ (ord(str(self.ConneryColorLetterComboBox.currentText())) - ord('P')),
+ int(str(self.ConneryColorNumberComboBox.currentText()))
+ ]
+
+
+ def showFrontPanelPage(self):
+ self.BackButton.setEnabled(False)
+ self.setColorCalButton(BUTTON_FINISH)
+ self.displayPage(PAGE_FRONT_PANEL)
+
+
+ def endFrontPanelPage(self):
+ pass
+
+ #
+ # Color cal specific
+ #
+
+ def colorCalType1PenCheck(self):
+ if not maint.colorCalType1PenCheck(self.dev):
+ pass # TODO: Error message (photo pen must be inserted)
+
+
+ def colorCalType2PenCheck(self):
+ if not maint.colorCalType2PenCheck(self.dev):
+ pass # TODO: Error message (photo pen must be inserted)
+
+
+ def colorCalType3PenCheck(self):
+ if not maint.colorCalType3PenCheck(self.dev):
+ pass # TODO:
+
+ #
+ # Misc
+ #
+
+ def displayPage(self, page):
+ self.updateStepText(self.step)
+ self.step += 1
+ self.new_page = True
+ self.StackedWidget.setCurrentIndex(page)
+
+
+ def skipPage(self):
+ self.step += 1
+ self.new_page = False
+
+
+ def updateStepText(self, p=None):
+ if p is None or not self.step_max:
+ self.StepText.setText(str(""))
+ else:
+ self.StepText.setText(self.__tr("Step %s of %s"%(p,self.step_max)))
+
+
+ def setColorCalButton(self, typ=BUTTON_CALIBRATE):
+ if typ == BUTTON_CALIBRATE:
+ self.NextButton.setText(self.__tr("Calibrate"))
+ elif typ == BUTTON_NEXT:
+ self.NextButton.setText(self.__tr("Next >"))
+ elif typ == BUTTON_FINISH:
+ self.NextButton.setText(self.__tr("Finish"))
+
+
+# def setPenConfig(self):
+# self.dev.pen_config = status.getPenConfiguration(dev.getStatusFromDeviceID())
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ColorCalDialog",s,c)
+
+
diff --git a/ui5/colorcaldialog_base.py b/ui5/colorcaldialog_base.py
new file mode 100644
index 000000000..a846df97f
--- /dev/null
+++ b/ui5/colorcaldialog_base.py
@@ -0,0 +1,332 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/colorcaldialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 3)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 5)
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtWidgets.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.StartPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.DeviceComboBox = DeviceUriComboBox(self.StartPage)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout1.addWidget(self.DeviceComboBox, 0, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.StartPage)
+ self.groupBox.setTitle("")
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtWidgets.QLabel(self.groupBox)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout2.addWidget(self.label_2, 0, 0, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 1, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.LoadPaperPage = QtWidgets.QWidget()
+ self.LoadPaperPage.setObjectName("LoadPaperPage")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.LoadPaperPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.LoadPaperPage)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 181, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem1, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.LoadPaperPage)
+ self.Deskjet450Page = QtWidgets.QWidget()
+ self.Deskjet450Page.setObjectName("Deskjet450Page")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.Deskjet450Page)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.label_3 = QtWidgets.QLabel(self.Deskjet450Page)
+ self.label_3.setWordWrap(True)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout4.addWidget(self.label_3, 0, 0, 1, 3)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem2, 1, 1, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(111, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem3, 2, 0, 1, 1)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label_4 = QtWidgets.QLabel(self.Deskjet450Page)
+ self.label_4.setObjectName("label_4")
+ self.hboxlayout.addWidget(self.label_4)
+ self.Deskjet450ComboBox = QtWidgets.QComboBox(self.Deskjet450Page)
+ self.Deskjet450ComboBox.setObjectName("Deskjet450ComboBox")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.Deskjet450ComboBox.addItem("")
+ self.hboxlayout.addWidget(self.Deskjet450ComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout, 2, 1, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(221, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem4, 2, 2, 1, 1)
+ spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem5, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.Deskjet450Page)
+ self.CrickPage = QtWidgets.QWidget()
+ self.CrickPage.setObjectName("CrickPage")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.CrickPage)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.label_5 = QtWidgets.QLabel(self.CrickPage)
+ self.label_5.setWordWrap(True)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout5.addWidget(self.label_5, 0, 0, 1, 3)
+ spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem6, 1, 1, 1, 1)
+ spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem7, 2, 0, 1, 1)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.label_6 = QtWidgets.QLabel(self.CrickPage)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout1.addWidget(self.label_6)
+ self.CrickSpinBox = QtWidgets.QSpinBox(self.CrickPage)
+ self.CrickSpinBox.setPrefix("")
+ self.CrickSpinBox.setMinimum(1)
+ self.CrickSpinBox.setMaximum(81)
+ self.CrickSpinBox.setProperty("value", 41)
+ self.CrickSpinBox.setObjectName("CrickSpinBox")
+ self.hboxlayout1.addWidget(self.CrickSpinBox)
+ self.gridlayout5.addLayout(self.hboxlayout1, 2, 1, 1, 1)
+ spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem8, 2, 2, 1, 1)
+ spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem9, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.CrickPage)
+ self.LBowPage = QtWidgets.QWidget()
+ self.LBowPage.setObjectName("LBowPage")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.LBowPage)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_12 = QtWidgets.QLabel(self.LBowPage)
+ self.label_12.setWordWrap(True)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout6.addWidget(self.label_12, 0, 0, 1, 5)
+ spacerItem10 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem10, 1, 1, 1, 1)
+ spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem11, 2, 0, 1, 1)
+ self.LBowIcon = QtWidgets.QLabel(self.LBowPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.LBowIcon.sizePolicy().hasHeightForWidth())
+ self.LBowIcon.setSizePolicy(sizePolicy)
+ self.LBowIcon.setMinimumSize(QtCore.QSize(85, 90))
+ self.LBowIcon.setMaximumSize(QtCore.QSize(85, 90))
+ self.LBowIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.LBowIcon.setText("")
+ self.LBowIcon.setObjectName("LBowIcon")
+ self.gridlayout6.addWidget(self.LBowIcon, 2, 1, 1, 1)
+ spacerItem12 = QtWidgets.QSpacerItem(31, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem12, 2, 2, 1, 1)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.LBowLabel = QtWidgets.QLabel(self.LBowPage)
+ self.LBowLabel.setObjectName("LBowLabel")
+ self.hboxlayout2.addWidget(self.LBowLabel)
+ self.LBowComboBox = QtWidgets.QComboBox(self.LBowPage)
+ self.LBowComboBox.setObjectName("LBowComboBox")
+ self.hboxlayout2.addWidget(self.LBowComboBox)
+ self.gridlayout6.addLayout(self.hboxlayout2, 2, 3, 1, 1)
+ spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem13, 2, 4, 1, 1)
+ spacerItem14 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem14, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.LBowPage)
+ self.ConneryPage = QtWidgets.QWidget()
+ self.ConneryPage.setObjectName("ConneryPage")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.ConneryPage)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_7 = QtWidgets.QLabel(self.ConneryPage)
+ self.label_7.setWordWrap(True)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout7.addWidget(self.label_7, 0, 0, 1, 5)
+ spacerItem15 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem15, 1, 2, 1, 1)
+ spacerItem16 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem16, 2, 0, 1, 1)
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.groupBox_2 = QtWidgets.QGroupBox(self.ConneryPage)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+ spacerItem17 = QtWidgets.QSpacerItem(21, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout8.addItem(spacerItem17, 0, 0, 1, 1)
+ self.ConneryGrayPatchIcon = QtWidgets.QLabel(self.groupBox_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ConneryGrayPatchIcon.sizePolicy().hasHeightForWidth())
+ self.ConneryGrayPatchIcon.setSizePolicy(sizePolicy)
+ self.ConneryGrayPatchIcon.setMinimumSize(QtCore.QSize(75, 75))
+ self.ConneryGrayPatchIcon.setMaximumSize(QtCore.QSize(75, 75))
+ self.ConneryGrayPatchIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.ConneryGrayPatchIcon.setText("")
+ self.ConneryGrayPatchIcon.setObjectName("ConneryGrayPatchIcon")
+ self.gridlayout8.addWidget(self.ConneryGrayPatchIcon, 0, 1, 1, 2)
+ spacerItem18 = QtWidgets.QSpacerItem(21, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout8.addItem(spacerItem18, 0, 3, 1, 1)
+ self.ConneryGrayLetterComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.ConneryGrayLetterComboBox.setObjectName("ConneryGrayLetterComboBox")
+ self.gridlayout8.addWidget(self.ConneryGrayLetterComboBox, 1, 0, 1, 2)
+ self.ConneryGrayNumberComboBox = QtWidgets.QComboBox(self.groupBox_2)
+ self.ConneryGrayNumberComboBox.setObjectName("ConneryGrayNumberComboBox")
+ self.gridlayout8.addWidget(self.ConneryGrayNumberComboBox, 1, 2, 1, 2)
+ self.hboxlayout3.addWidget(self.groupBox_2)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.ConneryPage)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout9.setObjectName("gridlayout9")
+ spacerItem19 = QtWidgets.QSpacerItem(21, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem19, 0, 0, 1, 1)
+ self.ConneryColorPatchIcon = QtWidgets.QLabel(self.groupBox_3)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ConneryColorPatchIcon.sizePolicy().hasHeightForWidth())
+ self.ConneryColorPatchIcon.setSizePolicy(sizePolicy)
+ self.ConneryColorPatchIcon.setMinimumSize(QtCore.QSize(75, 75))
+ self.ConneryColorPatchIcon.setMaximumSize(QtCore.QSize(75, 75))
+ self.ConneryColorPatchIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.ConneryColorPatchIcon.setText("")
+ self.ConneryColorPatchIcon.setObjectName("ConneryColorPatchIcon")
+ self.gridlayout9.addWidget(self.ConneryColorPatchIcon, 0, 1, 1, 2)
+ spacerItem20 = QtWidgets.QSpacerItem(31, 75, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem20, 0, 3, 1, 1)
+ self.ConneryColorLetterComboBox = QtWidgets.QComboBox(self.groupBox_3)
+ self.ConneryColorLetterComboBox.setObjectName("ConneryColorLetterComboBox")
+ self.gridlayout9.addWidget(self.ConneryColorLetterComboBox, 1, 0, 1, 2)
+ self.ConneryColorNumberComboBox = QtWidgets.QComboBox(self.groupBox_3)
+ self.ConneryColorNumberComboBox.setObjectName("ConneryColorNumberComboBox")
+ self.gridlayout9.addWidget(self.ConneryColorNumberComboBox, 1, 2, 1, 2)
+ self.hboxlayout3.addWidget(self.groupBox_3)
+ self.gridlayout7.addLayout(self.hboxlayout3, 2, 1, 1, 3)
+ spacerItem21 = QtWidgets.QSpacerItem(81, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem21, 2, 4, 1, 1)
+ spacerItem22 = QtWidgets.QSpacerItem(20, 21, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem22, 3, 1, 1, 1)
+ spacerItem23 = QtWidgets.QSpacerItem(20, 51, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem23, 3, 3, 2, 1)
+ self.ConneryUseFactoryDefaultsCheckBox = QtWidgets.QCheckBox(self.ConneryPage)
+ self.ConneryUseFactoryDefaultsCheckBox.setObjectName("ConneryUseFactoryDefaultsCheckBox")
+ self.gridlayout7.addWidget(self.ConneryUseFactoryDefaultsCheckBox, 4, 0, 1, 2)
+ self.StackedWidget.addWidget(self.ConneryPage)
+ self.FrontPanelPage = QtWidgets.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.FrontPanelPage)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_8 = QtWidgets.QLabel(self.FrontPanelPage)
+ self.label_8.setWordWrap(True)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout10.addWidget(self.label_8, 0, 0, 1, 1)
+ spacerItem24 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout10.addItem(spacerItem24, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.FrontPanelPage)
+ self.gridlayout.addWidget(self.StackedWidget, 2, 0, 1, 6)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 3, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 4, 0, 1, 1)
+ spacerItem25 = QtWidgets.QSpacerItem(141, 28, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem25, 4, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 4, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 4, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ self.ConneryUseFactoryDefaultsCheckBox.clicked['bool'].connect(self.groupBox_2.setDisabled)
+ self.ConneryUseFactoryDefaultsCheckBox.clicked['bool'].connect(self.groupBox_3.setDisabled)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Printer Color Calibration"))
+ self.label.setText(_translate("Dialog", "Printer Color Calibration"))
+ self.label_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Select the device to align and click <span style=\" font-style:italic;\">Next &gt;</span> to continue.</p></body></html>"))
+ self.label_3.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Choose the numbered image labeled \"1\" thru \"7\" that is <span style=\" font-weight:600;\">best color matched</span> to the image labeled \"X\".</p></body></html>"))
+ self.label_4.setText(_translate("Dialog", "Best Matched Image:"))
+ self.Deskjet450ComboBox.setItemText(0, _translate("Dialog", "1"))
+ self.Deskjet450ComboBox.setItemText(1, _translate("Dialog", "2"))
+ self.Deskjet450ComboBox.setItemText(2, _translate("Dialog", "3"))
+ self.Deskjet450ComboBox.setItemText(3, _translate("Dialog", "4"))
+ self.Deskjet450ComboBox.setItemText(4, _translate("Dialog", "5"))
+ self.Deskjet450ComboBox.setItemText(5, _translate("Dialog", "6"))
+ self.Deskjet450ComboBox.setItemText(6, _translate("Dialog", "7"))
+ self.label_5.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">A page of color patches is printing. When it is complete, follow these steps:</span> </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">1.</span> Hold the page approximately 8 inches (~20cm) in front of your eyes. </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">2.</span> Slowly move the page away from you until the numbered patches fade to match the background. </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">3.</span> Select the number (below) between <span style=\" font-style:italic;\">1</span> and <span style=\" font-style:italic;\">81 </span>of the numbered patch that <span style=\" font-weight:600;\">best </span>matches the background:</p></body></html>"))
+ self.label_6.setText(_translate("Dialog", "Number of <b>best</b> matching patch (1-81):"))
+ self.label_12.setText(_translate("Dialog", "Choose the numbered colored box that the color <b>best </b>matches the background color of the bar."))
+ self.LBowLabel.setText(_translate("Dialog", "Line %1:"))
+ self.label_7.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1. Hold the calibration page at arm\'s length in front of your eyes.</p>\n"
+"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2. Tilt the page away from you. Look at the two large squares, each containing colored patches. For each large square, find the colored path that <span style=\" font-weight:600;\">most closely</span> matches the background color.</p>\n"
+"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">3. Choose the letter and number for the matching patches for the gray and color plots.</p></body></html>"))
+ self.groupBox_2.setTitle(_translate("Dialog", "Gray Plot"))
+ self.groupBox_3.setTitle(_translate("Dialog", "Color Plot"))
+ self.ConneryUseFactoryDefaultsCheckBox.setText(_translate("Dialog", "Use Factory Defaults"))
+ self.label_8.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Cartridge alignment on this printer is only available by accessing the front panel of the printer.</span> Please refer to the user guide for the printer for more information. Click <span style=\" font-style:italic;\">Finish</span> to exit.</p></body></html>"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
+from .loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui5/colorcaldialog_base.ui b/ui5/colorcaldialog_base.ui
new file mode 100644
index 000000000..1b3cf6def
--- /dev/null
+++ b/ui5/colorcaldialog_base.ui
@@ -0,0 +1,810 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Printer Color Calibration</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="3" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Printer Color Calibration</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="6" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="StartPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string/>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Select the device to align and click &lt;span style=" font-style:italic;">Next &amp;gt;&lt;/span> to continue.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="LoadPaperPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>181</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Deskjet450Page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="3" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Choose the numbered image labeled "1" thru "7" that is &lt;span style=" font-weight:600;">best color matched&lt;/span> to the image labeled "X".&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>111</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Best Matched Image:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="Deskjet450ComboBox" >
+ <item>
+ <property name="text" >
+ <string>1</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>2</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>3</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>4</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>5</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>6</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>7</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>221</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="CrickPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="3" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">A page of color patches is printing. When it is complete, follow these steps:&lt;/span> &lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">1.&lt;/span> Hold the page approximately 8 inches (~20cm) in front of your eyes. &lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">2.&lt;/span> Slowly move the page away from you until the numbered patches fade to match the background. &lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">3.&lt;/span> Select the number (below) between &lt;span style=" font-style:italic;">1&lt;/span> and &lt;span style=" font-style:italic;">81 &lt;/span>of the numbered patch that &lt;span style=" font-weight:600;">best &lt;/span>matches the background:&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Number of &lt;b>best&lt;/b> matching patch (1-81):</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="CrickSpinBox" >
+ <property name="prefix" >
+ <string/>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>81</number>
+ </property>
+ <property name="value" >
+ <number>41</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="LBowPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QLabel" name="label_12" >
+ <property name="text" >
+ <string>Choose the numbered colored box that the color &lt;b>best &lt;/b>matches the background color of the bar.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLabel" name="LBowIcon" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>85</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="3" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="LBowLabel" >
+ <property name="text" >
+ <string>Line %1:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="LBowComboBox" />
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="4" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="ConneryPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1. Hold the calibration page at arm's length in front of your eyes.&lt;/p>
+&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2. Tilt the page away from you. Look at the two large squares, each containing colored patches. For each large square, find the colored path that &lt;span style=" font-weight:600;">most closely&lt;/span> matches the background color.&lt;/p>
+&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">3. Choose the letter and number for the matching patches for the gray and color plots.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" colspan="3" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Gray Plot</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QLabel" name="ConneryGrayPatchIcon" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>75</width>
+ <height>75</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>75</width>
+ <height>75</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QComboBox" name="ConneryGrayLetterComboBox" />
+ </item>
+ <item row="1" column="2" colspan="2" >
+ <widget class="QComboBox" name="ConneryGrayNumberComboBox" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string>Color Plot</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QLabel" name="ConneryColorPatchIcon" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>75</width>
+ <height>75</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>75</width>
+ <height>75</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>31</width>
+ <height>75</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QComboBox" name="ConneryColorLetterComboBox" />
+ </item>
+ <item row="1" column="2" colspan="2" >
+ <widget class="QComboBox" name="ConneryColorNumberComboBox" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="4" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item rowspan="2" row="3" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <widget class="QCheckBox" name="ConneryUseFactoryDefaultsCheckBox" >
+ <property name="text" >
+ <string>Use Factory Defaults</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="FrontPanelPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Cartridge alignment on this printer is only available by accessing the front panel of the printer.&lt;/span> Please refer to the user guide for the printer for more information. Click &lt;span style=" font-style:italic;">Finish&lt;/span> to exit.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="5" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>141</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>ConneryUseFactoryDefaultsCheckBox</sender>
+ <signal>clicked(bool)</signal>
+ <receiver>groupBox_2</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>98</x>
+ <y>417</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>146</x>
+ <y>221</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>ConneryUseFactoryDefaultsCheckBox</sender>
+ <signal>clicked(bool)</signal>
+ <receiver>groupBox_3</receiver>
+ <slot>setDisabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>158</x>
+ <y>427</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>324</x>
+ <y>222</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/devicesetupdialog.py b/ui5/devicesetupdialog.py
new file mode 100644
index 000000000..e2d57dcc3
--- /dev/null
+++ b/ui5/devicesetupdialog.py
@@ -0,0 +1,296 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import string
+
+# Local
+from base.g import *
+from base import device, pml
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .devicesetupdialog_base import Ui_Dialog
+
+TAB_POWER_SETTINGS = 0
+
+class DeviceSetupDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.mq = {}
+ self.dev = None
+ self.initUi()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ #self.ApplyButton.clicked.connect(self.ApplyButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+
+ self.DeviceComboBox.setFilter({'power-settings': (operator.gt, 0)})
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+ self.DurationComboBox.addItem(self.__tr("15 minutes"), 15)
+ self.DurationComboBox.addItem(self.__tr("30 minutes"), 30)
+ self.DurationComboBox.addItem(self.__tr("45 minutes"), 45)
+ self.DurationComboBox.addItem(self.__tr("1 hour"), 60)
+ self.DurationComboBox.addItem(self.__tr("2 hours"), 120)
+ self.DurationComboBox.addItem(self.__tr("3 hours"), 180)
+
+ self.DurationComboBox.activated[int].connect(self.DurationComboBox_activated)
+
+ self.OnRadioButton.toggled[bool].connect(self.OnRadioButton_toggled)
+
+
+ def OnRadioButton_toggled(self, b):
+ i = self.DurationComboBox.currentIndex()
+ if i == -1:
+ return
+ v, ok = value_int(self.DurationComboBox.itemData(i))
+ if not ok:
+ return
+
+ if self.power_settings == POWER_SETTINGS_EPML:
+ if b:
+ self.setPowerSettingsEPML('999')
+ else:
+ self.setPowerSettingsEPML(string.zfill(v, 3))
+
+ elif self.power_settings == POWER_SETTINGS_PML:
+ if b:
+ self.setPowerSettingsPML(pml.OID_POWER_SETTINGS_NEVER)
+ else:
+ self.setPowerSettingsPML(self.getPMLSettingsValue(v))
+
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+
+
+ def updatePowerSettingsUi(self):
+ pass
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ beginWaitCursor()
+ try:
+ self.device_uri = device_uri
+
+ if self.dev is not None:
+ self.dev.close()
+
+ self.dev = device.Device(self.device_uri)
+
+ # Update
+ self.mq = device.queryModelByURI(self.device_uri)
+ self.power_settings = self.mq.get('power-settings', POWER_SETTINGS_NONE)
+
+ self.TabWidget.setTabEnabled(TAB_POWER_SETTINGS, self.power_settings != POWER_SETTINGS_NONE)
+
+ if self.power_settings == POWER_SETTINGS_EPML:
+ self.updatePowerSettingsEPML()
+
+ elif self.power_settings == POWER_SETTINGS_PML:
+ self.updatePowerSettingsPML()
+
+ finally:
+ endWaitCursor()
+
+ # DJ 4x0 battery power settings
+
+ # 15min = 015
+ # 30min = 030
+ # 45min = 045
+ # 1hr = 060
+ # 2hr = 120
+ # 3hr = 180
+ # never = 999
+
+ def updatePowerSettingsEPML(self):
+ value = self.getPowerSettingsEPML()
+
+ if value == '999':
+ self.OnRadioButton.setChecked(True)
+ self.OffRadioButton.setChecked(False)
+ else:
+ self.OnRadioButton.setChecked(False)
+ self.OffRadioButton.setChecked(True)
+
+ find = int(value)
+ index = self.DurationComboBox.findData(find)
+
+ if index != -1:
+ self.DurationComboBox.setCurrentIndex(index)
+
+
+ def getPowerSettingsEPML(self):
+ value = self.dev.getDynamicCounter(256, False)
+ log.debug("Current power settings: %s" % value)
+ self.dev.closePrint()
+ return value[6:9]
+
+
+ def setPowerSettingsEPML(self, value):
+ log.debug("Setting power setting to %s" % value)
+ pcl= \
+ """\x1b%%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n\x1bE\x1b%%Pmech.set_battery_autooff %s;\nudw.quit;\x1b*rC\x1bE\x1b%%-12345X""" % value
+ self.dev.printData(pcl, direct=True)
+ self.dev.closePrint()
+
+ # h470
+
+ # PML
+ # OID_POWER_SETTINGS = ('1.1.2.118', TYPE_ENUMERATION)
+ # OID_POWER_SETTINGS_15MIN = 1
+ # OID_POWER_SETTINGS_30MIN = 2
+ # OID_POWER_SETTINGS_45MIN = 3
+ # OID_POWER_SETTINGS_1HR = 4
+ # OID_POWER_SETTINGS_2HR = 5
+ # OID_POWER_SETTINGS_3HR = 6
+ # OID_POWER_SETTINGS_NEVER = 999
+
+ def updatePowerSettingsPML(self):
+ value = self.getPowerSettingsPML()
+ if value == pml.OID_POWER_SETTINGS_NEVER:
+ self.OnRadioButton.setChecked(True)
+ self.OffRadioButton.setChecked(False)
+ else:
+ self.OnRadioButton.setChecked(False)
+ self.OffRadioButton.setChecked(True)
+
+ find = 15
+ if value == pml.OID_POWER_SETTINGS_15MIN:
+ find = 15
+ elif value == pml.OID_POWER_SETTINGS_30MIN:
+ find = 30
+ elif value == pml.OID_POWER_SETTINGS_45MIN:
+ find = 45
+ elif value == pml.OID_POWER_SETTINGS_1HR:
+ find = 60
+ elif value == pml.OID_POWER_SETTINGS_2HR:
+ find = 120
+ elif value == pml.OID_POWER_SETTINGS_3HR:
+ find = 180
+
+ index = self.DurationComboBox.findData(find)
+
+ if index != -1:
+ self.DurationComboBox.setCurrentIndex(index)
+
+
+
+ def getPowerSettingsPML(self):
+ pml_result_code, value = self.dev.getPML(pml.OID_POWER_SETTINGS)
+ self.dev.closePML()
+ log.debug("Current power settings: %s" % value)
+ return value
+
+
+ def setPowerSettingsPML(self, value):
+ log.debug("Setting power setting to %s" % value)
+ pml_result_code = self.dev.setPML(pml.OID_POWER_SETTINGS, value)
+ self.dev.closePML()
+
+ # #####################
+
+
+ def DurationComboBox_activated(self, i):
+ if i == -1:
+ return
+ v, ok = value_int(self.DurationComboBox.itemData(i))
+ if not ok:
+ return
+ if self.power_settings == POWER_SETTINGS_EPML:
+ beginWaitCursor()
+ try:
+ self.setPowerSettingsEPML(string.zfill(v, 3))
+ finally:
+ endWaitCursor()
+
+ elif self.power_settings == POWER_SETTINGS_PML:
+ beginWaitCursor()
+ try:
+ self.setPowerSettingsPML(self.getPMLSettingsValue(v))
+ finally:
+ endWaitCursor()
+
+
+ def getPMLSettingsValue(self, v):
+ x = pml.OID_POWER_SETTINGS_15MIN
+
+ if v == 15:
+ x = pml.OID_POWER_SETTINGS_15MIN
+ elif v == 30:
+ x = pml.OID_POWER_SETTINGS_30MIN
+ elif v == 45:
+ x = pml.OID_POWER_SETTINGS_45MIN
+ elif v == 60:
+ x = pml.OID_POWER_SETTINGS_1HR
+ elif v == 120:
+ x = pml.OID_POWER_SETTINGS_2HR
+ elif v == 180:
+ x = pml.OID_POWER_SETTINGS_3HR
+
+ return x
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support device setup found.</b>"))
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+
+# def ApplyButton_clicked(self):
+# pass
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DeviceSetupDialog",s,c)
+
+
diff --git a/ui5/devicesetupdialog_base.py b/ui5/devicesetupdialog_base.py
new file mode 100644
index 000000000..03b833115
--- /dev/null
+++ b/ui5/devicesetupdialog_base.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/devicesetupdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 3)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 3)
+ self.TabWidget = QtWidgets.QTabWidget(Dialog)
+ self.TabWidget.setObjectName("TabWidget")
+ self.PowerSettingsTab = QtWidgets.QWidget()
+ self.PowerSettingsTab.setObjectName("PowerSettingsTab")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.PowerSettingsTab)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.groupBox = QtWidgets.QGroupBox(self.PowerSettingsTab)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.OnRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.OnRadioButton.setObjectName("OnRadioButton")
+ self.gridlayout2.addWidget(self.OnRadioButton, 0, 0, 1, 2)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.OffRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.OffRadioButton.setEnabled(True)
+ self.OffRadioButton.setObjectName("OffRadioButton")
+ self.hboxlayout.addWidget(self.OffRadioButton)
+ self.DurationComboBox = QtWidgets.QComboBox(self.groupBox)
+ self.DurationComboBox.setEnabled(False)
+ self.DurationComboBox.setObjectName("DurationComboBox")
+ self.hboxlayout.addWidget(self.DurationComboBox)
+ self.gridlayout2.addLayout(self.hboxlayout, 1, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 1, 1, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 0, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(282, 51, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 1, 0, 1, 1)
+ self.TabWidget.addTab(self.PowerSettingsTab, "")
+ self.gridlayout.addWidget(self.TabWidget, 3, 0, 1, 3)
+ spacerItem2 = QtWidgets.QSpacerItem(510, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
+ self.gridlayout.addItem(spacerItem2, 4, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(361, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 5, 0, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.TabWidget.setCurrentIndex(0)
+ self.OffRadioButton.toggled['bool'].connect(self.DurationComboBox.setEnabled)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Device Setup"))
+ self.label.setText(_translate("Dialog", "Device Setup"))
+ self.groupBox.setTitle(_translate("Dialog", "Automatic Power Off"))
+ self.OnRadioButton.setText(_translate("Dialog", "Always leave printer on"))
+ self.OffRadioButton.setText(_translate("Dialog", "Automatically turn printer off after:"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.PowerSettingsTab), _translate("Dialog", "Power Settings"))
+ self.CancelButton.setText(_translate("Dialog", "Close"))
+
+from .deviceuricombobox import DeviceUriComboBox
diff --git a/ui5/devicesetupdialog_base.ui b/ui5/devicesetupdialog_base.ui
new file mode 100644
index 000000000..bc6e63a11
--- /dev/null
+++ b/ui5/devicesetupdialog_base.ui
@@ -0,0 +1,179 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Device Setup</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Device Setup</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="QTabWidget" name="TabWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="PowerSettingsTab" >
+ <attribute name="title" >
+ <string>Power Settings</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Automatic Power Off</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QRadioButton" name="OnRadioButton" >
+ <property name="text" >
+ <string>Always leave printer on</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QRadioButton" name="OffRadioButton" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Automatically turn printer off after:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="DurationComboBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>282</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>510</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>361</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>OffRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>DurationComboBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>140</x>
+ <y>189</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>276</x>
+ <y>196</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/deviceuricombobox.py b/ui5/deviceuricombobox.py
new file mode 100644
index 000000000..d01d13f17
--- /dev/null
+++ b/ui5/deviceuricombobox.py
@@ -0,0 +1,169 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Std Lib
+
+# Local
+from base.g import *
+from .ui_utils import *
+from base import device
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+DEVICEURICOMBOBOX_TYPE_PRINTER_ONLY = 0
+DEVICEURICOMBOBOX_TYPE_FAX_ONLY = 1
+DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX = 2
+
+
+class DeviceUriComboBox(QWidget):
+ DeviceUriComboBox_oneDevice = pyqtSignal()
+ DeviceUriComboBox_noDevices = pyqtSignal()
+ DeviceUriComboBox_currentChanged = pyqtSignal(str)
+ def __init__(self, parent):
+ QWidget.__init__(self, parent)
+ self.device_uri = ''
+ self.initial_device = None
+ self.updating = False
+ self.typ = DEVICEURICOMBOBOX_TYPE_PRINTER_ONLY
+ self.filter = None
+ self.devices = None
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+
+ def initUi(self):
+ HBoxLayout = QHBoxLayout(self)
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ self.NameLabel = QLabel(self)
+ self.NameLabel.setObjectName("NameLabel")
+ HBoxLayout.addWidget(self.NameLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.ComboBox = QComboBox(self)
+ sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ComboBox.sizePolicy().hasHeightForWidth())
+ self.ComboBox.setSizePolicy(sizePolicy)
+ self.ComboBox.setObjectName("ComboBox")
+ HBoxLayout.addWidget(self.ComboBox)
+
+ self.NameLabel.setText(self.__tr("Device:"))
+
+# self.connect(self.ComboBox, SIGNAL("currentIndexChanged(int)"),
+# self.ComboBox_currentIndexChanged)
+
+ # self.connect(self.ComboBox, SIGNAL("currentIndexChanged(const QString &)"),
+ # self.ComboBox_currentIndexChanged)
+ self.ComboBox.currentIndexChanged["const QString &"].connect(self.ComboBox_currentIndexChanged)
+
+ def setType(self, typ):
+ if typ in (DEVICEURICOMBOBOX_TYPE_PRINTER_ONLY,
+ DEVICEURICOMBOBOX_TYPE_FAX_ONLY,
+ DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX):
+ self.typ = typ
+
+
+ def setFilter(self, filter):
+ self.filter = filter
+
+
+ def setInitialDevice(self, device_uri):
+ self.initial_device = device_uri
+
+
+ def setDevices(self):
+ if self.typ == DEVICEURICOMBOBOX_TYPE_PRINTER_ONLY:
+ be_filter = ['hp']
+
+ elif self.typ == DEVICEURICOMBOBOX_TYPE_FAX_ONLY:
+ be_filter = ['hpfax']
+ self.NameLabel.setText(self.__tr("Fax Device:"))
+
+ else: # DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX
+ be_filter = ['hp', 'hpfax']
+
+ self.devices = device.getSupportedCUPSDevices(be_filter, self.filter)
+ return len(self.devices)
+
+
+ def updateUi(self):
+ if self.devices is None:
+ self.setDevices()
+
+ self.device_index = {}
+
+ if self.devices:
+ if self.initial_device is None:
+ #self.initial_device = user_conf.get('last_used', 'device_uri')
+ self.initial_device = self.user_settings.last_used_device_uri
+
+ self.updating = True
+ try:
+ k = 0
+ for i, d in enumerate(self.devices):
+ self.ComboBox.insertItem(i, d)
+
+ if self.initial_device is not None and d == self.initial_device:
+ self.initial_device = None
+ k = i
+
+ self.ComboBox.setCurrentIndex(-1)
+ finally:
+ self.updating = False
+
+ self.ComboBox.setCurrentIndex(k)
+
+ if len(self.devices) == 1:
+ # self.emit(SIGNAL("DeviceUriComboBox_oneDevice"))
+ self.DeviceUriComboBox_oneDevice.emit()
+
+ else:
+ # self.emit(SIGNAL("DeviceUriComboBox_noDevices"))
+ self.DeviceUriComboBox_noDevices.emit()
+
+ def ComboBox_currentIndexChanged(self, t):
+ if self.updating:
+ return
+
+ self.device_uri = to_unicode(t)
+ if self.device_uri:
+ #user_conf.set('last_used', 'device_uri', self.device_uri)
+ self.user_settings.last_used_device_uri = self.device_uri
+ self.user_settings.save()
+
+ # self.emit(SIGNAL("DeviceUriComboBox_currentChanged"), self.device_uri)
+ self.DeviceUriComboBox_currentChanged.emit(self.device_uri)
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DeviceUriComboBox",s,c)
diff --git a/ui5/devmgr5.py b/ui5/devmgr5.py
new file mode 100644
index 000000000..35bdcb7a3
--- /dev/null
+++ b/ui5/devmgr5.py
@@ -0,0 +1,2324 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch, Naga Samrat Chowdary Narla
+#
+
+#from __future__ import generators
+
+# Std Lib
+import sys
+import time
+import os
+import gzip
+import select
+import struct
+import signal
+from base.sixext.moves import configparser
+# Local
+from base.g import *
+from base import device, utils, pml, maint, models, pkit, os_utils
+from prnt import cups
+from base.sixext import PY3
+from base.codes import *
+from .ui_utils import *
+import hpmudext
+from installer.core_install import *
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+import collections
+
+# dbus
+try:
+ import dbus
+ from dbus.mainloop.pyqt5 import DBusQtMainLoop
+ from dbus import lowlevel
+except ImportError:
+ log.error("Unable to load DBus libraries. Please check your installation and try again.")
+ if PY3: # Workaround due to incomplete Python3 support in Linux distros.
+ log.error("Please upgrade your python installation to the latest available version.")
+ sys.exit(1)
+
+import warnings
+# Ignore: .../dbus/connection.py:242: DeprecationWarning: object.__init__() takes no parameters
+# (occurring on Python 2.6/dBus 0.83/Ubuntu 9.04)
+warnings.simplefilter("ignore", DeprecationWarning)
+
+
+# Main form
+from .devmgr5_base import Ui_MainWindow
+from .devmgr_ext import Ui_MainWindow_Derived
+# Aux. dialogs
+from .faxsetupdialog import FaxSetupDialog
+from .plugindialog import PluginDialog
+from .firmwaredialog import FirmwareDialog
+from .aligndialog import AlignDialog
+from .printdialog import PrintDialog
+from .makecopiesdialog import MakeCopiesDialog
+from .sendfaxdialog import SendFaxDialog
+from .fabwindow import FABWindow
+from .devicesetupdialog import DeviceSetupDialog
+from .printtestpagedialog import PrintTestPageDialog
+from .infodialog import InfoDialog
+from .cleandialog import CleanDialog
+from .colorcaldialog import ColorCalDialog
+from .linefeedcaldialog import LineFeedCalDialog
+from .pqdiagdialog import PQDiagDialog
+from .nodevicesdialog import NoDevicesDialog
+from .aboutdialog import AboutDialog
+
+# Other forms and controls
+from .settingsdialog import SettingsDialog
+from .printsettingstoolbox import PrintSettingsToolbox
+
+
+from base import os_utils
+
+# all in seconds
+MIN_AUTO_REFRESH_RATE = 5
+MAX_AUTO_REFRESH_RATE = 60
+DEF_AUTO_REFRESH_RATE = 30
+
+
+device_list = {} # { Device_URI : device.Device(), ... }
+model_obj = models.ModelData() # Used to convert dbus xformed data back to plain Python types
+
+
+# ***********************************************************************************
+#
+# ITEM/UTILITY UI CLASSES
+#
+# ***********************************************************************************
+
+
+class FuncViewItem(QListWidgetItem):
+ def __init__(self, parent, text, pixmap, tooltip_text, cmd):
+ QListWidgetItem.__init__(self, QIcon(pixmap), text, parent)
+ self.tooltip_text = tooltip_text
+ self.cmd = cmd
+
+# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+class DeviceViewItem(QListWidgetItem):
+ def __init__(self, parent, text, pixmap, device_uri, is_avail=True):
+ QListWidgetItem.__init__(self, QIcon(pixmap), text, parent)
+ self.device_uri = device_uri
+ self.is_avail = is_avail
+ self.setTextAlignment(Qt.AlignHCenter)
+
+# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+class PluginInstall(QObject):
+ def __init__(self, parent, plugin_type, plugin_installed):
+ self.parent = parent
+ self.plugin_type = plugin_type
+ self.plugin_installed = plugin_installed
+
+
+ def exec_(self):
+ install_plugin = True
+
+ if self.plugin_installed:
+ install_plugin = QMessageBox.warning(self.parent,
+ self.parent.windowTitle(),
+ self.__tr("<b>The HPLIP plugin is already installed.</b><p>Do you want to continue and re-install it?"),
+ QMessageBox.Yes,
+ QMessageBox.No,
+ QMessageBox.NoButton) == QMessageBox.Yes
+
+ if install_plugin:
+ ok, sudo_ok = pkit.run_plugin_command(self.plugin_type == PLUGIN_REQUIRED, self.parent.cur_device.mq['plugin-reason'])
+ if not sudo_ok:
+ QMessageBox.critical(self.parent,
+ self.parent.windowTitle(),
+ self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DevMgr5",s,c)
+
+
+
+# ***********************************************************************************
+#
+# MAINWINDOW
+#
+# ***********************************************************************************
+
+'''
+class Ui_MainWindow_Derived(Ui_MainWindow):
+ def setupUi(self, MainWindow, latest_available_version, Is_autoInstaller_distro):
+ super().setupUi(MainWindow)
+ self.DiagnoseQueueAction = QAction(MainWindow)
+ self.DiagnoseQueueAction.setObjectName("DiagnoseQueueAction")
+ self.DiagnoseHPLIPAction = QAction(MainWindow)
+ self.DiagnoseHPLIPAction.setObjectName("DiagnoseHPLIPAction")
+
+ self.latest_available_version = latest_available_version
+ self.Is_autoInstaller_distro = Is_autoInstaller_distro
+ if self.latest_available_version is not "":
+ self.tab_3 = QWidget()
+ self.tab_3.setObjectName("tab_3")
+ self.label = QLabel(self.tab_3)
+ self.label.setGeometry(QRect(30, 45, 300, 17))
+ self.label.setObjectName("label")
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton = QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QRect(351, 40, 96, 27))
+ self.InstallLatestButton.setObjectName("pushButton")
+ else:
+ self.ManualInstalllabel = QLabel(self.tab_3)
+ self.ManualInstalllabel.setGeometry(QRect(30, 70,300, 45))
+ self.ManualInstalllabel.setObjectName("label")
+ self.InstallLatestButton = QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QRect(295, 80, 110, 25))
+ self.InstallLatestButton.setObjectName("pushButton")
+ self.Tabs.addTab(self.tab_3, "")
+ # super().setupUi(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ super().retranslateUi(MainWindow)
+ if self.latest_available_version is not "":
+ self.label.setText(QtGui.QApplication.translate("MainWindow", "New version of HPLIP-%s is available"%self.latest_available_version, None))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Upgrade", None))
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton.setText(QtGui.QApplication.translate("MainWindow", "Install now", None))
+ else:
+ msg="Please install manually as mentioned in "
+ self.ManualInstalllabel.setText(QtGui.QApplication.translate("MainWindow", msg, None))
+ self.InstallLatestButton.setText(QtGui.QApplication.translate("MainWindow", "HPLIP website", None))
+'''
+
+class DevMgr5(Ui_MainWindow_Derived, Ui_MainWindow, QMainWindow):
+ def __init__(self, toolbox_version, initial_device_uri=None,
+ dbus_loop=None, parent=None, name=None, fl=0):
+
+ # QMainWindow.__init__(self, parent)
+ super(DevMgr5, self).__init__(parent)
+
+ log.debug("Initializing toolbox UI (Qt5)...")
+ log.debug("HPLIP Version: %s" % prop.installed_version)
+
+
+ self.toolbox_version = toolbox_version
+ self.initial_device_uri = initial_device_uri
+ self.device_vars = {}
+ self.num_devices = 0
+ self.cur_device = None
+ self.cur_printer = None
+ self.updating = False
+ self.init_failed = False
+ self.service = None
+ self.Is_autoInstaller_distro = False # True-->tier1(supports auto installation). False--> tier2(manual installation)
+
+ # Distro insformation
+ core = CoreInstall(MODE_CHECK)
+# core.init()
+ self.Is_autoInstaller_distro = core.is_auto_installer_support()
+ # User settings
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+ self.cur_device_uri = self.user_settings.last_used_device_uri
+ installed_version=sys_conf.get('hplip','version')
+ if not utils.Is_HPLIP_older_version( installed_version, self.user_settings.latest_available_version):
+ self.setupUi(self,"",self.Is_autoInstaller_distro)
+ else:
+ self.setupUi(self, self.user_settings.latest_available_version,self.Is_autoInstaller_distro)
+
+ # Other initialization
+ self.initDBus()
+ self.initPixmaps()
+ self.initMisc()
+ self.initUI()
+
+ cups.setPasswordCallback(showPasswordUI)
+
+ if not prop.doc_build:
+ self.ContentsAction.setEnabled(False)
+
+ self.allow_auto_refresh = True
+ QTimer.singleShot(0, self.initalUpdate)
+
+
+ # ***********************************************************************************
+ #
+ # INIT
+ #
+ # ***********************************************************************************
+
+ # TODO: Make sbus init mandatory success, else exit
+ def initDBus(self):
+ self.dbus_loop = DBusQtMainLoop(set_as_default=True)
+ self.dbus_avail, self.service, self.session_bus = device.init_dbus(self.dbus_loop)
+
+ if not self.dbus_avail:
+ log.error("dBus initialization error. Exiting.")
+ self.init_failed = True
+ return
+
+ # Receive events from the session bus
+ self.session_bus.add_signal_receiver(self.handleSessionSignal, sender_keyword='sender',
+ destination_keyword='dest', interface_keyword='interface',
+ member_keyword='member', path_keyword='path')
+
+
+ def initPixmaps(self):
+ self.func_icons_cached = False
+ self.func_icons = {}
+ self.device_icons = {}
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ self.fax_icon = load_pixmap("fax2", "other")
+
+
+ def initUI(self):
+ # Setup device icon list
+ self.DeviceList.setSortingEnabled(True)
+ self.DeviceList.setContextMenuPolicy(Qt.CustomContextMenu)
+ self.setDeviceListViewMode(QListView.IconMode)
+
+ self.ViewAsIconsAction.triggered.connect(lambda: self.setDeviceListViewMode(QListView.IconMode))
+ self.ViewAsListAction.triggered.connect(lambda: self.setDeviceListViewMode(QListView.ListMode))
+
+ self.DeviceList.customContextMenuRequested["const QPoint &"].connect(self.DeviceList_customContextMenuRequested)
+
+ # Setup main menu
+ self.DeviceRefreshAction.setIcon(QIcon(load_pixmap("refresh1", "16x16")))
+ self.DeviceRefreshAction.triggered.connect(self.DeviceRefreshAction_activated)
+
+ self.RefreshAllAction.setIcon(QIcon(load_pixmap("refresh", "16x16")))
+ self.RefreshAllAction.triggered.connect(self.RefreshAllAction_activated)
+
+ self.SetupDeviceAction.setIcon(QIcon(load_pixmap('list_add', '16x16')))
+ self.SetupDeviceAction.triggered.connect(self.SetupDeviceAction_activated)
+
+ self.RemoveDeviceAction.setIcon(QIcon(load_pixmap('list_remove', '16x16')))
+ self.RemoveDeviceAction.triggered.connect(self.RemoveDeviceAction_activated)
+
+ self.PreferencesAction.setIcon(QIcon(load_pixmap('settings', '16x16')))
+ self.PreferencesAction.triggered.connect(self.PreferencesAction_activated)
+
+ self.DiagnoseQueueAction.setIcon(QIcon(load_pixmap('warning', '16x16')))
+ self.DiagnoseQueueAction.triggered.connect(self.DiagnoseQueue_activated)
+
+ self.DiagnoseHPLIPAction.setIcon(QIcon(load_pixmap('troubleshoot', '16x16')))
+ self.DiagnoseHPLIPAction.triggered.connect(self.DiagnoseHPLIP_activated)
+
+ self.ContentsAction.setIcon(QIcon(load_pixmap("help", "16x16")))
+ self.ContentsAction.triggered.connect(self.helpContents)
+
+ self.QuitAction.setIcon(QIcon(load_pixmap("quit", "16x16")))
+ self.QuitAction.triggered.connect(self.quit)
+
+ self.AboutAction.triggered.connect(self.helpAbout)
+
+ self.PrintControlPrinterNameCombo.activated["const QString &"].connect(self.PrintControlPrinterNameCombo_activated)
+ self.PrintSettingsPrinterNameCombo.activated["const QString &"].connect(self.PrintSettingsPrinterNameCombo_activated)
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+
+ # Init tabs/controls
+ self.initActionsTab()
+ self.initStatusTab()
+ self.initSuppliesTab()
+ self.initPrintSettingsTab()
+ self.initPrintControlTab()
+
+
+ self.Tabs.currentChanged[int].connect(self.Tabs_currentChanged)
+
+ # Resize the splitter so that the device list starts as a single column
+ self.splitter.setSizes([80, 600])
+
+ # Setup the Device List
+ self.DeviceList.setIconSize(QSize(60, 60))
+ self.DeviceList.currentItemChanged["QListWidgetItem *", "QListWidgetItem *"].connect(self.DeviceList_currentChanged)
+
+
+ def initMisc(self):
+ self.TabIndex = { 0: self.updateActionsTab,
+ 1: self.updateStatusTab,
+ 2: self.updateSuppliesTab,
+ 3: self.updatePrintSettingsTab,
+ 4: self.updatePrintControlTab,
+ 5:self.updateHPLIPupgrade,
+ }
+
+ # docs
+ self.docs = "http://hplip.sf.net"
+
+ if prop.doc_build:
+ g = os.path.join(sys_conf.get('dirs', 'doc'), 'index.html')
+ if os.path.exists(g):
+ self.docs = "file://%s" % g
+
+ # support
+ self.support = "https://launchpad.net/hplip"
+
+
+
+ def initalUpdate(self):
+ if self.init_failed:
+ self.close()
+ return
+
+ self.rescanDevices()
+
+ cont = True
+ if self.initial_device_uri is not None:
+ if not self.activateDevice(self.initial_device_uri):
+ log.error("Device %s not found" % self.initial_device_uri)
+ cont = False
+
+ if self.cur_printer:
+ self.getPrinterState()
+
+ if self.printer_state == cups.IPP_PRINTER_STATE_STOPPED:
+ self.cur_device.sendEvent(EVENT_PRINTER_QUEUE_STOPPED, self.cur_printer)
+
+ if not self.printer_accepting:
+ self.cur_device.sendEvent(EVENT_PRINTER_QUEUE_REJECTING_JOBS, self.cur_printer)
+
+
+ def activateDevice(self, device_uri):
+ log.debug(log.bold("Activate: %s %s %s" % ("*"*20, device_uri, "*"*20)))
+ index = 0
+ d = self.DeviceList.item(index) #firstItem()
+ found = False
+
+ while d is not None:
+ if d.device_uri == device_uri:
+ found = True
+ self.DeviceList.setSelected(d, True)
+ self.DeviceList.setCurrentItem(d)
+ break
+
+ index += 1
+ d = self.DeviceList.item(index)
+
+ return found
+
+
+
+ # ***********************************************************************************
+ #
+ # UPDATES/NOTIFICATIONS
+ #
+ # ***********************************************************************************
+
+ def handleSessionSignal(self, *args, **kwds):
+ if kwds['interface'] == 'com.hplip.Toolbox' and \
+ kwds['member'] == 'Event':
+
+ log.debug("Handling event...")
+ event = device.Event(*args[:6])
+ event.debug()
+
+ if event.event_code < EVENT_MIN_USER_EVENT:
+ pass
+
+ elif event.event_code == EVENT_DEVICE_UPDATE_REPLY:
+ log.debug("EVENT_DEVICE_UPDATE_REPLY (%s)" % event.device_uri)
+ dev = self.findDeviceByURI(event.device_uri)
+
+ if dev is not None:
+ try:
+ self.service.GetStatus(event.device_uri, reply_handler=self.handleStatusReply,
+ error_handler=self.handleStatusError)
+
+ except dbus.exceptions.DBusException as e:
+ log.error("dbus call to GetStatus() failed.")
+
+ elif event.event_code == EVENT_USER_CONFIGURATION_CHANGED:
+ log.debug("EVENT_USER_CONFIGURATION_CHANGED")
+ self.user_settings.load()
+
+ elif event.event_code == EVENT_HISTORY_UPDATE:
+ log.debug("EVENT_HISTORY_UPDATE (%s)" % event.device_uri)
+ dev = self.findDeviceByURI(event.device_uri)
+ if dev is not None:
+ self.updateHistory(dev)
+
+ elif event.event_code == EVENT_SYSTEMTRAY_EXIT:
+ log.debug("EVENT_SYSTEMTRAY_EXIT")
+ log.warn("HPLIP Status Service was closed. HPLIP Device Manager will now exit.")
+ cups.releaseCupsInstance()
+ self.close()
+
+ elif event.event_code == EVENT_RAISE_DEVICE_MANAGER:
+ log.debug("EVENT_RAISE_DEVICE_MANAGER")
+ self.showNormal()
+ self.setWindowState(self.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
+ self.raise_()
+
+ elif event.event_code in (EVENT_DEVICE_START_POLLING,
+ EVENT_DEVICE_STOP_POLLING,
+ EVENT_POLLING_REQUEST):
+ pass
+
+ else:
+ log.error("Unhandled event: %d" % event.event_code)
+
+
+ def handleStatusReply(self, device_uri, data):
+ dev = self.findDeviceByURI(device_uri)
+ if dev is not None:
+ t = {}
+ for key in data:
+ value = model_obj.convert_data(str(key), str(data[key]))
+ t.setdefault(key, value)
+
+ dev.dq = t.copy()
+ for d in dev.dq:
+ dev.__dict__[d.replace('-','_')] = dev.dq[d]
+
+ self.updateDevice(dev)
+
+
+ def handleStatusError(self, e):
+ log.error(str(e))
+
+
+ def updateHistory(self, dev=None):
+ if dev is None:
+ dev = self.cur_device
+
+ try:
+ self.service.GetHistory(dev.device_uri, reply_handler=self.handleHistoryReply,
+ error_handler=self.handleHistoryError)
+ except dbus.exceptions.DBusException as e:
+ log.error("dbus call to GetHistory() failed.")
+
+
+ def handleHistoryReply(self, device_uri, history):
+ dev = self.findDeviceByURI(device_uri)
+ if dev is not None:
+ result = []
+ history.reverse()
+
+ for h in history:
+ result.append(device.Event(*tuple(h)))
+
+ try:
+ self.error_code = result[0].event_code
+ except IndexError:
+ self.error_code = STATUS_UNKNOWN
+
+ dev.error_state = STATUS_TO_ERROR_STATE_MAP.get(self.error_code, ERROR_STATE_CLEAR)
+ dev.hist = result
+
+ self.updateDevice(dev)
+
+
+ def handleHistoryError(self, e):
+ log.error(str(e))
+
+
+ def sendMessage(self, device_uri, printer_name, event_code, username=prop.username,
+ job_id=0, title=''):
+
+ device.Event(device_uri, printer_name, event_code, username,
+ job_id, title).send_via_dbus(self.session_bus)
+
+
+ def timedRefresh(self):
+ if not self.updating and self.user_settings.auto_refresh and self.allow_auto_refresh:
+ log.debug("Refresh timer...")
+ self.cleanupChildren()
+
+ if self.user_settings.auto_refresh_type == 0:
+ self.requestDeviceUpdate()
+ else:
+ self.rescanDevices()
+
+
+ # ***********************************************************************************
+ #
+ # TAB/DEVICE CHANGE SLOTS
+ #
+ # ***********************************************************************************
+
+ def Tabs_currentChanged(self, tab=0):
+ """ Called when the active tab changes.
+ Update newly displayed tab.
+ """
+ if self.cur_device is not None:
+ self.TabIndex[tab]()
+
+ def updateAllTabs(self):
+ for tab in self.TabIndex:
+ self.TabIndex[tab]()
+
+
+ def updateCurrentTab(self):
+ log.debug("updateCurrentTab()")
+ self.TabIndex[self.Tabs.currentIndex()]()
+
+
+
+ # ***********************************************************************************
+ #
+ # DEVICE ICON LIST/DEVICE UPDATE(S)
+ #
+ # ***********************************************************************************
+
+
+ def DeviceRefreshAction_activated(self):
+ self.DeviceRefreshAction.setEnabled(False)
+ self.requestDeviceUpdate()
+ self.DeviceRefreshAction.setEnabled(True)
+
+
+ def RefreshAllAction_activated(self):
+ self.rescanDevices()
+
+
+ def setDeviceListViewMode(self, mode):
+ if mode == QListView.ListMode:
+ self.DeviceList.setViewMode(QListView.ListMode)
+ self.ViewAsListAction.setEnabled(False)
+ self.ViewAsIconsAction.setEnabled(True)
+ else:
+ self.DeviceList.setViewMode(QListView.IconMode)
+ self.ViewAsListAction.setEnabled(True)
+ self.ViewAsIconsAction.setEnabled(False)
+
+
+ def createDeviceIcon(self, dev=None):
+ if dev is None:
+ dev = self.cur_device
+
+ try:
+ dev.icon
+ except AttributeError:
+ dev.icon = "default_printer"
+
+ try:
+ self.device_icons[dev.icon]
+ except:
+ self.device_icons[dev.icon] = load_pixmap(dev.icon, 'devices')
+
+ pix = self.device_icons[dev.icon]
+
+ w, h = pix.width(), pix.height()
+ error_state = dev.error_state
+ icon = QPixmap(w, h)
+ p = QPainter(icon)
+ p.eraseRect(0, 0, icon.width(), icon.height())
+ p.drawPixmap(0, 0, pix)
+
+ try:
+ tech_type = dev.tech_type
+ except AttributeError:
+ tech_type = TECH_TYPE_NONE
+
+ if dev.device_type == DEVICE_TYPE_FAX:
+ p.drawPixmap(w - self.fax_icon.width(), 0, self.fax_icon)
+
+ if error_state != ERROR_STATE_CLEAR:
+ if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
+ status_icon = getStatusOverlayIcon(error_state)[0] # ink
+ else:
+ status_icon = getStatusOverlayIcon(error_state)[1] # laser
+
+ if status_icon is not None:
+ p.drawPixmap(0, 0, status_icon)
+
+ p.end()
+ return icon
+
+
+ def refreshDeviceList(self):
+ global devices
+ log.debug("Rescanning device list...")
+
+ if 1:
+ beginWaitCursor()
+ self.updating = True
+
+ self.setWindowTitle(self.__tr("Refreshing Device List - HP Device Manager"))
+ self.statusBar().showMessage(self.__tr("Refreshing device list..."))
+
+ self.cups_devices = device.getSupportedCUPSDevices(['hp', 'hpfax'])
+
+ current = None
+
+ try:
+ adds = []
+ for d in self.cups_devices:
+ if d not in device_list:
+ adds.append(d)
+
+ log.debug("Adds: %s" % ','.join(adds))
+
+ removals = []
+ for d in device_list:
+ if d not in self.cups_devices:
+ removals.append(d)
+
+ log.debug("Removals (1): %s" % ','.join(removals))
+
+ updates = []
+ for d in device_list:
+ if d not in adds and d not in removals:
+ updates.append(d)
+
+ log.debug("Updates: %s" % ','.join(updates))
+
+ for d in adds:
+ log.debug("adding: %s" % d)
+ # Note: Do not perform any I/O with this device.
+ dev = device.Device(d, service=self.service, disable_dbus=False)
+
+ if not dev.supported:
+ log.debug("Unsupported model - removing device.")
+ removals.append(d)
+ continue
+
+ icon = self.createDeviceIcon(dev)
+
+ if dev.device_type == DEVICE_TYPE_FAX:
+ DeviceViewItem(self.DeviceList, self.__tr("%s (Fax)"%dev.model_ui),
+ icon, d)
+ else:
+ if dev.fax_type:
+ DeviceViewItem(self.DeviceList, self.__tr("%s (Printer)"%dev.model_ui),
+ icon, d)
+ else:
+ DeviceViewItem(self.DeviceList, dev.model_ui,
+ icon, d)
+
+ device_list[d] = dev
+
+ log.debug("Removals (2): %s" % ','.join(removals))
+ removed_device=None
+ for d in removals:
+ removed_device = d
+ index = self.DeviceList.count()-1
+ item = self.DeviceList.item(index)
+ log.debug("removing: %s" % d)
+
+ try:
+ del device_list[d]
+ except KeyError:
+ pass
+
+ while index >= 0 and item is not None:
+ if item.device_uri == d:
+ self.DeviceList.takeItem(index)
+ break
+
+ index -= 1
+ item = self.DeviceList.item(index)
+
+ qApp.processEvents()
+
+ self.DeviceList.updateGeometry()
+ qApp.processEvents()
+
+ if len(device_list):
+ for tab in self.TabIndex:
+ self.Tabs.setTabEnabled(tab, True)
+
+ if self.cur_device_uri:
+ index = 0
+ item = first_item = self.DeviceList.item(index)
+
+ while item is not None:
+ qApp.processEvents()
+ if item.device_uri == self.cur_device_uri:
+ current = item
+ self.statusBar().showMessage(self.cur_device_uri)
+ break
+
+ index += 1
+ item = self.DeviceList.item(index)
+
+ else:
+ self.cur_device = None
+ self.cur_device_uri = ''
+
+ if self.cur_device is None:
+ i = self.DeviceList.item(0)
+ if i is not None:
+ self.cur_device_uri = i.device_uri
+ self.cur_device = device_list[self.cur_device_uri]
+ current = i
+
+ self.updatePrinterCombos()
+
+ if self.cur_device_uri:
+ #user_conf.set('last_used', 'device_uri',self.cur_device_uri)
+ self.user_settings.last_used_device_uri = self.cur_device_uri
+ self.user_settings.save()
+
+ for d in updates + adds:
+ if d not in removals:
+ self.requestDeviceUpdate(device_list[d])
+
+ else: # no devices
+ self.cur_device = None
+ self.DeviceRefreshAction.setEnabled(False)
+ self.RemoveDeviceAction.setEnabled(False)
+ self.DiagnoseQueueAction.setEnabled(False)
+ self.updating = False
+ self.statusBar().showMessage(self.__tr("Press F6 to refresh."))
+
+ for tab in self.TabIndex:
+ self.Tabs.setTabEnabled(tab, False)
+
+ endWaitCursor()
+
+ dlg = NoDevicesDialog(self)
+ dlg.exec_()
+
+ finally:
+ self.updating = False
+ endWaitCursor()
+
+ if current is not None:
+ self.DeviceList.setCurrentItem(current)
+
+ self.DeviceRefreshAction.setEnabled(True)
+
+ if self.cur_device is not None:
+ self.RemoveDeviceAction.setEnabled(True)
+ self.DiagnoseQueueAction.setEnabled(True)
+
+ self.statusBar().showMessage(self.cur_device_uri)
+ self.updateWindowTitle()
+
+
+ def updateWindowTitle(self):
+ if self.cur_device.device_type == DEVICE_TYPE_FAX:
+ self.setWindowTitle(self.__tr("HP Device Manager - %s (Fax)"%self.cur_device.model_ui))
+ else:
+ if self.cur_device.fax_type:
+ self.setWindowTitle(self.__tr("HP Device Manager - %s (Printer)"%self.cur_device.model_ui))
+ else:
+ self.setWindowTitle(self.__tr("HP Device Manager - %s"%self.cur_device.model_ui))
+
+ self.statusBar().showMessage(self.cur_device_uri)
+
+
+ def updateDeviceByURI(self, device_uri):
+ return self.updateDevice(self.findDeviceByURI(device_uri))
+
+
+ def updateDevice(self, dev=None, update_tab=True):
+
+ """ Update the device icon and currently displayed tab.
+ """
+ if dev is None:
+ dev = self.cur_device
+
+ log.debug("updateDevice(%s)" % dev.device_uri)
+
+ item = self.findItem(dev)
+
+ if item is not None:
+ item.setIcon(QIcon(self.createDeviceIcon(dev)))
+
+ if dev is self.cur_device and update_tab:
+ self.updatePrinterCombos()
+ self.updateCurrentTab()
+ self.statusBar().showMessage(self.cur_device_uri)
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Settings), QApplication.translate("MainWindow", "Print Settings", None))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Control), QApplication.translate("MainWindow", "Printer Control", None))
+ else:
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Settings), QApplication.translate("MainWindow", "Fax Settings", None))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Control), QApplication.translate("MainWindow", "Fax Control", None))
+
+
+ def DeviceList_currentChanged(self, i, j):
+ if i is not None and not self.updating:
+ self.cur_device_uri = self.DeviceList.currentItem().device_uri
+ self.cur_device = device_list[self.cur_device_uri]
+ #user_conf.set('last_used', 'device_uri', self.cur_device_uri)
+ self.user_settings.last_used_device_uri = self.cur_device_uri
+ self.user_settings.save()
+
+ self.updateDevice()
+ self.updateWindowTitle()
+
+
+ def findItem(self, dev):
+ if dev is None:
+ dev = self.cur_device
+
+ return self.findItemByURI(dev.device_uri)
+
+
+ def findItemByURI(self, device_uri):
+ index = 0
+ item = self.DeviceList.item(index)
+
+ while item is not None:
+ if item.device_uri == device_uri:
+ return item
+
+ index += 1
+ item = self.DeviceList.item(index)
+
+
+ def findDeviceByURI(self, device_uri):
+ try:
+ return device_list[device_uri]
+ except:
+ return None
+
+
+ def requestDeviceUpdate(self, dev=None, item=None):
+ """ Submit device update request to update thread. """
+
+ if dev is None:
+ dev = self.cur_device
+
+ if dev is not None:
+ dev.error_state = ERROR_STATE_REFRESHING
+ self.updateDevice(dev, update_tab=False)
+
+ self.sendMessage(dev.device_uri, '', EVENT_DEVICE_UPDATE_REQUESTED)
+
+
+ def rescanDevices(self):
+ """ Rescan and update all devices. """
+ if not self.updating:
+ self.RefreshAllAction.setEnabled(False)
+ try:
+ self.refreshDeviceList()
+ finally:
+ self.RefreshAllAction.setEnabled(True)
+
+
+ def callback(self):
+ qApp.processEvents()
+
+
+ # ***********************************************************************************
+ #
+ # DEVICE LIST RIGHT CLICK
+ #
+ # ***********************************************************************************
+
+ def DeviceList_customContextMenuRequested(self, p):
+ d = self.cur_device
+
+ if d is not None:
+ avail = d.device_state != DEVICE_STATE_NOT_FOUND and d.supported
+ printer = d.device_type == DEVICE_TYPE_PRINTER and avail
+
+ fax = d.fax_type > FAX_TYPE_NONE and prop.fax_build and d.device_type == DEVICE_TYPE_FAX and \
+ sys.hexversion >= 0x020300f0 and avail
+
+ scan = d.scan_type > SCAN_TYPE_NONE and prop.scan_build and \
+ printer and self.user_settings.cmd_scan
+
+ cpy = d.copy_type > COPY_TYPE_NONE and printer
+
+ popup = QMenu(self)
+
+ item = self.DeviceList.currentItem()
+ if item is not None:
+ if self.cur_device.error_state != ERROR_STATE_ERROR:
+ if printer:
+ popup.addAction(self.__tr("Print..."), lambda: self.contextMenuFunc(PrintDialog(self, self.cur_printer)))
+
+ if scan:
+ popup.addAction(self.__tr("Scan..."), lambda: self.contextMenuFunc(self.user_settings.cmd_scan)) #self.ScanButton_clicked)
+
+ if cpy:
+ popup.addAction(self.__tr("Make Copies..."), lambda: MakeCopiesDialog(self, self.cur_device_uri)) #self.MakeCopiesButton_clicked)
+
+ else: # self.cur_device.device_type == DEVICE_TYPE_FAX:
+ if fax:
+ popup.addAction(self.__tr("Send Fax..."), lambda: self.contextMenuFunc(SendFaxDialog(self, self.cur_printer, self.cur_device_uri))) #self.SendFaxButton_clicked)
+
+ popup.addSeparator()
+
+ if not self.updating:
+ popup.addAction(self.__tr("Refresh Device"), self.requestDeviceUpdate) #self.DeviceRefreshAction_activated)
+
+ if not self.updating:
+ popup.addAction(self.__tr("Refresh All"), self.rescanDevices) #self.RefreshAllAction_activated)
+
+ popup.addSeparator()
+
+ if self.DeviceList.viewMode() == QListView.IconMode:
+ popup.addAction(self.__tr("View as List"), lambda: self.setDeviceListViewMode(QListView.ListMode))
+ else:
+ popup.addAction(self.__tr("View as Icons"), lambda: self.setDeviceListViewMode(QListView.IconMode))
+
+ popup.exec_(self.DeviceList.mapToGlobal(p))
+
+
+ def contextMenuFunc(self, f):
+ self.sendMessage('', '', EVENT_DEVICE_STOP_POLLING)
+ try:
+ try:
+ f.exec_() # Dialog
+ except AttributeError:
+ beginWaitCursor()
+
+ if f.split(':')[0] in ('http', 'https', 'file'):
+ log.debug("Opening browser to: %s" % f)
+ utils.openURL(f)
+ else:
+ self.runExternalCommand(f)
+
+ QTimer.singleShot(1000, self.unlockClick)
+ finally:
+ self.sendMessage('', '', EVENT_DEVICE_START_POLLING)
+
+
+
+ # ***********************************************************************************
+ #
+ # PRINTER NAME COMBOS
+ #
+ # ***********************************************************************************
+
+
+ def updatePrinterCombos(self):
+ self.PrintSettingsPrinterNameCombo.clear()
+ self.PrintControlPrinterNameCombo.clear()
+
+ if self.cur_device is not None and \
+ self.cur_device.supported:
+
+ self.cur_device.updateCUPSPrinters()
+
+ for c in self.cur_device.cups_printers:
+ self.PrintSettingsPrinterNameCombo.insertItem(0, c)
+ self.PrintControlPrinterNameCombo.insertItem(0, c)
+
+ self.cur_printer = to_unicode(self.PrintSettingsPrinterNameCombo.currentText())
+
+
+ def PrintSettingsPrinterNameCombo_activated(self, s):
+ self.cur_printer = to_unicode(s)
+ self.updateCurrentTab()
+
+
+ def PrintControlPrinterNameCombo_activated(self, s):
+ self.cur_printer = to_unicode(s)
+ self.updateCurrentTab()
+
+
+
+ # ***********************************************************************************
+ #
+ # FUNCTIONS/ACTION TAB
+ #
+ # ***********************************************************************************
+
+ def initActionsTab(self):
+ self.click_lock = None
+ self.ActionsList.setIconSize(QSize(32, 32))
+ self.ActionsList.itemClicked["QListWidgetItem *"].connect(self.ActionsList_clicked)
+ self.ActionsList.itemDoubleClicked["QListWidgetItem *"].connect(self.ActionsList_clicked)
+
+
+ def updateActionsTab(self):
+ beginWaitCursor()
+ try:
+ self.ActionsList.clear()
+
+ d = self.cur_device
+
+ if d is not None:
+ avail = d.device_state != DEVICE_STATE_NOT_FOUND and d.supported
+ fax = d.fax_type > FAX_TYPE_NONE and prop.fax_build and d.device_type == DEVICE_TYPE_FAX and \
+ sys.hexversion >= 0x020300f0 and avail
+ printer = d.device_type == DEVICE_TYPE_PRINTER and avail
+ scan = d.scan_type > SCAN_TYPE_NONE and prop.scan_build and \
+ printer and self.user_settings.cmd_scan
+ cpy = d.copy_type > COPY_TYPE_NONE and printer
+ req_plugin = d.plugin == PLUGIN_REQUIRED
+ opt_plugin = d.plugin == PLUGIN_OPTIONAL
+
+ try:
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(self.cur_device_uri)
+ except Error:
+ return
+
+ hplip_conf = configparser.ConfigParser()
+ fp = open("/etc/hp/hplip.conf", "r")
+ hplip_conf.readfp(fp)
+ fp.close()
+
+ try:
+ plugin_installed = utils.to_bool(hplip_conf.get("hplip", "plugin"))
+ except configparser.NoOptionError:
+ plugin_installed = False
+
+ if d.plugin != PLUGIN_NONE:
+ if req_plugin and plugin_installed:
+ x = self.__tr("Download and install<br>required plugin (already installed).")
+
+ elif req_plugin and not plugin_installed:
+ x = self.__tr("Download and install<br>required plugin (needs installation).")
+
+ elif opt_plugin and plugin_installed:
+ x = self.__tr("Download and install<br>optional plugin (already installed).")
+
+ elif opt_plugin and not plugin_installed:
+ x = self.__tr("Download and install<br>optional plugin (needs installation).")
+
+ else:
+ x = ''
+
+ # TODO: Cache this data structure
+ # -- add a field that specifies if the icon should always show, or only when device is avail.
+ # TODO: Tooltips
+ # TODO: Right-click icon/list view menu
+
+ self.ICONS = [
+
+ # PRINTER
+
+ (lambda : printer,
+ self.__tr("Print"), # Text
+ "print", # Icon
+ self.__tr("Print documents or files."), # Tooltip
+ lambda : PrintDialog(self, self.cur_printer)), # command/action
+
+ (lambda :scan,
+ self.__tr("Scan"),
+ "scan",
+ self.__tr("Scan a document, image, or photograph.<br>"),
+ self.user_settings.cmd_scan),
+
+ (lambda : cpy,
+ self.__tr("Make Copies"),
+ "makecopies",
+ self.__tr("Make copies on the device controlled by the PC.<br>"),
+ lambda : MakeCopiesDialog(self, self.cur_device_uri)),
+
+ # FAX
+
+ (lambda: fax,
+ self.__tr("Send Fax"),
+ "fax",
+ self.__tr("Send a fax from the PC."),
+ lambda : SendFaxDialog(self, self.cur_printer, self.cur_device_uri)),
+
+ (lambda: fax,
+ self.__tr("Fax Setup"),
+ "fax_setup",
+ self.__tr("Fax support must be setup before you can send faxes."),
+ lambda : FaxSetupDialog(self, self.cur_device_uri)),
+
+ (lambda: fax and self.user_settings.cmd_fab,
+ self.__tr("Fax Address Book"),
+ "fab",
+ self.__tr("Setup fax phone numbers to use when sending faxes from the PC."),
+ self.user_settings.cmd_fab),
+
+ # SETTINGS/TOOLS
+
+ (lambda : d.power_settings != POWER_SETTINGS_NONE and avail,
+ self.__tr("Device Settings"),
+ "settings",
+ self.__tr("Your device has special device settings.<br>You may alter these settings here."),
+ lambda : DeviceSetupDialog(self, self.cur_device_uri)),
+
+ (lambda : printer,
+ self.__tr("Print Test Page"),
+ "testpage",
+ self.__tr("Print a test page to test the setup of your printer."),
+ lambda : PrintTestPageDialog(self, self.cur_printer)),
+
+ (lambda : True,
+ self.__tr("View Printer and Device Information"),
+ "cups",
+ self.__tr("View information about the device and all its CUPS queues."),
+ lambda : InfoDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.align_type != ALIGN_TYPE_NONE,
+ self.__tr("Align Cartridges (Print Heads)"),
+ "align",
+ self.__tr("This will improve the quality of output when a new cartridge is installed."),
+ lambda : AlignDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.clean_type != CLEAN_TYPE_NONE,
+ self.__tr("Clean Printheads"),
+ "clean",
+ self.__tr("You only need to perform this action if you are<br>having problems with poor printout quality due to clogged ink nozzles."),
+ lambda : CleanDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.color_cal_type != COLOR_CAL_TYPE_NONE and d.color_cal_type == COLOR_CAL_TYPE_TYPHOON,
+ self.__tr("Color Calibration"),
+ "colorcal",
+ self.__tr("Use this procedure to optimimize your printer's color output<br>(requires glossy photo paper)."),
+ lambda : ColorCalDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.color_cal_type != COLOR_CAL_TYPE_NONE and d.color_cal_type != COLOR_CAL_TYPE_TYPHOON,
+ self.__tr("Color Calibration"),
+ "colorcal",
+ self.__tr("Use this procedure to optimimize your printer's color output."),
+ lambda : ColorCalDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.linefeed_cal_type != LINEFEED_CAL_TYPE_NONE,
+ self.__tr("Line Feed Calibration"),
+ "linefeed_cal",
+ self.__tr("Use line feed calibration to optimize print quality<br>(to remove gaps in the printed output)."),
+ lambda : LineFeedCalDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.pq_diag_type != PQ_DIAG_TYPE_NONE,
+ self.__tr("Print Diagnostic Page"),
+ "pq_diag",
+ self.__tr("Your printer can print a test page <br>to help diagnose print quality problems."),
+ lambda : PQDiagDialog(self, self.cur_device_uri)),
+
+ (lambda: printer and d.wifi_config >= WIFI_CONFIG_USB_XML and bus == 'usb',
+ self.__tr("Wireless/wifi setup using USB"),
+ "wireless",
+ self.__tr("Configure your wireless capable printer using a temporary USB connection."),
+ 'hp-wificonfig -d %s' % self.cur_device_uri),
+
+ # FIRMWARE
+
+ (lambda : printer and d.fw_download ,
+ self.__tr("Download Firmware"),
+ "firmware",
+ self.__tr("Download firmware to your printer <br>(required on some devices after each power-up)."),
+ lambda : FirmwareDialog(self, self.cur_device_uri)),
+
+ # PLUGIN
+
+ (lambda : printer and req_plugin,
+ self.__tr("Install Required Plugin"),
+ "plugin",
+ x,
+ lambda : PluginInstall(self, d.plugin, plugin_installed)),
+
+ (lambda : printer and opt_plugin,
+ self.__tr("Install Optional Plugin"),
+ "plugin",
+ x,
+ lambda : PluginInstall(self, d.plugin, plugin_installed)),
+
+ # EWS
+
+ (lambda : printer and d.embedded_server_type > EWS_NONE and bus == 'net',
+ self.__tr("Open printer's web page in a browser"),
+ "ews",
+ self.__tr("The printer's web page has supply, status, and other information."),
+ openEWS(host, zc)),
+
+ # HELP/WEBSITE
+
+ (lambda : True,
+ self.__tr("Visit HPLIP Support Website"),
+ "hp_logo",
+ self.__tr("Visit HPLIP Support Website."),
+ self.support),
+
+ (lambda : True,
+ self.__tr("Help"),
+ "help",
+ self.__tr("View HPLIP help."),
+ self.docs),
+
+ ]
+
+ if not self.func_icons_cached:
+ for filte, text, icon, tooltip, cmd in self.ICONS:
+ self.func_icons[icon] = load_pixmap(icon, '32x32')
+ self.func_icons_cached = True
+
+ for fltr, text, icon, tooltip, cmd in self.ICONS:
+ if fltr is not None:
+ if not fltr():
+ continue
+
+ FuncViewItem(self.ActionsList, text,
+ self.func_icons[icon],
+ tooltip,
+ cmd)
+ finally:
+ endWaitCursor()
+
+
+ def ActionsList_clicked(self, item):
+ if item is not None and self.click_lock is not item:
+ self.click_lock = item
+ if item.cmd and isinstance(item.cmd, collections.Callable):
+ dlg = item.cmd()
+ self.sendMessage('', '', EVENT_DEVICE_STOP_POLLING)
+ try:
+ dlg.exec_()
+ finally:
+ self.sendMessage('', '', EVENT_DEVICE_START_POLLING)
+
+ else:
+ beginWaitCursor()
+ if item.cmd.split(':')[0] in ('http', 'https', 'file'):
+ log.debug("Opening browser to: %s" % item.cmd)
+ utils.openURL(item.cmd)
+ else:
+ self.runExternalCommand(str(item.cmd))
+
+ QTimer.singleShot(1000, self.unlockClick)
+
+
+ def unlockClick(self):
+ self.click_lock = None
+ endWaitCursor()
+
+
+ def ActionsList_customContextMenuRequested(self, p):
+ print(p)
+ #pass
+
+
+ # ***********************************************************************************
+ #
+ # STATUS TAB
+ #
+ # ***********************************************************************************
+
+ def initStatusTab(self):
+ self.StatusTable.setColumnCount(0)
+ self.status_headers = [self.__tr(""), self.__tr("Status"), self.__tr("Date and Time"),
+ self.__tr("Code"), self.__tr("Job ID"), self.__tr("Description")]
+
+
+ def updateStatusTab(self):
+ self.updateStatusLCD()
+ self.updateStatusTable()
+
+
+ def updateStatusLCD(self):
+ if self.cur_device is not None and \
+ self.cur_device.hist and \
+ self.cur_device.supported:
+
+ dq = self.cur_device.dq
+
+ if dq.get('panel', 0) == 1:
+ line1 = dq.get('panel-line1', '')
+ line2 = dq.get('panel-line2', '')
+ else:
+ try:
+ line1 = device.queryString(self.cur_device.hist[0].event_code)
+ except (AttributeError, TypeError):
+ line1 = ''
+
+ line2 = ''
+
+ self.drawStatusLCD(line1, line2)
+
+ else:
+ if self.cur_device.status_type == STATUS_TYPE_NONE:
+ self.drawStatusLCD(self.__tr("Status information not"), self.__tr("available for this device."))
+
+ elif not self.cur_device.supported:
+ self.drawStatusLCD(self.__tr("Device not supported."))
+
+ elif not self.cur_device.hist:
+ self.drawStatusLCD(self.__tr("No status history available."))
+
+ else:
+ self.drawStatusLCD()
+
+
+ def drawStatusLCD(self, line1='', line2=''):
+ pm = load_pixmap('panel_lcd', 'other')
+
+ p = QPainter()
+ p.begin(pm)
+ p.setPen(QColor(0, 0, 0))
+ p.setFont(self.font())
+
+ x, y_line1, y_line2 = 10, 17, 33
+
+ # TODO: Scroll long lines
+ if line1:
+ p.drawText(x, y_line1, line1)
+
+ if line2:
+ p.drawText(x, y_line2, line2)
+
+ p.end()
+
+ self.LCD.setPixmap(pm)
+
+
+
+ def updateStatusTable(self):
+ self.StatusTable.clear()
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ row = 0
+ hist = self.cur_device.hist[:]
+
+ if hist:
+ self.StatusTable.setRowCount(len(hist))
+ self.StatusTable.setColumnCount(len(self.status_headers))
+ self.StatusTable.setHorizontalHeaderLabels(self.status_headers)
+ self.StatusTable.verticalHeader().hide()
+ self.StatusTable.horizontalHeader().show()
+
+ hist.reverse()
+ row = len(hist)-1
+
+ for e in hist:
+ if e is None:
+ continue
+
+ ess = device.queryString(e.event_code, 0)
+ esl = device.queryString(e.event_code, 1)
+
+ if row == 0:
+ desc = self.__tr("(most recent)")
+
+ else:
+ desc = getTimeDeltaDesc(e.timedate)
+
+ dt = QDateTime()
+ dt.setTime_t(int(e.timedate)) #, Qt.LocalTime)
+
+ # TODO: In Qt4.x, use QLocale.toString(date, format)
+ tt = str("%s %s"%(dt.toString(),desc))
+
+ if e.job_id:
+ job_id = to_unicode(e.job_id)
+ else:
+ job_id = to_unicode('')
+
+ error_state = STATUS_TO_ERROR_STATE_MAP.get(e.event_code, ERROR_STATE_CLEAR)
+ tech_type = self.cur_device.tech_type
+
+ if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
+ status_pix = getStatusListIcon(error_state)[0] # ink
+ else:
+ status_pix = getStatusListIcon(error_state)[1] # laser
+
+ event_code = to_unicode(e.event_code)
+
+ i = QTableWidgetItem(QIcon(status_pix), self.__tr(""))
+ i.setFlags(flags)
+ self.StatusTable.setItem(row, 0, i)
+
+ for col, t in [(1, ess), (2, tt), (3, event_code), (4, job_id), (5, esl)]:
+ i = QTableWidgetItem(str(t))
+ i.setFlags(flags)
+
+ self.StatusTable.setItem(row, col, i)
+
+ row -= 1
+
+ self.StatusTable.resizeColumnsToContents()
+ self.StatusTable.setColumnWidth(0, 24)
+
+ else:
+ self.StatusTable.setRowCount(1)
+ self.StatusTable.setColumnCount(2)
+ self.StatusTable.setHorizontalHeaderLabels(["", ""])
+ self.StatusTable.verticalHeader().hide()
+ self.StatusTable.horizontalHeader().hide()
+
+ flags = Qt.ItemIsEnabled
+
+ pixmap = getStatusListIcon(ERROR_STATE_ERROR)[0]
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr(""))
+ i.setFlags(flags)
+ self.StatusTable.setItem(row, 0, i)
+
+ i = QTableWidgetItem(self.__tr("Status information not available for this device."))
+ i.setFlags(flags)
+ self.StatusTable.setItem(0, 1, i)
+
+ self.StatusTable.resizeColumnsToContents()
+ self.StatusTable.setColumnWidth(0, 24)
+
+
+ # ***********************************************************************************
+ #
+ # SUPPLIES TAB
+ #
+ # ***********************************************************************************
+
+ def initSuppliesTab(self):
+ self.pix_battery = load_pixmap('battery', '16x16')
+
+ yellow = "#ffff00"
+ light_yellow = "#ffffcc"
+ cyan = "#00ffff"
+ light_cyan = "#ccffff"
+ magenta = "#ff00ff"
+ light_magenta = "#ffccff"
+ black = "#000000"
+ blue = "#0000ff"
+ gray = "#808080"
+ dark_gray = "#a9a9a9"
+ light_gray = "#c0c0c0"
+ red = "#ff0000"
+
+ self.TYPE_TO_PIX_MAP = {
+ AGENT_TYPE_UNSPECIFIED : [black],
+ AGENT_TYPE_BLACK: [black],
+ AGENT_TYPE_MATTE_BLACK : [black],
+ AGENT_TYPE_PHOTO_BLACK : [dark_gray],
+ AGENT_TYPE_BLACK_B8800: [black],
+ AGENT_TYPE_CMY: [cyan, magenta, yellow],
+ AGENT_TYPE_KCM: [light_cyan, light_magenta, light_yellow],
+ AGENT_TYPE_GGK: [dark_gray],
+ AGENT_TYPE_YELLOW: [yellow],
+ AGENT_TYPE_MAGENTA: [magenta],
+ AGENT_TYPE_CYAN : [cyan],
+ AGENT_TYPE_CYAN_LOW: [light_cyan],
+ AGENT_TYPE_YELLOW_LOW: [light_yellow],
+ AGENT_TYPE_MAGENTA_LOW: [light_magenta],
+ AGENT_TYPE_BLUE: [blue],
+ AGENT_TYPE_KCMY_CM: [yellow, cyan, magenta],
+ AGENT_TYPE_LC_LM: [light_cyan, light_magenta],
+ #AGENT_TYPE_Y_M: [yellow, magenta],
+ #AGENT_TYPE_C_K: [black, cyan],
+ AGENT_TYPE_LG_PK: [light_gray, dark_gray],
+ AGENT_TYPE_LG: [light_gray],
+ AGENT_TYPE_G: [gray],
+ AGENT_TYPE_DG: [dark_gray],
+ AGENT_TYPE_PG: [light_gray],
+ AGENT_TYPE_C_M: [cyan, magenta],
+ AGENT_TYPE_K_Y: [black, yellow],
+ AGENT_TYPE_LC: [light_cyan],
+ AGENT_TYPE_RED : [red],
+ }
+
+ self.supplies_headers = [self.__tr(""), self.__tr("Description"),
+ self.__tr("HP Part No."), self.__tr("Approx. Level"),
+ self.__tr("Status")]
+
+
+ def updateSuppliesTab(self):
+ beginWaitCursor()
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ try:
+ self.SuppliesTable.clear()
+ self.SuppliesTable.setRowCount(0)
+ self.SuppliesTable.setColumnCount(0)
+
+ if self.cur_device is not None and \
+ self.cur_device.supported and \
+ self.cur_device.status_type != STATUS_TYPE_NONE and \
+ self.cur_device.device_state != DEVICE_STATE_NOT_FOUND:
+ self.cur_device.sorted_supplies = []
+ a = 1
+ while True:
+ try:
+ agent_type = int(self.cur_device.dq['agent%d-type' % a])
+ agent_kind = int(self.cur_device.dq['agent%d-kind' % a])
+ agent_sku = self.cur_device.dq['agent%d-sku' % a]
+ except KeyError:
+ break
+ else:
+ self.cur_device.sorted_supplies.append((a, agent_kind, agent_type, agent_sku))
+
+ a += 1
+
+ self.cur_device.sorted_supplies.sort(key=utils.cmp_to_key(utils.levelsCmp))
+
+ self.SuppliesTable.setRowCount(len(self.cur_device.sorted_supplies))
+ self.SuppliesTable.setColumnCount(len(self.supplies_headers))
+ self.SuppliesTable.setHorizontalHeaderLabels(self.supplies_headers)
+ self.SuppliesTable.verticalHeader().hide()
+ self.SuppliesTable.horizontalHeader().show()
+ self.SuppliesTable.setIconSize(QSize(100, 18))
+
+ for row, x in enumerate(self.cur_device.sorted_supplies):
+ a, agent_kind, agent_type, agent_sku = x
+ try:
+ agent_level = int(self.cur_device.dq['agent%d-level' % a])
+ agent_desc = self.cur_device.dq['agent%d-desc' % a]
+ agent_health_desc = self.cur_device.dq['agent%d-health-desc' % a]
+ except KeyError:
+ break
+ # Bar graph level
+ level_pixmap = None
+ if agent_kind in (AGENT_KIND_SUPPLY,
+ #AGENT_KIND_HEAD,
+ AGENT_KIND_HEAD_AND_SUPPLY,
+ AGENT_KIND_TONER_CARTRIDGE,
+ AGENT_KIND_MAINT_KIT,
+ AGENT_KIND_ADF_KIT,
+ AGENT_KIND_INT_BATTERY,
+ AGENT_KIND_DRUM_KIT,
+ ):
+
+ level_pixmap = self.createStatusLevelGraphic(agent_level, agent_type)
+
+ # Color icon
+ pixmap = None
+ if agent_kind in (AGENT_KIND_SUPPLY,
+ AGENT_KIND_HEAD,
+ AGENT_KIND_HEAD_AND_SUPPLY,
+ AGENT_KIND_TONER_CARTRIDGE,
+ #AGENT_KIND_MAINT_KIT,
+ #AGENT_KIND_ADF_KIT,
+ AGENT_KIND_INT_BATTERY,
+ #AGENT_KIND_DRUM_KIT,
+ ):
+
+ pixmap = self.getStatusIcon(agent_kind, agent_type)
+
+ if pixmap is not None:
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr(""))
+ i.setFlags(flags)
+ self.SuppliesTable.setItem(row, 0, i)
+
+ for col, t in [(1, agent_desc), (2, agent_sku), (4, agent_health_desc)]:
+ i = QTableWidgetItem(str(t))
+ i.setFlags(flags)
+ self.SuppliesTable.setItem(row, col, i)
+
+ if level_pixmap is not None:
+ i = QTableWidgetItem(QIcon(level_pixmap), self.__tr(""))
+ i.setFlags(flags)
+ self.SuppliesTable.setItem(row, 3, i)
+
+ self.SuppliesTable.resizeColumnsToContents()
+ self.SuppliesTable.setColumnWidth(0, 24)
+ self.SuppliesTable.setColumnWidth(3, 120)
+
+ else: # No supplies info
+ log.warning("Supplies information not available for this device.")
+ flags = Qt.ItemIsEnabled
+ self.SuppliesTable.setRowCount(1)
+ self.SuppliesTable.setColumnCount(2)
+ self.SuppliesTable.setHorizontalHeaderLabels(["", ""])
+ self.SuppliesTable.verticalHeader().hide()
+ self.SuppliesTable.horizontalHeader().hide()
+
+ i = QTableWidgetItem(self.__tr("Supplies information not available for this device."))
+ i.setFlags(flags)
+ self.SuppliesTable.setItem(0, 1, i)
+
+ pixmap = getStatusListIcon(ERROR_STATE_ERROR)[0]
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr(""))
+ i.setFlags(flags)
+ self.SuppliesTable.setItem(0, 0, i)
+
+ self.SuppliesTable.resizeColumnsToContents()
+ self.SuppliesTable.setColumnWidth(0, 24)
+
+ finally:
+ endWaitCursor()
+
+
+ def getStatusIcon(self, agent_kind, agent_type):
+ if agent_kind in (AGENT_KIND_SUPPLY,
+ AGENT_KIND_HEAD,
+ AGENT_KIND_HEAD_AND_SUPPLY,
+ AGENT_KIND_TONER_CARTRIDGE):
+
+ map = self.TYPE_TO_PIX_MAP[agent_type]
+
+ if isinstance(map, list):
+ map_len = len(map)
+ pix = QPixmap(16, 16)
+ pix.fill(QColor(0, 0, 0, 0))
+ p = QPainter()
+
+ p.begin(pix)
+ p.setRenderHint(QPainter.Antialiasing)
+
+ if map_len == 1:
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(2, 2, 10, 10, 0, 5760)
+
+ elif map_len == 2:
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(2, 4, 8, 8, 0, 5760)
+
+ p.setPen(QColor(map[1]))
+ p.setBrush(QBrush(QColor(map[1]), Qt.SolidPattern))
+ p.drawPie(6, 4, 8, 8, 0, 5760)
+
+ elif map_len == 3:
+ p.setPen(QColor(map[2]))
+ p.setBrush(QBrush(QColor(map[2]), Qt.SolidPattern))
+ p.drawPie(6, 6, 8, 8, 0, 5760)
+
+ p.setPen(QColor(map[1]))
+ p.setBrush(QBrush(QColor(map[1]), Qt.SolidPattern))
+ p.drawPie(2, 6, 8, 8, 0, 5760)
+
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(4, 2, 8, 8, 0, 5760)
+
+ p.end()
+ return pix
+
+ else:
+ return map
+
+ elif agent_kind == AGENT_KIND_INT_BATTERY:
+ return self.pix_battery
+
+
+ def createStatusLevelGraphic(self, percent, agent_type, w=100, h=18):
+ if percent:
+ fw = w/100*percent
+ else:
+ fw = 0
+
+ px = QPixmap(w, h)
+ px.fill(QColor(0, 0, 0, 0))
+ pp = QPainter()
+ pp.begin(px)
+ pp.setRenderHint(QPainter.Antialiasing)
+ pp.setPen(Qt.black)
+
+ map = self.TYPE_TO_PIX_MAP[agent_type]
+ map_len = len(map)
+
+ if map_len == 1 or map_len > 3:
+ pp.fillRect(0, 0, fw, h, QBrush(QColor(map[0])))
+
+ elif map_len == 2:
+ h2 = h / 2
+ pp.fillRect(0, 0, fw, h2, QBrush(QColor(map[0])))
+ pp.fillRect(0, h2, fw, h, QBrush(QColor(map[1])))
+
+ elif map_len == 3:
+ h3 = h / 3
+ h23 = 2 * h3
+ pp.fillRect(0, 0, fw, h3, QBrush(QColor(map[0])))
+ pp.fillRect(0, h3, fw, h23, QBrush(QColor(map[1])))
+ pp.fillRect(0, h23, fw, h, QBrush(QColor(map[2])))
+
+ # draw black frame
+ pp.drawRect(0, 0, w, h)
+
+ if percent > 75 and agent_type in \
+ (AGENT_TYPE_BLACK, AGENT_TYPE_UNSPECIFIED, AGENT_TYPE_BLUE):
+ pp.setPen(Qt.white)
+
+ # 75% ticks
+ w1 = 3 * w / 4
+ h6 = h / 6
+ pp.drawLine(w1, 0, w1, h6)
+ pp.drawLine(w1, h, w1, h-h6)
+
+ if percent > 50 and agent_type in \
+ (AGENT_TYPE_BLACK, AGENT_TYPE_UNSPECIFIED, AGENT_TYPE_BLUE):
+ pp.setPen(Qt.white)
+
+ # 50% ticks
+ w2 = w / 2
+ h4 = h / 4
+ pp.drawLine(w2, 0, w2, h4)
+ pp.drawLine(w2, h, w2, h-h4)
+
+ if percent > 25 and agent_type in \
+ (AGENT_TYPE_BLACK, AGENT_TYPE_UNSPECIFIED, AGENT_TYPE_BLUE):
+ pp.setPen(Qt.white)
+
+ # 25% ticks
+ w4 = w / 4
+ pp.drawLine(w4, 0, w4, h6)
+ pp.drawLine(w4, h, w4, h-h6)
+
+ pp.end()
+
+ return px
+
+
+
+ # ***********************************************************************************
+ #
+ # PRINTER SETTINGS TAB
+ #
+ # ***********************************************************************************
+
+ def initPrintSettingsTab(self):
+ pass
+
+
+ def updatePrintSettingsTab(self):
+ beginWaitCursor()
+ try:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.PrintSettingsPrinterNameLabel.setText(self.__tr("Printer Name:"))
+ else:
+ self.PrintSettingsPrinterNameLabel.setText(self.__tr("Fax Name:"))
+
+ self.PrintSettingsToolbox.updateUi(self.cur_device, self.cur_printer)
+ finally:
+ endWaitCursor()
+
+
+ # ***********************************************************************************
+ #
+ # PRINTER CONTROL TAB
+ #
+ # ***********************************************************************************
+
+ def initPrintControlTab(self):
+ self.JOB_STATES = { cups.IPP_JOB_PENDING : self.__tr("Pending"),
+ cups.IPP_JOB_HELD : self.__tr("On hold"),
+ cups.IPP_JOB_PROCESSING : self.__tr("Printing"),
+ cups.IPP_JOB_STOPPED : self.__tr("Stopped"),
+ cups.IPP_JOB_CANCELLED : self.__tr("Canceled"),
+ cups.IPP_JOB_ABORTED : self.__tr("Aborted"),
+ cups.IPP_JOB_COMPLETED : self.__tr("Completed"),
+ }
+
+ self.CancelJobButton.setIcon(QIcon(load_pixmap('cancel', '16x16')))
+ self.RefreshButton.setIcon(QIcon(load_pixmap('refresh', '16x16')))
+
+ self.JOB_STATE_ICONS = { cups.IPP_JOB_PENDING: QIcon(load_pixmap("busy", "16x16")),
+ cups.IPP_JOB_HELD : QIcon(load_pixmap("busy", "16x16")),
+ cups.IPP_JOB_PROCESSING : QIcon(load_pixmap("print", "16x16")),
+ cups.IPP_JOB_STOPPED : QIcon(load_pixmap("warning", "16x16")),
+ cups.IPP_JOB_CANCELLED : QIcon(load_pixmap("warning", "16x16")),
+ cups.IPP_JOB_ABORTED : QIcon(load_pixmap("error", "16x16")),
+ cups.IPP_JOB_COMPLETED : QIcon(load_pixmap("ok", "16x16")),
+ }
+
+ self.StartStopButton.clicked.connect(self.StartStopButton_clicked)
+ self.AcceptRejectButton.clicked.connect(self.AcceptRejectButton_clicked)
+ self.SetDefaultButton.clicked.connect(self.SetDefaultButton_clicked)
+ self.CancelJobButton.clicked.connect(self.CancelJobButton_clicked)
+ self.RefreshButton.clicked.connect(self.RefreshButton_clicked)
+
+ self.job_headers = [self.__tr("Status"), self.__tr("Title/Description"), self.__tr("Job ID")]
+
+ # TODO: Check queues at startup and send events if stopped or rejecting
+
+
+ def initUpgradeTab(self):
+ self.InstallLatestButton.clicked.connect(self.InstallLatestButton_clicked)
+ self.InstallLatestButton_lock = False
+
+
+ def InstallLatestButton_clicked(self):
+ if self.InstallLatestButton_lock is True:
+ return
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton.setEnabled(False)
+ terminal_cmd = utils.get_terminal()
+ if terminal_cmd is not None and utils.which("hp-upgrade"):
+ cmd = terminal_cmd + " 'hp-upgrade -w'"
+ os_utils.execute(cmd)
+ else:
+ log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd)
+ self.InstallLatestButton.setEnabled(True)
+ else:
+ self.InstallLatestButton_lock = True
+ utils.openURL("http://hplipopensource.com/hplip-web/install/manual/index.html")
+ QTimer.singleShot(1000, self.InstallLatestButton_unlock)
+
+
+ def InstallLatestButton_unlock(self):
+ self.InstallLatestButton_lock = False
+
+
+ def CancelJobButton_clicked(self):
+ item = self.JobTable.currentItem()
+
+ if item is not None:
+ job_id, ok = value_int(item.data(Qt.UserRole))
+ if ok and job_id:
+ self.cur_device.cancelJob(job_id)
+ QTimer.singleShot(1000, self.updatePrintControlTab)
+
+
+ def RefreshButton_clicked(self):
+ self.updatePrintControlTab()
+
+ def updateHPLIPupgrade(self):
+ self.initUpgradeTab()
+
+
+
+
+ def updatePrintControlTab(self):
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.PrintControlPrinterNameLabel.setText(self.__tr("Printer Name:"))
+ self.groupBox.setTitle(QApplication.translate("MainWindow", "Printer Queue Control", None))
+ else:
+ self.PrintControlPrinterNameLabel.setText(self.__tr("Fax Name:"))
+ self.groupBox.setTitle(QApplication.translate("MainWindow", "Fax Queue Control", None))
+
+ self.JobTable.clear()
+ self.JobTable.setRowCount(0)
+ self.JobTable.setColumnCount(0)
+ self.updatePrintController()
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+ jobs = cups.getJobs()
+ num_jobs = 0
+ for j in jobs:
+ if j.dest == self.cur_printer:
+ num_jobs += 1
+
+ if num_jobs:
+ self.CancelJobButton.setEnabled(True)
+ self.JobTable.setRowCount(num_jobs)
+ self.JobTable.setColumnCount(len(self.job_headers))
+ self.JobTable.setHorizontalHeaderLabels(self.job_headers)
+
+ for row, j in enumerate(jobs):
+ if j.dest == self.cur_printer:
+ i = QTableWidgetItem(self.JOB_STATE_ICONS[j.state], self.JOB_STATES[j.state])
+ i.setData(Qt.UserRole, j.id)
+ i.setFlags(flags)
+ self.JobTable.setItem(row, 0, i)
+
+ i = QTableWidgetItem(j.title)
+ i.setFlags(flags)
+ self.JobTable.setItem(row, 1, i)
+
+ i = QTableWidgetItem(to_unicode(j.id))
+ i.setFlags(flags)
+ self.JobTable.setItem(row, 2, i)
+
+
+ self.JobTable.setCurrentCell(0, 0)
+ self.JobTable.resizeColumnsToContents()
+
+ else:
+ self.CancelJobButton.setEnabled(False)
+
+
+ def getPrinterState(self):
+ self.printer_state = cups.IPP_PRINTER_STATE_IDLE
+ self.printer_accepting = True
+ cups_printers = cups.getPrinters()
+
+ for p in cups_printers:
+ if p.name == self.cur_printer:
+ self.printer_state = p.state
+ self.printer_accepting = p.accepting
+ break
+
+
+ def updatePrintController(self):
+ # default printer
+ self.SetDefaultButton.setText(self.__tr("Set as Default"))
+
+ default_printer = cups.getDefaultPrinter()
+
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ device_string = "Printer"
+ else:
+ device_string = "Fax"
+
+ if default_printer == self.cur_printer:
+ self.SetDefaultLabel.setText(self.__tr("Default %s"%device_string))
+ self.SetDefaultIcon.setPixmap(load_pixmap("ok", "16x16"))
+ self.SetDefaultButton.setEnabled(False)
+
+ else:
+ self.SetDefaultLabel.setText(self.__tr("Not Default %s"%device_string))
+ self.SetDefaultIcon.setPixmap(load_pixmap("info", "16x16"))
+ self.SetDefaultButton.setEnabled(True)
+
+ self.getPrinterState()
+
+ # start/stop
+ if self.printer_state == cups.IPP_PRINTER_STATE_IDLE:
+ self.StartStopLabel.setText(self.__tr("Started/Idle"))
+ self.StartStopIcon.setPixmap(load_pixmap("idle", "16x16"))
+ self.StartStopButton.setText(self.__tr("Stop %s"%device_string))
+
+
+ elif self.printer_state == cups.IPP_PRINTER_STATE_PROCESSING:
+ self.StartStopLabel.setText(self.__tr("Started/Processing"))
+ self.StartStopIcon.setPixmap(load_pixmap("busy", "16x16"))
+ self.StartStopButton.setText(self.__tr("Stop %s"%device_string))
+
+ else:
+ self.StartStopLabel.setText(self.__tr("Stopped"))
+ self.StartStopIcon.setPixmap(load_pixmap("warning", "16x16"))
+ self.StartStopButton.setText(self.__tr("Start %s"%device_string))
+
+ # reject/accept
+ if self.printer_accepting:
+ self.AcceptRejectLabel.setText(self.__tr("Accepting Jobs"))
+ self.AcceptRejectIcon.setPixmap(load_pixmap("idle", "16x16"))
+ self.AcceptRejectButton.setText(self.__tr("Reject Jobs"))
+
+ else:
+ self.AcceptRejectLabel.setText(self.__tr("Rejecting Jobs"))
+ self.AcceptRejectIcon.setPixmap(load_pixmap("warning", "16x16"))
+ self.AcceptRejectButton.setText(self.__tr("Accept Jobs"))
+
+
+
+ def StartStopButton_clicked(self):
+ beginWaitCursor()
+ try:
+ if self.printer_state in (cups.IPP_PRINTER_STATE_IDLE, cups.IPP_PRINTER_STATE_PROCESSING):
+ result, result_str = cups.cups_operation(cups.stop, GUI_MODE, 'qt4', self, self.cur_printer)
+ if result == cups.IPP_OK:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_STOPPED
+ else:
+ e = EVENT_FAX_QUEUE_STOPPED
+
+ else:
+ result, result_str = cups.cups_operation(cups.start, GUI_MODE, 'qt4', self, self.cur_printer)
+ if result == cups.IPP_OK:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_STARTED
+ else:
+ e = EVENT_FAX_QUEUE_STARTED
+
+ if result == cups.IPP_OK:
+ self.updatePrintController()
+ self.cur_device.sendEvent(e, self.cur_printer)
+ else:
+ FailureUI(self, self.__tr("<b>Start/Stop printer queue operation fails. </b><p>Error : %s"%result_str))
+ cups.releaseCupsInstance()
+
+ finally:
+ endWaitCursor()
+
+
+
+ def AcceptRejectButton_clicked(self):
+ beginWaitCursor()
+ try:
+ if self.printer_accepting:
+ result, result_str = cups.cups_operation(cups.reject, GUI_MODE, 'qt4', self, self.cur_printer)
+ if result == cups.IPP_OK:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_REJECTING_JOBS
+ else:
+ e = EVENT_FAX_QUEUE_REJECTING_JOBS
+
+ else:
+ result, result_str = cups.cups_operation(cups.accept, GUI_MODE, 'qt4', self, self.cur_printer)
+ if result == cups.IPP_OK:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_ACCEPTING_JOBS
+ else:
+ e = EVENT_FAX_QUEUE_ACCEPTING_JOBS
+
+ if result == cups.IPP_OK:
+ self.updatePrintController()
+ self.cur_device.sendEvent(e, self.cur_printer)
+ else:
+ FailureUI(self, self.__tr("<b>Accept/Reject printer queue operation fails.</b><p>Error : %s"%result_str))
+ cups.releaseCupsInstance()
+
+ finally:
+ endWaitCursor()
+
+
+
+ def SetDefaultButton_clicked(self):
+ beginWaitCursor()
+ try:
+ result, result_str = cups.cups_operation(cups.setDefaultPrinter, GUI_MODE, 'qt4', self, self.cur_printer.encode('utf8'))
+ if result != cups.IPP_OK:
+ FailureUI(self, self.__tr("<b>Set printer queue as default operation fails. </b><p>Error : %s"%result_str))
+ cups.releaseCupsInstance()
+ else:
+ self.updatePrintController()
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_SET_AS_DEFAULT
+ else:
+ e = EVENT_FAX_QUEUE_SET_AS_DEFAULT
+
+ self.cur_device.sendEvent(e, self.cur_printer)
+
+ finally:
+ endWaitCursor()
+
+
+
+ def cancelCheckedJobs(self):
+ beginWaitCursor()
+ try:
+ item = self.JobTable.firstChild()
+ while item is not None:
+ if item.isOn():
+ self.cur_device.cancelJob(item.job_id)
+
+ item = item.nextSibling()
+
+ finally:
+ endWaitCursor()
+
+
+ self.updatePrintControlTab()
+
+
+
+
+ # ***********************************************************************************
+ #
+ # EXIT/CHILD CLEANUP
+ #
+ # ***********************************************************************************
+
+ def closeEvent(self, event):
+ self.cleanup()
+ event.accept()
+
+
+ def cleanup(self):
+ self.cleanupChildren()
+
+
+ def cleanupChildren(self):
+ log.debug("Cleaning up child processes.")
+ try:
+ os.waitpid(-1, os.WNOHANG)
+ except OSError:
+ pass
+
+
+ def quit(self):
+ self.cleanupChildren()
+ cups.releaseCupsInstance()
+ self.close()
+
+
+ # ***********************************************************************************
+ #
+ # DEVICE SETTINGS PLUGIN
+ #
+ # ***********************************************************************************
+
+
+ # ***********************************************************************************
+ #
+ # SETTINGS DIALOG
+ #
+ # ***********************************************************************************
+
+ def PreferencesAction_activated(self, tab_to_show=0):
+ dlg = SettingsDialog(self)
+ dlg.TabWidget.setCurrentIndex(tab_to_show)
+
+ if dlg.exec_() == QDialog.Accepted:
+ self.user_settings.load()
+
+ if self.cur_device is not None:
+ self.cur_device.sendEvent(EVENT_USER_CONFIGURATION_CHANGED, self.cur_printer)
+
+
+ # ***********************************************************************************
+ #
+ # SETUP/REMOVE
+ #
+ # ***********************************************************************************
+
+ def SetupDeviceAction_activated(self):
+ if utils.which('hp-setup'):
+ cmd = 'hp-setup --gui'
+ else:
+ cmd = 'python ./setup.py --gui'
+
+ log.debug(cmd)
+ utils.run(cmd)
+ self.rescanDevices()
+ self.updatePrinterCombos()
+
+
+ def RemoveDeviceAction_activated(self):
+ if utils.which('hp-setup'):
+ cmd = 'hp-setup --gui --remove'
+ else:
+ cmd = 'python ./setup.py --gui --remove'
+
+ if self.cur_device_uri is not None:
+ cmd += ' --device=%s' % self.cur_device_uri
+
+ log.debug(cmd)
+ utils.run(cmd)
+ self.rescanDevices()
+ self.updatePrinterCombos()
+
+
+ def DiagnoseQueue_activated(self):
+ if utils.which('hp-diagnose_queues'):
+ cmd= 'hp-diagnose_queues --gui'
+ else:
+ cmd= 'python ./diagnose_queues.py --gui'
+ log.debug(cmd)
+# ok, output = utils.run(cmd)
+ os_utils.execute(cmd)
+
+
+ def DiagnoseHPLIP_activated(self):
+ if utils.which('hp-doctor'):
+ cmd = 'hp-doctor -i -w'
+ else:
+ cmd = 'python ./doctor.py -i -w'
+
+ terminal_cmd = utils.get_terminal()
+ if terminal_cmd:
+ cmd = terminal_cmd + " '%s'"%cmd
+ os_utils.execute(cmd)
+
+
+
+ # ***********************************************************************************
+ #
+ # MISC
+ #
+ # ***********************************************************************************
+
+ def runExternalCommand(self, cmd, macro_char='%'):
+ beginWaitCursor()
+
+ try:
+ if len(cmd) == 0:
+ FailureUI(self,self.__tr("<p><b>Unable to run command. No command specified.</b><p>Use <pre>Configure...</pre> to specify a command to run."))
+ log.error("No command specified. Use settings to configure commands.")
+ else:
+ log.debug("Run: %s %s (%s) %s" % ("*"*20, cmd, self.cur_device_uri, "*"*20))
+ log.debug(cmd)
+
+ try:
+ cmd = ''.join([self.cur_device.device_vars.get(x, x) \
+ for x in cmd.split(macro_char)])
+ except AttributeError:
+ pass
+
+ log.debug(cmd)
+
+ path = cmd.split()[0]
+ args = cmd.split()
+
+ log.debug(path)
+ log.debug(args)
+
+ self.cleanupChildren()
+ os.spawnvp(os.P_NOWAIT, path, args)
+ qApp.processEvents()
+
+ finally:
+ endWaitCursor()
+
+
+ def helpContents(self):
+ utils.openURL(self.docs)
+
+
+ def helpAbout(self):
+ dlg = AboutDialog(self, prop.version, self.toolbox_version + " (Qt4)")
+ dlg.exec_()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DevMgr5",s,c)
+
+
+# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+class PasswordDialog(QDialog):
+ def __init__(self, prompt, parent=None, name=None, modal=0, fl=0):
+ QDialog.__init__(self, parent)
+ self.prompt = prompt
+
+ Layout= QGridLayout(self)
+ Layout.setMargin(11)
+ Layout.setSpacing(6)
+
+ self.PromptTextLabel = QLabel(self)
+ Layout.addWidget(self.PromptTextLabel,0,0,1,3)
+
+ self.UsernameTextLabel = QLabel(self)
+ Layout.addWidget(self.UsernameTextLabel,1,0)
+
+ self.UsernameLineEdit = QLineEdit(self)
+ self.UsernameLineEdit.setEchoMode(QLineEdit.Normal)
+ Layout.addWidget(self.UsernameLineEdit,1,1,1,2)
+
+ self.PasswordTextLabel = QLabel(self)
+ Layout.addWidget(self.PasswordTextLabel,2,0)
+
+ self.PasswordLineEdit = QLineEdit(self)
+ self.PasswordLineEdit.setEchoMode(QLineEdit.Password)
+ Layout.addWidget(self.PasswordLineEdit,2,1,1,2)
+
+ self.OkPushButton = QPushButton(self)
+ Layout.addWidget(self.OkPushButton,3,2)
+
+ self.languageChange()
+
+ self.resize(QSize(420,163).expandedTo(self.minimumSizeHint()))
+
+ self.OkPushButton.clicked.connect(self.accept)
+ self.PasswordLineEdit.returnPressed.connect(self.accept)
+
+
+ def getUsername(self):
+ return to_unicode(self.UsernameLineEdit.text())
+
+
+ def getPassword(self):
+ return to_unicode(self.PasswordLineEdit.text())
+
+
+ def languageChange(self):
+ self.setWindowTitle(self.__tr("HP Device Manager - Enter Username/Password"))
+ self.PromptTextLabel.setText(self.__tr(self.prompt))
+ self.UsernameTextLabel.setText(self.__tr("Username:"))
+ self.PasswordTextLabel.setText(self.__tr("Password:"))
+ self.OkPushButton.setText(self.__tr("OK"))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DevMgr5",s,c)
+
+# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+def showPasswordUI(prompt):
+ try:
+ dlg = PasswordDialog(prompt, None)
+
+ if dlg.exec_() == QDialog.Accepted:
+ return (dlg.getUsername(), dlg.getPassword())
+
+ finally:
+ pass
+
+ return ("", "")
+
+
+def openEWS(host, zc):
+ if zc:
+ status, ip = hpmudext.get_zc_ip_address(zc)
+ if status != hpmudext.HPMUD_R_OK:
+ ip = "hplipopensource.com"
+ else:
+ ip = host
+ return "http://%s" % ip
diff --git a/ui5/devmgr5_base.py b/ui5/devmgr5_base.py
new file mode 100644
index 000000000..93ebdd2d1
--- /dev/null
+++ b/ui5/devmgr5_base.py
@@ -0,0 +1,409 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/devmgr5_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.setWindowModality(QtCore.Qt.ApplicationModal)
+ MainWindow.resize(700, 500)
+ self.centralwidget = QtWidgets.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridlayout = QtWidgets.QGridLayout(self.centralwidget)
+ self.gridlayout.setObjectName("gridlayout")
+ self.splitter = QtWidgets.QSplitter(self.centralwidget)
+ self.splitter.setOrientation(QtCore.Qt.Horizontal)
+ self.splitter.setObjectName("splitter")
+ self.DeviceList = QtWidgets.QListWidget(self.splitter)
+ self.DeviceList.setMovement(QtWidgets.QListView.Static)
+ self.DeviceList.setFlow(QtWidgets.QListView.TopToBottom)
+ self.DeviceList.setResizeMode(QtWidgets.QListView.Adjust)
+ self.DeviceList.setViewMode(QtWidgets.QListView.IconMode)
+ self.DeviceList.setUniformItemSizes(True)
+ self.DeviceList.setWordWrap(True)
+ self.DeviceList.setSelectionRectVisible(False)
+ self.DeviceList.setObjectName("DeviceList")
+ self.Tabs = QtWidgets.QTabWidget(self.splitter)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Tabs.sizePolicy().hasHeightForWidth())
+ self.Tabs.setSizePolicy(sizePolicy)
+ self.Tabs.setStyleSheet("")
+ self.Tabs.setObjectName("Tabs")
+ self.Actions = QtWidgets.QWidget()
+ self.Actions.setObjectName("Actions")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.Actions)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.ActionsList = QtWidgets.QListWidget(self.Actions)
+ self.ActionsList.setViewMode(QtWidgets.QListView.ListMode)
+ self.ActionsList.setUniformItemSizes(True)
+ self.ActionsList.setWordWrap(True)
+ self.ActionsList.setObjectName("ActionsList")
+ self.gridlayout1.addWidget(self.ActionsList, 0, 0, 1, 1)
+ self.Tabs.addTab(self.Actions, "")
+ self.Status = QtWidgets.QWidget()
+ self.Status.setObjectName("Status")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.Status)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ spacerItem = QtWidgets.QSpacerItem(21, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem)
+ self.LCD = QtWidgets.QLabel(self.Status)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.LCD.sizePolicy().hasHeightForWidth())
+ self.LCD.setSizePolicy(sizePolicy)
+ self.LCD.setMinimumSize(QtCore.QSize(254, 40))
+ self.LCD.setMaximumSize(QtCore.QSize(254, 40))
+ self.LCD.setText("")
+ self.LCD.setObjectName("LCD")
+ self.hboxlayout.addWidget(self.LCD)
+ spacerItem1 = QtWidgets.QSpacerItem(21, 40, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem1)
+ self.gridlayout2.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.StatusTable = QtWidgets.QTableWidget(self.Status)
+ self.StatusTable.setAlternatingRowColors(True)
+ self.StatusTable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.StatusTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.StatusTable.setShowGrid(False)
+ self.StatusTable.setCornerButtonEnabled(False)
+ self.StatusTable.setObjectName("StatusTable")
+ self.StatusTable.setColumnCount(0)
+ self.StatusTable.setRowCount(0)
+ self.gridlayout2.addWidget(self.StatusTable, 1, 0, 1, 1)
+ self.Tabs.addTab(self.Status, "")
+ self.Supplies = QtWidgets.QWidget()
+ self.Supplies.setObjectName("Supplies")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.Supplies)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.SuppliesTable = QtWidgets.QTableWidget(self.Supplies)
+ self.SuppliesTable.setAlternatingRowColors(True)
+ self.SuppliesTable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.SuppliesTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.SuppliesTable.setShowGrid(False)
+ self.SuppliesTable.setCornerButtonEnabled(False)
+ self.SuppliesTable.setObjectName("SuppliesTable")
+ self.SuppliesTable.setColumnCount(0)
+ self.SuppliesTable.setRowCount(0)
+ self.gridlayout3.addWidget(self.SuppliesTable, 0, 0, 1, 1)
+ self.Tabs.addTab(self.Supplies, "")
+ self.Settings = QtWidgets.QWidget()
+ self.Settings.setObjectName("Settings")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.Settings)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.PrintSettingsPrinterNameLabel = QtWidgets.QLabel(self.Settings)
+ self.PrintSettingsPrinterNameLabel.setObjectName("PrintSettingsPrinterNameLabel")
+ self.hboxlayout1.addWidget(self.PrintSettingsPrinterNameLabel)
+ self.PrintSettingsPrinterNameCombo = QtWidgets.QComboBox(self.Settings)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.PrintSettingsPrinterNameCombo.sizePolicy().hasHeightForWidth())
+ self.PrintSettingsPrinterNameCombo.setSizePolicy(sizePolicy)
+ self.PrintSettingsPrinterNameCombo.setObjectName("PrintSettingsPrinterNameCombo")
+ self.hboxlayout1.addWidget(self.PrintSettingsPrinterNameCombo)
+ self.gridlayout4.addLayout(self.hboxlayout1, 0, 0, 1, 1)
+ self.PrintSettingsToolbox = PrintSettingsToolbox(self.Settings)
+ self.PrintSettingsToolbox.setObjectName("PrintSettingsToolbox")
+ self.gridlayout4.addWidget(self.PrintSettingsToolbox, 1, 0, 1, 1)
+ self.Tabs.addTab(self.Settings, "")
+ self.Control = QtWidgets.QWidget()
+ self.Control.setObjectName("Control")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.Control)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.PrintControlPrinterNameLabel = QtWidgets.QLabel(self.Control)
+ self.PrintControlPrinterNameLabel.setObjectName("PrintControlPrinterNameLabel")
+ self.hboxlayout2.addWidget(self.PrintControlPrinterNameLabel)
+ self.PrintControlPrinterNameCombo = QtWidgets.QComboBox(self.Control)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.PrintControlPrinterNameCombo.sizePolicy().hasHeightForWidth())
+ self.PrintControlPrinterNameCombo.setSizePolicy(sizePolicy)
+ self.PrintControlPrinterNameCombo.setObjectName("PrintControlPrinterNameCombo")
+ self.hboxlayout2.addWidget(self.PrintControlPrinterNameCombo)
+ self.gridlayout5.addLayout(self.hboxlayout2, 0, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.Control)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.vboxlayout = QtWidgets.QVBoxLayout()
+ self.vboxlayout.setObjectName("vboxlayout")
+ self.groupBox_3 = QtWidgets.QGroupBox(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox_3.sizePolicy().hasHeightForWidth())
+ self.groupBox_3.setSizePolicy(sizePolicy)
+ self.groupBox_3.setTitle("")
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout7.setContentsMargins(1, 1, 1, 1)
+ self.gridlayout7.setHorizontalSpacing(6)
+ self.gridlayout7.setVerticalSpacing(1)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.StartStopIcon = QtWidgets.QLabel(self.groupBox_3)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.StartStopIcon.sizePolicy().hasHeightForWidth())
+ self.StartStopIcon.setSizePolicy(sizePolicy)
+ self.StartStopIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.StartStopIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.StartStopIcon.setText("")
+ self.StartStopIcon.setObjectName("StartStopIcon")
+ self.hboxlayout3.addWidget(self.StartStopIcon)
+ self.StartStopLabel = QtWidgets.QLabel(self.groupBox_3)
+ self.StartStopLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.StartStopLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.StartStopLabel.setObjectName("StartStopLabel")
+ self.hboxlayout3.addWidget(self.StartStopLabel)
+ self.gridlayout7.addLayout(self.hboxlayout3, 0, 0, 1, 1)
+ self.vboxlayout.addWidget(self.groupBox_3)
+ self.StartStopButton = QtWidgets.QPushButton(self.groupBox)
+ self.StartStopButton.setObjectName("StartStopButton")
+ self.vboxlayout.addWidget(self.StartStopButton)
+ self.gridlayout6.addLayout(self.vboxlayout, 0, 0, 1, 1)
+ self.vboxlayout1 = QtWidgets.QVBoxLayout()
+ self.vboxlayout1.setObjectName("vboxlayout1")
+ self.groupBox_4 = QtWidgets.QGroupBox(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox_4.sizePolicy().hasHeightForWidth())
+ self.groupBox_4.setSizePolicy(sizePolicy)
+ self.groupBox_4.setTitle("")
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_4)
+ self.gridlayout8.setContentsMargins(1, 1, 1, 1)
+ self.gridlayout8.setHorizontalSpacing(6)
+ self.gridlayout8.setVerticalSpacing(1)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.hboxlayout4 = QtWidgets.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.AcceptRejectIcon = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AcceptRejectIcon.sizePolicy().hasHeightForWidth())
+ self.AcceptRejectIcon.setSizePolicy(sizePolicy)
+ self.AcceptRejectIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.AcceptRejectIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.AcceptRejectIcon.setText("")
+ self.AcceptRejectIcon.setObjectName("AcceptRejectIcon")
+ self.hboxlayout4.addWidget(self.AcceptRejectIcon)
+ self.AcceptRejectLabel = QtWidgets.QLabel(self.groupBox_4)
+ self.AcceptRejectLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.AcceptRejectLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.AcceptRejectLabel.setObjectName("AcceptRejectLabel")
+ self.hboxlayout4.addWidget(self.AcceptRejectLabel)
+ self.gridlayout8.addLayout(self.hboxlayout4, 0, 0, 1, 1)
+ self.vboxlayout1.addWidget(self.groupBox_4)
+ self.AcceptRejectButton = QtWidgets.QPushButton(self.groupBox)
+ self.AcceptRejectButton.setObjectName("AcceptRejectButton")
+ self.vboxlayout1.addWidget(self.AcceptRejectButton)
+ self.gridlayout6.addLayout(self.vboxlayout1, 0, 1, 1, 1)
+ self.vboxlayout2 = QtWidgets.QVBoxLayout()
+ self.vboxlayout2.setObjectName("vboxlayout2")
+ self.groupBox_5 = QtWidgets.QGroupBox(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth())
+ self.groupBox_5.setSizePolicy(sizePolicy)
+ self.groupBox_5.setTitle("")
+ self.groupBox_5.setObjectName("groupBox_5")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.groupBox_5)
+ self.gridlayout9.setContentsMargins(1, 1, 1, 1)
+ self.gridlayout9.setHorizontalSpacing(6)
+ self.gridlayout9.setVerticalSpacing(1)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.hboxlayout5 = QtWidgets.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.SetDefaultIcon = QtWidgets.QLabel(self.groupBox_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SetDefaultIcon.sizePolicy().hasHeightForWidth())
+ self.SetDefaultIcon.setSizePolicy(sizePolicy)
+ self.SetDefaultIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.SetDefaultIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.SetDefaultIcon.setText("")
+ self.SetDefaultIcon.setObjectName("SetDefaultIcon")
+ self.hboxlayout5.addWidget(self.SetDefaultIcon)
+ self.SetDefaultLabel = QtWidgets.QLabel(self.groupBox_5)
+ self.SetDefaultLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.SetDefaultLabel.setAlignment(QtCore.Qt.AlignCenter)
+ self.SetDefaultLabel.setObjectName("SetDefaultLabel")
+ self.hboxlayout5.addWidget(self.SetDefaultLabel)
+ self.gridlayout9.addLayout(self.hboxlayout5, 0, 0, 1, 1)
+ self.vboxlayout2.addWidget(self.groupBox_5)
+ self.SetDefaultButton = QtWidgets.QPushButton(self.groupBox)
+ self.SetDefaultButton.setObjectName("SetDefaultButton")
+ self.vboxlayout2.addWidget(self.SetDefaultButton)
+ self.gridlayout6.addLayout(self.vboxlayout2, 0, 2, 1, 1)
+ self.gridlayout5.addWidget(self.groupBox, 1, 0, 1, 1)
+ self.groupBox_2 = QtWidgets.QGroupBox(self.Control)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.JobTable = QtWidgets.QTableWidget(self.groupBox_2)
+ self.JobTable.setAlternatingRowColors(True)
+ self.JobTable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.JobTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.JobTable.setGridStyle(QtCore.Qt.DotLine)
+ self.JobTable.setObjectName("JobTable")
+ self.JobTable.setColumnCount(0)
+ self.JobTable.setRowCount(0)
+ self.gridlayout10.addWidget(self.JobTable, 0, 0, 1, 3)
+ self.CancelJobButton = QtWidgets.QPushButton(self.groupBox_2)
+ self.CancelJobButton.setObjectName("CancelJobButton")
+ self.gridlayout10.addWidget(self.CancelJobButton, 1, 0, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(131, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout10.addItem(spacerItem2, 1, 1, 1, 1)
+ self.RefreshButton = QtWidgets.QPushButton(self.groupBox_2)
+ self.RefreshButton.setObjectName("RefreshButton")
+ self.gridlayout10.addWidget(self.RefreshButton, 1, 2, 1, 1)
+ self.gridlayout5.addWidget(self.groupBox_2, 2, 0, 1, 1)
+ self.Tabs.addTab(self.Control, "")
+ # self.tab_3 = QtWidgets.QWidget()
+ # self.tab_3.setObjectName("tab_3")
+ # self.pushButton = QtWidgets.QPushButton(self.tab_3)
+ # self.pushButton.setGeometry(QtCore.QRect(280, 40, 96, 27))
+ # self.pushButton.setObjectName("pushButton")
+ # self.label = QtWidgets.QLabel(self.tab_3)
+ # self.label.setGeometry(QtCore.QRect(30, 45, 251, 17))
+ # self.label.setObjectName("label")
+ # self.Tabs.addTab(self.tab_3, "")
+ self.gridlayout.addWidget(self.splitter, 0, 0, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.Menubar = QtWidgets.QMenuBar(MainWindow)
+ self.Menubar.setGeometry(QtCore.QRect(0, 0, 700, 27))
+ self.Menubar.setObjectName("Menubar")
+ self.DeviceMenu = QtWidgets.QMenu(self.Menubar)
+ self.DeviceMenu.setObjectName("DeviceMenu")
+ self.ConfigureMenu = QtWidgets.QMenu(self.Menubar)
+ self.ConfigureMenu.setObjectName("ConfigureMenu")
+ self.HelpMenu = QtWidgets.QMenu(self.Menubar)
+ self.HelpMenu.setObjectName("HelpMenu")
+ self.ViewMenu = QtWidgets.QMenu(self.Menubar)
+ self.ViewMenu.setObjectName("ViewMenu")
+ MainWindow.setMenuBar(self.Menubar)
+ self.Statusbar = QtWidgets.QStatusBar(MainWindow)
+ self.Statusbar.setObjectName("Statusbar")
+ MainWindow.setStatusBar(self.Statusbar)
+ self.toolBar = QtWidgets.QToolBar(MainWindow)
+ self.toolBar.setObjectName("toolBar")
+ MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
+ self.QuitAction = QtWidgets.QAction(MainWindow)
+ self.QuitAction.setObjectName("QuitAction")
+ self.PreferencesAction = QtWidgets.QAction(MainWindow)
+ self.PreferencesAction.setObjectName("PreferencesAction")
+ self.AboutAction = QtWidgets.QAction(MainWindow)
+ self.AboutAction.setObjectName("AboutAction")
+ self.ContentsAction = QtWidgets.QAction(MainWindow)
+ self.ContentsAction.setObjectName("ContentsAction")
+ self.DeviceSettingsAction = QtWidgets.QAction(MainWindow)
+ self.DeviceSettingsAction.setEnabled(False)
+ self.DeviceSettingsAction.setObjectName("DeviceSettingsAction")
+ self.DeviceRefreshAction = QtWidgets.QAction(MainWindow)
+ self.DeviceRefreshAction.setObjectName("DeviceRefreshAction")
+ self.RefreshAllAction = QtWidgets.QAction(MainWindow)
+ self.RefreshAllAction.setObjectName("RefreshAllAction")
+ self.SetupDeviceAction = QtWidgets.QAction(MainWindow)
+ self.SetupDeviceAction.setObjectName("SetupDeviceAction")
+ self.RemoveDeviceAction = QtWidgets.QAction(MainWindow)
+ self.RemoveDeviceAction.setObjectName("RemoveDeviceAction")
+ self.ViewAsListAction = QtWidgets.QAction(MainWindow)
+ self.ViewAsListAction.setObjectName("ViewAsListAction")
+ self.ViewAsIconsAction = QtWidgets.QAction(MainWindow)
+ self.ViewAsIconsAction.setObjectName("ViewAsIconsAction")
+ self.DeviceMenu.addAction(self.DeviceSettingsAction)
+ self.DeviceMenu.addSeparator()
+ self.DeviceMenu.addAction(self.DeviceRefreshAction)
+ self.DeviceMenu.addAction(self.RefreshAllAction)
+ self.DeviceMenu.addSeparator()
+ self.DeviceMenu.addAction(self.SetupDeviceAction)
+ self.DeviceMenu.addAction(self.RemoveDeviceAction)
+ self.DeviceMenu.addSeparator()
+ self.DeviceMenu.addAction(self.QuitAction)
+ self.ConfigureMenu.addAction(self.PreferencesAction)
+ self.HelpMenu.addAction(self.ContentsAction)
+ self.HelpMenu.addAction(self.AboutAction)
+ self.ViewMenu.addAction(self.ViewAsListAction)
+ self.ViewMenu.addAction(self.ViewAsIconsAction)
+ self.Menubar.addAction(self.DeviceMenu.menuAction())
+ self.Menubar.addAction(self.ViewMenu.menuAction())
+ self.Menubar.addAction(self.ConfigureMenu.menuAction())
+ self.Menubar.addAction(self.HelpMenu.menuAction())
+ self.toolBar.addAction(self.DeviceRefreshAction)
+ self.toolBar.addAction(self.RefreshAllAction)
+ self.toolBar.addSeparator()
+ self.toolBar.addAction(self.SetupDeviceAction)
+ self.toolBar.addAction(self.RemoveDeviceAction)
+ self.toolBar.addSeparator()
+ self.toolBar.addAction(self.ContentsAction)
+
+ # self.retranslateUi(MainWindow)
+ self.Tabs.setCurrentIndex(5)
+ self.PrintSettingsToolbox.setCurrentIndex(-1)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ _translate = QtCore.QCoreApplication.translate
+ MainWindow.setWindowTitle(_translate("MainWindow", "HP Device Manager"))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Actions), _translate("MainWindow", "Actions"))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Status), _translate("MainWindow", "Status"))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Supplies), _translate("MainWindow", "Supplies"))
+ self.PrintSettingsPrinterNameLabel.setText(_translate("MainWindow", "Printer Name:"))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Settings), _translate("MainWindow", "Print Settings"))
+ self.PrintControlPrinterNameLabel.setText(_translate("MainWindow", "Printer Name:"))
+ self.groupBox.setTitle(_translate("MainWindow", "Printer/Queue Control"))
+ self.StartStopLabel.setText(_translate("MainWindow", "Started"))
+ self.StartStopButton.setText(_translate("MainWindow", "Stop Printer"))
+ self.AcceptRejectLabel.setText(_translate("MainWindow", "Accepting"))
+ self.AcceptRejectButton.setText(_translate("MainWindow", "Reject Jobs"))
+ self.SetDefaultLabel.setText(_translate("MainWindow", "Not default"))
+ self.SetDefaultButton.setText(_translate("MainWindow", "Set as Default"))
+ self.groupBox_2.setTitle(_translate("MainWindow", "Job Queue"))
+ self.CancelJobButton.setText(_translate("MainWindow", "Cancel Job"))
+ self.RefreshButton.setText(_translate("MainWindow", "Refresh"))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Control), _translate("MainWindow", "Printer Control"))
+ # self.pushButton.setText(_translate("MainWindow", "Install now"))
+ # self.label.setText(_translate("MainWindow", "New version of HPLIP-x.x.x is available"))
+ # self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), _translate("MainWindow", "Page"))
+ self.DeviceMenu.setTitle(_translate("MainWindow", "&Device"))
+ self.ConfigureMenu.setTitle(_translate("MainWindow", "&Configure"))
+ self.HelpMenu.setTitle(_translate("MainWindow", "&Help"))
+ self.ViewMenu.setTitle(_translate("MainWindow", "&View"))
+ self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar_2"))
+ self.QuitAction.setText(_translate("MainWindow", "Quit"))
+ self.PreferencesAction.setText(_translate("MainWindow", "Preferences..."))
+ self.AboutAction.setText(_translate("MainWindow", "About..."))
+ self.ContentsAction.setText(_translate("MainWindow", "Contents..."))
+ self.DeviceSettingsAction.setText(_translate("MainWindow", "Settings..."))
+ self.DeviceRefreshAction.setText(_translate("MainWindow", "Refresh Device"))
+ self.RefreshAllAction.setText(_translate("MainWindow", "Refresh All"))
+ self.SetupDeviceAction.setText(_translate("MainWindow", "Setup Device..."))
+ self.RemoveDeviceAction.setText(_translate("MainWindow", "Remove Device..."))
+ self.ViewAsListAction.setText(_translate("MainWindow", "View as List"))
+ self.ViewAsListAction.setToolTip(_translate("MainWindow", "View Devices as a list"))
+ self.ViewAsIconsAction.setText(_translate("MainWindow", "View as Icons"))
+ self.ViewAsIconsAction.setToolTip(_translate("MainWindow", "View device list as icons"))
+
+from .printsettingstoolbox import PrintSettingsToolbox
diff --git a/ui5/devmgr5_base.ui b/ui5/devmgr5_base.ui
new file mode 100644
index 000000000..7d0c7f53e
--- /dev/null
+++ b/ui5/devmgr5_base.ui
@@ -0,0 +1,728 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HP Device Manager</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QListWidget" name="DeviceList">
+ <property name="movement">
+ <enum>QListView::Static</enum>
+ </property>
+ <property name="flow">
+ <enum>QListView::TopToBottom</enum>
+ </property>
+ <property name="resizeMode">
+ <enum>QListView::Adjust</enum>
+ </property>
+ <property name="spacing">
+ <number>10</number>
+ </property>
+ <property name="viewMode">
+ <enum>QListView::IconMode</enum>
+ </property>
+ <property name="uniformItemSizes">
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="selectionRectVisible">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QTabWidget" name="Tabs">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="currentIndex">
+ <number>5</number>
+ </property>
+ <widget class="QWidget" name="Actions">
+ <attribute name="title">
+ <string>Actions</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QListWidget" name="ActionsList">
+ <property name="spacing">
+ <number>10</number>
+ </property>
+ <property name="viewMode">
+ <enum>QListView::ListMode</enum>
+ </property>
+ <property name="uniformItemSizes">
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Status">
+ <attribute name="title">
+ <string>Status</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="LCD">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>254</width>
+ <height>40</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>254</width>
+ <height>40</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QTableWidget" name="StatusTable">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Supplies">
+ <attribute name="title">
+ <string>Supplies</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QTableWidget" name="SuppliesTable">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="showGrid">
+ <bool>false</bool>
+ </property>
+ <property name="cornerButtonEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Settings">
+ <attribute name="title">
+ <string>Print Settings</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="PrintSettingsPrinterNameLabel">
+ <property name="text">
+ <string>Printer Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="PrintSettingsPrinterNameCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="PrintSettingsToolbox" name="PrintSettingsToolbox">
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Control">
+ <attribute name="title">
+ <string>Printer Control</string>
+ </attribute>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="PrintControlPrinterNameLabel">
+ <property name="text">
+ <string>Printer Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="PrintControlPrinterNameCombo">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Printer/Queue Control</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="horizontalSpacing">
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="StartStopIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="StartStopLabel">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Started</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="StartStopButton">
+ <property name="text">
+ <string>Stop Printer</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="horizontalSpacing">
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="AcceptRejectIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="AcceptRejectLabel">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Accepting</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="AcceptRejectButton">
+ <property name="text">
+ <string>Reject Jobs</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="2">
+ <layout class="QVBoxLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="horizontalSpacing">
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>1</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="SetDefaultIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="SetDefaultLabel">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>Not default</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="SetDefaultButton">
+ <property name="text">
+ <string>Set as Default</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Job Queue</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QTableWidget" name="JobTable">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="gridStyle">
+ <enum>Qt::DotLine</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="CancelJobButton">
+ <property name="text">
+ <string>Cancel Job</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>131</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="RefreshButton">
+ <property name="text">
+ <string>Refresh</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_3">
+ <attribute name="title">
+ <string>Page</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>280</x>
+ <y>40</y>
+ <width>96</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Install now</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>45</y>
+ <width>251</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>New version of HPLIP-x.x.x is available</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="Menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="DeviceMenu">
+ <property name="title">
+ <string>&amp;Device</string>
+ </property>
+ <addaction name="DeviceSettingsAction"/>
+ <addaction name="separator"/>
+ <addaction name="DeviceRefreshAction"/>
+ <addaction name="RefreshAllAction"/>
+ <addaction name="separator"/>
+ <addaction name="SetupDeviceAction"/>
+ <addaction name="RemoveDeviceAction"/>
+ <addaction name="separator"/>
+ <addaction name="QuitAction"/>
+ </widget>
+ <widget class="QMenu" name="ConfigureMenu">
+ <property name="title">
+ <string>&amp;Configure</string>
+ </property>
+ <addaction name="PreferencesAction"/>
+ </widget>
+ <widget class="QMenu" name="HelpMenu">
+ <property name="title">
+ <string>&amp;Help</string>
+ </property>
+ <addaction name="ContentsAction"/>
+ <addaction name="AboutAction"/>
+ </widget>
+ <widget class="QMenu" name="ViewMenu">
+ <property name="title">
+ <string>&amp;View</string>
+ </property>
+ <addaction name="ViewAsListAction"/>
+ <addaction name="ViewAsIconsAction"/>
+ </widget>
+ <addaction name="DeviceMenu"/>
+ <addaction name="ViewMenu"/>
+ <addaction name="ConfigureMenu"/>
+ <addaction name="HelpMenu"/>
+ </widget>
+ <widget class="QStatusBar" name="Statusbar"/>
+ <widget class="QToolBar" name="toolBar">
+ <property name="windowTitle">
+ <string>toolBar_2</string>
+ </property>
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ <addaction name="DeviceRefreshAction"/>
+ <addaction name="RefreshAllAction"/>
+ <addaction name="separator"/>
+ <addaction name="SetupDeviceAction"/>
+ <addaction name="RemoveDeviceAction"/>
+ <addaction name="separator"/>
+ <addaction name="ContentsAction"/>
+ </widget>
+ <action name="QuitAction">
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ </action>
+ <action name="PreferencesAction">
+ <property name="text">
+ <string>Preferences...</string>
+ </property>
+ </action>
+ <action name="AboutAction">
+ <property name="text">
+ <string>About...</string>
+ </property>
+ </action>
+ <action name="ContentsAction">
+ <property name="text">
+ <string>Contents...</string>
+ </property>
+ </action>
+ <action name="DeviceSettingsAction">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Settings...</string>
+ </property>
+ </action>
+ <action name="DeviceRefreshAction">
+ <property name="text">
+ <string>Refresh Device</string>
+ </property>
+ </action>
+ <action name="RefreshAllAction">
+ <property name="text">
+ <string>Refresh All</string>
+ </property>
+ </action>
+ <action name="SetupDeviceAction">
+ <property name="text">
+ <string>Setup Device...</string>
+ </property>
+ </action>
+ <action name="RemoveDeviceAction">
+ <property name="text">
+ <string>Remove Device...</string>
+ </property>
+ </action>
+ <action name="ViewAsListAction">
+ <property name="text">
+ <string>View as List</string>
+ </property>
+ <property name="toolTip">
+ <string>View Devices as a list</string>
+ </property>
+ </action>
+ <action name="ViewAsIconsAction">
+ <property name="text">
+ <string>View as Icons</string>
+ </property>
+ <property name="toolTip">
+ <string>View device list as icons</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>PrintSettingsToolbox</class>
+ <extends>QToolBox</extends>
+ <header>printsettingstoolbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/devmgr_ext.py b/ui5/devmgr_ext.py
new file mode 100644
index 000000000..30592d0f4
--- /dev/null
+++ b/ui5/devmgr_ext.py
@@ -0,0 +1,45 @@
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+class Ui_MainWindow_Derived(object):
+ def setupUi(self, MainWindow, latest_available_version, Is_autoInstaller_distro):
+ super(Ui_MainWindow_Derived, self).setupUi(MainWindow)
+ self.DiagnoseQueueAction = QAction(MainWindow)
+ self.DiagnoseQueueAction.setObjectName("DiagnoseQueueAction")
+ self.DiagnoseHPLIPAction = QAction(MainWindow)
+ self.DiagnoseHPLIPAction.setObjectName("DiagnoseHPLIPAction")
+
+ self.latest_available_version = latest_available_version
+ self.Is_autoInstaller_distro = Is_autoInstaller_distro
+ if self.latest_available_version is not "":
+ self.tab_3 = QWidget()
+ self.tab_3.setObjectName("tab_3")
+ self.label = QLabel(self.tab_3)
+ self.label.setGeometry(QRect(30, 45, 300, 17))
+ self.label.setObjectName("label")
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton = QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QRect(351, 40, 96, 27))
+ self.InstallLatestButton.setObjectName("pushButton")
+ else:
+ self.ManualInstalllabel = QLabel(self.tab_3)
+ self.ManualInstalllabel.setGeometry(QRect(30, 70,300, 45))
+ self.ManualInstalllabel.setObjectName("label")
+ self.InstallLatestButton = QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QRect(295, 80, 110, 25))
+ self.InstallLatestButton.setObjectName("pushButton")
+ self.Tabs.addTab(self.tab_3, "")
+ self.retranslateUi(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ super(Ui_MainWindow_Derived, self).retranslateUi(MainWindow)
+ if self.latest_available_version is not "":
+ self.label.setText(QApplication.translate("MainWindow", "New version of HPLIP-%s is available"%self.latest_available_version, None))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), QApplication.translate("MainWindow", "Upgrade", None))
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton.setText(QApplication.translate("MainWindow", "Install now", None))
+ else:
+ msg="Please install manually as mentioned in "
+ self.ManualInstalllabel.setText(QApplication.translate("MainWindow", msg, None))
+ self.InstallLatestButton.setText(QApplication.translate("MainWindow", "HPLIP website", None))
diff --git a/ui5/fabgrouptable.py b/ui5/fabgrouptable.py
new file mode 100644
index 000000000..bb91fae61
--- /dev/null
+++ b/ui5/fabgrouptable.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Local
+from base.g import *
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+class FABGroupTable(QTableWidget):
+
+ namesAddedToGroup = pyqtSignal()
+
+ def __init__(self, parent):
+ QTableWidget.__init__(self, parent)
+
+ self.db = None
+
+
+ def setDatabase(self, db):
+ self.db = db
+
+
+ def dragMoveEvent(self, e):
+ item = self.itemAt(e.pos())
+ if item is not None:
+ group = to_unicode(item.text())
+
+ if group == to_unicode('All'):
+ e.ignore()
+ return
+
+ names = to_unicode(e.mimeData().data(to_unicode('text/plain'))).split(to_unicode('|'))
+ group_members = self.db.group_members(group)
+
+ if not group_members:
+ e.accept()
+ return
+
+ for n in names:
+ if n not in group_members:
+ e.accept()
+ return
+
+ e.ignore()
+
+
+ def dropMimeData(self, row, col, data, action):
+ items = to_unicode(data.data(to_unicode('text/plain'))).split(to_unicode('|'))
+ # self.emit(SIGNAL("namesAddedToGroup"), row, items)
+ self.namesAddedToGroup.emit(row, items)
+ return False
+
+
+ def mimeTypes(self):
+ return QStringList([to_unicode('text/plain')])
+
+
diff --git a/ui5/fabnametable.py b/ui5/fabnametable.py
new file mode 100644
index 000000000..08db36ed1
--- /dev/null
+++ b/ui5/fabnametable.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+class FABNameTable(QTableWidget):
+ def __init__(self, parent):
+ QTableWidget.__init__(self, parent)
+
+
+ def mimeData(self, items):
+ data = QMimeData()
+ data.setText(to_unicode('|').join([to_unicode(i.text()) for i in items]))
+ return data
+
diff --git a/ui5/fabwindow.py b/ui5/fabwindow.py
new file mode 100644
index 000000000..488b6bbd5
--- /dev/null
+++ b/ui5/fabwindow.py
@@ -0,0 +1,616 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# StdLib
+
+# Local
+from base.g import *
+from .ui_utils import *
+from base.sixext import to_unicode, from_unicode_to_str
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Main window
+from .fabwindow_base import Ui_MainWindow
+
+fax_avail = True
+try:
+ from fax import fax
+except ImportError:
+ # This can fail on Python < 2.3 due to the datetime module
+ log.error("Fax address book disabled - Python 2.3+ required.")
+ fax_avail = False
+
+
+
+class FABWindow(QMainWindow, Ui_MainWindow):
+
+ databaseChanged = pyqtSignal([int, str], [int, str, str])
+ editingFinished = pyqtSignal()
+
+ def __init__(self, parent):
+ QMainWindow.__init__(self, parent)
+ self.setupUi(self)
+ self.group = to_unicode('All') # current group
+ self.name = None # current name
+ self.updating_group = False
+ self.updating_name = False
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initDB()
+ self.initUi()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initDB(self):
+ self.db = fax.FaxAddressBook()
+
+ # Fixup data from old-style database
+ data = self.db.get_all_records()
+ for d in data:
+ if to_unicode('All') not in data[d]['groups']:
+ data[d]['groups'].append(to_unicode('All'))
+
+ if not data:
+ self.db.set('__' + utils.gen_random_uuid(), '', '', '', '', [to_unicode('All')], '')
+
+
+ def initUi(self):
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ self.NewGroupAction.setIcon(QIcon(load_pixmap('new_group', '24x24')))
+ self.NewGroupFromSelectionAction.setIcon(QIcon(load_pixmap('new_group_from_selection', '24x24')))
+ self.RenameGroupAction.setIcon(QIcon(load_pixmap('rename_group', '24x24')))
+ self.RemoveGroupAction.setIcon(QIcon(load_pixmap('remove_group', '24x24')))
+ self.NewNameAction.setIcon(QIcon(load_pixmap('new_user', '24x24')))
+ self.RemoveNameAction.setIcon(QIcon(load_pixmap('remove_user', '24x24')))
+ self.AddToGroupAction.setIcon(QIcon(load_pixmap('add_to_group', '24x24')))
+ self.RemoveFromGroupAction.setIcon(QIcon(load_pixmap('remove_from_group', '24x24')))
+
+ self.QuitAction.triggered.connect(self.close)
+ self.NewGroupAction.triggered.connect(self.NewGroupAction_triggered)
+ self.NewGroupFromSelectionAction.triggered.connect(self.NewGroupFromSelectionAction_triggered)
+ self.RenameGroupAction.triggered.connect(self.RenameGroupAction_triggered)
+ self.RemoveGroupAction.triggered.connect(self.RemoveGroupAction_triggered)
+ self.NewNameAction.triggered.connect(self.NewNameAction_triggered)
+ self.RemoveNameAction.triggered.connect(self.RemoveNameAction_triggered)
+ self.ImportAction.triggered.connect(self.ImportAction_triggered)
+ self.RemoveFromGroupAction.triggered.connect(self.RemoveFromGroupAction_triggered)
+ self.AddToGroupAction.triggered.connect(self.AddToGroupAction_triggered)
+
+ self.GroupTableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+ self.NameTableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+
+ self.Splitter.splitterMoved[int, int].connect(self.Splitter_splitterMoved)
+ self.Splitter.setChildrenCollapsible(False)
+ self.Splitter.setHandleWidth(self.Splitter.handleWidth()+2)
+
+ self.GroupTableWidget.verticalHeader().hide()
+ self.GroupTableWidget.setShowGrid(False)
+ self.GroupTableWidget.setSelectionMode(QAbstractItemView.SingleSelection)
+ self.NameTableWidget.verticalHeader().hide()
+ self.NameTableWidget.setShowGrid(False)
+
+ self.NameTableWidget.setDragEnabled(True)
+ self.GroupTableWidget.setAcceptDrops(True)
+ self.GroupTableWidget.setDropIndicatorShown(True)
+
+ self.GroupTableWidget.itemSelectionChanged.connect(self.GroupTableWidget_itemSelectionChanged)
+ self.NameTableWidget.itemSelectionChanged.connect(self.NameTableWidget_itemSelectionChanged)
+ self.NameLineEdit.editingFinished.connect(self.NameLineEdit_editingFinished)
+ self.FaxNumberLineEdit.editingFinished.connect(self.FaxNumberLineEdit_editingFinished)
+ self.NotesTextEdit.textChanged.connect(self.NotesTextEdit_textChanged)
+ # self.NotesTextEdit.editingFinished.connect(self.NotesTextEdit_editingFinished)
+ self.GroupTableWidget.namesAddedToGroup.connect(self.GroupTableWidget_namesAddedToGroup)
+
+
+ self.FaxNumberLineEdit.setValidator(PhoneNumValidator(self.FaxNumberLineEdit))
+ self.NameLineEdit.setValidator(AddressBookNameValidator(self.db, self.NameLineEdit))
+
+ self.GroupTableWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
+ self.GroupTableWidget.addAction(self.NewGroupAction)
+ self.GroupTableWidget.addAction(self.NewGroupFromSelectionAction)
+ self.GroupTableWidget.addAction(self.RenameGroupAction)
+ self.GroupTableWidget.addAction(self.RemoveGroupAction)
+
+ self.NameTableWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
+ self.NameTableWidget.addAction(self.NewNameAction)
+ self.NameTableWidget.addAction(self.AddToGroupAction)
+ self.NameTableWidget.addAction(self.RemoveFromGroupAction)
+ self.NameTableWidget.addAction(self.RemoveNameAction)
+ self.NameTableWidget.addAction(self.NewGroupFromSelectionAction)
+
+ self.GroupTableWidget.setDatabase(self.db)
+
+
+ def updateUi(self):
+ if not fax_avail:
+ FailureUI(self, self.__tr("<b>Fax support disabled.</b><p>Fax support requires Python 2.3."))
+ self.close()
+ return
+
+ self.updateGroupList()
+ self.updateNameList()
+ self.updateDetailsFrame()
+
+
+ def closeEvent(self, e):
+ #self.NameLineEdit.emit(SIGNAL("editingFinished()"))
+ # self.FaxNumberLineEdit.emit(SIGNAL("editingFinished()"))
+ self.FaxNumberLineEdit.editingFinished.emit()
+ # self.NotesTextEdit.emit(SIGNAL("editingFinished()"))
+ # XXX: qt5port: NotesTextEdit editingFinished requires attention
+ # self.NotesTextEdit.editingFinished.emit()
+ e.accept()
+
+
+ def Splitter_splitterMoved(self, pos, index):
+ self.GroupTableWidget.setColumnWidth(0, self.GroupTableWidget.width())
+ self.NameTableWidget.setColumnWidth(0, self.NameTableWidget.width())
+
+
+ def updateGroupList(self):
+ self.updating_group = True
+ all, k = None, None
+ try:
+ headerItem = QTableWidgetItem()
+ headerItem.setText(self.__tr("Group"))
+ self.GroupTableWidget.clear()
+ self.GroupTableWidget.setColumnCount(1)
+ self.GroupTableWidget.setHorizontalHeaderItem(0, headerItem)
+ self.GroupTableWidget.setColumnWidth(0, self.GroupTableWidget.width())
+
+ groups = self.db.get_all_groups()
+ groups.sort()
+ self.GroupTableWidget.setRowCount(len(groups))
+
+ # Force All group to top of table
+ all = QTableWidgetItem(self.__tr("All"))
+ all.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
+ self.GroupTableWidget.setItem(0, 0, all)
+
+ j = 1
+ for g in groups:
+ if g == to_unicode('All'):
+ continue
+
+# i = QTableWidgetItem(str(g))
+ if isinstance(g, int):
+ i = QTableWidgetItem(str(g))
+ else:
+ i = QTableWidgetItem(from_unicode_to_str(g))
+
+
+ if g == self.group:
+ k = i
+
+ i.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDropEnabled)
+ self.GroupTableWidget.setItem(j, 0, i)
+ j += 1
+
+
+ finally:
+ self.updating_group = False
+
+ if k is not None:
+ k.setSelected(True)
+
+ elif all is not None:
+ all.setSelected(True)
+
+
+ def GroupTableWidget_itemSelectionChanged(self):
+ if not self.updating_group:
+ selected_items = self.GroupTableWidget.selectedItems()
+ if selected_items:
+ self.group = to_unicode(selected_items[0].text())
+ self.RemoveGroupAction.setEnabled(self.group != to_unicode('All'))
+ self.RenameGroupAction.setEnabled(self.group != to_unicode('All'))
+ else: # shouldn't happen?!
+ self.RemoveGroupAction.setEnabled(False)
+ self.RenameGroupAction.setEnabled(False)
+ self.group = None
+
+ self.updateNameList()
+
+
+ def NameTableWidget_itemSelectionChanged(self):
+ if not self.updating_name:
+ selected_items = self.NameTableWidget.selectedItems()
+ num_selected_items = len(selected_items)
+
+ if num_selected_items == 0:
+ self.name = None
+ self.RemoveNameAction.setEnabled(False)
+ self.NewGroupFromSelectionAction.setEnabled(False)
+ self.RemoveFromGroupAction.setEnabled(False)
+ self.AddToGroupAction.setEnabled(False)
+
+ elif num_selected_items == 1:
+ self.name = to_unicode(selected_items[0].text())
+ self.RemoveNameAction.setEnabled(True)
+ self.NewGroupFromSelectionAction.setEnabled(True)
+
+ self.RemoveFromGroupAction.setEnabled(self.group != to_unicode('All'))
+ self.AddToGroupAction.setEnabled(True) #self.group != u'All')
+
+ else: # > 1
+ self.RemoveNameAction.setEnabled(True)
+ self.NewGroupFromSelectionAction.setEnabled(True)
+ self.RemoveFromGroupAction.setEnabled(self.group != to_unicode('All'))
+ self.AddToGroupAction.setEnabled(True) #self.group != u'All')
+ self.name = None
+
+ self.updateDetailsFrame()
+
+
+ def updateNameList(self):
+ self.updating_name = True
+ m, k = None, None
+ try:
+ headerItem = QTableWidgetItem()
+ headerItem.setText(self.__tr("Name"))
+ self.NameTableWidget.clear()
+ self.NameTableWidget.setColumnCount(1)
+ self.NameTableWidget.setHorizontalHeaderItem(0,headerItem)
+ self.NameTableWidget.setColumnWidth(0, self.NameTableWidget.width())
+
+ names = self.db.group_members(self.group)
+ filtered_names = [n for n in names if not n.startswith('__')]
+ filtered_names.sort()
+ self.NameTableWidget.setRowCount(len(filtered_names))
+
+ for j, n in enumerate(filtered_names):
+ if isinstance(n, int):
+ i = QTableWidgetItem(str(n))
+ else:
+ i = QTableWidgetItem(from_unicode_to_str(n))
+ i.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled)
+ self.NameTableWidget.setItem(j, 0, i)
+
+ if n == self.name:
+ m = i
+
+ if j == 0:
+ k = i
+
+ finally:
+ self.updating_name = False
+
+ if m is not None:
+ m.setSelected(True)
+
+ elif k is not None:
+ k.setSelected(True)
+
+ else: # no names, disable name frame and name actions
+ self.name = None
+ self.RemoveNameAction.setEnabled(False)
+ self.NewGroupFromSelectionAction.setEnabled(False)
+ self.RemoveFromGroupAction.setEnabled(False)
+ self.AddToGroupAction.setEnabled(False)
+ self.updateDetailsFrame()
+
+
+ def selectByName(self, name):
+ rows = self.NameTableWidget.rowCount()
+ for r in range(rows):
+ i = self.NameTableWidget.item(r, 0)
+ i.setSelected(name == to_unicode(i.text()))
+
+
+ def updateDetailsFrame(self):
+ if self.name is None:
+ self.NameFrame.setEnabled(False)
+ self.NameLineEdit.setText(str())
+ self.FaxNumberLineEdit.setText(str())
+ self.NotesTextEdit.setText(str())
+
+ else:
+ self.NameFrame.setEnabled(True)
+ data = self.db.get(self.name)
+ self.NameLineEdit.setText(self.name)
+ self.FaxNumberLineEdit.setText(data['fax'])
+ self.NotesTextEdit.setText(data['notes'])
+
+
+ def NameLineEdit_editingFinished(self):
+ if self.name is not None:
+ new_name = to_unicode(self.NameLineEdit.text())
+ if new_name != self.name:
+ if QMessageBox.question(self, self.__tr("Rename?"), "Rename '%s' to '%s'?"%(self.name,new_name), \
+ QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
+
+ self.db.rename(self.name, new_name)
+ log.debug("Rename %s to %s" % (self.name, new_name))
+ self.databaseChanged[int, str, str].emit(FAB_NAME_RENAME, self.name, new_name)
+ self.updateNameList()
+ else:
+ self.NameLineEdit.setText(self.name)
+
+
+ def FaxNumberLineEdit_editingFinished(self):
+ if self.name is not None:
+ self.db.set_key_value(self.name, 'fax', to_unicode(self.FaxNumberLineEdit.text()))
+ self.databaseChanged.emit(FAB_NAME_DETAILS_CHANGED, self.name)
+
+
+ def NotesTextEdit_textChanged(self):
+ if self.name is not None:
+ self.db.set_key_value(self.name, 'notes', to_unicode(self.NotesTextEdit.document().toPlainText()))
+
+
+ def NotesTextEdit_editingFinished(self):
+ if self.name is not None:
+ self.databaseChanged.emit(FAB_NAME_DETAILS_CHANGED, self.name)
+
+
+ def NewGroupAction_triggered(self):
+ ok = False
+ g, ok = QInputDialog.getText(self, self.__tr("Enter New Group Name"), self.__tr("Name for New Group:"))
+ g = to_unicode(g)
+
+ if g == to_unicode('All'):
+ FailureUI(self, self.__tr("<b>Sorry, the group name cannot be 'All'.</b><p>Please choose a different name."))
+ ok = False
+
+ if ok:
+ self.db.set('__' + utils.gen_random_uuid(), '', '', '', '', [to_unicode('All'), g], '')
+ self.group = g
+ log.debug("New empty group %s" % self.group)
+ self.databaseChanged.emit(FAB_GROUP_ADD, self.group)
+ self.updateGroupList()
+
+
+ def NewGroupFromSelectionAction_triggered(self):
+ selected_names = [to_unicode(n.text()) for n in self.NameTableWidget.selectedItems()]
+ if selected_names:
+ ok = False
+ g, ok = QInputDialog.getText(self, self.__tr("Enter New Group Name"), self.__tr("Name for New Group:"))
+ g = to_unicode(g)
+
+ groups = self.db.get_all_groups()
+
+ if g in groups:
+ FailureUI(self, self.__tr("<b>Sorry, the group name cannot be the same as an existing group (or 'All').</b><p>Please choose a different name."))
+ ok = False
+
+ if ok:
+ self.db.update_groups(g, selected_names)
+ self.group = g
+ log.debug("New group %s with names %s" % (self.group, ','.join(selected_names)))
+ self.databaseChanged.emit(FAB_GROUP_ADD, self.group)
+ self.updateGroupList()
+
+
+ def RenameGroupAction_triggered(self):
+ selected_items = self.GroupTableWidget.selectedItems()
+ if selected_items:
+ old_group = to_unicode(selected_items[0].text())
+ ok = False
+ new_group, ok = QInputDialog.getText(self, self.__tr("Rename Group"), "New Name for Group '%s':"%old_group)
+ new_group = to_unicode(new_group)
+ groups = self.db.get_all_groups()
+
+ if new_group in groups:
+ FailureUI(self, self.__tr("<b>Sorry, the group name cannot be the same as an existing group (or 'All').</b><p>Please choose a different name."))
+ ok = False
+
+ if ok:
+ self.db.rename_group(old_group, new_group)
+ log.debug("Rename group %s to %s" % (old_group, new_group))
+ self.databaseChanged[int, str, str].emit(FAB_GROUP_RENAME, old_group, new_group)
+ self.group = new_group
+ self.updateGroupList()
+
+
+ def RemoveGroupAction_triggered(self):
+ self.db.delete_group(self.group)
+ log.debug("Remove group %s" % self.group)
+ self.databaseChanged.emit(FAB_GROUP_REMOVE, self.group)
+ self.group = None
+ self.updateGroupList()
+
+
+ def NewNameAction_triggered(self):
+ ok = False
+ t, ok = QInputDialog.getText(self, self.__tr("Enter New Name"), self.__tr("New Name:"))
+ if ok:
+ t = to_unicode(t)
+ self.addName(t)
+
+
+ def addName(self, name, fax=''):
+ if self.group == to_unicode('All'):
+ g = [to_unicode('All')]
+ else:
+ g = [to_unicode('All'), self.group]
+
+ self.db.set(name, '', '', '', fax, g, '')
+ self.name = name
+ log.debug("New name %s" % self.name)
+ self.databaseChanged.emit(FAB_NAME_ADD, self.name)
+ self.updateNameList()
+
+
+ def RemoveNameAction_triggered(self):
+ selected_names = [to_unicode(n.text()) for n in self.NameTableWidget.selectedItems()]
+ if selected_names:
+ for n in selected_names:
+ self.db.delete(n)
+ log.debug("Removing name %s" % n)
+ self.databaseChanged.emit(FAB_NAME_REMOVE, n)
+
+ self.name = None
+ self.updateNameList()
+
+
+ def RemoveFromGroupAction_triggered(self):
+ selected_names = [str(n.text()) for n in self.NameTableWidget.selectedItems()]
+ if selected_names:
+ log.debug("%s leaving group %s" % (','.join(selected_names), self.group))
+ self.db.remove_from_group(self.group, selected_names)
+ self.databaseChanged.emit(FAB_GROUP_MEMBERSHIP_CHANGED, self.group)
+ self.name = None
+ self.updateGroupList()
+
+
+ def GroupTableWidget_namesAddedToGroup(self, row, items): # drag n' drop handler
+ self.group = to_unicode(self.GroupTableWidget.item(row, 0).text())
+ self.db.add_to_group(self.group, items)
+ log.debug("Adding %s to group %s" % (','.join(items), self.group))
+ self.databaseChanged.emit(FAB_GROUP_MEMBERSHIP_CHANGED, self.group)
+ self.updateGroupList()
+
+
+ def AddToGroupAction_triggered(self):
+ selected_names = [to_unicode(n.text()) for n in self.NameTableWidget.selectedItems()]
+ if selected_names:
+ ok = False
+ all_groups = self.db.get_all_groups()
+
+ if all_groups:
+ all_groups = [g for g in all_groups if g != to_unicode('All')]
+ all_groups.sort()
+
+ dlg = JoinDialog(self, all_groups)
+
+ if dlg.exec_() == QDialog.Accepted:
+ group = dlg.group
+ if group:
+ self.db.add_to_group(group, selected_names)
+ self.group = group
+ log.debug("Adding %s to group %s" % (','.join(selected_names), self.group))
+ self.databaseChanged.emit(FAB_GROUP_MEMBERSHIP_CHANGED, self.group)
+ self.updateGroupList()
+
+ else:
+ FailureUI(self, self.__tr("<b>There are no groups to join.</b><p>Use <i>New Group from Selection</i> to create a new group using these name(s)."))
+
+
+ def ImportAction_triggered(self):
+ result = str(QFileDialog.getOpenFileName(self,
+ self.__tr("Import fax addresses from LDIF or vCard"),
+ #user_conf.workingDirectory(),
+ self.user_settings.working_dir,
+ "vCard (*.vcf);;LDIF (*.ldif *.ldi)"))
+
+ if result:
+ working_directory = to_unicode(os.path.dirname(result))
+ log.debug("result: %s" % result)
+ #user_conf.setWorkingDirectory(working_directory)
+ self.user_settings.working_dir = working_directory
+ self.user_settings.save()
+
+ if result:
+ if result.endswith('.vcf'):
+ ok, error_str = self.db.import_vcard(result)
+ else:
+ ok, error_str = self.db.import_ldif(result)
+
+ if not ok:
+ FailureUI(self, error_str)
+
+ else:
+ self.updateUi()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("FABWindow",s.encode('utf-8'),c)
+
+
+
+
+class JoinDialog(QDialog):
+ def __init__(self, parent, groups):
+ QDialog.__init__(self, parent)
+ self.group = ''
+ self.setupUi(groups)
+
+
+ def setupUi(self, groups):
+ self.setObjectName("Dialog")
+ self.resize(QSize(QRect(0,0,271,107).size()).expandedTo(self.minimumSizeHint()))
+
+ self.gridlayout = QGridLayout(self)
+ self.gridlayout.setObjectName("gridlayout")
+
+ self.hboxlayout = QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+
+ self.label = QLabel(self)
+ self.label.setObjectName("label")
+ self.hboxlayout.addWidget(self.label)
+
+ self.GroupJoinComboBox = QComboBox(self)
+
+ sizePolicy = QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.GroupJoinComboBox.sizePolicy().hasHeightForWidth())
+ self.GroupJoinComboBox.setSizePolicy(sizePolicy)
+ self.GroupJoinComboBox.setObjectName("comboBox")
+ self.hboxlayout.addWidget(self.GroupJoinComboBox)
+ self.gridlayout.addLayout(self.hboxlayout,0,0,1,3)
+
+ spacerItem = QSpacerItem(20,40,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem,1,0,1,1)
+
+ spacerItem1 = QSpacerItem(231,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1,2,0,1,1)
+
+ self.JoinButton = QPushButton(self)
+ self.JoinButton.setObjectName("pushButton_2")
+ self.gridlayout.addWidget(self.JoinButton,2,1,1,1)
+
+ self.CancelButton = QPushButton(self)
+ self.CancelButton.setObjectName("pushButton")
+ self.gridlayout.addWidget(self.CancelButton,2,2,1,1)
+
+ self.GroupJoinComboBox.currentIndexChanged[int].connect(self.GroupJoinComboBox_currentIndexChanged)
+
+ for i, g in enumerate(groups):
+ if i == 0:
+ self.group = g
+ self.GroupJoinComboBox.insertItem(i, g)
+
+ self.JoinButton.clicked.connect(self.accept)
+ self.CancelButton.clicked.connect(self.reject)
+
+ self.retranslateUi()
+
+
+ def GroupJoinComboBox_currentIndexChanged(self, i):
+ self.group = to_unicode(self.GroupJoinComboBox.currentText())
+
+
+ def retranslateUi(self):
+ self.setWindowTitle(QApplication.translate("Dialog", "Join Group", None, QApplication.UnicodeUTF8))
+ self.label.setText(QApplication.translate("Dialog", "Group to Join:", None, QApplication.UnicodeUTF8))
+ self.JoinButton.setText(QApplication.translate("Dialog", "Join", None, QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QApplication.translate("Dialog", "Cancel", None, QApplication.UnicodeUTF8))
diff --git a/ui5/fabwindow_base.py b/ui5/fabwindow_base.py
new file mode 100644
index 000000000..8ac41baa7
--- /dev/null
+++ b/ui5/fabwindow_base.py
@@ -0,0 +1,161 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/fabwindow_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(700, 440)
+ self.centralwidget = QtWidgets.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridlayout = QtWidgets.QGridLayout(self.centralwidget)
+ self.gridlayout.setObjectName("gridlayout")
+ self.Splitter = QtWidgets.QSplitter(self.centralwidget)
+ self.Splitter.setOrientation(QtCore.Qt.Horizontal)
+ self.Splitter.setObjectName("Splitter")
+ self.GroupTableWidget = FABGroupTable(self.Splitter)
+ self.GroupTableWidget.setAlternatingRowColors(True)
+ self.GroupTableWidget.setObjectName("GroupTableWidget")
+ self.GroupTableWidget.setColumnCount(1)
+ self.GroupTableWidget.setRowCount(0)
+ item = QtWidgets.QTableWidgetItem()
+ self.GroupTableWidget.setHorizontalHeaderItem(0, item)
+ self.NameTableWidget = FABNameTable(self.Splitter)
+ self.NameTableWidget.setAlternatingRowColors(True)
+ self.NameTableWidget.setObjectName("NameTableWidget")
+ self.NameTableWidget.setColumnCount(1)
+ self.NameTableWidget.setRowCount(0)
+ item = QtWidgets.QTableWidgetItem()
+ self.NameTableWidget.setHorizontalHeaderItem(0, item)
+ self.NameFrame = QtWidgets.QFrame(self.Splitter)
+ self.NameFrame.setEnabled(False)
+ self.NameFrame.setFrameShape(QtWidgets.QFrame.StyledPanel)
+ self.NameFrame.setFrameShadow(QtWidgets.QFrame.Raised)
+ self.NameFrame.setObjectName("NameFrame")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.NameFrame)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.NameFrame)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.NameLineEdit = QtWidgets.QLineEdit(self.NameFrame)
+ self.NameLineEdit.setObjectName("NameLineEdit")
+ self.gridlayout1.addWidget(self.NameLineEdit, 0, 1, 1, 1)
+ self.label_2 = QtWidgets.QLabel(self.NameFrame)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 1, 0, 1, 1)
+ self.FaxNumberLineEdit = QtWidgets.QLineEdit(self.NameFrame)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout1.addWidget(self.FaxNumberLineEdit, 1, 1, 1, 1)
+ self.label_3 = QtWidgets.QLabel(self.NameFrame)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout1.addWidget(self.label_3, 2, 0, 1, 1)
+ self.NotesTextEdit = QtWidgets.QTextEdit(self.NameFrame)
+ self.NotesTextEdit.setObjectName("NotesTextEdit")
+ self.gridlayout1.addWidget(self.NotesTextEdit, 3, 0, 1, 2)
+ self.gridlayout.addWidget(self.Splitter, 0, 0, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtWidgets.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 700, 27))
+ self.menubar.setObjectName("menubar")
+ self.menuGroup = QtWidgets.QMenu(self.menubar)
+ self.menuGroup.setObjectName("menuGroup")
+ self.menuName = QtWidgets.QMenu(self.menubar)
+ self.menuName.setObjectName("menuName")
+ self.menuFile = QtWidgets.QMenu(self.menubar)
+ self.menuFile.setObjectName("menuFile")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtWidgets.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.toolBar = QtWidgets.QToolBar(MainWindow)
+ self.toolBar.setObjectName("toolBar")
+ MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
+ self.NewGroupAction = QtWidgets.QAction(MainWindow)
+ self.NewGroupAction.setObjectName("NewGroupAction")
+ self.NewNameAction = QtWidgets.QAction(MainWindow)
+ self.NewNameAction.setObjectName("NewNameAction")
+ self.RemoveGroupAction = QtWidgets.QAction(MainWindow)
+ self.RemoveGroupAction.setEnabled(False)
+ self.RemoveGroupAction.setObjectName("RemoveGroupAction")
+ self.QuitAction = QtWidgets.QAction(MainWindow)
+ self.QuitAction.setObjectName("QuitAction")
+ self.RemoveNameAction = QtWidgets.QAction(MainWindow)
+ self.RemoveNameAction.setEnabled(False)
+ self.RemoveNameAction.setObjectName("RemoveNameAction")
+ self.NewGroupFromSelectionAction = QtWidgets.QAction(MainWindow)
+ self.NewGroupFromSelectionAction.setEnabled(False)
+ self.NewGroupFromSelectionAction.setObjectName("NewGroupFromSelectionAction")
+ self.ImportAction = QtWidgets.QAction(MainWindow)
+ self.ImportAction.setObjectName("ImportAction")
+ self.RenameGroupAction = QtWidgets.QAction(MainWindow)
+ self.RenameGroupAction.setEnabled(False)
+ self.RenameGroupAction.setObjectName("RenameGroupAction")
+ self.RemoveFromGroupAction = QtWidgets.QAction(MainWindow)
+ self.RemoveFromGroupAction.setEnabled(False)
+ self.RemoveFromGroupAction.setObjectName("RemoveFromGroupAction")
+ self.AddToGroupAction = QtWidgets.QAction(MainWindow)
+ self.AddToGroupAction.setEnabled(False)
+ self.AddToGroupAction.setObjectName("AddToGroupAction")
+ self.menuGroup.addAction(self.NewGroupAction)
+ self.menuGroup.addAction(self.NewGroupFromSelectionAction)
+ self.menuGroup.addAction(self.RenameGroupAction)
+ self.menuGroup.addSeparator()
+ self.menuGroup.addAction(self.RemoveGroupAction)
+ self.menuName.addAction(self.NewNameAction)
+ self.menuName.addSeparator()
+ self.menuName.addAction(self.AddToGroupAction)
+ self.menuName.addAction(self.RemoveFromGroupAction)
+ self.menuName.addSeparator()
+ self.menuName.addAction(self.RemoveNameAction)
+ self.menuFile.addAction(self.ImportAction)
+ self.menuFile.addSeparator()
+ self.menuFile.addAction(self.QuitAction)
+ self.menubar.addAction(self.menuFile.menuAction())
+ self.menubar.addAction(self.menuGroup.menuAction())
+ self.menubar.addAction(self.menuName.menuAction())
+ self.toolBar.addAction(self.NewGroupAction)
+ self.toolBar.addAction(self.NewGroupFromSelectionAction)
+ self.toolBar.addAction(self.RenameGroupAction)
+ self.toolBar.addAction(self.RemoveGroupAction)
+ self.toolBar.addSeparator()
+ self.toolBar.addAction(self.NewNameAction)
+ self.toolBar.addAction(self.AddToGroupAction)
+ self.toolBar.addAction(self.RemoveFromGroupAction)
+ self.toolBar.addAction(self.RemoveNameAction)
+
+ self.retranslateUi(MainWindow)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ _translate = QtCore.QCoreApplication.translate
+ MainWindow.setWindowTitle(_translate("MainWindow", "HP Device Manager - Fax Address Book"))
+ item = self.GroupTableWidget.horizontalHeaderItem(0)
+ item.setText(_translate("MainWindow", "Group"))
+ item = self.NameTableWidget.horizontalHeaderItem(0)
+ item.setText(_translate("MainWindow", "Name"))
+ self.label.setText(_translate("MainWindow", "Name:"))
+ self.label_2.setText(_translate("MainWindow", "Fax Number:"))
+ self.label_3.setText(_translate("MainWindow", "Notes:"))
+ self.menuGroup.setTitle(_translate("MainWindow", "Group"))
+ self.menuName.setTitle(_translate("MainWindow", "Name"))
+ self.menuFile.setTitle(_translate("MainWindow", "File"))
+ self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
+ self.NewGroupAction.setText(_translate("MainWindow", "New Group..."))
+ self.NewNameAction.setText(_translate("MainWindow", "New Name..."))
+ self.RemoveGroupAction.setText(_translate("MainWindow", "Delete Group..."))
+ self.QuitAction.setText(_translate("MainWindow", "Quit"))
+ self.RemoveNameAction.setText(_translate("MainWindow", "Delete Name..."))
+ self.NewGroupFromSelectionAction.setText(_translate("MainWindow", "New Group From Selection..."))
+ self.ImportAction.setText(_translate("MainWindow", "Import..."))
+ self.RenameGroupAction.setText(_translate("MainWindow", "Rename Group..."))
+ self.RemoveFromGroupAction.setText(_translate("MainWindow", "Leave Group"))
+ self.AddToGroupAction.setText(_translate("MainWindow", "Join Group..."))
+
+from .fabgrouptable import FABGroupTable
+from .fabnametable import FABNameTable
diff --git a/ui5/fabwindow_base.ui b/ui5/fabwindow_base.ui
new file mode 100644
index 000000000..927ac9dfa
--- /dev/null
+++ b/ui5/fabwindow_base.ui
@@ -0,0 +1,235 @@
+<ui version="4.0" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>440</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Fax Address Book</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QSplitter" name="Splitter" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="FABGroupTable" name="GroupTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Group</string>
+ </property>
+ </column>
+ </widget>
+ <widget class="FABNameTable" name="NameTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Name</string>
+ </property>
+ </column>
+ </widget>
+ <widget class="QFrame" name="NameFrame" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="NameLineEdit" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Fax Number:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="FaxNumberLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Notes:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QTextEdit" name="NotesTextEdit" />
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuGroup" >
+ <property name="title" >
+ <string>Group</string>
+ </property>
+ <addaction name="NewGroupAction" />
+ <addaction name="NewGroupFromSelectionAction" />
+ <addaction name="RenameGroupAction" />
+ <addaction name="separator" />
+ <addaction name="RemoveGroupAction" />
+ </widget>
+ <widget class="QMenu" name="menuName" >
+ <property name="title" >
+ <string>Name</string>
+ </property>
+ <addaction name="NewNameAction" />
+ <addaction name="separator" />
+ <addaction name="AddToGroupAction" />
+ <addaction name="RemoveFromGroupAction" />
+ <addaction name="separator" />
+ <addaction name="RemoveNameAction" />
+ </widget>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>File</string>
+ </property>
+ <addaction name="ImportAction" />
+ <addaction name="separator" />
+ <addaction name="QuitAction" />
+ </widget>
+ <addaction name="menuFile" />
+ <addaction name="menuGroup" />
+ <addaction name="menuName" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <widget class="QToolBar" name="toolBar" >
+ <property name="windowTitle" >
+ <string>toolBar</string>
+ </property>
+ <attribute name="toolBarArea" >
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak" >
+ <bool>false</bool>
+ </attribute>
+ <addaction name="NewGroupAction" />
+ <addaction name="NewGroupFromSelectionAction" />
+ <addaction name="RenameGroupAction" />
+ <addaction name="RemoveGroupAction" />
+ <addaction name="separator" />
+ <addaction name="NewNameAction" />
+ <addaction name="AddToGroupAction" />
+ <addaction name="RemoveFromGroupAction" />
+ <addaction name="RemoveNameAction" />
+ </widget>
+ <action name="NewGroupAction" >
+ <property name="text" >
+ <string>New Group...</string>
+ </property>
+ </action>
+ <action name="NewNameAction" >
+ <property name="text" >
+ <string>New Name...</string>
+ </property>
+ </action>
+ <action name="RemoveGroupAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Delete Group...</string>
+ </property>
+ </action>
+ <action name="QuitAction" >
+ <property name="text" >
+ <string>Quit</string>
+ </property>
+ </action>
+ <action name="RemoveNameAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Delete Name...</string>
+ </property>
+ </action>
+ <action name="NewGroupFromSelectionAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>New Group From Selection...</string>
+ </property>
+ </action>
+ <action name="ImportAction" >
+ <property name="text" >
+ <string>Import...</string>
+ </property>
+ </action>
+ <action name="RenameGroupAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Rename Group...</string>
+ </property>
+ </action>
+ <action name="RemoveFromGroupAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Leave Group</string>
+ </property>
+ </action>
+ <action name="AddToGroupAction" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Join Group...</string>
+ </property>
+ </action>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>FABGroupTable</class>
+ <extends>QTableWidget</extends>
+ <header>fabgrouptable.h</header>
+ </customwidget>
+ <customwidget>
+ <class>FABNameTable</class>
+ <extends>QTableWidget</extends>
+ <header>fabnametable.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/faxsetupdialog.py b/ui5/faxsetupdialog.py
new file mode 100644
index 000000000..021875ca8
--- /dev/null
+++ b/ui5/faxsetupdialog.py
@@ -0,0 +1,298 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, utils
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from base.sixext import to_unicode
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .faxsetupdialog_base import Ui_Dialog
+from .deviceuricombobox import DEVICEURICOMBOBOX_TYPE_FAX_ONLY
+
+fax_enabled = prop.fax_build
+
+if fax_enabled:
+ try:
+ from fax import fax
+ except ImportError:
+ # This can fail on Python < 2.3 due to the datetime module
+ # or if fax was diabled during the build
+ fax_enabled = False
+
+if not fax_enabled:
+ log.warn("Fax disabled.")
+
+
+class FaxSetupDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.initUi()
+ self.dev = None
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.FaxComboBox.DeviceUriComboBox_noDevices.connect(self.FaxComboBox_noDevices)
+ self.FaxComboBox.DeviceUriComboBox_currentChanged.connect(self.FaxComboBox_currentChanged)
+ self.FaxComboBox.setType(DEVICEURICOMBOBOX_TYPE_FAX_ONLY)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.FaxComboBox.setInitialDevice(self.device_uri)
+
+ self.NameCompanyLineEdit.setMaxLength(50)
+ self.FaxNumberLineEdit.setMaxLength(50)
+ self.FaxNumberLineEdit.setValidator(PhoneNumValidator(self.FaxNumberLineEdit))
+ self.VoiceNumberLineEdit.setMaxLength(50)
+ self.VoiceNumberLineEdit.setValidator(PhoneNumValidator(self.VoiceNumberLineEdit))
+ self.EmailLineEdit.setMaxLength(50)
+
+ self.NameCompanyLineEdit.editingFinished.connect( self.NameCompanyLineEdit_editingFinished)
+
+ self.NameCompanyLineEdit.textChanged["const QString &"].connect( self.NameCompanyLineEdit_textChanged)
+
+ self.FaxNumberLineEdit.editingFinished.connect( self.FaxNumberLineEdit_editingFinished)
+
+ self.FaxNumberLineEdit.textChanged["const QString &"].connect( self.FaxNumberLineEdit_textChanged)
+
+ self.VoiceNumberLineEdit.editingFinished.connect( self.VoiceNumberLineEdit_editingFinished)
+
+ self.VoiceNumberLineEdit.textChanged["const QString &"].connect( self.VoiceNumberLineEdit_textChanged)
+
+ self.EmailLineEdit.editingFinished.connect( self.EmailLineEdit_editingFinished)
+
+ self.EmailLineEdit.textChanged["const QString &"].connect( self.EmailLineEdit_textChanged)
+
+ self.tabWidget.currentChanged[int].connect(self.Tabs_currentChanged)
+
+ self.name_company_dirty = False
+ self.fax_number_dirty = False
+ self.voice_number_dirty = False
+ self.email_dirty = False
+
+
+ def updateUi(self):
+ if not fax_enabled:
+ FailureUI(self, self.__tr("<b>PC send fax support is not enabled.</b><p>Re-install HPLIP with fax support or use the device front panel to send a fax.</p><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+ return
+
+ self.FaxComboBox.updateUi()
+ self.tabWidget.setCurrentIndex(0)
+
+
+ def FaxComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+ self.updateCoverpageTab()
+
+ if self.dev is not None:
+ self.dev.close()
+
+ try:
+ self.dev = fax.getFaxDevice(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+ self.updateHeaderTab()
+
+
+
+ def FaxComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that require fax setup found.</b>"))
+ self.close()
+
+ #
+ # Name/Company (for TTI header) (stored in device)
+ #
+
+ def NameCompanyLineEdit_editingFinished(self):
+ self.saveNameCompany(to_unicode(self.NameCompanyLineEdit.text()))
+
+
+ def NameCompanyLineEdit_textChanged(self, s):
+ self.name_company_dirty = True
+
+
+ def saveNameCompany(self, s):
+ self.name_company_dirty = False
+ beginWaitCursor()
+ try:
+ try:
+ log.debug("Saving station name %s to device" % s)
+ self.dev.setStationName(s)
+ except Error:
+ CheckDeviceUI(self)
+ finally:
+ endWaitCursor()
+
+ #
+ # Fax Number (for TTI header) (stored in device)
+ #
+
+ def FaxNumberLineEdit_editingFinished(self):
+ self.saveFaxNumber(to_unicode(self.FaxNumberLineEdit.text()))
+
+
+ def FaxNumberLineEdit_textChanged(self, s):
+ self.fax_number_dirty = True
+
+
+ def saveFaxNumber(self, s):
+ self.fax_number_dirty = False
+ beginWaitCursor()
+ try:
+ try:
+ log.debug("Saving fax number %s to device" % s)
+ self.dev.setPhoneNum(s)
+ except Error:
+ CheckDeviceUI(self)
+ finally:
+ endWaitCursor()
+
+ #
+ # Voice Number (for coverpage) (stored in ~/.hplip/hplip.conf)
+ #
+
+ def VoiceNumberLineEdit_editingFinished(self):
+ self.saveVoiceNumber(to_unicode(self.VoiceNumberLineEdit.text()))
+
+
+ def VoiceNumberLineEdit_textChanged(self, s):
+ self.voice_number_dirty = True
+
+
+ def saveVoiceNumber(self, s):
+ log.debug("Saving voice number (%s) to ~/.hplip/hplip.conf" % s)
+ self.voice_number_dirty = False
+ #user_conf.set('fax', 'voice_phone', s)
+ self.user_settings.voice_phone = s
+ self.user_settings.save()
+
+ #
+ # EMail (for coverpage) (stored in ~/.hplip/hplip.conf)
+ #
+
+ def EmailLineEdit_editingFinished(self):
+ self.saveEmail(to_unicode(self.EmailLineEdit.text()))
+
+
+ def EmailLineEdit_textChanged(self, s):
+ self.email_dirty = True
+
+
+ def saveEmail(self, s):
+ log.debug("Saving email address (%s) to ~/.hplip/hplip.conf" % s)
+ self.email_dirty = False
+ #user_conf.set('fax', 'email_address', s)
+ self.user_settings.email_address = s
+ self.user_settings.save()
+
+ #
+ #
+ #
+
+ def CancelButton_clicked(self):
+ self.close()
+
+ def Tabs_currentChanged(self, tab=0):
+ """ Called when the active tab changes.
+ Update newly displayed tab.
+ """
+ if tab == 0:
+ self.updateHeaderTab()
+ elif tab ==1:
+ self.updateCoverpageTab()
+
+
+ def updateHeaderTab(self):
+ beginWaitCursor()
+ try:
+ try:
+ name_company = to_unicode(self.dev.getStationName())
+ log.debug("name_company = '%s'" % name_company)
+ self.NameCompanyLineEdit.setText(name_company)
+ fax_number = str(self.dev.getPhoneNum())
+ log.debug("fax_number = '%s'" % fax_number)
+ self.FaxNumberLineEdit.setText(fax_number)
+ except Error:
+ CheckDeviceUI(self)
+ finally:
+ endWaitCursor()
+
+
+ def updateCoverpageTab(self):
+ #voice_phone = user_conf.get('fax', 'voice_phone')
+ voice_phone = self.user_settings.voice_phone
+ log.debug("voice_phone = '%s'" % voice_phone)
+ self.VoiceNumberLineEdit.setText(voice_phone)
+ #email_address = user_conf.get('fax', 'email_address')
+ email_address = self.user_settings.email_address
+ log.debug("email_address = '%s'" % email_address)
+ self.EmailLineEdit.setText(email_address)
+
+
+ def closeEvent(self, e):
+ if self.voice_number_dirty:
+ self.VoiceNumberLineEdit.editingFinished.emit()
+ if self.name_company_dirty:
+ self.NameCompanyLineEdit.editingFinished.emit()
+ if self.email_dirty:
+ self.EmailLineEdit.editingFinished.emit()
+ if self.fax_number_dirty:
+ self.FaxNumberLineEdit.editingFinished.emit()
+ if self.dev is not None:
+ self.dev.close()
+
+ e.accept()
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("FaxSetupDialog",s,c)
+
+
diff --git a/ui5/faxsetupdialog_base.py b/ui5/faxsetupdialog_base.py
new file mode 100644
index 000000000..71a42353b
--- /dev/null
+++ b/ui5/faxsetupdialog_base.py
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/faxsetupdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 3)
+ self.FaxComboBox = DeviceUriComboBox(Dialog)
+ self.FaxComboBox.setObjectName("FaxComboBox")
+ self.gridlayout.addWidget(self.FaxComboBox, 2, 0, 1, 3)
+ self.tabWidget = QtWidgets.QTabWidget(Dialog)
+ self.tabWidget.setObjectName("tabWidget")
+ self.tab = QtWidgets.QWidget()
+ self.tab.setObjectName("tab")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.tab)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_3 = QtWidgets.QLabel(self.tab)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout1.addWidget(self.label_3, 0, 0, 1, 2)
+ self.label_2 = QtWidgets.QLabel(self.tab)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 1, 0, 1, 1)
+ self.NameCompanyLineEdit = QtWidgets.QLineEdit(self.tab)
+ self.NameCompanyLineEdit.setObjectName("NameCompanyLineEdit")
+ self.gridlayout1.addWidget(self.NameCompanyLineEdit, 1, 1, 1, 1)
+ self.label_4 = QtWidgets.QLabel(self.tab)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout1.addWidget(self.label_4, 2, 0, 1, 1)
+ self.FaxNumberLineEdit = QtWidgets.QLineEdit(self.tab)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout1.addWidget(self.FaxNumberLineEdit, 2, 1, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ self.tabWidget.addTab(self.tab, "")
+ self.tab_2 = QtWidgets.QWidget()
+ self.tab_2.setObjectName("tab_2")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.tab_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_5 = QtWidgets.QLabel(self.tab_2)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout2.addWidget(self.label_5, 0, 0, 1, 2)
+ self.label_6 = QtWidgets.QLabel(self.tab_2)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout2.addWidget(self.label_6, 1, 0, 1, 1)
+ self.VoiceNumberLineEdit = QtWidgets.QLineEdit(self.tab_2)
+ self.VoiceNumberLineEdit.setObjectName("VoiceNumberLineEdit")
+ self.gridlayout2.addWidget(self.VoiceNumberLineEdit, 1, 1, 1, 1)
+ self.label_7 = QtWidgets.QLabel(self.tab_2)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout2.addWidget(self.label_7, 2, 0, 1, 1)
+ self.EmailLineEdit = QtWidgets.QLineEdit(self.tab_2)
+ self.EmailLineEdit.setObjectName("EmailLineEdit")
+ self.gridlayout2.addWidget(self.EmailLineEdit, 2, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 131, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout2.addItem(spacerItem1, 3, 1, 1, 1)
+ self.tabWidget.addTab(self.tab_2, "")
+ self.gridlayout.addWidget(self.tabWidget, 3, 0, 1, 3)
+ spacerItem2 = QtWidgets.QSpacerItem(371, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem2, 4, 0, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.tabWidget.setCurrentIndex(1)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Fax Device Setup"))
+ self.label.setText(_translate("Dialog", "Fax Device Setup"))
+ self.label_3.setText(_translate("Dialog", "This information will appear at the top of each fax you send."))
+ self.label_2.setText(_translate("Dialog", "Name and/or Company:"))
+ self.label_4.setText(_translate("Dialog", "Fax Number:"))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Dialog", "Fax Header"))
+ self.label_5.setText(_translate("Dialog", "This information will appear on all coverpages."))
+ self.label_6.setText(_translate("Dialog", "Voice Phone Number:"))
+ self.label_7.setText(_translate("Dialog", "Email Address:"))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Dialog", "Coverpage"))
+ self.CancelButton.setText(_translate("Dialog", "Close"))
+
+from .deviceuricombobox import DeviceUriComboBox
diff --git a/ui5/faxsetupdialog_base.ui b/ui5/faxsetupdialog_base.ui
new file mode 100644
index 000000000..ab0f1a1ac
--- /dev/null
+++ b/ui5/faxsetupdialog_base.ui
@@ -0,0 +1,170 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Fax Device Setup</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Fax Device Setup</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="DeviceUriComboBox" name="FaxComboBox" />
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="QTabWidget" name="tabWidget" >
+ <property name="currentIndex" >
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="tab" >
+ <attribute name="title" >
+ <string>Fax Header</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>This information will appear at the top of each fax you send.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Name and/or Company:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="NameCompanyLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Fax Number:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="FaxNumberLineEdit" />
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2" >
+ <attribute name="title" >
+ <string>Coverpage</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>This information will appear on all coverpages.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Voice Phone Number:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="VoiceNumberLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>Email Address:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="EmailLineEdit" />
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>131</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>371</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/filetable.py b/ui5/filetable.py
new file mode 100644
index 000000000..8a13f9542
--- /dev/null
+++ b/ui5/filetable.py
@@ -0,0 +1,431 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Std Lib
+import sys
+import os.path
+import os
+import subprocess
+
+# Local
+from base.g import *
+from base import utils, magic
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from base.sixext import to_unicode, to_string_utf8, from_unicode_to_str
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Other UI
+from .mimetypesdialog import MimeTypesDialog
+
+
+FILETABLE_TYPE_PRINT = 0
+FILETABLE_TYPE_FAX = 1
+
+
+
+class FileTable(QWidget):
+
+ fileListChanged = pyqtSignal()
+ isEmpty = pyqtSignal()
+ isNotEmpt = pyqtSignal()
+
+ def __init__(self, parent):
+ QWidget.__init__(self, parent)
+ self.parent = parent
+
+ self.initUi()
+ self.file_list = []
+ self.typ = FILETABLE_TYPE_PRINT
+ self.selected_filename = None
+ self.fax_add_callback = None
+ self.allowable_mime_types = cups.getAllowableMIMETypes()
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.working_dir = self.user_settings.working_dir #user_conf.workingDirectory()
+
+
+
+ def initUi(self):
+ self.gridlayout = QGridLayout(self)
+ self.gridlayout.setObjectName("gridlayout")
+ self.FileTable = QTableWidget(self)
+ self.FileTable.setObjectName("FileTable")
+ self.gridlayout.addWidget(self.FileTable,0,0,1,6)
+ self.AddFileButton = QPushButton(self)
+ self.AddFileButton.setObjectName("AddFileButton")
+ self.gridlayout.addWidget(self.AddFileButton,1,0,1,1)
+ self.RemoveFileButton = QPushButton(self)
+ self.RemoveFileButton.setObjectName("RemoveFileButton")
+ self.gridlayout.addWidget(self.RemoveFileButton,1,1,1,1)
+ self.MoveFileUpButton = QPushButton(self)
+ self.MoveFileUpButton.setObjectName("MoveFileUpButton")
+ self.gridlayout.addWidget(self.MoveFileUpButton,1,2,1,1)
+ self.MoveFileDownButton = QPushButton(self)
+ self.MoveFileDownButton.setObjectName("MoveFileDownButton")
+ self.gridlayout.addWidget(self.MoveFileDownButton,1,3,1,1)
+ spacerItem = QSpacerItem(91,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem,1,4,1,1)
+ self.ShowTypesButton = QPushButton(self)
+ self.ShowTypesButton.setObjectName("ShowTypesButton")
+ self.gridlayout.addWidget(self.ShowTypesButton,1,5,1,1)
+ self.AddFileButton.setText(self.__tr("Add..."))
+ self.AddFileButton.setIcon(QIcon(load_pixmap('list_add', '16x16')))
+ self.AddFileButton.clicked.connect(self.AddFileButton_clicked)
+ self.RemoveFileButton.setIcon(QIcon(load_pixmap('list_remove', '16x16')))
+ self.RemoveFileButton.setText(self.__tr("Remove"))
+ self.RemoveFileButton.clicked.connect(self.RemoveFileButton_clicked)
+ self.MoveFileUpButton.setText(self.__tr("Move Up"))
+ self.MoveFileUpButton.setIcon(QIcon(load_pixmap('up', '16x16')))
+ self.MoveFileUpButton.clicked.connect(self.MoveFileUpButton_clicked)
+ self.MoveFileDownButton.setText(self.__tr("Move Down"))
+ self.MoveFileDownButton.setIcon(QIcon(load_pixmap('down', '16x16')))
+ self.MoveFileDownButton.clicked.connect(self.MoveFileDownButton_clicked)
+ self.ShowTypesButton.setText(self.__tr("Show Valid Types..."))
+ self.ShowTypesButton.setIcon(QIcon(load_pixmap('mimetypes', '16x16')))
+ self.ShowTypesButton.clicked.connect(self.ShowTypesButton_clicked)
+ self.FileTable.setContextMenuPolicy(Qt.CustomContextMenu)
+ #self.connect(self.FileTable, SIGNAL("customContextMenuRequested(const QPoint &)"),
+ # self.FileTable_customContextMenuRequested)
+ self.FileTable.customContextMenuRequested["const QPoint &"].connect(self.FileTable_customContextMenuRequested)
+ self.headers = [self.__tr("Name"), self.__tr("Type"), self.__tr("Folder/Path")]
+
+ self.FileTable.setSortingEnabled(False)
+ self.FileTable.itemSelectionChanged.connect(self.FileTable_itemSelectionChanged)
+
+
+ def setWorkingDir(self, d):
+ if os.path.exists(d):
+ self.working_dir = d
+
+
+ def getWorkingDir(self):
+ if self.file_list:
+ self.working_dir = os.path.pathname(self.file_list[0][0])
+ #user_conf.setWorkingDirectory(self.working_dir)
+ self.user_settings.working_dir = self.working_dir
+ self.user_settings.save()
+
+ return self.working_dir
+
+
+ def setType(self, t):
+ self.typ = t
+ if self.typ == FILETABLE_TYPE_FAX:
+ self.headers = [self.__tr("Name"), self.__tr("Type"), self.__tr("Pages")]
+ if log.is_debug():
+ self.headers.append(self.__tr("File"))
+
+
+ def setFaxCallback(self, callback):
+ self.fax_add_callback = callback
+
+
+ def isNotEmpty(self):
+ return len(self.file_list)
+
+
+ def FileTable_itemSelectionChanged(self):
+ self.selected_filename = self.currentFilename()
+ self.setUpDownButtons()
+
+
+ def updateUi(self, show_add_file_if_empty=True):
+ self.FileTable.clear()
+ self.FileTable.setRowCount(len(self.file_list))
+ self.FileTable.setColumnCount(0)
+
+ if self.file_list:
+ # self.emit(SIGNAL("isNotEmpty"))
+ self.isNotEmpt.emit()
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ selected = None
+ self.FileTable.setColumnCount(len(self.headers))
+ self.FileTable.setHorizontalHeaderLabels(self.headers)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ for row, f in enumerate(self.file_list):
+ filename, mime_type, mime_type_desc, title, num_pages = f
+ col = 0
+
+ if self.typ == FILETABLE_TYPE_FAX:
+ if title:
+ i = QTableWidgetItem(title)
+ else:
+ i = QTableWidgetItem(os.path.basename(filename))
+ else: # FILETABLE_TYPE_PRINT
+ # Filename (basename)
+ i = QTableWidgetItem(os.path.basename(filename))
+
+ i.setData(Qt.UserRole, to_unicode(filename))
+ i.setFlags(flags)
+
+ if self.selected_filename is not None and \
+ self.selected_filename == filename:
+ selected = i
+
+ self.FileTable.setItem(row, col, i)
+ col += 1
+
+ # MIME type
+ i = QTableWidgetItem(mime_type_desc)
+ i.setFlags(flags)
+ self.FileTable.setItem(row, col, i)
+ col += 1
+
+ if self.typ == FILETABLE_TYPE_PRINT:
+ # path/folder
+ i = QTableWidgetItem(os.path.dirname(filename))
+ i.setFlags(flags)
+ self.FileTable.setItem(row, col, i)
+ col += 1
+
+ if self.typ == FILETABLE_TYPE_FAX:
+ # num pages
+ if num_pages < 1:
+ i = QTableWidgetItem(self.__tr("(unknown)"))
+ else:
+ i = QTableWidgetItem(to_unicode(num_pages))
+ i.setFlags(flags)
+ self.FileTable.setItem(row, col, i)
+ col += 1
+
+ if self.typ == FILETABLE_TYPE_FAX and log.is_debug():
+ i = QTableWidgetItem(filename)
+ i.setFlags(flags)
+ self.FileTable.setItem(row, col, i)
+
+
+ self.FileTable.resizeColumnsToContents()
+
+ if selected is None:
+ selected = self.FileTable.item(0, 0)
+
+ selected.setSelected(True)
+ self.FileTable.setCurrentItem(selected)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ self.RemoveFileButton.setEnabled(True)
+ self.RemoveFileButton.setIcon(QIcon(load_pixmap('list_remove', '16x16')))
+
+ self.setUpDownButtons()
+
+ else:
+ # self.emit(SIGNAL("isEmpty"))
+ self.isEmpty.emit()
+ self.RemoveFileButton.setEnabled(False)
+ self.setUpDownButtons()
+
+ if show_add_file_if_empty:
+ # self.AddFileButton.emit(SIGNAL("clicked()"))
+ self.AddFileButton.clicked.emit()
+
+
+ def setUpDownButtons(self):
+ if self.file_list:
+ i = self.FileTable.currentRow()
+
+ if len(self.file_list) > 1 and i != len(self.file_list)-1:
+ self.MoveFileDownButton.setEnabled(True)
+ else:
+ self.MoveFileDownButton.setEnabled(False)
+
+ if len(self.file_list) > 1 and i != 0:
+ self.MoveFileUpButton.setEnabled(True)
+ else:
+ self.MoveFileUpButton.setEnabled(False)
+
+ else:
+ self.MoveFileDownButton.setEnabled(False)
+ self.MoveFileUpButton.setEnabled(False)
+
+
+ def AddFileButton_clicked(self):
+ if self.typ == FILETABLE_TYPE_PRINT:
+ s = self.__tr("Select File(s) to Print")
+ else:
+ stat = ''
+ try :
+ p = subprocess.Popen('getenforce', stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stat, err = p.communicate()
+ stat = to_string_utf8(stat)
+ except OSError :
+ pass
+ except :
+ log.exception()
+ # if stat.strip('\n') == 'Enforcing' :
+ # FailureUI(self, self.__tr("<b>Unable to add file. Please disable SeLinux.</b><p>Either disable it manually or run hp-doctor from terminal.</p>"),
+ # self.__tr("HP Device Manager"))
+ # return
+
+ s = self.__tr("Select File(s) to Send")
+
+ files = QFileDialog.getOpenFileNames(self, s, self.working_dir, self.__tr("All files (*)"))
+
+ files = [to_unicode(f) for f in files[0]]
+ # log.error(files)
+ if files:
+ self.addFileList(files)
+
+ if self.typ == FILETABLE_TYPE_PRINT:
+ self.updateUi(False)
+
+
+ def addFileList(self, file_list):
+ for f in file_list:
+ self.addFileFromUI(f)
+
+
+ def addFileFromUI(self, f, title='', num_pages=0):
+ f = os.path.abspath(os.path.expanduser(f))
+ log.debug("Trying to add file: %s" % f)
+ if os.path.exists(f) and os.access(f, os.R_OK):
+ mime_type = magic.mime_type(f)
+ mime_type_desc = mime_type
+ log.debug("File type of file %s: %s" % (f, mime_type))
+ try:
+ mime_type_desc = MIME_TYPES_DESC[mime_type][0]
+ except KeyError:
+ if self.typ == FILETABLE_TYPE_PRINT:
+ FailureUI(self, self.__tr("<b>You are trying to add a file '%s' that cannot be directly printed with this utility.</b><p>To print this file, use the print command in the application that created it.<p>Note: Click <i>Show Valid Types...</i> to view a list of compatible file types that can be directly printed from this utility."%f),
+ self.__tr("HP Device Manager"))
+ else:
+ FailureUI(self, self.__tr("<b>You are trying to add a file '%s' that cannot be directly faxed with this utility.</b><p>To fax this file, use the print command in the application that created it (using the appropriate fax print queue).<p>Note: Click <i>Show Valid Types...</i> to view a list of compatible file types that can be directly added to the fax file list in this utility."%f),
+ self.__tr("HP Device Manager"))
+ else:
+ if self.typ == FILETABLE_TYPE_PRINT:
+ self.addFile(f, mime_type, mime_type_desc, title, num_pages)
+ else:
+ self.fax_add_callback(f)
+ else:
+ FailureUI(self, self.__tr("<b>Unable to add file '%s' to file list (file not found or insufficient permissions).</b><p>Check the file name and try again."%f),
+ self.__tr("HP Device Manager"))
+
+
+ def addFile(self, f, mime_type, mime_type_desc, title, num_pages):
+ log.debug("Adding file %s (%s,%s,%s,%d)" % (f, mime_type, mime_type_desc, title, num_pages))
+ self.file_list.append((f, mime_type, mime_type_desc, title, num_pages))
+ self.updateUi()
+ # self.emit(SIGNAL("fileListChanged"))
+ self.fileListChanged.emit()
+
+
+ def currentFilename(self):
+ i = self.FileTable.item(self.FileTable.currentRow(), 0)
+ if i is None:
+ return None
+
+ return value_str(i.data(Qt.UserRole))
+
+
+ def RemoveFileButton_clicked(self):
+ filename = self.currentFilename()
+ if filename is None:
+ return
+
+ return self.removeFile(filename)
+
+
+ def removeFile(self, filename):
+ temp = self.file_list[:]
+ index = 0
+ for f, mime_type, mime_type_desc, title, num_pages in temp:
+ if f == to_unicode(filename):
+ del self.file_list[index]
+ # self.emit(SIGNAL("fileListChanged"))
+ self.fileListChanged.emit()
+ self.updateUi(False)
+ break
+ index += 1
+
+
+ def removeFileByMIMEType(self, mime_type):
+ temp = self.file_list[:]
+ index = 0
+ for filename, m, mime_type_desc, title, num_pages in temp:
+ if m == mime_type:
+ del self.file_list[index]
+ # self.emit(SIGNAL("fileListChanged"))
+ self.fileListChanged.emit()
+ self.updateUi(False)
+ break
+ index += 1
+
+
+ def isMIMETypeInList(self, mime_type):
+ for filename, m, mime_type_desc, title, num_pages in self.file_list:
+ if m == mime_type:
+ return True
+
+ return False
+
+
+ def ShowTypesButton_clicked(self):
+ x = {}
+ for a in self.allowable_mime_types:
+ x[a] = MIME_TYPES_DESC.get(a, ('Unknown', 'n/a'))
+
+ dlg = MimeTypesDialog(x, self)
+ dlg.exec_()
+
+
+ def MoveFileUpButton_clicked(self):
+ filename = self.currentFilename()
+ if filename is None:
+ return
+
+ utils.list_move_up(self.file_list, filename, self.__compareFilenames)
+ self.updateUi()
+
+
+ def MoveFileDownButton_clicked(self):
+ filename = self.currentFilename()
+ if filename is None:
+ return
+
+ utils.list_move_down(self.file_list, filename, self.__compareFilenames)
+ self.updateUi()
+
+
+ def __compareFilenames(self, a, b):
+ return a[0] == b
+
+
+ def FileTable_customContextMenuRequested(self, p):
+ print(p)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("FileTable",s,c)
+
+
+
diff --git a/ui5/firmwaredialog.py b/ui5/firmwaredialog.py
new file mode 100644
index 000000000..a6ee0d9b6
--- /dev/null
+++ b/ui5/firmwaredialog.py
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# Std Lib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, utils
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .firmwaredialog_base import Ui_Dialog
+
+
+class FirmwareDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.initUi()
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ self.DeviceComboBox.setFilter({'fw-download' : (operator.gt, 0)})
+
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.CancelButton.clicked.connect(self.close)
+ self.DownloadFirmwareButton.clicked.connect(self.downloadFirmware)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+ # Update
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support firmware download found.</b>"))
+ self.close()
+
+
+ def downloadFirmware(self):
+ d = None
+
+ try:
+ try:
+ d = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+ try:
+ d.open()
+ except Error:
+ CheckDeviceUI(self)
+ else:
+ if d.isIdleAndNoError():
+ ok = d.downloadFirmware()
+
+ else:
+ CheckDeviceUI(self)
+
+ finally:
+ if d is not None:
+ d.close()
+
+ self.close()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("FirmwareDialog",s,c)
+
diff --git a/ui5/firmwaredialog_base.py b/ui5/firmwaredialog_base.py
new file mode 100644
index 000000000..876a3c32c
--- /dev/null
+++ b/ui5/firmwaredialog_base.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/firmwaredialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 3)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 3)
+ self.frame = QtWidgets.QFrame(Dialog)
+ self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
+ self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
+ self.frame.setObjectName("frame")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.frame)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_2 = QtWidgets.QLabel(self.frame)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 0, 0, 1, 1)
+ self.gridlayout.addWidget(self.frame, 3, 0, 1, 3)
+ spacerItem = QtWidgets.QSpacerItem(20, 171, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(301, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.DownloadFirmwareButton = QtWidgets.QPushButton(Dialog)
+ self.DownloadFirmwareButton.setObjectName("DownloadFirmwareButton")
+ self.gridlayout.addWidget(self.DownloadFirmwareButton, 5, 1, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Download Firmware"))
+ self.label.setText(_translate("Dialog", "Download Firmware"))
+ self.label_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Click<span style=\" font-style:italic;\"> Download Firmware</span> to begin download process.</p></body></html>"))
+ self.DownloadFirmwareButton.setText(_translate("Dialog", "Download Firmware"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
diff --git a/ui5/firmwaredialog_base.ui b/ui5/firmwaredialog_base.ui
new file mode 100644
index 000000000..d5b67340d
--- /dev/null
+++ b/ui5/firmwaredialog_base.ui
@@ -0,0 +1,114 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Download Firmware</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Download Firmware</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="QFrame" name="frame" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click&lt;span style=" font-style:italic;"> Download Firmware&lt;/span> to begin download process.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>171</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QPushButton" name="DownloadFirmwareButton" >
+ <property name="text" >
+ <string>Download Firmware</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/infodialog.py b/ui5/infodialog.py
new file mode 100644
index 000000000..0de62fb1c
--- /dev/null
+++ b/ui5/infodialog.py
@@ -0,0 +1,311 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import os.path
+
+# Local
+from base.g import *
+from base import device
+from prnt import cups
+from base.codes import *
+from base.sixext import to_unicode
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .infodialog_base import Ui_Dialog
+from .deviceuricombobox import DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX
+
+
+class InfoDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.device_uri = device_uri
+ #self.tabs = []
+ self.setupUi(self)
+ self.initUi()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+ self.DeviceComboBox.setType(DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX)
+
+ self.headers = [self.__tr("Key"), self.__tr("Value")]
+ self.history_headers = [self.__tr("Date/Time"), None,
+ self.__tr("Event Code"), self.__tr("Description"),
+ self.__tr("User"), self.__tr("CUPS Job ID"),
+ self.__tr("Doc. Title")]
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+ #self.updateInfoTable()
+
+
+ def updateInfoTable(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ self.DynamicTableWidget.clear()
+ self.DynamicTableWidget.setRowCount(0)
+ self.DynamicTableWidget.setColumnCount(0)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ while self.TabWidget.count() > 3:
+ self.TabWidget.removeTab(3)
+
+ self.DynamicTableWidget.clear()
+ self.DynamicTableWidget.setRowCount(0)
+ self.DynamicTableWidget.setColumnCount(len(self.headers))
+ self.DynamicTableWidget.setHorizontalHeaderLabels(self.headers)
+
+ #
+ # Static Data
+ #
+
+ try:
+ d = device.Device(self.device_uri, None)
+ except Error:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Unable to open device %s.</b>"%(self.device_uri)))
+ #self.close()
+ return
+
+ self.StaticTableWidget.clear()
+
+ self.StaticTableWidget.setColumnCount(len(self.headers))
+ self.StaticTableWidget.setHorizontalHeaderLabels(self.headers)
+
+ mq_keys = list(d.mq.keys())
+ mq_keys.sort()
+
+ self.StaticTableWidget.setRowCount(len(mq_keys))
+
+ for row, key in enumerate(mq_keys):
+ i = QTableWidgetItem(str(key))
+ i.setFlags(flags)
+ self.StaticTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(str(d.mq[key]))
+ i.setFlags(flags)
+ self.StaticTableWidget.setItem(row, 1, i)
+
+ self.StaticTableWidget.resizeColumnToContents(0)
+ self.StaticTableWidget.resizeColumnToContents(1)
+ self.StaticTableWidget.setSortingEnabled(True)
+ self.StaticTableWidget.sortItems(0)
+
+ #
+ # Dynamic Data
+ #
+
+ try:
+ try:
+ d.open()
+ d.queryDevice()
+ except Error as e:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Unable to open device %s.</b>"%(self.device_uri)))
+ #self.close()
+ return
+
+ dq_keys = list(d.dq.keys())
+ dq_keys.sort()
+
+ self.DynamicTableWidget.setRowCount(len(dq_keys))
+
+ for row, key in enumerate(dq_keys):
+ i = QTableWidgetItem(str(key))
+ i.setFlags(flags)
+ self.DynamicTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(str(d.dq[key]))
+ i.setFlags(flags)
+ self.DynamicTableWidget.setItem(row, 1, i)
+
+
+ self.DynamicTableWidget.resizeColumnToContents(0)
+ self.DynamicTableWidget.resizeColumnToContents(1)
+ self.DynamicTableWidget.setSortingEnabled(True)
+ self.DynamicTableWidget.sortItems(0)
+
+ finally:
+ d.close()
+
+ #
+ # History Table
+ #
+
+ self.HistoryTableWidget.clear()
+ self.HistoryTableWidget.setRowCount(0)
+
+ if d.device_type == DEVICE_TYPE_FAX:
+ self.history_headers[1] = self.__tr("Fax")
+ else:
+ self.history_headers[1] = self.__tr("Printer")
+
+ self.HistoryTableWidget.setColumnCount(len(self.history_headers))
+ self.HistoryTableWidget.setHorizontalHeaderLabels(self.history_headers)
+
+ history = d.queryHistory()
+ history.reverse()
+ self.HistoryTableWidget.setRowCount(len(history))
+
+ for row, h in enumerate(history):
+ dt = QDateTime()
+ dt.setTime_t(int(h.timedate))
+ dt = value_str(dt)
+
+ ess = device.queryString(h.event_code, 0)
+
+ for col, t in enumerate([dt, h.printer_name,
+ to_unicode(h.event_code), ess,
+ h.username, to_unicode(h.job_id),
+ h.title]):
+
+ i = QTableWidgetItem(str(t))
+ i.setFlags(flags)
+ self.HistoryTableWidget.setItem(row, col, i)
+
+ self.HistoryTableWidget.resizeColumnToContents(0)
+ self.HistoryTableWidget.resizeColumnToContents(1)
+ self.HistoryTableWidget.setSortingEnabled(True)
+ self.HistoryTableWidget.sortItems(0)
+
+ #
+ # Printer Data
+ #
+
+ printers = cups.getPrinters()
+
+ for p in printers:
+ if p.device_uri == self.device_uri:
+ Tab = QWidget()
+ Tab.setObjectName(str(p.name))
+
+ GridLayout = QGridLayout(Tab)
+ GridLayout.setObjectName(str("GridLayout-%s" % p.name))
+
+ Table = QTableWidget(Tab)
+ Table.setAlternatingRowColors(True)
+ Table.setSelectionMode(QAbstractItemView.SingleSelection)
+ Table.setSelectionBehavior(QAbstractItemView.SelectRows)
+ Table.setVerticalScrollMode(QAbstractItemView.ScrollPerItem)
+ Table.setHorizontalScrollMode(QAbstractItemView.ScrollPerPixel)
+ Table.setGridStyle(Qt.DotLine)
+ Table.setObjectName(str("Table-%s" % p.name))
+ GridLayout.addWidget(Table, 0, 0, 1, 1)
+ self.TabWidget.addTab(Tab, str(p.name))
+
+ Table.setColumnCount(len(self.headers))
+ Table.setHorizontalHeaderLabels(self.headers)
+
+ cups.resetOptions()
+ cups.openPPD(p.name)
+ current_options = dict(cups.getOptions())
+
+ #current_options['cups_error_log_level'] = cups.getErrorLogLevel()
+
+ try:
+ f = open(os.path.expanduser('~/.cups/lpoptions'))
+ except IOError as e:
+ log.debug(str(e))
+ current_options['lpoptions_file_data'] = str("(%s)"%str(e))
+ else:
+ text = f.read()
+ for d in text.splitlines():
+ if p.name in d:
+ current_options['lpoptions_file_data'] = d
+ break
+ else:
+ current_options['lpoptions_file_data'] = self.__tr("(no data)")
+
+ keys = list(current_options.keys())
+ keys.sort()
+
+ Table.setRowCount(len(keys))
+
+ for row, key in enumerate(keys):
+ i = QTableWidgetItem(str(key))
+ i.setFlags(flags)
+ Table.setItem(row, 0, i)
+
+ if key == 'printer-state':
+ state = int(current_options[key])
+ if state == cups.IPP_PRINTER_STATE_IDLE:
+ i = QTableWidgetItem(self.__tr("idle (%s)"%state))
+ elif state == cups.IPP_PRINTER_STATE_PROCESSING:
+ i = QTableWidgetItem(self.__tr("busy/printing (%s)"%state))
+ elif state == cups.IPP_PRINTER_STATE_STOPPED:
+ i = QTableWidgetItem(self.__tr("stopped (%s)"%state))
+ else:
+ i = QTableWidgetItem(str(state))
+ else:
+ i = QTableWidgetItem(str(current_options[key]))
+
+ i.setFlags(flags)
+ Table.setItem(row, 1, i)
+
+ Table.resizeColumnToContents(0)
+ Table.resizeColumnToContents(1)
+ Table.setSortingEnabled(True)
+ Table.sortItems(0)
+
+ cups.closePPD()
+ self.TabWidget.setCurrentIndex(0)
+ QApplication.restoreOverrideCursor()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+ self.updateInfoTable()
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices found.</b>"))
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("InfoDialog",s,c)
+
+
diff --git a/ui5/infodialog_base.py b/ui5/infodialog_base.py
new file mode 100644
index 000000000..9534b0a2e
--- /dev/null
+++ b/ui5/infodialog_base.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/infodialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 2)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 2)
+ self.TabWidget = QtWidgets.QTabWidget(Dialog)
+ self.TabWidget.setObjectName("TabWidget")
+ self.tab_2 = QtWidgets.QWidget()
+ self.tab_2.setObjectName("tab_2")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.tab_2)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.StaticTableWidget = QtWidgets.QTableWidget(self.tab_2)
+ self.StaticTableWidget.setAlternatingRowColors(True)
+ self.StaticTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.StaticTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.StaticTableWidget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerItem)
+ self.StaticTableWidget.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
+ self.StaticTableWidget.setGridStyle(QtCore.Qt.DotLine)
+ self.StaticTableWidget.setObjectName("StaticTableWidget")
+ self.StaticTableWidget.setColumnCount(0)
+ self.StaticTableWidget.setRowCount(0)
+ self.gridlayout1.addWidget(self.StaticTableWidget, 0, 0, 1, 1)
+ self.TabWidget.addTab(self.tab_2, "")
+ self.tab = QtWidgets.QWidget()
+ self.tab.setObjectName("tab")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.tab)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.DynamicTableWidget = QtWidgets.QTableWidget(self.tab)
+ self.DynamicTableWidget.setAlternatingRowColors(True)
+ self.DynamicTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.DynamicTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.DynamicTableWidget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerItem)
+ self.DynamicTableWidget.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
+ self.DynamicTableWidget.setGridStyle(QtCore.Qt.DotLine)
+ self.DynamicTableWidget.setObjectName("DynamicTableWidget")
+ self.DynamicTableWidget.setColumnCount(0)
+ self.DynamicTableWidget.setRowCount(0)
+ self.gridlayout2.addWidget(self.DynamicTableWidget, 0, 0, 1, 1)
+ self.TabWidget.addTab(self.tab, "")
+ self.tab_3 = QtWidgets.QWidget()
+ self.tab_3.setObjectName("tab_3")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.tab_3)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.HistoryTableWidget = QtWidgets.QTableWidget(self.tab_3)
+ self.HistoryTableWidget.setAlternatingRowColors(True)
+ self.HistoryTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.HistoryTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.HistoryTableWidget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
+ self.HistoryTableWidget.setGridStyle(QtCore.Qt.DotLine)
+ self.HistoryTableWidget.setObjectName("HistoryTableWidget")
+ self.HistoryTableWidget.setColumnCount(0)
+ self.HistoryTableWidget.setRowCount(0)
+ self.gridlayout3.addWidget(self.HistoryTableWidget, 0, 0, 1, 1)
+ self.TabWidget.addTab(self.tab_3, "")
+ self.gridlayout.addWidget(self.TabWidget, 3, 0, 1, 2)
+ spacerItem = QtWidgets.QSpacerItem(470, 31, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(361, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 1, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.TabWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Device Information"))
+ self.label.setText(_translate("Dialog", "Device Information"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab_2), _translate("Dialog", "Model Data (Static)"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab), _translate("Dialog", "Status Data (Dynamic)"))
+ self.HistoryTableWidget.setSortingEnabled(False)
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab_3), _translate("Dialog", "Status History"))
+ self.CancelButton.setText(_translate("Dialog", "Close"))
+
+from .deviceuricombobox import DeviceUriComboBox
diff --git a/ui5/infodialog_base.ui b/ui5/infodialog_base.ui
new file mode 100644
index 000000000..f86843197
--- /dev/null
+++ b/ui5/infodialog_base.ui
@@ -0,0 +1,179 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Device Information</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Device Information</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QTabWidget" name="TabWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab_2" >
+ <attribute name="title" >
+ <string>Model Data (Static)</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QTableWidget" name="StaticTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="verticalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="horizontalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ <property name="gridStyle" >
+ <enum>Qt::DotLine</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab" >
+ <attribute name="title" >
+ <string>Status Data (Dynamic)</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QTableWidget" name="DynamicTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="verticalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="horizontalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ <property name="gridStyle" >
+ <enum>Qt::DotLine</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_3" >
+ <attribute name="title" >
+ <string>Status History</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QTableWidget" name="HistoryTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="verticalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ <property name="gridStyle" >
+ <enum>Qt::DotLine</enum>
+ </property>
+ <property name="sortingEnabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>470</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>361</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/linefeedcaldialog.py b/ui5/linefeedcaldialog.py
new file mode 100644
index 000000000..13e749a31
--- /dev/null
+++ b/ui5/linefeedcaldialog.py
@@ -0,0 +1,125 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# Std Lib
+import operator
+
+# Local
+from base.g import *
+from base import device, utils, maint
+#from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .linefeedcaldialog_base import Ui_Dialog
+from .deviceuricombobox import DEVICEURICOMBOBOX_TYPE_FAX_ONLY
+
+
+class LineFeedCalDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.initUi()
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.CalibrateButton.clicked.connect(self.CalibrateButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'linefeed-cal-type': (operator.gt, 0)})
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+ self.LoadPaper.setButtonName(self.__tr("Calibrate"))
+ self.LoadPaper.updateUi()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+ # Update
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("""<b>No devices that support line feed calibration found.</b><p>Click <i>OK</i> to exit.</p>"""))
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def CalibrateButton_clicked(self):
+ d = None
+
+ try:
+ try:
+ d = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+ linefeed_type = d.linefeed_cal_type
+
+ try:
+ d.open()
+ except Error:
+ CheckDeviceUI(self)
+ else:
+ if d.isIdleAndNoError():
+ if linefeed_type == LINEFEED_CAL_TYPE_OJ_K550: # 1
+ maint.linefeedCalType1(d, lambda : True)
+
+ elif linefeed_type == LINEFEED_CAL_TYPE_OJ_PRO_L7XXX: # 2
+ maint.linefeedCalType2(d, lambda : True)
+
+ else:
+ CheckDeviceUI(self)
+
+ finally:
+ if d is not None:
+ d.close()
+
+ self.close()
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("LineFeedCalDialog",s,c)
+
+
diff --git a/ui5/linefeedcaldialog_base.py b/ui5/linefeedcaldialog_base.py
new file mode 100644
index 000000000..064bb9790
--- /dev/null
+++ b/ui5/linefeedcaldialog_base.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/linefeedcaldialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 3)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 3)
+ self.LoadPaper = LoadPaperGroupBox(Dialog)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 3, 0, 1, 3)
+ spacerItem = QtWidgets.QSpacerItem(410, 81, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(361, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.CalibrateButton = QtWidgets.QPushButton(Dialog)
+ self.CalibrateButton.setObjectName("CalibrateButton")
+ self.gridlayout.addWidget(self.CalibrateButton, 5, 1, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Line Feed Calibration"))
+ self.label.setText(_translate("Dialog", "Line Feed Calibration"))
+ self.CalibrateButton.setText(_translate("Dialog", "Calibrate"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
+from .loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui5/linefeedcaldialog_base.ui b/ui5/linefeedcaldialog_base.ui
new file mode 100644
index 000000000..2d0802019
--- /dev/null
+++ b/ui5/linefeedcaldialog_base.ui
@@ -0,0 +1,102 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Line Feed Calibration</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Line Feed Calibration</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>410</width>
+ <height>81</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>361</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QPushButton" name="CalibrateButton" >
+ <property name="text" >
+ <string>Calibrate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/loadpapergroupbox.py b/ui5/loadpapergroupbox.py
new file mode 100644
index 000000000..135c456a9
--- /dev/null
+++ b/ui5/loadpapergroupbox.py
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Std Lib
+import sys
+
+# Local
+from base.g import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+LOADPAPER_TYPE_PLAIN_PAPER = 0
+LOADPAPER_TYPE_PHOTO_PAPER = 1
+
+
+class LoadPaperGroupBox(QGroupBox):
+ def __init__(self, parent):
+ QWidget.__init__(self, parent)
+
+ self.initUi()
+ self.typ = LOADPAPER_TYPE_PLAIN_PAPER
+ self.button_name = self.__tr("Next >")
+
+
+ def initUi(self):
+ #print "LoadPaperWidget.initUi()"
+
+ self.GridLayout = QGridLayout(self)
+ self.GridLayout.setObjectName("GridLayout")
+
+ self.LoadPaperPix = QLabel(self)
+
+ sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.LoadPaperPix.sizePolicy().hasHeightForWidth())
+ self.LoadPaperPix.setSizePolicy(sizePolicy)
+ self.LoadPaperPix.setMinimumSize(QSize(96,96))
+ self.LoadPaperPix.setMaximumSize(QSize(96,96))
+ #self.LoadPaperPix.setFrameShape(QFrame.Box)
+ self.LoadPaperPix.setObjectName("LoadPaperPix")
+ self.GridLayout.addWidget(self.LoadPaperPix,0,0,1,1)
+
+ spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ self.GridLayout.addItem(spacerItem,0,1,1,1)
+
+ self.Text = QLabel(self)
+
+ sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Text.sizePolicy().hasHeightForWidth())
+ self.Text.setSizePolicy(sizePolicy)
+ self.Text.setWordWrap(True)
+ self.Text.setObjectName("Text")
+ self.GridLayout.addWidget(self.Text,0,2,1,1)
+
+ self.LoadPaperPix.setPixmap(load_pixmap("load_paper", "other"))
+
+
+ def updateUi(self):
+ #print "LoadPaperWidget.updateUi()"
+ if self.typ == LOADPAPER_TYPE_PLAIN_PAPER:
+ paper_name = self.__tr("plain paper")
+ else:
+ paper_name = self.__tr("photo paper")
+
+ self.Text.setText(self.__tr("Please load <b>%s</b> in the printer and then click <i>%s</i> to continue." %(paper_name, self.button_name)))
+
+
+ def setType(self, typ):
+ if typ in (LOADPAPER_TYPE_PHOTO_PAPER, LOADPAPER_TYPE_PHOTO_PAPER):
+ self.typ = typ
+
+
+ def setButtonName(self, b):
+ self.button_name = b
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("LoadPaperWidget",s,c)
diff --git a/ui5/makecopiesdialog.py b/ui5/makecopiesdialog.py
new file mode 100644
index 000000000..77c8ba481
--- /dev/null
+++ b/ui5/makecopiesdialog.py
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# Std Lib
+import operator
+
+# Local
+from base.g import *
+from base import device, utils
+#from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .makecopiesdialog_base import Ui_Dialog
+
+
+class MakeCopiesDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.initUi()
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.CopyButton.clicked.connect(self.CopyButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'copy-type': (operator.gt, 0)})
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+ # Update
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support PC initiated copy found.</b><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def CopyButton_clicked(self):
+ pass
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("MakeCopiesDialog",s,c)
+
+
diff --git a/ui5/makecopiesdialog_base.py b/ui5/makecopiesdialog_base.py
new file mode 100644
index 000000000..ce648208c
--- /dev/null
+++ b/ui5/makecopiesdialog_base.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/makecopiesdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 4)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 4)
+ spacerItem = QtWidgets.QSpacerItem(20, 341, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 3, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(391, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 4, 0, 1, 2)
+ self.CopyButton = QtWidgets.QPushButton(Dialog)
+ self.CopyButton.setObjectName("CopyButton")
+ self.gridlayout.addWidget(self.CopyButton, 4, 2, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 3, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Make Copies"))
+ self.label.setText(_translate("Dialog", "Make Copies"))
+ self.CopyButton.setText(_translate("Dialog", "Make Copies"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
diff --git a/ui5/makecopiesdialog_base.ui b/ui5/makecopiesdialog_base.ui
new file mode 100644
index 000000000..15ccdd6e9
--- /dev/null
+++ b/ui5/makecopiesdialog_base.ui
@@ -0,0 +1,89 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Make Copies</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Make Copies</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="4" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>341</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>391</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QPushButton" name="CopyButton" >
+ <property name="text" >
+ <string>Make Copies</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/mimetypesdialog.py b/ui5/mimetypesdialog.py
new file mode 100644
index 000000000..422e6c4ec
--- /dev/null
+++ b/ui5/mimetypesdialog.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Local
+from base.g import *
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+from .mimetypesdialog_base import Ui_MimeTypesDialog_base
+
+
+
+class MimeTypesDialog(QDialog, Ui_MimeTypesDialog_base):
+ def __init__(self, mime_types, parent=None):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.TypesTableWidget.setRowCount(len(mime_types))
+ t = list(mime_types.keys())
+ t.sort()
+ for row, m in enumerate(t):
+ i = QTableWidgetItem(m)
+ self.TypesTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(mime_types[m][0])
+ self.TypesTableWidget.setItem(row, 1, i)
+
+ i = QTableWidgetItem(mime_types[m][1])
+ self.TypesTableWidget.setItem(row, 2, i)
+
+ self.TypesTableWidget.resizeColumnsToContents()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SettingsDialog",s,c)
+
+
diff --git a/ui5/mimetypesdialog_base.py b/ui5/mimetypesdialog_base.py
new file mode 100644
index 000000000..232427203
--- /dev/null
+++ b/ui5/mimetypesdialog_base.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/mimetypesdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_MimeTypesDialog_base(object):
+ def setupUi(self, MimeTypesDialog_base):
+ MimeTypesDialog_base.setObjectName("MimeTypesDialog_base")
+ MimeTypesDialog_base.resize(500, 540)
+ self.gridlayout = QtWidgets.QGridLayout(MimeTypesDialog_base)
+ self.gridlayout.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout.setSpacing(6)
+ self.gridlayout.setObjectName("gridlayout")
+ self.textLabel3_2 = QtWidgets.QLabel(MimeTypesDialog_base)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.textLabel3_2.sizePolicy().hasHeightForWidth())
+ self.textLabel3_2.setSizePolicy(sizePolicy)
+ self.textLabel3_2.setWordWrap(False)
+ self.textLabel3_2.setObjectName("textLabel3_2")
+ self.gridlayout.addWidget(self.textLabel3_2, 0, 0, 1, 2)
+ self.line1_2 = QtWidgets.QFrame(MimeTypesDialog_base)
+ self.line1_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line1_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line1_2.setObjectName("line1_2")
+ self.gridlayout.addWidget(self.line1_2, 1, 0, 1, 2)
+ self.TypesTableWidget = QtWidgets.QTableWidget(MimeTypesDialog_base)
+ self.TypesTableWidget.setAlternatingRowColors(True)
+ self.TypesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
+ self.TypesTableWidget.setObjectName("TypesTableWidget")
+ self.TypesTableWidget.setColumnCount(3)
+ self.TypesTableWidget.setRowCount(0)
+ item = QtWidgets.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(0, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(1, item)
+ item = QtWidgets.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(2, item)
+ self.gridlayout.addWidget(self.TypesTableWidget, 2, 0, 1, 2)
+ self.textLabel1 = QtWidgets.QLabel(MimeTypesDialog_base)
+ self.textLabel1.setWordWrap(True)
+ self.textLabel1.setObjectName("textLabel1")
+ self.gridlayout.addWidget(self.textLabel1, 3, 0, 1, 2)
+ spacerItem = QtWidgets.QSpacerItem(301, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ self.pushButton10 = QtWidgets.QPushButton(MimeTypesDialog_base)
+ self.pushButton10.setObjectName("pushButton10")
+ self.gridlayout.addWidget(self.pushButton10, 4, 1, 1, 1)
+
+ self.retranslateUi(MimeTypesDialog_base)
+ self.pushButton10.clicked.connect(MimeTypesDialog_base.accept)
+ QtCore.QMetaObject.connectSlotsByName(MimeTypesDialog_base)
+
+ def retranslateUi(self, MimeTypesDialog_base):
+ _translate = QtCore.QCoreApplication.translate
+ MimeTypesDialog_base.setWindowTitle(_translate("MimeTypesDialog_base", "HP Device Manager - MIME Types"))
+ self.textLabel3_2.setText(_translate("MimeTypesDialog_base", "<b>File/document types that can be added to the file list.</b>"))
+ item = self.TypesTableWidget.horizontalHeaderItem(0)
+ item.setText(_translate("MimeTypesDialog_base", "MIME Type"))
+ item = self.TypesTableWidget.horizontalHeaderItem(1)
+ item.setText(_translate("MimeTypesDialog_base", "Description"))
+ item = self.TypesTableWidget.horizontalHeaderItem(2)
+ item.setText(_translate("MimeTypesDialog_base", "Usual File Extension(s)"))
+ self.textLabel1.setText(_translate("MimeTypesDialog_base", "<i>Note: To print or fax file/document types that do not appear on this list, print the document from the application that created it through the appropriate CUPS printer.</i>"))
+ self.pushButton10.setText(_translate("MimeTypesDialog_base", "OK"))
+
diff --git a/ui5/mimetypesdialog_base.ui b/ui5/mimetypesdialog_base.ui
new file mode 100644
index 000000000..d1f482379
--- /dev/null
+++ b/ui5/mimetypesdialog_base.ui
@@ -0,0 +1,123 @@
+<ui version="4.0" >
+ <class>MimeTypesDialog_base</class>
+ <widget class="QDialog" name="MimeTypesDialog_base" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>540</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - MIME Types</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel3_2" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>&lt;b>File/document types that can be added to the file list.&lt;/b></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line1_2" >
+ <property name="frameShape" >
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QTableWidget" name="TypesTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::NoSelection</enum>
+ </property>
+ <column>
+ <property name="text" >
+ <string>MIME Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Description</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Usual File Extension(s)</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>&lt;i>Note: To print or fax file/document types that do not appear on this list, print the document from the application that created it through the appropriate CUPS printer.&lt;/i></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QPushButton" name="pushButton10" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>pushButton10</sender>
+ <signal>clicked()</signal>
+ <receiver>MimeTypesDialog_base</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/nodevicesdialog.py b/ui5/nodevicesdialog.py
new file mode 100644
index 000000000..6083f6d4b
--- /dev/null
+++ b/ui5/nodevicesdialog.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Local
+from base.g import *
+from base import device, utils
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .nodevicesdialog_base import Ui_NoDevicesDialog_base
+
+
+class NoDevicesDialog(QDialog, Ui_NoDevicesDialog_base):
+ def __init__(self, parent):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.initUi()
+
+
+ def initUi(self):
+ self.SetupButton.clicked.connect(self.SetupButton_clicked)
+ self.CUPSButton.clicked.connect(self.CUPSButton_clicked)
+ self.CloseButton.clicked.connect(self.CloseButton_clicked)
+ self.Icon.setPixmap(load_pixmap("warning", '32x32'))
+
+
+ def SetupButton_clicked(self):
+ self.close()
+
+ if utils.which('hp-setup'):
+ cmd = 'hp-setup -u'
+ else:
+ cmd = 'python ./setup.py -u'
+
+ log.debug(cmd)
+ utils.run(cmd)
+
+ try:
+ self.parent().rescanDevices()
+ except Error:
+ QMessageBox.critical(self,
+ self.windowTitle(),
+ self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+ def CUPSButton_clicked(self):
+ self.close()
+ utils.openURL("http://localhost:631/admin")
+
+
+ def CloseButton_clicked(self):
+ self.close()
+
+
+
diff --git a/ui5/nodevicesdialog_base.py b/ui5/nodevicesdialog_base.py
new file mode 100644
index 000000000..1c355a9e5
--- /dev/null
+++ b/ui5/nodevicesdialog_base.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/nodevicesdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_NoDevicesDialog_base(object):
+ def setupUi(self, NoDevicesDialog_base):
+ NoDevicesDialog_base.setObjectName("NoDevicesDialog_base")
+ NoDevicesDialog_base.resize(539, 335)
+ self.gridlayout = QtWidgets.QGridLayout(NoDevicesDialog_base)
+ self.gridlayout.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout.setSpacing(6)
+ self.gridlayout.setObjectName("gridlayout")
+ self.Icon = QtWidgets.QLabel(NoDevicesDialog_base)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Icon.sizePolicy().hasHeightForWidth())
+ self.Icon.setSizePolicy(sizePolicy)
+ self.Icon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.Icon.setScaledContents(True)
+ self.Icon.setWordWrap(False)
+ self.Icon.setObjectName("Icon")
+ self.gridlayout.addWidget(self.Icon, 0, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 280, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 1, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 16, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem1, 2, 2, 1, 1)
+ self.textLabel7 = QtWidgets.QLabel(NoDevicesDialog_base)
+ self.textLabel7.setAlignment(QtCore.Qt.AlignVCenter)
+ self.textLabel7.setWordWrap(True)
+ self.textLabel7.setObjectName("textLabel7")
+ self.gridlayout.addWidget(self.textLabel7, 0, 1, 2, 4)
+ spacerItem2 = QtWidgets.QSpacerItem(400, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem2, 3, 0, 1, 2)
+ self.SetupButton = QtWidgets.QPushButton(NoDevicesDialog_base)
+ self.SetupButton.setObjectName("SetupButton")
+ self.gridlayout.addWidget(self.SetupButton, 3, 2, 1, 1)
+ self.CUPSButton = QtWidgets.QPushButton(NoDevicesDialog_base)
+ self.CUPSButton.setObjectName("CUPSButton")
+ self.gridlayout.addWidget(self.CUPSButton, 3, 3, 1, 1)
+ self.CloseButton = QtWidgets.QPushButton(NoDevicesDialog_base)
+ self.CloseButton.setDefault(True)
+ self.CloseButton.setObjectName("CloseButton")
+ self.gridlayout.addWidget(self.CloseButton, 3, 4, 1, 1)
+
+ self.retranslateUi(NoDevicesDialog_base)
+ QtCore.QMetaObject.connectSlotsByName(NoDevicesDialog_base)
+
+ def retranslateUi(self, NoDevicesDialog_base):
+ _translate = QtCore.QCoreApplication.translate
+ NoDevicesDialog_base.setWindowTitle(_translate("NoDevicesDialog_base", "HP Device Manager - No Installed HP Devices Found"))
+ self.textLabel7.setText(_translate("NoDevicesDialog_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:x-large; font-weight:600;\">No Installed HP Devices Found.</span></p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">To setup a new device in the HP Device Manager (toolbox), use one of the following methods:</p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1.Run <span style=\" font-weight:600;\">hp-setup</span> (in a shell/terminal or click <span style=\" font-family:\'Courier New,courier\';\">Setup Device...</span> below).</p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2. <span style=\" font-weight:600;\">CUPS web interface</span> (open a browser to: <span style=\" text-decoration: underline;\">http://localhost:631</span> or press the button below),</p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">3. The <span style=\" font-weight:600;\">printer installation utility</span> that came with your operating system (YaST, PrinterDrake, etc). </p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">After setting up a printer, you may have to press <span style=\" font-family:\'Courier New,courier\';\">F6</span> or chose <span style=\" font-family:\'Courier New,courier\';\">Device | Refresh All</span> for the printer to appear in the HP Device Manager.</p>\n"
+"<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600; font-style:italic;\">Note: Only devices installed with the </span><span style=\" font-family:\'Courier New,courier\'; font-weight:600; font-style:italic;\">hp:</span><span style=\" font-weight:600; font-style:italic;\"> or </span><span style=\" font-family:\'Courier New,courier\'; font-weight:600; font-style:italic;\">hpfax:</span><span style=\" font-weight:600; font-style:italic;\"> CUPS backend will appear in the HP Device Manager.</span></p>\n"
+"<p style=\"-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>"))
+ self.SetupButton.setText(_translate("NoDevicesDialog_base", "Setup Device..."))
+ self.CUPSButton.setText(_translate("NoDevicesDialog_base", "CUPS Web Interface"))
+ self.CloseButton.setText(_translate("NoDevicesDialog_base", "Close"))
+
diff --git a/ui5/nodevicesdialog_base.ui b/ui5/nodevicesdialog_base.ui
new file mode 100644
index 000000000..b4d41e59d
--- /dev/null
+++ b/ui5/nodevicesdialog_base.ui
@@ -0,0 +1,136 @@
+<ui version="4.0" >
+ <class>NoDevicesDialog_base</class>
+ <widget class="QDialog" name="NoDevicesDialog_base" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>539</width>
+ <height>335</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - No Installed HP Devices Found</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="Icon" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>280</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item rowspan="2" row="0" column="1" colspan="4" >
+ <widget class="QLabel" name="textLabel7" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:x-large; font-weight:600;">No Installed HP Devices Found.&lt;/span>&lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To setup a new device in the HP Device Manager (toolbox), use one of the following methods:&lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1.Run &lt;span style=" font-weight:600;">hp-setup&lt;/span> (in a shell/terminal or click &lt;span style=" font-family:'Courier New,courier';">Setup Device...&lt;/span> below).&lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2. &lt;span style=" font-weight:600;">CUPS web interface&lt;/span> (open a browser to: &lt;span style=" text-decoration: underline;">http://localhost:631&lt;/span> or press the button below),&lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">3. The &lt;span style=" font-weight:600;">printer installation utility&lt;/span> that came with your operating system (YaST, PrinterDrake, etc). &lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">After setting up a printer, you may have to press &lt;span style=" font-family:'Courier New,courier';">F6&lt;/span> or chose &lt;span style=" font-family:'Courier New,courier';">Device | Refresh All&lt;/span> for the printer to appear in the HP Device Manager.&lt;/p>
+&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600; font-style:italic;">Note: Only devices installed with the &lt;/span>&lt;span style=" font-family:'Courier New,courier'; font-weight:600; font-style:italic;">hp:&lt;/span>&lt;span style=" font-weight:600; font-style:italic;"> or &lt;/span>&lt;span style=" font-family:'Courier New,courier'; font-weight:600; font-style:italic;">hpfax:&lt;/span>&lt;span style=" font-weight:600; font-style:italic;"> CUPS backend will appear in the HP Device Manager.&lt;/span>&lt;/p>
+&lt;p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignVCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>400</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QPushButton" name="SetupButton" >
+ <property name="text" >
+ <string>Setup Device...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3" >
+ <widget class="QPushButton" name="CUPSButton" >
+ <property name="text" >
+ <string>CUPS Web Interface</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="4" >
+ <widget class="QPushButton" name="CloseButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ <property name="default" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/plugindiagnose.py b/ui5/plugindiagnose.py
new file mode 100644
index 000000000..13c3adca7
--- /dev/null
+++ b/ui5/plugindiagnose.py
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Amarnath Chitumalla
+#
+
+
+# Local
+from base.g import *
+from base import device, utils, pkit
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from installer import pluginhandler
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+import signal
+
+# Ui
+from .plugindiagnose_base import Ui_Dialog
+
+
+
+class PluginDiagnose(QDialog, Ui_Dialog):
+ def __init__(self, parent, install_mode=PLUGIN_NONE, plugin_reason=PLUGIN_REASON_NONE, upgrade=False):
+ QDialog.__init__(self, parent)
+ self.install_mode = install_mode
+ self.plugin_reason = plugin_reason
+ self.plugin_path = None
+ self.result = False
+ self.pluginObj = pluginhandler.PluginHandle()
+ self.setupUi(self)
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def PathLineEdit_textChanged(self, t):
+ self.plugin_path = to_unicode(t)
+ self.setPathIndicators()
+
+
+ #
+ # Misc
+ #
+
+ def displayPage(self, page):
+ self.updateStepText(page)
+ self.StackedWidget.setCurrentIndex(page)
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def NextButton_clicked(self):
+ self.NextButton.setEnabled(False)
+ self.CancelButton.setEnabled(False)
+ try:
+ plugin = PLUGIN_REQUIRED
+ plugin_reason = PLUGIN_REASON_NONE
+ ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
+
+ if not ok or self.pluginObj.getStatus() != pluginhandler.PLUGIN_INSTALLED:
+ FailureUI(self, self.__tr("Failed to install Plug-in.\nEither you have chosen to skip the Plug-in installation or entered incorrect Password."))
+
+ finally:
+ endWaitCursor()
+ self.result = True
+ self.close()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PluginDialog",s,c)
+
diff --git a/ui5/plugindiagnose_base.py b/ui5/plugindiagnose_base.py
new file mode 100644
index 000000000..ecba05f94
--- /dev/null
+++ b/ui5/plugindiagnose_base.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/plugindiagnose_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(500, 180)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.page)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(self.page)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QtWidgets.QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ self.StackedWidget.addWidget(self.page)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 4)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 4)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setEnabled(True)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 2, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 3, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Plug-in Installer"))
+ self.label.setText(_translate("Dialog", "Driver Plug-in Installation is required"))
+ self.TitleLabel.setText(_translate("Dialog", "HP Device requires proprietary plug-in which is missing. Click \'Next\' to continue plug-in installation"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
diff --git a/ui5/plugindiagnose_base.ui b/ui5/plugindiagnose_base.ui
new file mode 100644
index 000000000..b073c6a46
--- /dev/null
+++ b/ui5/plugindiagnose_base.ui
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>180</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HP Device Manager - Plug-in Installer</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="4">
+ <widget class="QStackedWidget" name="StackedWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Driver Plug-in Installation is required</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="TitleLabel">
+ <property name="text">
+ <string>HP Device requires proprietary plug-in which is missing. Click 'Next' to continue plug-in installation</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4">
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="NextButton">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Next &gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QPushButton" name="CancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/plugindialog.py b/ui5/plugindialog.py
new file mode 100644
index 000000000..e3007f911
--- /dev/null
+++ b/ui5/plugindialog.py
@@ -0,0 +1,332 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Local
+from base.g import *
+from base import device, utils
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from installer import pluginhandler
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+# Ui
+from .plugindialog_base import Ui_Dialog
+
+#signal
+import signal
+
+PAGE_SOURCE = 0
+# PAGE_LICENSE = 1 # part of plug-in itself, this is a placeholder
+PAGE_MAX = 1
+
+
+class PluginDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, install_mode=PLUGIN_NONE, plugin_reason=PLUGIN_REASON_NONE):
+ QDialog.__init__(self, parent)
+ self.install_mode = install_mode
+ self.plugin_reason = plugin_reason
+ self.plugin_path = ""
+ self.result = False
+ self.pluginObj = pluginhandler.PluginHandle()
+ self.setupUi(self)
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+ QTimer.singleShot(0, self.showSourcePage)
+
+
+ def isPluginInstalled(self):
+ return self.pluginObj.getStatus()
+
+
+ def initUi(self):
+ # connect signals/slots
+ # self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ # self.NextButton.clicked.connect(self.NextButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ self.PLUGIN_REASON_TEXT = {
+ PLUGIN_REASON_NONE: None,
+ PLUGIN_REASON_PRINTING_SUPPORT: self.__tr("This plugin will enable printing support."),
+ PLUGIN_REASON_FASTER_PRINTING: self.__tr("This plugin will enhance print speed."),
+ PLUGIN_REASON_BETTER_PRINTING_PQ: self.__tr("This plugin will enhance print quality."),
+ PLUGIN_REASON_PRINTING_FEATURES: self.__tr("This plugin will add printing features."),
+ PLUGIN_REASON_RESERVED_10: None,
+ PLUGIN_REASON_RESERVED_20: None,
+ PLUGIN_REASON_SCANNING_SUPPORT: self.__tr("This plugin will enable scanning support."),
+ PLUGIN_REASON_FASTER_SCANNING: self.__tr("This plugin will enhance scanning speed."),
+ PLUGIN_REASON_BETTER_SCANNING_IQ: self.__tr("This plugin will enhance scanning image quality."),
+ PLUGIN_REASON_RESERVED_200: None,
+ PLUGIN_REASON_RESERVED_400: None,
+ PLUGIN_REASON_FAXING_SUPPORT: self.__tr("This plugin will enable faxing support."),
+ PLUGIN_REASON_FAX_FEATURES: self.__tr("This plugin will enhnace faxing features."),
+ PLUGIN_REASON_RESERVED_20000: None,
+ PLUGIN_REASON_RESERVED_40000: None,
+ }
+
+ #
+ # SOURCE PAGE
+ #
+ def showSourcePage(self):
+ reason_text = self.plugin_reason_text()
+
+ if self.install_mode == PLUGIN_REQUIRED:
+ self.SkipRadioButton.setEnabled(False)
+ msg = "An additional driver plug-in is required to operate this printer. You may download the plug-in directly from an HP authorized server (recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced)."
+ if reason_text is not None:
+ msg += "<br><br>%s"%reason_text
+ self.TitleLabel.setText(self.__tr(msg))
+
+ elif self.install_mode == PLUGIN_OPTIONAL:
+ msg = "An optional driver plug-in is available to enhance the operation of this printer. You may download the plug-in directly from an HP authorized server (recommended), skip this installation (not recommended), or, if you already have a copy of the file, you can specify a path to the file (advanced)."
+ if reason_text is not None:
+ msg += "<br><br>%s"%reason_text
+ self.TitleLabel.setText(self.__tr(msg))
+
+ self.DownloadRadioButton.toggled[bool].connect(self.DownloadRadioButton_toggled)
+ self.CopyRadioButton.toggled[bool].connect(self.CopyRadioButton_toggled)
+ self.SkipRadioButton.toggled[bool].connect(self.SkipRadioButton_toggled)
+ self.PathLineEdit.textChanged["const QString &"].connect(self.PathLineEdit_textChanged)
+ self.BrowseToolButton.clicked.connect(self.BrowseToolButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ self.BrowseToolButton.setIcon(QIcon(load_pixmap('folder_open', '16x16')))
+
+ self.displayPage(PAGE_SOURCE)
+
+
+ def DownloadRadioButton_toggled(self, b):
+ if b:
+ self.PathLineEdit.setEnabled(False)
+ self.BrowseToolButton.setEnabled(False)
+ self.NextButton.setEnabled(True)
+ try:
+ self.PathLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ self.plugin_path = None
+
+
+ def CopyRadioButton_toggled(self, b):
+ if b:
+ self.PathLineEdit.setEnabled(True)
+ self.BrowseToolButton.setEnabled(True)
+ self.plugin_path = to_unicode(self.PathLineEdit.text())
+ self.setPathIndicators()
+
+
+ def SkipRadioButton_toggled(self, b):
+ if b:
+ self.PathLineEdit.setEnabled(False)
+ self.BrowseToolButton.setEnabled(False)
+ self.NextButton.setEnabled(True)
+ try:
+ self.PathLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ self.plugin_path = None
+
+
+ def PathLineEdit_textChanged(self, t):
+ self.plugin_path = to_unicode(t)
+ self.setPathIndicators()
+
+
+ def setPathIndicators(self):
+ ok = True
+ if not self.plugin_path or (self.plugin_path and os.path.isdir(self.plugin_path)):
+ self.PathLineEdit.setToolTip(self.__tr("You must specify a path to the '%s' file."%self.pluginObj.getFileName() ))
+ ok = False
+ elif os.path.basename(self.plugin_path) != self.pluginObj.getFileName():
+ self.PathLineEdit.setToolTip(self.__tr("The plugin filename must be '%s'."%self.pluginObj.getFileName()))
+ ok = False
+
+ if not ok:
+ try:
+ self.PathLineEdit.setStyleSheet("background-color: yellow; ")
+ except AttributeError:
+ pass
+ self.NextButton.setEnabled(False)
+ else:
+ try:
+ self.PathLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ self.NextButton.setEnabled(True)
+ self.PathLineEdit.setToolTip("")
+
+
+ def BrowseToolButton_clicked(self):
+ t = to_unicode(self.PathLineEdit.text())
+ path =""
+ if not os.path.exists(t):
+ path = QFileDialog.getOpenFileName(self, self.__tr("Select Plug-in File"),
+ #user_conf.workingDirectory(),
+ self.user_settings.working_dir,
+ self.__tr("Plugin Files (*.run)"))
+
+ if path:
+ self.plugin_path = path[0]
+ self.PathLineEdit.setText(self.plugin_path)
+ #user_conf.setWorkingDirectory(self.plugin_path)
+ self.user_settings.working_dir = self.plugin_path
+ self.user_settings.save()
+
+ self.setPathIndicators()
+
+ #
+ # Misc
+ #
+
+ def displayPage(self, page):
+ self.updateStepText(page)
+ self.StackedWidget.setCurrentIndex(page)
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def NextButton_clicked(self):
+ if self.SkipRadioButton.isChecked():
+ log.debug("Skipping plug-in installation.")
+ self.close()
+ return
+
+ beginWaitCursor()
+ try:
+
+ if self.plugin_path: # User specified Path
+ if not self.plugin_path.startswith('http://'):
+ self.plugin_path = 'file://' + self.plugin_path
+
+ else:
+ log.info("Checking for network connection...")
+ ok = utils.check_network_connection()
+
+ if not ok:
+ log.error("Network connection not detected.")
+ endWaitCursor()
+ FailureUI(self, self.__tr("Network connection not detected."))
+ self.close()
+ return
+
+ log.info("Downloading plug-in from: %s" % self.plugin_path)
+
+ status, download_plugin_file, error_str = self.pluginObj.download(self.plugin_path,self.plugin_download_callback)
+
+ if status in (ERROR_UNABLE_TO_RECV_KEYS, ERROR_DIGITAL_SIGN_NOT_FOUND):
+ endWaitCursor()
+
+ if QMessageBox.question(self, " ",
+ self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate the plug-in prior to installation.</p>Do you still want to install the plug-in?" %error_str),
+ QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes:
+
+ self.pluginObj.deleteInstallationFiles(download_plugin_file)
+ self.close()
+ return
+
+ elif status != ERROR_SUCCESS:
+ self.pluginObj.deleteInstallationFiles(download_plugin_file)
+ endWaitCursor()
+ FailureUI(self, error_str)
+ self.close()
+ return
+
+ if not self.pluginObj.run_plugin(download_plugin_file, GUI_MODE):
+ self.pluginObj.deleteInstallationFiles(download_plugin_file)
+ endWaitCursor()
+ FailureUI(self, self.__tr("Plug-in install failed."))
+ self.close()
+ return
+
+ cups_devices = device.getSupportedCUPSDevices(['hp'])
+ for dev in cups_devices:
+ mq = device.queryModelByURI(dev)
+
+ if mq.get('fw-download', False):
+ # Download firmware if needed
+ log.info(log.bold("\nDownloading firmware to device %s..." % dev))
+ try:
+ d = None
+ try:
+ d = device.Device(dev)
+ except Error:
+ log.error("Error opening device.")
+ endWaitCursor()
+ FailureUI(self, self.__tr("<b>Firmware download to device failed.</b><p>%s</p>"%dev))
+ continue
+
+ if d.downloadFirmware():
+ log.info("Firmware download successful.\n")
+ else:
+ endWaitCursor()
+ FailureUI(self, self.__tr("<b>Firmware download to device failed.</b><p>%s</p>"%dev))
+
+ finally:
+ if d is not None:
+ d.close()
+ finally:
+ endWaitCursor()
+
+ self.pluginObj.deleteInstallationFiles(download_plugin_file)
+ SuccessUI(self, self.__tr("<b>Plug-in installation successful</b>"))
+ self.result = True
+ self.close()
+
+
+ def plugin_download_callback(self, c, s, t):
+ pass
+
+
+ def plugin_install_callback(self, s):
+ print(s)
+
+
+ def updateStepText(self, p):
+ self.StepText.setText(self.__tr("Step %s of %s"%( p+1, PAGE_MAX+1)))
+
+
+ def plugin_reason_text(self):
+ try:
+ return self.PLUGIN_REASON_TEXT[self.plugin_reason]
+ except KeyError:
+ return None
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PluginDialog",s,c)
+
+
diff --git a/ui5/plugindialog_base.py b/ui5/plugindialog_base.py
new file mode 100644
index 000000000..a1e5c5ddb
--- /dev/null
+++ b/ui5/plugindialog_base.py
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/plugindialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.page)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(self.page)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QtWidgets.QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 3, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.page)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.DownloadRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.DownloadRadioButton.setChecked(True)
+ self.DownloadRadioButton.setObjectName("DownloadRadioButton")
+ self.gridlayout2.addWidget(self.DownloadRadioButton, 0, 0, 1, 2)
+ self.CopyRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.CopyRadioButton.setEnabled(True)
+ self.CopyRadioButton.setObjectName("CopyRadioButton")
+ self.gridlayout2.addWidget(self.CopyRadioButton, 1, 0, 1, 2)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem1, 2, 0, 1, 1)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.PathLineEdit = QtWidgets.QLineEdit(self.groupBox)
+ self.PathLineEdit.setEnabled(False)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.PathLineEdit.sizePolicy().hasHeightForWidth())
+ self.PathLineEdit.setSizePolicy(sizePolicy)
+ self.PathLineEdit.setObjectName("PathLineEdit")
+ self.hboxlayout.addWidget(self.PathLineEdit)
+ self.BrowseToolButton = QtWidgets.QToolButton(self.groupBox)
+ self.BrowseToolButton.setEnabled(False)
+ self.BrowseToolButton.setText("")
+ self.BrowseToolButton.setObjectName("BrowseToolButton")
+ self.hboxlayout.addWidget(self.BrowseToolButton)
+ self.gridlayout2.addLayout(self.hboxlayout, 2, 1, 1, 1)
+ self.SkipRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.SkipRadioButton.setObjectName("SkipRadioButton")
+ self.gridlayout2.addWidget(self.SkipRadioButton, 3, 0, 1, 2)
+ self.gridlayout1.addWidget(self.groupBox, 4, 0, 1, 2)
+ spacerItem2 = QtWidgets.QSpacerItem(278, 51, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem2, 5, 1, 1, 1)
+ self.StackedWidget.addWidget(self.page)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(161, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 2, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setEnabled(False)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Plug-in Installer"))
+ self.label.setText(_translate("Dialog", "Driver Plug-in Installation"))
+ self.TitleLabel.setText(_translate("Dialog", "You may download the plug-in directly from an HP authorized server, or, if you already have a local copy of the plug-in file, you can specify a path to the file."))
+ self.groupBox.setTitle(_translate("Dialog", "Plug-in Installation Choice"))
+ self.DownloadRadioButton.setText(_translate("Dialog", "Download and install the plug-in from an HP authorized server (recommended)"))
+ self.CopyRadioButton.setText(_translate("Dialog", "Select and install an existing local copy of the plug-in file (advanced):"))
+ self.BrowseToolButton.setToolTip(_translate("Dialog", "Open a local copy of the plug-in file"))
+ self.SkipRadioButton.setText(_translate("Dialog", "Skip installation of the plug-in (not recommended)"))
+ self.StepText.setText(_translate("Dialog", "Step %d of %d"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
diff --git a/ui5/plugindialog_base.ui b/ui5/plugindialog_base.ui
new file mode 100644
index 000000000..a7cc8f17a
--- /dev/null
+++ b/ui5/plugindialog_base.ui
@@ -0,0 +1,219 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Plug-in Installer</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Driver Plug-in Installation</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QLabel" name="TitleLabel" >
+ <property name="text" >
+ <string>You may download the plug-in directly from an HP authorized server, or, if you already have a local copy of the plug-in file, you can specify a path to the file.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Plug-in Installation Choice</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QRadioButton" name="DownloadRadioButton" >
+ <property name="text" >
+ <string>Download and install the plug-in from an HP authorized server (recommended)</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QRadioButton" name="CopyRadioButton" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Select and install an existing local copy of the plug-in file (advanced):</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLineEdit" name="PathLineEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="BrowseToolButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string>Open a local copy of the plug-in file</string>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="QRadioButton" name="SkipRadioButton" >
+ <property name="text" >
+ <string>Skip installation of the plug-in (not recommended)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>278</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %d of %d</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>161</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/pluginlicensedialog.py b/ui5/pluginlicensedialog.py
new file mode 100644
index 000000000..fc9a1034a
--- /dev/null
+++ b/ui5/pluginlicensedialog.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Local
+from base.g import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .pluginlicensedialog_base import Ui_Dialog
+
+
+
+class PluginLicenseDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, license_txt):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.license_txt = license_txt
+ self.initUi()
+
+
+ def initUi(self):
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ self.LicenseTextEdit.setText(self.license_txt)
+
+
diff --git a/ui5/pluginlicensedialog_base.py b/ui5/pluginlicensedialog_base.py
new file mode 100644
index 000000000..2d941f9e6
--- /dev/null
+++ b/ui5/pluginlicensedialog_base.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/pluginlicensedialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.page)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(self.page)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 1)
+ self.label_2 = QtWidgets.QLabel(self.page)
+ self.label_2.setWordWrap(True)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 2, 0, 1, 1)
+ self.LicenseTextEdit = QtWidgets.QTextEdit(self.page)
+ self.LicenseTextEdit.setAutoFormatting(QtWidgets.QTextEdit.AutoAll)
+ self.LicenseTextEdit.setReadOnly(True)
+ self.LicenseTextEdit.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
+ self.LicenseTextEdit.setObjectName("LicenseTextEdit")
+ self.gridlayout1.addWidget(self.LicenseTextEdit, 3, 0, 1, 1)
+ self.AgreeCheckBox = QtWidgets.QCheckBox(self.page)
+ self.AgreeCheckBox.setObjectName("AgreeCheckBox")
+ self.gridlayout1.addWidget(self.AgreeCheckBox, 4, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.line_2 = QtWidgets.QFrame(Dialog)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 5)
+ spacerItem = QtWidgets.QSpacerItem(161, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 2, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setEnabled(False)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setEnabled(False)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ self.AgreeCheckBox.toggled['bool'].connect(self.NextButton.setEnabled)
+ self.NextButton.clicked.connect(Dialog.accept)
+ self.CancelButton.clicked.connect(Dialog.reject)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Plug-in Installer"))
+ self.label.setText(_translate("Dialog", "Driver Plug-in License Agreement"))
+ self.label_2.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Please read the driver plug-in license agreement and then check the <span style=\" font-style:italic;\">I agree</span> box and then click <span style=\" font-style:italic;\">Next</span> to continue.</p></body></html>"))
+ self.AgreeCheckBox.setText(_translate("Dialog", "I agree to the terms of the driver plug-in license agreement"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
diff --git a/ui5/pluginlicensedialog_base.ui b/ui5/pluginlicensedialog_base.ui
new file mode 100644
index 000000000..0807b8df2
--- /dev/null
+++ b/ui5/pluginlicensedialog_base.ui
@@ -0,0 +1,179 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Plug-in Installer</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Driver Plug-in License Agreement</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please read the driver plug-in license agreement and then check the &lt;span style=" font-style:italic;">I agree&lt;/span> box and then click &lt;span style=" font-style:italic;">Next&lt;/span> to continue.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QTextEdit" name="LicenseTextEdit" >
+ <property name="autoFormatting" >
+ <set>QTextEdit::AutoAll</set>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::NoTextInteraction</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QCheckBox" name="AgreeCheckBox" >
+ <property name="text" >
+ <string>I agree to the terms of the driver plug-in license agreement</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>161</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>AgreeCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>NextButton</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>129</x>
+ <y>432</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>450</x>
+ <y>478</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>NextButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>454</x>
+ <y>481</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>448</x>
+ <y>495</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>CancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>556</x>
+ <y>476</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>556</x>
+ <y>495</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/pqdiagdialog.py b/ui5/pqdiagdialog.py
new file mode 100644
index 000000000..9c384d25d
--- /dev/null
+++ b/ui5/pqdiagdialog.py
@@ -0,0 +1,124 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+
+# Local
+from base.g import *
+from base import device, utils, maint
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .pqdiagdialog_base import Ui_Dialog
+
+
+class PQDiagDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, device_uri):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.device_uri = device_uri
+ self.initUi()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.RunButton.clicked.connect(self.RunButton_clicked)
+ self.DeviceComboBox.DeviceUriComboBox_noDevices.connect(self.DeviceUriComboBox_noDevices)
+ self.DeviceComboBox.DeviceUriComboBox_currentChanged.connect(self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'pq-diag-type': (operator.gt, 0)})
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.device_uri:
+ self.DeviceComboBox.setInitialDevice(self.device_uri)
+
+
+ def updateUi(self):
+ self.DeviceComboBox.updateUi()
+ self.LoadPaper.setButtonName(self.__tr("Run"))
+ self.LoadPaper.updateUi()
+
+
+ def DeviceUriComboBox_currentChanged(self, device_uri):
+ self.device_uri = device_uri
+
+
+ def DeviceUriComboBox_noDevices(self):
+ FailureUI(self, self.__tr("<b>No devices that support print quality diagnostics found.</b><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def RunButton_clicked(self):
+ d = None
+
+ try:
+ try:
+ d = device.Device(self.device_uri)
+ except Error:
+ CheckDeviceUI(self)
+ return
+
+ pqdiag_type = d.pq_diag_type
+
+ try:
+ d.open()
+ except Error:
+ CheckDeviceUI(self)
+ else:
+ if d.isIdleAndNoError():
+ if pqdiag_type == 1:
+ maint.printQualityDiagType1(d, lambda : True)
+
+ elif pqdiag_type == 2:
+ maint.printQualityDiagType2(d, lambda : True)
+
+ else:
+ CheckDeviceUI(self)
+
+ finally:
+ if d is not None:
+ d.close()
+
+ self.close()
+
+ #
+ # Misc
+ #
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PQDiagDialog",s,c)
+
+
diff --git a/ui5/pqdiagdialog_base.py b/ui5/pqdiagdialog_base.py
new file mode 100644
index 000000000..d03e299fd
--- /dev/null
+++ b/ui5/pqdiagdialog_base.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/pqdiagdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 3)
+ self.DeviceComboBox = DeviceUriComboBox(Dialog)
+ self.DeviceComboBox.setObjectName("DeviceComboBox")
+ self.gridlayout.addWidget(self.DeviceComboBox, 2, 0, 1, 3)
+ self.LoadPaper = LoadPaperGroupBox(Dialog)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 3, 0, 1, 3)
+ spacerItem = QtWidgets.QSpacerItem(410, 81, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(361, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.RunButton = QtWidgets.QPushButton(Dialog)
+ self.RunButton.setObjectName("RunButton")
+ self.gridlayout.addWidget(self.RunButton, 5, 1, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Print Quality Diagnostics"))
+ self.label.setText(_translate("Dialog", "Print Quality Diagnostics"))
+ self.RunButton.setText(_translate("Dialog", "Run"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .deviceuricombobox import DeviceUriComboBox
+from .loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui5/pqdiagdialog_base.ui b/ui5/pqdiagdialog_base.ui
new file mode 100644
index 000000000..398189aac
--- /dev/null
+++ b/ui5/pqdiagdialog_base.ui
@@ -0,0 +1,102 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Print Quality Diagnostics</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Print Quality Diagnostics</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="DeviceUriComboBox" name="DeviceComboBox" />
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>410</width>
+ <height>81</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>361</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QPushButton" name="RunButton" >
+ <property name="text" >
+ <string>Run</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>DeviceUriComboBox</class>
+ <extends>QComboBox</extends>
+ <header>deviceuricombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/printdialog.py b/ui5/printdialog.py
new file mode 100644
index 000000000..e02b6ce4a
--- /dev/null
+++ b/ui5/printdialog.py
@@ -0,0 +1,217 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+# Local
+from base.g import *
+from base import device, utils
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .printdialog_base import Ui_Dialog
+from .filetable import FileTable, FILETABLE_TYPE_PRINT
+from .printernamecombobox import PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY
+
+#signal
+import signal
+
+PAGE_FILE = 0
+PAGE_OPTIONS = 1
+PAGE_MAX = 1
+
+
+class PrintDialog(QDialog, Ui_Dialog):
+
+ def __init__(self, parent, printer_name, args=None):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.printer_name = printer_name
+
+ # User settings
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+ self.file_list = []
+ if args is not None:
+ for a in args:
+ self.Files.addFileFromUI(os.path.abspath(a))
+
+ self.devices = {}
+
+
+ QTimer.singleShot(0, self.updateFilePage)
+
+
+ def initUi(self):
+ self.OptionsToolBox.include_job_options = True
+
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.BackButton.clicked.connect(self.BackButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ self.initFilePage()
+ self.initOptionsPage()
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ if self.printer_name:
+ self.PrinterName.setInitialPrinter(self.printer_name)
+
+ self.StackedWidget.setCurrentIndex(0)
+
+
+ #
+ # File Page
+ #
+
+ def initFilePage(self):
+ self.Files.setType(FILETABLE_TYPE_PRINT)
+ #self.Files.setWorkingDir(user_conf.workingDirectory())
+ self.Files.setWorkingDir(self.user_settings.working_dir)
+ self.Files.isEmpty.connect(self.Files_isEmpty)
+ self.Files.isNotEmpt.connect(self.Files_isNotEmpty)
+
+
+ def updateFilePage(self):
+ self.NextButton.setText(self.__tr("Next >"))
+ self.NextButton.setEnabled(self.Files.isNotEmpty())
+ self.BackButton.setEnabled(False)
+ self.updateStepText(PAGE_FILE)
+ self.Files.updateUi()
+
+ def Files_isEmpty(self):
+ self.NextButton.setEnabled(False)
+
+
+ def Files_isNotEmpty(self):
+ self.NextButton.setEnabled(True)
+
+
+ #
+ # Options Page
+ #
+
+ def initOptionsPage(self):
+ self.BackButton.setEnabled(True)
+ self.PrinterName.setType(PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY)
+
+ self.PrinterName.PrinterNameComboBox_currentChanged.connect(self.PrinterNameComboBox_currentChanged)
+
+ self.PrinterName.PrinterNameComboBox_noPrinters.connect(self.PrinterNameComboBox_noPrinters)
+
+
+ def updateOptionsPage(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ self.PrinterName.updateUi()
+ self.BackButton.setEnabled(True)
+ num_files = len(self.Files.file_list)
+
+ if num_files > 1:
+ self.NextButton.setText(self.__tr("Print %s Files"%num_files))
+ else:
+ self.NextButton.setText(self.__tr("Print File"))
+
+ self.updateStepText(PAGE_OPTIONS)
+ # TODO: Enable print button only if printer is accepting and all options are OK (esp. page range)
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def PrinterNameComboBox_currentChanged(self, device_uri, printer_name):
+ try:
+ self.devices[device_uri]
+ except KeyError:
+ self.devices[device_uri] = device.Device(device_uri)
+
+ self.OptionsToolBox.updateUi(self.devices[device_uri], printer_name)
+
+
+ def PrinterNameComboBox_noPrinters(self):
+ FailureUI(self, self.__tr("<b>No printers found.</b><p>Please setup a printer and try again."))
+ self.close()
+
+
+ #
+ # Print
+ #
+
+ def executePrint(self):
+ for cmd in self.OptionsToolBox.getPrintCommands(self.Files.file_list):
+ log.debug(cmd)
+ status, output = utils.run(cmd)
+ if status != 0:
+ FailureUI(self, self.__tr("<b>Print command failed with status code %s.</b><p>%s</p>"%(status,cmd)))
+
+ self.close()
+ #print file('/home/dwelch/.cups/lpoptions', 'r').read()
+
+ #
+ # Misc
+ #
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def BackButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_OPTIONS:
+ self.StackedWidget.setCurrentIndex(PAGE_FILE)
+ self.updateFilePage()
+
+ else:
+ log.error("Invalid page!") # shouldn't happen!
+
+
+ def NextButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_FILE:
+ self.StackedWidget.setCurrentIndex(PAGE_OPTIONS)
+ self.updateOptionsPage()
+
+ elif p == PAGE_OPTIONS:
+ self.executePrint()
+
+
+ def updateStepText(self, p):
+ self.StepText.setText(self.__tr("Step %d of %d" %(p+1, PAGE_MAX+1)))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrintDialog",s,c)
+
+
+
diff --git a/ui5/printdialog_base.py b/ui5/printdialog_base.py
new file mode 100644
index 000000000..0d48125f4
--- /dev/null
+++ b/ui5/printdialog_base.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/printdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_2 = QtWidgets.QLabel(self.page)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_2.setFont(font)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(self.page)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 1)
+ self.Files = FileTable(self.page)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Files.sizePolicy().hasHeightForWidth())
+ self.Files.setSizePolicy(sizePolicy)
+ self.Files.setObjectName("Files")
+ self.gridlayout1.addWidget(self.Files, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page)
+ self.page_2 = QtWidgets.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.page_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_3 = QtWidgets.QLabel(self.page_2)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_3.setFont(font)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout2.addWidget(self.label_3, 0, 0, 1, 1)
+ self.line_2 = QtWidgets.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout2.addWidget(self.line_2, 1, 0, 1, 1)
+ self.PrinterName = PrinterNameComboBox(self.page_2)
+ self.PrinterName.setObjectName("PrinterName")
+ self.gridlayout2.addWidget(self.PrinterName, 2, 0, 1, 1)
+ self.OptionsToolBox = PrintSettingsToolbox(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.OptionsToolBox.sizePolicy().hasHeightForWidth())
+ self.OptionsToolBox.setSizePolicy(sizePolicy)
+ self.OptionsToolBox.setObjectName("OptionsToolBox")
+ self.gridlayout2.addWidget(self.OptionsToolBox, 3, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_2)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.line_3 = QtWidgets.QFrame(Dialog)
+ self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout.addWidget(self.line_3, 1, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(251, 28, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 2, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(1)
+ self.OptionsToolBox.setCurrentIndex(-1)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Print"))
+ self.label_2.setText(_translate("Dialog", "Select Files to Print"))
+ self.label_3.setText(_translate("Dialog", "Select Printer and Options"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .filetable import FileTable
+from .printernamecombobox import PrinterNameComboBox
+from .printsettingstoolbox import PrintSettingsToolbox
diff --git a/ui5/printdialog_base.ui b/ui5/printdialog_base.ui
new file mode 100644
index 000000000..2d1aab6d0
--- /dev/null
+++ b/ui5/printdialog_base.ui
@@ -0,0 +1,169 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Print</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="currentIndex" >
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Files to Print</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="FileTable" native="1" name="Files" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Printer and Options</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="PrinterNameComboBox" name="PrinterName" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="PrintSettingsToolbox" name="OptionsToolBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex" >
+ <number>-1</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5" >
+ <widget class="Line" name="line_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>251</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>FileTable</class>
+ <extends>QWidget</extends>
+ <header>filetable.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>PrinterNameComboBox</class>
+ <extends>QComboBox</extends>
+ <header>printernamecombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>PrintSettingsToolbox</class>
+ <extends>QToolBox</extends>
+ <header>printsettingstoolbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/printernamecombobox.py b/ui5/printernamecombobox.py
new file mode 100644
index 000000000..6e9037c4c
--- /dev/null
+++ b/ui5/printernamecombobox.py
@@ -0,0 +1,163 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Std Lib
+#import sys
+
+# Local
+from base.g import *
+from .ui_utils import *
+from base import device
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY = 0
+PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY = 1
+PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX = 2
+
+
+class PrinterNameComboBox(QWidget):
+
+ PrinterNameComboBox_currentChanged = pyqtSignal(str, str)
+ PrinterNameComboBox_noPrinters = pyqtSignal()
+
+ def __init__(self, parent):
+ QWidget.__init__(self, parent)
+ self.printer_name = ''
+ self.device_uri = ''
+ self.printer_index = {}
+ self.initial_printer = None
+ self.updating = False
+ self.typ = PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+
+ def initUi(self):
+ #print "PrinterNameComboBox.initUi()"
+ HBoxLayout = QHBoxLayout(self)
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ self.NameLabel = QLabel(self)
+ self.NameLabel.setObjectName("NameLabel")
+ HBoxLayout.addWidget(self.NameLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.ComboBox = QComboBox(self)
+ sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ComboBox.sizePolicy().hasHeightForWidth())
+ self.ComboBox.setSizePolicy(sizePolicy)
+ self.ComboBox.setObjectName("ComboBox")
+ HBoxLayout.addWidget(self.ComboBox)
+
+ self.NameLabel.setText(self.__tr("Printer:"))
+
+ #self.connect(self.ComboBox, SIGNAL("currentIndexChanged(int)"),
+ # self.ComboBox_currentIndexChanged)
+
+ # self.connect(self.ComboBox, SIGNAL("currentIndexChanged(const QString &)"),
+ # self.ComboBox_currentIndexChanged)
+ self.ComboBox.currentIndexChanged["const QString &"].connect(self.ComboBox_currentIndexChanged)
+
+ def setType(self, typ):
+ if typ in (PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY,
+ PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY,
+ PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX):
+ self.typ = typ
+
+
+ def setInitialPrinter(self, printer_name):
+ self.initial_printer = printer_name
+
+
+ def updateUi(self):
+ #print "PrinterNameComboBox.updateUi()"
+ if self.typ == PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY:
+ self.NameLabel.setText(self.__tr("Printer Name:"))
+ be_filter = ['hp']
+
+ elif self.typ == PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY:
+ self.NameLabel.setText(self.__tr("Fax Name:"))
+ be_filter = ['hpfax']
+
+ else: # PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX
+ self.NameLabel.setText(self.__tr("Printer/Fax Name:"))
+ be_filter = ['hp', 'hpfax']
+
+ self.printers = device.getSupportedCUPSPrinters(be_filter)
+ self.printer_index.clear() # = {}
+
+ if self.printers:
+ if self.initial_printer is None:
+ #user_conf.get('last_used', 'printer_name')
+ self.initial_printer = self.user_settings.last_used_printer
+
+ self.updating = True
+ try:
+ k = 0
+ for i, p in enumerate(self.printers):
+ self.printer_index[p.name] = p.device_uri
+ self.ComboBox.insertItem(i, p.name)
+
+ if self.initial_printer is not None and to_unicode(p.name).lower() == to_unicode(self.initial_printer).lower():
+ self.initial_printer = None
+ k = i
+
+ self.ComboBox.setCurrentIndex(-1)
+
+ finally:
+ self.updating = False
+
+ self.ComboBox.setCurrentIndex(k)
+ else:
+ # self.emit(SIGNAL("PrinterNameComboBox_noPrinters"))
+ self.PrinterNameComboBox_noPrinters.emit()
+
+
+ def ComboBox_currentIndexChanged(self, t):
+ self.printer_name = to_unicode(t)
+
+ if self.updating:
+ return
+
+ self.device_uri = self.printer_index[self.printer_name]
+ #user_conf.set('last_used', 'printer_name', self.printer_name)
+ self.user_settings.last_used_printer = self.printer_name
+ self.user_settings.save()
+
+ # self.emit(SIGNAL("PrinterNameComboBox_currentChanged"), self.device_uri, self.printer_name)
+ self.PrinterNameComboBox_currentChanged.emit(self.device_uri, self.printer_name)
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrinterNameComboBox",s,c)
diff --git a/ui5/printsettings_base.py b/ui5/printsettings_base.py
new file mode 100644
index 000000000..1efadc5cc
--- /dev/null
+++ b/ui5/printsettings_base.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/printsettings_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
diff --git a/ui5/printsettingsdialog.py b/ui5/printsettingsdialog.py
new file mode 100644
index 000000000..35c6867fb
--- /dev/null
+++ b/ui5/printsettingsdialog.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Local
+from base.g import *
+from base import device
+from prnt import cups
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .printsettingsdialog_base import Ui_Dialog
+from .printsettingstoolbox import PrintSettingsToolbox
+from .printernamecombobox import PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX, PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY
+
+#signal
+import signal
+
+class PrintSettingsDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, printer_name, fax_mode=False):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+ self.fax_mode = fax_mode
+ self.printer_name = printer_name
+ self.device_uri = None
+ self.devices = {}
+ self.printer_index = {}
+
+ # User settings
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+ #self.cur_printer = self.user_settings.last_used_printer
+
+ self.initUi(printer_name)
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self, printer_name=None):
+ self.OptionsToolBox.include_print_options = False
+
+ if self.printer_name:
+ self.PrinterName.setInitialPrinter(self.printer_name)
+
+ if self.fax_mode:
+ self.PrinterName.setType(PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY)
+ self.TitleLabel.setText(self.__tr("Fax Settings"))
+ else:
+ self.PrinterName.setType(PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX)
+
+ self.CloseButton.clicked.connect(self.CloseButton_clicked)
+ self.PrinterName.PrinterNameComboBox_currentChanged.connect(self.PrinterNameComboBox_currentChanged)
+
+ self.PrinterName.PrinterNameComboBox_noPrinters.connect(self.PrinterNameComboBox_noPrinters)
+
+
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def updateUi(self):
+ self.PrinterName.updateUi()
+
+
+ def PrinterNameComboBox_noPrinters(self):
+ FailureUI(self, self.__tr("<b>No printers or faxes found.</b><p>Please setup a printer or fax and try again."))
+ self.close()
+
+
+ def PrinterNameComboBox_currentChanged(self, device_uri, printer_name):
+ self.printer_name = printer_name
+ self.device_uri = device_uri
+ try:
+ self.devices[device_uri]
+ except KeyError:
+ self.devices[device_uri] = device.Device(device_uri)
+
+ self.OptionsToolBox.updateUi(self.devices[device_uri], self.printer_name)
+
+
+ #
+ # Misc
+ #
+
+ def CloseButton_clicked(self):
+ self.close()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrintSettingsDialog",s,c)
+
+
diff --git a/ui5/printsettingsdialog_base.py b/ui5/printsettingsdialog_base.py
new file mode 100644
index 000000000..eb198e843
--- /dev/null
+++ b/ui5/printsettingsdialog_base.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/printsettingsdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.TitleLabel = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.TitleLabel.setFont(font)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout.addWidget(self.TitleLabel, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 2)
+ self.PrinterName = PrinterNameComboBox(Dialog)
+ self.PrinterName.setObjectName("PrinterName")
+ self.gridlayout.addWidget(self.PrinterName, 2, 0, 1, 2)
+ self.OptionsToolBox = PrintSettingsToolbox(Dialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.OptionsToolBox.sizePolicy().hasHeightForWidth())
+ self.OptionsToolBox.setSizePolicy(sizePolicy)
+ self.OptionsToolBox.setObjectName("OptionsToolBox")
+ self.gridlayout.addWidget(self.OptionsToolBox, 3, 0, 1, 2)
+ spacerItem = QtWidgets.QSpacerItem(461, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ self.CloseButton = QtWidgets.QPushButton(Dialog)
+ self.CloseButton.setObjectName("CloseButton")
+ self.gridlayout.addWidget(self.CloseButton, 4, 1, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.OptionsToolBox.setCurrentIndex(-1)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Print Settings"))
+ self.TitleLabel.setText(_translate("Dialog", "Print Settings"))
+ self.CloseButton.setText(_translate("Dialog", "Close"))
+
+from .printernamecombobox import PrinterNameComboBox
+from .printsettingstoolbox import PrintSettingsToolbox
diff --git a/ui5/printsettingsdialog_base.ui b/ui5/printsettingsdialog_base.ui
new file mode 100644
index 000000000..2ea3e0e04
--- /dev/null
+++ b/ui5/printsettingsdialog_base.ui
@@ -0,0 +1,91 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Print Settings</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="TitleLabel" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Print Settings</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="PrinterNameComboBox" name="PrinterName" />
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <widget class="PrintSettingsToolbox" name="OptionsToolBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex" >
+ <number>-1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>461</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QPushButton" name="CloseButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>PrinterNameComboBox</class>
+ <extends>QComboBox</extends>
+ <header>printernamecombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>PrintSettingsToolbox</class>
+ <extends>QToolBox</extends>
+ <header>printsettingstoolbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/printsettingstoolbox.py b/ui5/printsettingstoolbox.py
new file mode 100644
index 000000000..193d8ba22
--- /dev/null
+++ b/ui5/printsettingstoolbox.py
@@ -0,0 +1,1999 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch, Yashwant Kumar Sahu, Sanjay Kumar Sharma
+#
+
+# Std Lib
+import sys
+
+# Local
+from base.g import *
+from base import utils
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from base.sixext import PY3
+from base.sixext import to_unicode
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+
+class RangeValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in to_unicode(input)[pos-1:]:
+ if x not in to_unicode('0123456789,- '):
+ return QValidator.Invalid, input, pos
+ return QValidator.Acceptable, input, pos
+
+
+class PinValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in to_unicode(input)[pos-1:]:
+ if x not in to_unicode('0123456789'):
+ return QValidator.Invalid, input, pos
+
+ return QValidator.Acceptable, input, pos
+
+
+class UsernameAndJobnameValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in to_unicode(input)[pos-1:]:
+ if x in to_unicode(' /=,.:;\'"[]{}-+!@#$%^&*()'):
+ return QValidator.Invalid, input, pos
+ return QValidator.Acceptable, input, pos
+
+
+class OptionComboBox(QComboBox):
+ def __init__(self, rw, parent, name, group, option, choices, default,
+ typ=cups.PPD_UI_PICKONE, other=None, job_option=False):
+ QComboBox.__init__(self, parent)
+ # rw?
+ self.group = group
+ self.option = option
+ self.choices = choices
+ self.default = default
+ self.typ = typ
+ self.other = other
+ self.job_option = job_option
+ self.setObjectName(name)
+
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+ def setOther(self, other):
+ self.other = other
+
+
+
+class OptionSpinBox(QSpinBox):
+ def __init__(self, parent, name, group, option, default, job_option=False):
+ QSpinBox.__init__(self, parent)
+ self.group = group
+ self.option = option
+ self.default = default
+ self.job_option = job_option
+ self.setObjectName(name)
+
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+
+class OptionRadioButton(QRadioButton):
+ def __init__(self, parent, name, group, option, default, job_option=False):
+ QRadioButton.__init__(self, parent)
+ self.group = group
+ self.option = option
+ self.default = default
+ self.job_option = job_option
+ self.setObjectName(name)
+
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+
+class DefaultPushButton(QPushButton):
+ def __init__(self, parent, name, group, option, choices,
+ default, control, typ, job_option=False):
+ QPushButton.__init__(self, parent)
+ self.group = group
+ self.option = option
+ self.default = default
+ self.control = control
+ self.typ = typ
+ self.choices = choices
+ self.job_option = job_option
+ self.setObjectName(name)
+
+
+#class PageRangeRadioButton(QRadioButton):
+# def __init__(self, parent, page_range_edit):
+# QRadioButton.__init__(self, parent):
+# self.page_range_edit = page_range_edit
+
+
+class PageRangeRadioButton(QRadioButton):
+ def __init__(self, parent, name, group, option, default): #, edit_control=None ):
+ QRadioButton.__init__(self, parent)
+ self.group = group
+ self.option = option
+ self.default = default
+ self.job_option = True
+ self.setObjectName(name)
+
+
+ def setRangeEdit(self, edit_control):
+ self.edit_control = edit_control
+
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+
+class PrintSettingsToolbox(QToolBox):
+ def __init__(self, parent, include_job_options=False):
+ QToolBox.__init__(self, parent)
+ self.include_job_options = include_job_options
+ self.plus_icon = QIcon(load_pixmap('plus', '16x16'))
+ self.minus_icon = QIcon(load_pixmap('minus', '16x16'))
+ self.last_item = 0
+ self.job_options = {}
+ self.job_storage_enable = False
+
+ # self.currentChanged[int].connect(self.PrintSettingsToolbox_currentChanged)
+ self.currentChanged[int].connect(self.PrintSettingsToolbox_currentChanged)
+
+
+ def getPrintCommands(self, file_list=None):
+ # File list: [(path, mime_type, mime_desc, title, num_pages), ...]
+ if file_list is None or not file_list:
+ return []
+
+ print_commands = []
+
+ try:
+ copies = int(self.job_options['copies'])
+ except ValueError:
+ copies = 1
+
+ if copies < 1:
+ copies = 1
+ log.warning("Copies < 1, setting to 1.")
+ elif copies > 99:
+ copies = 99
+ log.warning("Copies > 99, setting to 99.")
+
+ #page_range = unicode(self.pageRangeEdit.text())
+ page_range = self.job_options['pagerange']
+
+ try:
+ x = utils.expand_range(page_range)
+ except ValueError:
+ log.error("Invalid page range: %s" % page_range)
+ return []
+
+ all_pages = not page_range
+ #page_set = int(self.pageSetComboBox.currentItem())
+ page_set = self.job_options['pageset']
+
+ cups.resetOptions()
+ cups.openPPD(self.cur_printer)
+ current_options = dict(cups.getOptions())
+ cups.closePPD()
+
+ nup = int(current_options.get("number-up", 1))
+ psnup = utils.which('psnup')
+
+ for p, t, d, title, num_pages in file_list:
+ alt_nup = (nup > 1 and t == 'application/postscript' and psnup)
+
+ if utils.which('lpr'):
+ if alt_nup:
+ cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lpr -P', self.cur_printer])
+ else:
+ cmd = ' '.join(['lpr -P', self.cur_printer])
+
+ if copies > 1:
+ cmd = ' '.join([cmd, '-#%d' % copies])
+
+ else: # lp
+ if alt_nup:
+ cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lp -c -d', self.cur_printer])
+ else:
+ cmd = ' '.join(['lp -c -d', self.cur_printer])
+
+ if copies > 1:
+ cmd = ' '.join([cmd, '-n%d' % copies])
+
+
+ if not all_pages and page_range:
+ cmd = ' '.join([cmd, '-o page-ranges=%s' % page_range])
+
+ if page_set:
+ cmd = ' '.join([cmd, '-o page-set=%s' % page_set])
+
+ # Job Storage
+ # self.job_storage_mode = (0=Off, 1=P&H, 2=PJ, 3=QC, 4=SJ)
+ # self.job_storage_pin = u"" (dddd)
+ # self.job_storage_use_pin = True|False
+ # self.job_storage_username = u""
+ # self.job_storage_auto_username = True|False
+ # self.job_storage_jobname = u""
+ # self.job_storage_auto_jobname = True|False
+ # self.job_storage_job_exist = (0=replace, 1=job name+(1-99))
+
+ if self.job_storage_enable:
+ if self.job_storage_mode != JOB_STORAGE_TYPE_OFF:
+ if self.job_storage_mode == JOB_STORAGE_TYPE_PROOF_AND_HOLD:
+ cmd = ' '.join([cmd, '-o HOLD=PROOF'])
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_PERSONAL:
+ if self.job_storage_use_pin:
+ cmd = ' '.join([cmd, '-o HOLD=ON'])
+ cmd = ' '.join([cmd, '-o HOLDTYPE=PRIVATE'])
+ cmd = ' '.join([cmd, '-o HOLDKEY=%s' % self.job_storage_pin.encode('ascii')])
+ else:
+ cmd = ' '.join([cmd, '-o HOLD=PROOF'])
+ cmd = ' '.join([cmd, '-o HOLDTYPE=PRIVATE'])
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_QUICK_COPY:
+ cmd = ' '.join([cmd, '-o HOLD=ON'])
+ cmd = ' '.join([cmd, '-o HOLDTYPE=PUBLIC'])
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_STORE:
+ if self.job_storage_use_pin:
+ cmd = ' '.join([cmd, '-o HOLD=STORE'])
+ cmd = ' '.join([cmd, '-o HOLDTYPE=PRIVATE'])
+ cmd = ' '.join([cmd, '-o HOLDKEY=%s' % self.job_storage_pin.encode('ascii')])
+ else:
+ cmd = ' '.join([cmd, '-o HOLD=STORE'])
+
+ cmd = ' '.join([cmd, '-o USERNAME=%s' % self.job_storage_username.encode('ascii')\
+ .replace(" ", "_")])
+
+ cmd = ' '.join([cmd, '-o JOBNAME=%s' % self.job_storage_jobname.encode('ascii')\
+ .replace(" ", "_")])
+
+ if self.job_storage_job_exist == 1:
+ cmd = ' '.join([cmd, '-o DUPLICATEJOB=APPEND'])
+ else:
+ cmd = ' '.join([cmd, '-o DUPLICATEJOB=REPLACE'])
+
+ else: # Off
+ cmd = ' '.join([cmd, '-o HOLD=OFF'])
+
+ if not alt_nup:
+ cmd = ''.join([cmd, ' "', p, '"'])
+
+ print_commands.append(cmd)
+
+ return print_commands
+
+
+ def PrintSettingsToolbox_currentChanged(self, i):
+ if i != -1:
+ self.setItemIcon(self.last_item, self.plus_icon)
+ self.setItemIcon(i, self.minus_icon)
+ self.last_item = i
+
+
+ def updateUi(self, cur_device, cur_printer):
+ #print "updateUi(%s, %s)" % (cur_device, cur_printer)
+ self.cur_device = cur_device
+ self.cur_printer = cur_printer
+
+ while self.count():
+ self.removeItem(0)
+
+ self.loading = True
+ cups.resetOptions()
+ cups.openPPD(self.cur_printer)
+ cur_outputmode = ""
+
+ try:
+ if 1:
+ #try:
+ current_options = dict(cups.getOptions())
+
+ if self.include_job_options:
+ self.beginControlGroup("job_options", self.__tr("Job Options"))
+
+ # Num. copies (SPINNER)
+ try:
+ current = int(current_options.get('copies', '1'))
+ except ValueError:
+ current = 1
+
+ self.addControlRow("copies", self.__tr("Number of copies"),
+ cups.UI_SPINNER, current, (1, 99), 1, job_option=True)
+ self.job_options['copies'] = current
+
+ # page range RADIO + RANGE (custom)
+ current = current_options.get('pagerange', '')
+
+ self.addControlRow("pagerange", self.__tr("Page Range"),
+ cups.UI_PAGE_RANGE, current, None, None, job_option=True)
+
+ self.job_options['pagerange'] = current
+
+ # page set (COMBO/PICKONE)
+ current = current_options.get('pageset', 'all')
+ self.addControlRow("pageset", self.__tr("Page Set"),
+ cups.PPD_UI_PICKONE, current,
+ [('all', self.__tr("AllPages")),
+ ('even', self.__tr("Even")),
+ ('odd', self.__tr("Odd"))], 'all', job_option=True)
+
+ self.job_options['pageset'] = current
+# if current == u'even':
+# self.job_options["pageset"] = PAGE_SET_EVEN
+# elif current == u'odd':
+# self.job_options["pageset"] = PAGE_SET_ODD
+# else:
+# self.job_options["pageset"] = PAGE_SET_ALL
+
+ self.endControlGroup() # job_options
+
+ if not self.cur_device.device_type == DEVICE_TYPE_FAX:
+ self.beginControlGroup("basic", self.__tr("Basic"))
+
+ # Basic
+ # PageSize (in PPD section)
+ # orientation-requested
+ # sides
+ # outputorder
+ # Collate
+
+ current = current_options.get('orientation-requested', '3')
+
+ self.addControlRow("orientation-requested", self.__tr("Page Orientation"),
+ cups.PPD_UI_PICKONE, current,
+ [('3', self.__tr('Portrait')),
+ ('4', self.__tr('Landscape')),
+ ('5', self.__tr('Reverse landscape')),
+ ('6', self.__tr('Reverse portrait'))], '3')
+
+ log.debug("Option: orientation-requested")
+ log.debug("Current value: %s" % current)
+
+ duplexer = self.cur_device.dq.get('duplexer', 0)
+ log.debug("Duplexer = %d" % duplexer)
+
+ if duplexer:
+ current = current_options.get('sides', 'one-sided')
+ self.addControlRow("sides",
+ self.__tr("Duplex (Print on both sides of the page)"),
+ cups.PPD_UI_PICKONE, current,
+ [('one-sided',self.__tr('Single sided')),
+ ('two-sided-long-edge', self.__tr('Two sided (long edge)')),
+ ('two-sided-short-edge', self.__tr('Two sided (short edge)'))], 'one-sided')
+
+ log.debug("Option: sides")
+ log.debug("Current value: %s" % current)
+
+ current = current_options.get('outputorder', 'normal')
+
+ self.addControlRow("outputorder",
+ self.__tr("Output Order"),
+ cups.PPD_UI_PICKONE, current,
+ [('normal', self.__tr('Normal (Print first page first)')),
+ ('reverse', self.__tr('Reversed (Print last page first)'))], 'normal')
+
+ log.debug("Option: outputorder")
+ log.debug("Current value: %s" % current)
+
+ #If collate section is not in the PPD, only then add a collate section.
+ to_add = cups.duplicateSection("collate")
+ if to_add == 0:
+ current = utils.to_bool(current_options.get('Collate', '0'))
+
+ self.addControlRow("Collate",
+ self.__tr("Collate (Group together multiple copies)"),
+ cups.PPD_UI_BOOLEAN, current,
+ [], 0)
+
+ log.debug("Option: Collate")
+ log.debug("Current value: %s" % current)
+
+ self.endControlGroup()
+
+ groups = cups.getGroupList()
+
+ #print groups
+
+ for g in groups:
+ if 'jobretention' in g.lower():
+ log.debug("HPJobRetention skipped.")
+ continue
+
+ try:
+ text, num_subgroups = cups.getGroup(g)
+ except TypeError:
+ log.warn("Group %s returned None" % g)
+ continue
+
+ read_only = 'install' in g.lower()
+
+
+ if g.lower() == 'printoutmode':
+ text = self.__tr("Quality (also see 'Printout Mode' under 'General')")
+
+ self.beginControlGroup(g, str(text))
+
+ log.debug(" Text: %s" % str(text))
+ log.debug("Num subgroups: %d" % num_subgroups)
+
+ options = cups.getOptionList(g)
+
+ #print options
+
+ for o in options:
+ log.debug(" Option: %s" % repr(o))
+
+ if 'pageregion' in o.lower():
+ log.debug("Page Region skipped.")
+ continue
+
+ try:
+ option_text, defchoice, conflicted, ui = cups.getOption(g, o)
+ except TypeError:
+ log.warn("Option %s in group %s returned None" % (o, g))
+ continue
+
+
+ if o.lower() == 'quality':
+ option_text = self.__tr("Quality")
+
+ log.debug(" Text: %s" % repr(option_text))
+ log.debug(" Defchoice: %s" % repr(defchoice))
+
+ choices = cups.getChoiceList(g, o)
+
+ value = None
+ choice_data = []
+ for c in choices:
+ log.debug(" Choice: %s" % repr(c))
+
+ # TODO: Add custom paper size controls
+ if 'pagesize' in o.lower() and 'custom' in c.lower():
+ log.debug("Skipped.")
+ continue
+
+ choice_text, marked = cups.getChoice(g, o, c)
+
+
+ log.debug(" Text: %s" % repr(choice_text))
+
+ if marked:
+ value = c
+
+ choice_data.append((c, choice_text))
+
+ if o.lower() == 'outputmode':
+ if value is not None:
+ cur_outputmode = value
+ else:
+ cur_outputmode = defchoice
+
+ self.addControlRow(o, option_text, ui, value, choice_data, defchoice, read_only)
+
+ self.endControlGroup()
+
+## if 'pagesize' in o.lower(): # and 'custom' in c.lower():
+## current = 0.0
+## width_widget = self.addControlRow(widget, "custom", "custom-width", self.__tr("Custom Paper Width"), cups.UI_UNITS_SPINNER,
+## current, (0.0, 0.0), 0.0)
+##
+## current = 0.0
+## height_widget = self.addControlRow("custom", "custom-height", self.__tr("Custom Paper Height"), cups.UI_UNITS_SPINNER,
+## current, (0.0, 0.0), 0.0)
+##
+## if value.lower() == 'custom':
+## pass
+
+ # N-Up
+ # number-up
+ # number-up-layout
+ # page-border
+
+ self.beginControlGroup("nup", self.__tr("N-Up (Multiple document pages per printed page)"))
+ current = current_options.get('number-up', '1')
+
+ self.addControlRow("number-up", self.__tr("Pages per Sheet"),
+ cups.PPD_UI_PICKONE, current,
+ [('1', self.__tr('1 page per sheet')),
+ ('2', self.__tr('2 pages per sheet')),
+ ('4', self.__tr('4 pages per sheet'))], '1')
+
+ log.debug(" Option: number-up")
+ log.debug(" Current value: %s" % current)
+
+ current = current_options.get('number-up-layout', 'lrtb')
+
+ self.addControlRow("number-up-layout", self.__tr("Layout"),
+ cups.PPD_UI_PICKONE, current,
+ [('btlr', self.__tr('Bottom to top, left to right')),
+ ('btrl', self.__tr('Bottom to top, right to left')),
+ ('lrbt', self.__tr('Left to right, bottom to top')),
+ ('lrtb', self.__tr('Left to right, top to bottom')),
+ ('rlbt', self.__tr('Right to left, bottom to top')),
+ ('rltb', self.__tr('Right to left, top to bottom')),
+ ('tblr', self.__tr('Top to bottom, left to right')),
+ ('tbrl', self.__tr('Top to bottom, right to left')) ], 'lrtb')
+
+ log.debug(" Option: number-up-layout")
+ log.debug(" Current value: %s" % current)
+
+ current = current_options.get('page-border', 'none')
+
+ self.addControlRow("page-border",
+ self.__tr("Printed Border Around Each Page"),
+ cups.PPD_UI_PICKONE, current,
+ [('double', self.__tr("Two thin borders")),
+ ("double-thick", self.__tr("Two thick borders")),
+ ("none", self.__tr("No border")),
+ ("single", self.__tr("One thin border")),
+ ("single-thick", self.__tr("One thick border"))], 'none')
+
+ log.debug(" Option: page-border")
+ log.debug(" Current value: %s" % current)
+
+ self.endControlGroup()
+
+ # Adjustment
+ # brightness
+ # gamma
+
+ if not self.cur_device.device_type == DEVICE_TYPE_FAX:
+ self.beginControlGroup("adjustment", self.__tr("Printout Appearance"))
+
+ current = int(current_options.get('brightness', 100))
+
+ log.debug(" Option: brightness")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("brightness", self.__tr("Brightness"),
+ cups.UI_SPINNER, current, (0, 200), 100, suffix=" %")
+
+ current = int(current_options.get('gamma', 1000))
+
+ log.debug(" Option: gamma")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("gamma", self.__tr("Gamma"), cups.UI_SPINNER, current,
+ (1, 10000), 1000)
+
+ self.endControlGroup()
+
+ # Margins (pts)
+ # page-left
+ # page-right
+ # page-top
+ # page-bottom
+
+## if 0:
+## # TODO: cupsPPDPageSize() fails on LaserJets. How do we get margins in this case? Defaults?
+## # PPD file for LJs has a HWMargin entry...
+## page, page_width, page_len, left, bottom, right, top = cups.getPPDPageSize()
+##
+## right = page_width - right
+## top = page_len - top
+##
+## self.addGroupHeading("margins", self.__tr("Margins"))
+## current_top = current_options.get('page-top', 0) # pts
+## current_bottom = current_options.get('page-bottom', 0) # pts
+## current_left = current_options.get('page-left', 0) # pts
+## current_right = current_options.get('page-right', 0) # pts
+##
+## log.debug(" Option: page-top")
+## log.debug(" Current value: %s" % current_top)
+##
+## self.addControlRow("margins", "page-top", self.__tr("Top margin"),
+## cups.UI_UNITS_SPINNER, current_top,
+## (0, page_len), top)
+##
+## self.addControlRow("margins", "page-bottom", self.__tr("Bottom margin"),
+## cups.UI_UNITS_SPINNER, current_bottom,
+## (0, page_len), bottom)
+##
+## self.addControlRow("margins", "page-left", self.__tr("Right margin"),
+## cups.UI_UNITS_SPINNER, current_left,
+## (0, page_width), left)
+##
+## self.addControlRow("margins", "page-right", self.__tr("Left margin"),
+## cups.UI_UNITS_SPINNER, current_right,
+## (0, page_width), right)
+
+ # Image Printing
+ # position
+ # natural-scaling
+ # saturation
+ # hue
+
+ self.beginControlGroup("image", self.__tr("Image Printing"))
+
+ current = utils.to_bool(current_options.get('fitplot', 'false'))
+
+ self.addControlRow("fitplot",
+ self.__tr("Fit to Page"),
+ cups.PPD_UI_BOOLEAN, current,
+ [], 0)
+
+ current = current_options.get('position', 'center')
+
+ self.addControlRow("position", self.__tr("Position on Page"),
+ cups.PPD_UI_PICKONE, current,
+ [('center', self.__tr('Centered')),
+ ('top', self.__tr('Top')),
+ ('left', self.__tr('Left')),
+ ('right', self.__tr('Right')),
+ ('top-left', self.__tr('Top left')),
+ ('top-right', self.__tr('Top right')),
+ ('bottom', self.__tr('Bottom')),
+ ('bottom-left', self.__tr('Bottom left')),
+ ('bottom-right', self.__tr('Bottom right'))], 'center')
+
+ log.debug(" Option: position")
+ log.debug(" Current value: %s" % current)
+
+ if not self.cur_device.device_type == DEVICE_TYPE_FAX:
+ current = int(current_options.get('saturation', 100))
+
+ log.debug(" Option: saturation")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("saturation", self.__tr("Saturation"),
+ cups.UI_SPINNER, current, (0, 200), 100, suffix=" %")
+
+ current = int(current_options.get('hue', 0))
+
+ log.debug(" Option: hue")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("hue", self.__tr("Hue (color shift/rotation)"),
+ cups.UI_SPINNER, current,
+ (-100, 100), 0)
+
+ current = int(current_options.get('natural-scaling', 100))
+
+ log.debug(" Option: natural-scaling")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("natural-scaling",
+ self.__tr('"Natural" Scaling (relative to image)'),
+ cups.UI_SPINNER, current, (1, 800), 100, suffix=" %")
+
+ current = int(current_options.get('scaling', 100))
+
+ log.debug(" Option: scaling")
+ log.debug(" Current value: %s" % current)
+
+ self.addControlRow("scaling", self.__tr("Scaling (relative to page)"),
+ cups.UI_SPINNER, current,
+ (1, 800), 100, suffix=" %")
+
+ self.endControlGroup()
+
+ # Misc
+ # PrettyPrint
+ # job-sheets
+ # mirror
+
+ self.beginControlGroup("misc", self.__tr("Miscellaneous"))
+
+ log.debug("Group: Misc")
+
+ current = utils.to_bool(current_options.get('prettyprint', '0'))
+
+ self.addControlRow("prettyprint",
+ self.__tr('"Pretty Print" Text Documents (Add headers and formatting)'),
+ cups.PPD_UI_BOOLEAN, current, [], 0)
+
+ log.debug(" Option: prettyprint")
+ log.debug(" Current value: %s" % current)
+
+ if not self.cur_device.device_type == DEVICE_TYPE_FAX:
+ current = current_options.get('job-sheets', 'none').split(',')
+
+ try:
+ start = current[0]
+ except IndexError:
+ start = 'none'
+
+ try:
+ end = current[1]
+ except IndexError:
+ end = 'none'
+
+ # TODO: Look for locally installed banner pages beyond the default CUPS ones?
+ self.addControlRow("job-sheets", self.__tr("Banner Pages"), cups.UI_BANNER_JOB_SHEETS,
+ (start, end),
+ [("none", self.__tr("No banner page")),
+ ('classified', self.__tr("Classified")),
+ ('confidential', self.__tr("Confidential")),
+ ('secret', self.__tr("Secret")),
+ ('standard', self.__tr("Standard")),
+ ('topsecret', self.__tr("Top secret")),
+ ('unclassified', self.__tr("Unclassified"))], ('none', 'none'))
+
+ log.debug(" Option: job-sheets")
+ log.debug(" Current value: %s,%s" % (start, end))
+
+ current = utils.to_bool(current_options.get('mirror', '0'))
+
+ self.addControlRow("mirror", self.__tr('Mirror Printing'),
+ cups.PPD_UI_BOOLEAN, current, [], 0)
+
+ log.debug(" Option: mirror")
+ log.debug(" Current value: %s" % current)
+
+ self.endControlGroup()
+
+ #Summary
+ #color input
+ #quality
+ quality_attr_name = "OutputModeDPI"
+ cur_outputmode_dpi = cups.findPPDAttribute(quality_attr_name, cur_outputmode)
+ if cur_outputmode_dpi is not None:
+ log.debug("Adding Group: Summary outputmode is : %s" % cur_outputmode)
+ log.debug("Adding Group: Summary outputmode dpi is : %s" % to_unicode (cur_outputmode_dpi))
+ self.beginControlGroup("sumry", self.__tr("Summary"))
+ self.addControlRow("colorinput", self.__tr('Color Input / Black Render'),
+ cups.UI_INFO, to_unicode (cur_outputmode_dpi), [], read_only)
+ self.addControlRow("quality", self.__tr('Print Quality'),
+ cups.UI_INFO, cur_outputmode, [], read_only)
+ self.endControlGroup()
+ log.debug("End adding Group: Summary")
+
+
+ self.job_storage_enable = 0 #self.cur_device.mq.get('job-storage', JOB_STORAGE_DISABLE) == JOB_STORAGE_ENABLE
+
+
+ if self.job_storage_enable:
+ self.job_storage_pin = to_unicode(current_options.get('HOLDKEY', '0000')[:4])
+ self.job_storage_username = to_unicode(current_options.get('USERNAME', prop.username)[:16])
+ self.job_storage_jobname = to_unicode(current_options.get('JOBNAME', to_unicode('Untitled'))[:16])
+ hold = to_unicode(current_options.get('HOLD', to_unicode('OFF')))
+ holdtype = to_unicode(current_options.get('HOLDTYPE', to_unicode('PUBLIC')))
+ self.job_storage_use_pin = False
+ duplicate = to_unicode(current_options.get('DUPLICATEJOB', to_unicode('REPLACE')))
+ self.job_storage_auto_username = True
+ self.job_storage_auto_jobname = True
+ self.job_storage_mode = JOB_STORAGE_TYPE_OFF
+
+ if hold == 'OFF':
+ self.job_storage_mode = JOB_STORAGE_TYPE_OFF
+
+ elif hold == 'ON':
+ if holdtype == to_unicode('PUBLIC'):
+ self.job_storage_mode = JOB_STORAGE_TYPE_QUICK_COPY
+
+ else: # 'PRIVATE'
+ self.job_storage_mode = JOB_STORAGE_TYPE_PERSONAL
+ self.job_storage_use_pin = True
+
+ elif hold == to_unicode('PROOF'):
+ if holdtype == to_unicode('PUBLIC'):
+ self.job_storage_mode = JOB_STORAGE_TYPE_PROOF_AND_HOLD
+ else:
+ self.job_storage_mode = JOB_STORAGE_TYPE_PERSONAL
+ self.job_storage_use_pin = True
+
+ elif hold == to_unicode('STORE'):
+ self.job_storage_mode = JOB_STORAGE_TYPE_STORE
+ self.job_storage_use_pin = (holdtype == 'PRIVATE')
+
+ if duplicate == to_unicode('REPLACE'):
+ self.job_storage_job_exist = JOB_STORAGE_EXISTING_JOB_REPLACE
+ else: # u'APPEND'
+ self.job_storage_job_exist = JOB_STORAGE_EXISTING_JOB_APPEND_1_99
+
+ # option, text, typ, value, choices, default, read_only=False, suffix="", job_option=False)
+
+ self.beginControlGroup("jobstorage", self.__tr("Job Storage and Secure Printing"))
+
+ self.addControlRow("job-storage-mode", self.__tr("Mode"),
+ cups.UI_JOB_STORAGE_MODE, None, None, None)
+
+ self.addControlRow("job-storage-pin", self.__tr("Make job private (use PIN to print)"),
+ cups.UI_JOB_STORAGE_PIN, None, None, None )
+
+ self.addControlRow("job-storage-username", self.__tr("User name (for job identification)"),
+ cups.UI_JOB_STORAGE_USERNAME, None, None, None)
+
+ self.addControlRow("job-storage-id", self.__tr("Job name/ID (for job identification)"),
+ cups.UI_JOB_STORAGE_ID, None, None, None)
+
+ self.addControlRow("job-storage-id-exists", self.__tr("If job name/ID already exists..."),
+ cups.UI_JOB_STORAGE_ID_EXISTS, None, None, None)
+
+ self.endControlGroup()
+ self.updateJobStorageControls()
+
+ # use: self.job_options['xxx'] so that values can be picked up by getPrintCommand(
+
+
+ #except Exception, e:
+ #log.exception()
+ # pass
+
+ finally:
+ cups.closePPD()
+ self.loading = False
+
+
+ def beginControlGroup(self, group, text):
+ log.debug("BeginGroup: %s" % group)
+ self.row = 0
+ self.widget = QWidget()
+ self.gridlayout = QGridLayout(self.widget)
+ self.group = group
+ self.text = text
+
+
+ def endControlGroup(self):
+ log.debug("EndGroup: %s" % self.group)
+ spacer = QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
+ self.row += 1
+ self.gridlayout.addItem(spacer, self.row, 0, 1, 1)
+ i = self.addItem(self.widget, self.text)
+
+ if i:
+ self.setItemIcon(i, self.plus_icon)
+ else:
+ self.setItemIcon(i, self.minus_icon)
+
+ self.widget, self.gridlayout = None, None
+
+
+ def addControlRow(self, option, text, typ, value, choices, default, read_only=False, suffix="", job_option=False):
+
+ if typ == cups.PPD_UI_BOOLEAN: # () On (*) Off widget
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ GroupBox = QFrame(self.widget)
+
+ gridlayout1 = QGridLayout(GroupBox)
+ OnRadioButton = OptionRadioButton(GroupBox, "OnRadioButton", self.group,
+ option, default, job_option)
+ gridlayout1.addWidget(OnRadioButton,0,0,1,1)
+ OffRadioButton = OptionRadioButton(GroupBox, "OffRadioButton", self.group,
+ option, default, job_option)
+ gridlayout1.addWidget(OffRadioButton,0,1,1,1)
+ HBoxLayout.addWidget(GroupBox)
+
+ DefaultButton = DefaultPushButton(self.widget, "defaultPushButton", self.group, option,
+ choices, default, (OnRadioButton, OffRadioButton), typ, job_option)
+
+ #GroupBox.setDefaultPushbutton(DefaultButton)
+ OnRadioButton.setDefaultPushbutton(DefaultButton)
+ OffRadioButton.setDefaultPushbutton(DefaultButton)
+
+ HBoxLayout.addWidget(DefaultButton)
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ OptionLabel.setText(text)
+ OnRadioButton.setText(self.__tr("On"))
+ OffRadioButton.setText(self.__tr("Off"))
+
+ DefaultButton.setText("Default")
+
+ #type of 'value' and 'default' can be unicode (ppd values), str, int or boolean, so we need to typecast it to bool for easy comparison
+ if value == True or value == 'True' or value == 'true':
+ value = True;
+ else:
+ value = False;
+
+ if default == True or default == 'True' or default == 'true':
+ default = True;
+ else:
+ default = False;
+
+ if value == default:
+ DefaultButton.setEnabled(False)
+ DefaultButton.clicked.connect(self.DefaultButton_clicked)
+
+ if value:
+ OnRadioButton.setChecked(True)
+ else:
+ OffRadioButton.setChecked(True)
+ OnRadioButton.toggled[bool].connect(self.BoolRadioButtons_clicked)
+
+ if read_only:
+ OnRadioButton.setEnabled(False)
+ OffRadioButton.setEnabled(False)
+ DefaultButton.setEnabled(False)
+
+
+
+ elif typ == cups.PPD_UI_PICKONE: # Combo box widget
+ #print option, job_option
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ ComboBox = OptionComboBox(0, self.widget, "ComboBox", self.group, option,
+ choices, default, typ, None, job_option)
+
+ HBoxLayout.addWidget(ComboBox)
+
+ DefaultButton = DefaultPushButton(self.widget, "DefaultButton", self.group, option,
+ choices, default, ComboBox, typ, job_option)
+
+ ComboBox.setDefaultPushbutton(DefaultButton)
+ HBoxLayout.addWidget(DefaultButton)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ OptionLabel.setText(text)
+ DefaultButton.setText("Default")
+
+ i, x, y = 0, None, None
+ for c, t in choices:
+ d = c.lower()
+ if value is not None and d == value.lower():
+ x = i
+
+ if d == default.lower():
+ y = t
+
+ ComboBox.insertItem(i, t)
+ i += 1
+
+ if x is not None:
+ ComboBox.setCurrentIndex(x)
+ else:
+ ComboBox.setCurrentIndex(0)
+
+ if value is not None and value.lower() == default.lower():
+ DefaultButton.setEnabled(False)
+
+ #self.linkPrintoutModeAndQuality(option, value)
+#
+# if read_only:
+# optionComboBox.setEnabled(False)
+# defaultPushButton.setEnabled(False)
+# elif y is not None:
+# QToolTip.add(defaultPushButton, self.__tr('Set to default value of "%1".').arg(y))
+#
+
+ DefaultButton.clicked.connect(self.DefaultButton_clicked)
+ ComboBox.currentIndexChanged["const QString &"].connect(self.ComboBox_indexChanged)
+ ComboBox.highlighted["const QString &"].connect(self.ComboBox_highlighted)
+
+ control = ComboBox
+
+ elif typ == cups.UI_SPINNER: # Spinner widget
+
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ SpinBox = OptionSpinBox(self.widget,"SpinBox", self.group, option, default, job_option)
+ HBoxLayout.addWidget(SpinBox)
+
+ DefaultButton = DefaultPushButton(self.widget,"DefaultButton", self.group, option,
+ choices, default, SpinBox, typ, job_option)
+
+ SpinBox.setDefaultPushbutton(DefaultButton)
+ HBoxLayout.addWidget(DefaultButton)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ min, max = choices
+ SpinBox.setMinimum(min)
+ SpinBox.setMaximum(max)
+ SpinBox.setValue(value)
+
+ if suffix:
+ SpinBox.setSuffix(suffix)
+
+ OptionLabel.setText(text)
+ DefaultButton.setText("Default")
+
+ SpinBox.valueChanged[int].connect(self.SpinBox_valueChanged)
+ DefaultButton.clicked.connect(self.DefaultButton_clicked)
+
+ DefaultButton.setEnabled(not value == default)
+
+ if read_only:
+ SpinBox.setEnabled(False)
+ DefaultButton.setEnabled(False)
+
+ elif typ == cups.UI_BANNER_JOB_SHEETS: # Job sheets widget
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ StartLabel = QLabel(self.widget)
+ HBoxLayout.addWidget(StartLabel)
+
+ StartComboBox = OptionComboBox(0, self.widget, "StartComboBox", self.group,
+ "start", choices, default, typ)
+
+ HBoxLayout.addWidget(StartComboBox)
+
+ EndLabel = QLabel(self.widget)
+ HBoxLayout.addWidget(EndLabel)
+
+ EndComboBox = OptionComboBox(0, self.widget, "EndComboBox", self.group, "end", choices,
+ default, typ, StartComboBox)
+
+ HBoxLayout.addWidget(EndComboBox)
+
+ StartComboBox.setOther(EndComboBox)
+
+ DefaultButton = DefaultPushButton(self.widget, "DefaultButton", self.group, option, choices,
+ default, (StartComboBox, EndComboBox), typ, job_option)
+
+ HBoxLayout.addWidget(DefaultButton)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ StartComboBox.setDefaultPushbutton(DefaultButton)
+ EndComboBox.setDefaultPushbutton(DefaultButton)
+
+ OptionLabel.setText(text)
+ DefaultButton.setText("Default")
+
+ StartLabel.setText(self.__tr("Start:"))
+ EndLabel.setText(self.__tr("End:"))
+
+ s, e, y, z = None, None, None, None
+ for c, t in choices:
+ d = c.lower()
+ if value is not None:
+ if d == value[0].lower():
+ s = t
+
+ if d == value[1].lower():
+ e = t
+
+ if d == default[0].lower():
+ y = t
+
+ if d == default[1].lower():
+ z = t
+
+ StartComboBox.insertItem(0, t)
+ EndComboBox.insertItem(0, t)
+
+ if s is not None:
+ StartComboBox.setCurrentIndex(StartComboBox.findText(s))
+
+ if e is not None:
+ EndComboBox.setCurrentIndex(EndComboBox.findText(e))
+
+ if value is not None and \
+ value[0].lower() == default[0].lower() and \
+ value[1].lower() == default[1].lower():
+
+ DefaultButton.setEnabled(False)
+
+ StartComboBox.activated["const QString&"].connect(self.BannerComboBox_activated)
+ EndComboBox.activated["const QString&"].connect(self.BannerComboBox_activated)
+ DefaultButton.clicked.connect(self.DefaultButton_clicked)
+
+ elif typ == cups.PPD_UI_PICKMANY:
+ log.error("Unrecognized type: pickmany")
+
+ elif typ == cups.UI_UNITS_SPINNER:
+ log.error("Unrecognized type: units spinner")
+
+ elif typ == cups.UI_PAGE_RANGE:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ GroupBox = QFrame(self.widget)
+
+ gridlayout1 = QGridLayout(GroupBox)
+
+ AllRadioButton = PageRangeRadioButton(GroupBox, "AllRadioButton",
+ self.group, option, default)
+
+ gridlayout1.addWidget(AllRadioButton,0,0,1,1)
+ RangeRadioButton = PageRangeRadioButton(GroupBox, "RangeRadioButton",
+ self.group, option, default)
+
+ gridlayout1.addWidget(RangeRadioButton,0,1,1,1)
+ HBoxLayout.addWidget(GroupBox)
+
+ PageRangeEdit = QLineEdit(self.widget)
+ HBoxLayout.addWidget(PageRangeEdit)
+ PageRangeEdit.setValidator(RangeValidator(PageRangeEdit))
+
+ AllRadioButton.setRangeEdit(PageRangeEdit)
+ RangeRadioButton.setRangeEdit(PageRangeEdit)
+
+ DefaultButton = DefaultPushButton(self.widget, "defaultPushButton", self.group, option,
+ choices, default, (AllRadioButton, RangeRadioButton, PageRangeEdit), typ, job_option)
+
+ AllRadioButton.setDefaultPushbutton(DefaultButton)
+ RangeRadioButton.setDefaultPushbutton(DefaultButton)
+
+ HBoxLayout.addWidget(DefaultButton)
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ OptionLabel.setText(text)
+ AllRadioButton.setText(self.__tr("All pages"))
+ RangeRadioButton.setText(self.__tr("Page Range:"))
+
+ DefaultButton.setText("Default")
+ DefaultButton.setEnabled(False)
+
+ AllRadioButton.setChecked(True)
+ PageRangeEdit.setEnabled(False)
+
+ # TODO: Set current
+
+ AllRadioButton.toggled[bool].connect(self.PageRangeAllRadio_toggled)
+ RangeRadioButton.toggled[bool].connect(self.PageRangeRangeRadio_toggled)
+ DefaultButton.clicked.connect(self.DefaultButton_clicked)
+ PageRangeEdit.textChanged["const QString &"].connect(self.PageRangeEdit_textChanged)
+ PageRangeEdit.editingFinished.connect(self.PageRangeEdit_editingFinished)
+
+ elif typ == cups.UI_JOB_STORAGE_MODE:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.JobStorageModeComboBox = QComboBox(self.widget)
+ HBoxLayout.addWidget(self.JobStorageModeComboBox)
+
+ self.JobStorageModeDefaultButton = QPushButton(self.widget)
+ HBoxLayout.addWidget(self.JobStorageModeDefaultButton)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ OptionLabel.setText(text)
+ self.JobStorageModeDefaultButton.setText(self.__tr("Default"))
+
+ self.JobStorageModeComboBox.addItem(self.__tr("Off/Disabled"), JOB_STORAGE_TYPE_OFF)
+ self.JobStorageModeComboBox.addItem(self.__tr("Proof and Hold"), JOB_STORAGE_TYPE_PROOF_AND_HOLD)
+ self.JobStorageModeComboBox.addItem(self.__tr("Personal/Private Job"), JOB_STORAGE_TYPE_PERSONAL)
+ self.JobStorageModeComboBox.addItem(self.__tr("Quick Copy"), JOB_STORAGE_TYPE_QUICK_COPY)
+ self.JobStorageModeComboBox.addItem(self.__tr("Stored Job"), JOB_STORAGE_TYPE_STORE)
+
+ self.JobStorageModeComboBox.activated[int].connect( self.JobStorageModeComboBox_activated)
+
+ self.JobStorageModeDefaultButton.clicked.connect( self.JobStorageModeDefaultButton_clicked)
+
+
+ elif typ == cups.UI_JOB_STORAGE_PIN:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.JobStoragePinGroupBox = QFrame(self.widget)
+
+ gridlayout1 = QGridLayout(self.JobStoragePinGroupBox)
+ self.JobStoragePinOffRadioButton = QRadioButton(self.JobStoragePinGroupBox)
+ gridlayout1.addWidget(self.JobStoragePinOffRadioButton, 0, 0, 1, 1)
+
+ self.JobStoragePinPrivateRadioButton = QRadioButton(self.JobStoragePinGroupBox)
+ gridlayout1.addWidget(self.JobStoragePinPrivateRadioButton, 0, 1, 1, 1)
+
+ self.JobStoragePinEdit = QLineEdit(self.JobStoragePinGroupBox)
+ self.JobStoragePinEdit.setMaxLength(4)
+ self.JobStoragePinEdit.setValidator(PinValidator(self.JobStoragePinEdit))
+ gridlayout1.addWidget(self.JobStoragePinEdit, 0, 2, 1, 1)
+
+ HBoxLayout.addWidget(self.JobStoragePinGroupBox)
+
+ self.JobStoragePinDefaultButton = QPushButton(self.widget)
+ HBoxLayout.addWidget(self.JobStoragePinDefaultButton)
+
+ self.JobStoragePinOffRadioButton.setText(self.__tr("Public/Off"))
+ self.JobStoragePinPrivateRadioButton.setText(self.__tr("Private/Use PIN:"))
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ OptionLabel.setText(text)
+ self.JobStoragePinDefaultButton.setText(self.__tr("Default"))
+
+ self.JobStoragePinOffRadioButton.toggled[bool].connect( self.JobStoragePinOffRadioButton_toggled)
+
+ self.JobStoragePinPrivateRadioButton.toggled[bool].connect( self.JobStoragePinPrivateRadioButton_toggled)
+
+ self.JobStoragePinDefaultButton.clicked.connect( self.JobStoragePinDefaultButton_clicked)
+
+ self.JobStoragePinEdit.textEdited["const QString &"].connect( self.JobStoragePinEdit_textEdited)
+
+
+ elif typ == cups.UI_JOB_STORAGE_USERNAME:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+ OptionLabel.setText(text)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.JobStorageUsernameGroupBox = QFrame(self.widget)
+
+ gridlayout1 = QGridLayout(self.JobStorageUsernameGroupBox)
+ self.JobStorageUsernameAutoRadioButton = QRadioButton(self.JobStorageUsernameGroupBox)
+ gridlayout1.addWidget(self.JobStorageUsernameAutoRadioButton, 0, 0, 1, 1)
+
+ self.JobStorageUsernameCustomRadioButton = QRadioButton(self.JobStorageUsernameGroupBox)
+ gridlayout1.addWidget(self.JobStorageUsernameCustomRadioButton, 0, 1, 1, 1)
+
+ self.JobStorageUsernameEdit = QLineEdit(self.JobStorageUsernameGroupBox)
+ self.JobStorageUsernameEdit.setValidator(UsernameAndJobnameValidator(self.JobStorageUsernameEdit))
+ self.JobStorageUsernameEdit.setMaxLength(16)
+ gridlayout1.addWidget(self.JobStorageUsernameEdit, 0, 2, 1, 1)
+
+ HBoxLayout.addWidget(self.JobStorageUsernameGroupBox)
+
+ self.JobStorageUsernameDefaultButton = QPushButton(self.widget)
+ HBoxLayout.addWidget(self.JobStorageUsernameDefaultButton)
+
+ self.JobStorageUsernameAutoRadioButton.setText(self.__tr("Automatic"))
+ self.JobStorageUsernameCustomRadioButton.setText(self.__tr("Custom:"))
+ self.JobStorageUsernameDefaultButton.setText(self.__tr("Default"))
+
+ self.JobStorageUsernameAutoRadioButton.toggled[bool].connect( self.JobStorageUsernameAutoRadioButton_toggled)
+
+ self.JobStorageUsernameCustomRadioButton.toggled[bool].connect( self.JobStorageUsernameCustomRadioButton_toggled)
+
+ self.JobStorageUsernameDefaultButton.clicked.connect( self.JobStorageUsernameDefaultButton_clicked)
+
+ self.JobStorageUsernameEdit.textEdited["const QString &"].connect( self.JobStorageUsernameEdit_textEdited)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ elif typ == cups.UI_JOB_STORAGE_ID:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+ OptionLabel.setText(text)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.JobStorageIDGroupBox = QFrame(self.widget)
+
+ gridlayout1 = QGridLayout(self.JobStorageIDGroupBox)
+ self.JobStorageIDAutoRadioButton = QRadioButton(self.JobStorageIDGroupBox)
+ gridlayout1.addWidget(self.JobStorageIDAutoRadioButton, 0, 0, 1, 1)
+
+ self.JobStorageIDCustomRadioButton = QRadioButton(self.JobStorageIDGroupBox)
+ gridlayout1.addWidget(self.JobStorageIDCustomRadioButton, 0, 1, 1, 1)
+
+ self.JobStorageIDEdit = QLineEdit(self.JobStorageIDGroupBox)
+ self.JobStorageIDEdit.setValidator(UsernameAndJobnameValidator(self.JobStorageIDEdit))
+ self.JobStorageIDEdit.setMaxLength(16)
+ gridlayout1.addWidget(self.JobStorageIDEdit, 0, 2, 1, 1)
+
+ HBoxLayout.addWidget(self.JobStorageIDGroupBox)
+
+ self.JobStorageIDDefaultButton = QPushButton(self.widget)
+ HBoxLayout.addWidget(self.JobStorageIDDefaultButton)
+
+ self.JobStorageIDAutoRadioButton.setText(self.__tr("Automatic"))
+ self.JobStorageIDCustomRadioButton.setText(self.__tr("Custom:"))
+ self.JobStorageIDDefaultButton.setText(self.__tr("Default"))
+
+ self.JobStorageIDAutoRadioButton.toggled[bool].connect( self.JobStorageIDAutoRadioButton_toggled)
+
+ self.JobStorageIDCustomRadioButton.toggled[bool].connect( self.JobStorageIDCustomRadioButton_toggled)
+
+ self.JobStorageIDDefaultButton.clicked.connect( self.JobStorageIDDefaultButton_clicked)
+
+ self.JobStorageIDEdit.textEdited["const QString &"].connect( self.JobStorageIDEdit_textEdited)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ elif typ == cups.UI_JOB_STORAGE_ID_EXISTS:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionLabel = QLabel(self.widget)
+ OptionLabel.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionLabel)
+ OptionLabel.setText(text)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ self.JobStorageExistingComboBox = QComboBox(self.widget)
+ HBoxLayout.addWidget(self.JobStorageExistingComboBox)
+
+ self.JobStorageExistingDefaultButton = QPushButton(self.widget)
+ HBoxLayout.addWidget(self.JobStorageExistingDefaultButton)
+
+ self.JobStorageExistingComboBox.addItem(self.__tr("Replace existing job"),
+ JOB_STORAGE_EXISTING_JOB_REPLACE)
+
+ self.JobStorageExistingComboBox.addItem(self.__tr("Use job name appended with 1-99"),
+ JOB_STORAGE_EXISTING_JOB_APPEND_1_99)
+
+ self.JobStorageExistingDefaultButton.setText(self.__tr("Default"))
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ self.JobStorageExistingComboBox.activated[int].connect( self.JobStorageExistingComboBox_activated)
+
+ self.JobStorageExistingDefaultButton.clicked.connect( self.JobStorageExistingDefaultButton_clicked)
+
+ elif typ == cups.UI_INFO:
+ HBoxLayout = QHBoxLayout()
+ HBoxLayout.setObjectName("HBoxLayout")
+
+ OptionName = QLabel(self.widget)
+ OptionName.setObjectName("OptionLabel")
+ HBoxLayout.addWidget(OptionName)
+ OptionName.setText(text)
+
+ SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ HBoxLayout.addItem(SpacerItem)
+
+ if text == 'Print Quality':
+ self.PQValueLabel = QLabel(self.widget)
+ self.PQValueLabel.setObjectName("PQValueLabel")
+ HBoxLayout.addWidget(self.PQValueLabel)
+ self.PQValueLabel.setText(value)
+ elif text == 'Color Input / Black Render':
+ self.PQColorInputLabel = QLabel(self.widget)
+ self.PQColorInputLabel.setObjectName("PQColorInputLabel")
+ HBoxLayout.addWidget(self.PQColorInputLabel)
+ self.PQColorInputLabel.setText(value)
+ else:
+ OptionValue = QLabel(self.widget)
+ OptionValue.setObjectName("OptionValue")
+ HBoxLayout.addWidget(OptionValue)
+ OptionValue.setText(value)
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ else:
+ log.error("Invalid UI value: %s/%s" % (self.group, option))
+
+ self.row += 1
+
+
+
+ def BannerComboBox_activated(self, a): # cups.UI_BANNER_JOB_SHEETS
+ a = to_unicode(a)
+ sender = self.sender()
+ choice = None
+
+ start, end = None, None
+ for c, t in sender.choices:
+ if t == a:
+ start = c
+ break
+
+ for c, t in sender.other.choices:
+ if t == sender.other.currentText():
+ end = c
+ break
+
+ if sender.option == 'end':
+ start, end = end, start
+
+ if start is not None and \
+ end is not None and \
+ start.lower() == sender.default[0].lower() and \
+ end.lower() == sender.default[1].lower():
+ self.removePrinterOption('job-sheets')
+ sender.pushbutton.setEnabled(False)
+ else:
+ sender.pushbutton.setEnabled(True)
+
+ if start is not None and \
+ end is not None:
+
+ self.setPrinterOption('job-sheets', ','.join([start, end]))
+
+
+ def ComboBox_highlighted(self, t):
+ t = to_unicode(t)
+ sender = self.sender()
+ choice = None
+
+ #print sender, sender.option, sender.job_option
+
+ choice = None
+ for c, a in sender.choices:
+ if a == t:
+ choice = c
+ break
+
+ if choice is not None and choice == sender.default:
+ if sender.job_option:
+ self.job_options[sender.option] = sender.default
+ else:
+ self.removePrinterOption(sender.option)
+ sender.pushbutton.setEnabled(False)
+
+ else:
+ sender.pushbutton.setEnabled(True)
+
+ if choice is not None:
+ if sender.job_option:
+ self.job_options[sender.option] = choice
+ else:
+ self.setPrinterOption(sender.option, choice)
+
+ #self.linkPrintoutModeAndQuality(sender.option, choice)
+
+ if 0:
+ pass
+ # def linkPrintoutModeAndQuality(self, option, choice):
+ # if option.lower() == 'quality' and \
+ # choice is not None:
+ #
+ # try:
+ # c = self.items['o:PrintoutMode'].control
+ # except KeyError:
+ # return
+ # else:
+ # if c is not None:
+ # if choice.lower() == 'fromprintoutmode':
+ # # from printoutmode selected
+ # # determine printoutmode option combo enable state
+ # c.setEnabled(True)
+ # QToolTip.remove(c)
+ # a = unicode(c.currentText())
+ #
+ # # determine printoutmode default button state
+ # link_choice = None
+ # for x, t in c.choices:
+ # if t == a:
+ # link_choice = x
+ # break
+ #
+ # if link_choice is not None and \
+ # link_choice.lower() == c.default.lower():
+ #
+ # c.pushbutton.setEnabled(False)
+ # else:
+ # c.pushbutton.setEnabled(True)
+ #
+ # else: # fromprintoutmode not selected, disable printoutmode
+ # c.setEnabled(False)
+ # QToolTip.add(c, self.__tr("""Set Quality to "Controlled by 'Printout Mode'" to enable."""))
+ # c.pushbutton.setEnabled(False)
+ #
+
+ def SpinBox_valueChanged(self, i): # cups.UI_SPINNER
+ sender = self.sender()
+
+ if not sender.job_option:
+ if i == sender.default:
+ self.removePrinterOption(sender.option)
+ sender.pushbutton.setEnabled(False)
+ else:
+ sender.pushbutton.setEnabled(True)
+ self.setPrinterOption(sender.option, str(i))
+
+ else:
+ try:
+ self.job_options[sender.option] = int(i)
+ except ValueError:
+ self.job_options[sender.option] = sender.default
+
+
+ def BoolRadioButtons_clicked(self, b): # cups.PPD_UI_BOOLEAN
+ sender = self.sender()
+ b = int(b)
+ if sender.default == True or sender.default == "True" or sender.default == "true":
+ sender.default = int(True)
+ else:
+ sender.default = int(False)
+
+ if b == sender.default:
+ self.removePrinterOption(sender.option)
+ sender.pushbutton.setEnabled(False)
+ else:
+ sender.pushbutton.setEnabled(True)
+
+ if b:
+ self.setPrinterOption(sender.option, "true")
+ else:
+ self.setPrinterOption(sender.option, "false")
+
+ def ComboBox_indexChanged(self, currentItem):
+ sender = self.sender()
+ currentItem = to_unicode(currentItem)
+ # Checking for summary control
+ labelPQValaue = getattr(self, 'PQValueLabel', None)
+ labelPQColorInput = getattr(self, 'PQColorInputLabel', None)
+ # When output mode combo item is changed, we need to update the summary information
+ if currentItem is not None and sender.option == 'OutputMode' and labelPQValaue is not None and labelPQColorInput is not None:
+ # Setting output mode
+ self.PQValueLabel.setText(currentItem)
+
+ # Getting DPI custom attributefrom the PPD
+ # Setting color input
+ quality_attr_name = "OutputModeDPI"
+ cups.openPPD(self.cur_printer)
+ outputmode_dpi = cups.findPPDAttribute(quality_attr_name, currentItem)
+ log.debug("Outputmode changed, setting outputmode_dpi: %s" % outputmode_dpi)
+ cups.closePPD()
+ self.PQColorInputLabel.setText(outputmode_dpi)
+
+ log.debug("Outputmode changed, setting value outputmode: %s" % currentItem)
+
+ def DefaultButton_clicked(self):
+ sender = self.sender()
+ sender.setEnabled(False)
+
+ if sender.typ == cups.PPD_UI_BOOLEAN: # () On (*) Off
+ if sender.default == True or sender.default == 'True' or sender.default == 'true':
+ sender.default = True
+ else:
+ sender.default = False
+ if sender.default:
+ sender.control[0].setChecked(True)
+ sender.control[0].setFocus(Qt.OtherFocusReason)
+ else:
+ sender.control[1].setChecked(True)
+ sender.control[1].setFocus(Qt.OtherFocusReason)
+
+ if not sender.job_option:
+ self.removePrinterOption(sender.option)
+
+ elif sender.typ == cups.PPD_UI_PICKONE: # [ \/]
+ choice, text = None, None
+
+ for c, t in sender.choices:
+ if c == sender.default:
+ choice = c
+ text = t
+ self.job_options[sender.option] = t
+ break
+
+ if choice is not None:
+ if not sender.job_option:
+ self.removePrinterOption(sender.option)
+ index = sender.control.findText(text)
+ sender.control.setCurrentIndex(index)
+
+ #self.linkPrintoutModeAndQuality(sender.option, choice) # TODO:
+ sender.control.setFocus(Qt.OtherFocusReason)
+
+ elif sender.typ == cups.UI_SPINNER: # [ x /\|\/]
+ sender.control.setValue(sender.default)
+ if not sender.job_option:
+ self.removePrinterOption(sender.option)
+
+ sender.control.setFocus(Qt.OtherFocusReason)
+
+ elif sender.typ == cups.UI_BANNER_JOB_SHEETS: # start: [ \/] end: [ \/]
+ start, end, start_text, end_text = None, None, None, None
+ for c, t in sender.choices:
+ if c == sender.default[0]:
+ start = c
+ start_text = t
+
+ if c == sender.default[1]:
+ end = c
+ end_text = t
+
+ if start is not None:
+ index = sender.control[0].findText(start_text)
+ sender.control[0].setCurrentIndex(index)
+
+ if end is not None:
+ index = sender.control[1].findText(end_text)
+ sender.control[1].setCurrentIndex(index)
+
+ if not sender.job_option:
+ self.removePrinterOption('job-sheets')
+
+ sender.control[0].setFocus(Qt.OtherFocusReason)
+
+ elif sender.typ == cups.UI_PAGE_RANGE: # (*) All () Pages: [ ]
+ sender.control[0].setChecked(True) # all radio button
+ sender.control[0].setFocus(Qt.OtherFocusReason)
+ sender.control[2].setEnabled(False) # range edit box
+
+
+ def PageRangeAllRadio_toggled(self, b):
+ if b:
+ sender = self.sender()
+ sender.edit_control.setEnabled(False)
+ sender.pushbutton.setEnabled(False)
+ self.job_options['pagerange'] = ''
+
+
+ def PageRangeRangeRadio_toggled(self, b):
+ if b:
+ sender = self.sender()
+ sender.pushbutton.setEnabled(True)
+ sender.edit_control.setEnabled(True)
+ self.job_options['pagerange'] = to_unicode(sender.edit_control.text())
+
+
+ def PageRangeEdit_editingFinished(self):
+ sender = self.sender()
+ t, ok, x = self.job_options['pagerange'], True, []
+
+
+ try:
+ x = utils.expand_range(t)
+ except ValueError:
+ ok = False
+
+ if ok:
+ for y in x:
+ if y <= 0 or y > 999:
+ ok = False
+ break
+
+ if not ok:
+ self.job_options['pagerange'] = ''
+ log.error("Invalid page range: %s" % t)
+ FailureUI(self, self.__tr("<b>Invalid page range.</b><p>Please enter a range using page numbers (1-999), dashes, and commas. For example: 1-2,3,5-7</p>"))
+ sender.setFocus(Qt.OtherFocusReason)
+
+
+ def PageRangeEdit_textChanged(self, t):
+ self.job_options['pagerange'] = to_unicode(t) # Do range validation only in PageRangeEdit_editingFinished method
+
+ #
+ # Job Storage
+ #
+
+ def updateJobStorageControls(self):
+ beginWaitCursor()
+ try:
+ # Mode
+ self.JobStorageModeComboBox.setCurrentIndex(self.JobStorageModeComboBox.findData(self.job_storage_mode))
+ self.JobStorageModeDefaultButton.setEnabled(self.job_storage_mode != JOB_STORAGE_TYPE_OFF)
+
+ # PIN
+ self.JobStoragePinPrivateRadioButton.setChecked(self.job_storage_use_pin)
+
+ # Username
+ self.JobStorageUsernameAutoRadioButton.setChecked(self.job_storage_auto_username)
+
+ # Jobname/ID
+ self.JobStorageIDAutoRadioButton.setChecked(self.job_storage_auto_jobname)
+
+ # Dup/existing ID
+ self.JobStorageExistingComboBox.setCurrentIndex(self.JobStorageExistingComboBox.findData(self.job_storage_job_exist))
+
+ if self.job_storage_mode == JOB_STORAGE_TYPE_OFF:
+ # PIN
+ self.JobStoragePinGroupBox.setEnabled(False)
+ self.JobStoragePinEdit.setEnabled(False)
+ self.JobStoragePinDefaultButton.setEnabled(False)
+ self.JobStoragePinEdit.setText(str())
+
+ # Username
+ self.JobStorageUsernameGroupBox.setEnabled(False)
+ self.JobStorageUsernameEdit.setEnabled(False)
+ self.JobStorageUsernameDefaultButton.setEnabled(False)
+
+ # Jobname/ID
+ self.JobStorageIDGroupBox.setEnabled(False)
+ self.JobStorageIDEdit.setEnabled(False)
+ self.JobStorageIDDefaultButton.setEnabled(False)
+
+ # Duplicate/existing Jobname/ID
+ self.JobStorageExistingComboBox.setEnabled(False)
+
+ else:
+ # PIN
+ if self.job_storage_mode in (JOB_STORAGE_TYPE_PERSONAL, JOB_STORAGE_TYPE_STORE):
+ self.JobStoragePinGroupBox.setEnabled(True)
+ self.JobStoragePinDefaultButton.setEnabled(self.job_storage_use_pin)
+ self.JobStoragePinEdit.setEnabled(self.job_storage_use_pin)
+ self.JobStoragePinEdit.setText(str(self.job_storage_pin))
+ else:
+ self.JobStoragePinGroupBox.setEnabled(False)
+ self.JobStoragePinEdit.setEnabled(False)
+ self.JobStoragePinDefaultButton.setEnabled(False)
+ self.JobStoragePinEdit.setText(str())
+
+ # Username
+ self.JobStorageUsernameGroupBox.setEnabled(True)
+ self.JobStorageUsernameEdit.setEnabled(not self.job_storage_auto_username)
+ self.JobStorageUsernameDefaultButton.setEnabled(not self.job_storage_auto_username)
+ self.JobStorageUsernameEdit.setText(str(self.job_storage_username))
+
+ # Jobname/ID
+ self.JobStorageIDGroupBox.setEnabled(True)
+ self.JobStorageIDEdit.setEnabled(not self.job_storage_auto_jobname)
+ self.JobStorageIDDefaultButton.setEnabled(not self.job_storage_auto_jobname)
+ self.JobStorageIDEdit.setText(str(self.job_storage_jobname))
+
+ # Duplicate/existing JobName/ID
+ self.JobStorageExistingComboBox.setEnabled(not self.job_storage_auto_jobname)
+ self.JobStorageExistingDefaultButton.setEnabled(not self.job_storage_auto_jobname and self.job_storage_job_exist != JOB_STORAGE_EXISTING_JOB_REPLACE)
+
+ finally:
+ endWaitCursor()
+
+
+ def saveJobStorageOptions(self):
+ beginWaitCursor()
+ try:
+ log.debug("Saving job storage options...")
+
+ if self.job_storage_mode == JOB_STORAGE_TYPE_OFF:
+ log.debug("Job storage mode = JOB_STORAGE_TYPE_OFF")
+ self.setPrinterOption('HOLD', 'OFF')
+ self.removePrinterOption('HOLDTYPE')
+ self.removePrinterOption('USERNAME')
+ self.removePrinterOption('JOBNAME')
+ self.removePrinterOption('DUPLICATEJOB')
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_PROOF_AND_HOLD:
+ log.debug("Job storage mode = JOB_STORAGE_TYPE_PROOF_AND_HOLD")
+ self.setPrinterOption('HOLD', 'PROOF')
+ #self.removePrinterOption('HOLDTYPE')
+ self.setPrinterOption('HOLDTYPE', 'PUBLIC')
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_PERSONAL:
+ log.debug("Job storage mode = JOB_STORAGE_TYPE_PERSONAL")
+
+ if self.job_storage_use_pin:
+ self.setPrinterOption('HOLD', 'ON')
+ else:
+ self.setPrinterOption('HOLD', 'PROOF')
+ self.setPrinterOption('HOLDTYPE', 'PUBLIC')
+
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_QUICK_COPY:
+ log.debug("Job storage mode = JOB_STORAGE_TYPE_QUICK_COPY")
+ self.setPrinterOption('HOLD', 'ON')
+ self.setPrinterOption('HOLDTYPE', 'PUBLIC')
+
+ elif self.job_storage_mode == JOB_STORAGE_TYPE_STORE:
+ log.debug("Job storage mode = JOB_STORAGE_TYPE_STORE")
+ self.setPrinterOption('HOLD', 'STORE')
+
+ if not self.job_storage_use_pin:
+ self.removePrinterOption('HOLDTYPE')
+
+ # PIN
+ log.debug("Job storage use pin = %d" % self.job_storage_use_pin)
+ if self.job_storage_use_pin:
+ self.setPrinterOption('HOLDTYPE', 'PRIVATE')
+
+ #else:
+ # self.removePrinterOption('HOLDKEY')
+
+ # Dup/exisiting
+ if self.job_storage_job_exist == JOB_STORAGE_EXISTING_JOB_REPLACE:
+ log.debug("Job storage duplicate = JOB_STORAGE_EXISTING_JOB_REPLACE")
+ self.setPrinterOption('DUPLICATEJOB', 'REPLACE')
+
+ else: # JOB_STORAGE_EXISTING_JOB_APPEND_1_99
+ log.debug("Job storage duplicate = JOB_STORAGE_EXISTING_JOB_APPEND_1_99")
+ self.setPrinterOption('DUPLICATEJOB', 'APPEND')
+
+
+ finally:
+ endWaitCursor()
+
+
+ #
+ # Mode
+ #
+
+ def JobStorageModeComboBox_activated(self, i):
+ sender = self.sender()
+ mode, ok = value_int(sender.itemData(i))
+ if ok:
+ self.job_storage_mode = mode
+ self.saveJobStorageOptions()
+ self.updateJobStorageControls()
+
+
+ def JobStorageModeDefaultButton_clicked(self):
+ self.JobStorageModeComboBox.emit(SIGNAL("activated(int)"), JOB_STORAGE_TYPE_OFF)
+
+
+ #
+ # PIN
+ #
+
+ def JobStoragePinOffRadioButton_toggled(self, b):
+ self.job_storage_use_pin = not b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStoragePinPrivateRadioButton_toggled(self, b):
+ self.job_storage_use_pin = b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStoragePinDefaultButton_clicked(self):
+ self.JobStoragePinOffRadioButton.emit(SIGNAL("toggled(bool)"), True)
+
+
+ def JobStoragePinEdit_textEdited(self, s):
+ self.job_storage_pin = to_unicode(s)
+ self.setPrinterOption('HOLDKEY', self.job_storage_pin.encode('ascii'))
+
+
+
+ #
+ # Username
+ #
+
+ def JobStorageUsernameAutoRadioButton_toggled(self, b):
+ self.job_storage_auto_username = b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStorageUsernameCustomRadioButton_toggled(self, b):
+ self.job_storage_auto_username = not b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStorageUsernameDefaultButton_clicked(self):
+ self.JobStorageUsernameAutoRadioButton.emit(SIGNAL("toggled(bool)"), True)
+
+
+ def JobStorageUsernameEdit_textEdited(self, s):
+ self.job_storage_username = to_unicode(s)
+ self.setPrinterOption('USERNAME', self.job_storage_username.encode('ascii'))
+
+ #
+ # Jobname/ID
+ #
+
+ def JobStorageIDAutoRadioButton_toggled(self, b):
+ self.job_storage_auto_jobname = b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStorageIDCustomRadioButton_toggled(self, b):
+ self.job_storage_auto_jobname = not b
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStorageIDDefaultButton_clicked(self):
+ self.JobStorageIDAutoRadioButton.emit(SIGNAL("toggled(bool)"), True)
+
+
+ def JobStorageIDEdit_textEdited(self, s):
+ self.job_storage_jobname = to_unicode(s)
+ self.setPrinterOption('JOBNAME', self.job_storage_jobname.encode('ascii'))
+
+ #
+ # Duplicate/existing Jobname/ID
+ #
+
+ def JobStorageExistingComboBox_activated(self, i):
+ sender = self.sender()
+ opt, ok = value_int(sender.itemData(i))
+ if ok:
+ self.job_storage_job_exist = opt
+ self.updateJobStorageControls()
+ self.saveJobStorageOptions()
+
+
+ def JobStorageExistingDefaultButton_clicked(self):
+ self.JobStorageExistingComboBox.emit(SIGNAL("activated(int)"), JOB_STORAGE_EXISTING_JOB_REPLACE)
+
+
+ #
+ # Printer I/O
+ #
+
+ def setPrinterOption(self, option, value):
+ log.debug("setPrinterOption(%s, %s)" % (option, value))
+ cups.openPPD(self.cur_printer)
+
+ try:
+ cups.addOption("%s=%s" % (option, value))
+ cups.setOptions()
+ finally:
+ cups.closePPD()
+
+ def removePrinterOption(self, option):
+ log.debug("removePrinterOption(%s)" % option)
+ cups.openPPD(self.cur_printer)
+
+ try:
+ cups.removeOption(option)
+ cups.setOptions()
+ finally:
+ cups.closePPD()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrintSettingsToolbox",s,c)
+
diff --git a/ui5/printtestpagedialog.py b/ui5/printtestpagedialog.py
new file mode 100644
index 000000000..1c9d52be6
--- /dev/null
+++ b/ui5/printtestpagedialog.py
@@ -0,0 +1,159 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+
+# Local
+from base.g import *
+from base import device
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+import signal
+
+# Ui
+from .printtestpagedialog_base import Ui_Dialog
+
+
+class PrintTestPageDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, printer_name):
+ QDialog.__init__(self, parent)
+
+ self.printer_name = printer_name
+ self.device_uri = ''
+ self.setupUi(self)
+ self.initUi()
+
+ QTimer.singleShot(0, self.updateUi)
+
+
+ def initUi(self):
+ #print "PrintTestPageDialog.initUi()"
+ self.HPLIPTestPageRadioButton.setChecked(True)
+ self.LoadPaper.setButtonName(self.__tr("Print Test Page"))
+
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.PrintTestpageButton.clicked.connect(self.PrintTestpageButton_clicked)
+
+ self.PrinterNameCombo.PrinterNameComboBox_currentChanged.connect(self.PrinterNameCombo_currentChanged)
+
+ self.PrinterNameCombo.PrinterNameComboBox_noPrinters.connect(self.PrinterNameComboBox_noPrinters)
+
+
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ if self.printer_name:
+ self.PrinterNameCombo.setInitialPrinter(self.printer_name)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def updateUi(self):
+ self.PrinterNameCombo.updateUi()
+ self.LoadPaper.updateUi()
+ #self.updatePrintButton()
+
+
+ def PrinterNameComboBox_noPrinters(self):
+ FailureUI(self, self.__tr("<b>No printers found.</b><p>Please setup a printer and try again."))
+ self.close()
+
+
+ def updatePrintButton(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ self.PrintTestpageButton.setEnabled(False)
+ ok = False
+ try:
+ try:
+ d = device.Device(self.device_uri, self.printer_name)
+ except Error as e:
+ log.error("Device error (%s)." % e.msg)
+ else:
+ try:
+ d.open()
+ except Error:
+ log.error("Unable to print to printer. Please check device and try again.")
+ else:
+ ok = d.isIdleAndNoError()
+
+ self.PrintTestpageButton.setEnabled(ok)
+
+ if not ok:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Unable to communicate with printer %s.</b><p>Please check the printer and try again." % self.printer_name))
+
+ d.close()
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def PrinterNameCombo_currentChanged(self, device_uri, printer_name):
+ self.printer_name = printer_name
+ self.device_uri = device_uri
+ self.updatePrintButton()
+ #self.updateUi()
+
+
+ def PrintTestpageButton_clicked(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ ok = False
+ try:
+ try:
+ d = device.Device(self.device_uri, self.printer_name)
+ except Error as e:
+ log.error("Device error (%s)." % e.msg)
+ else:
+ try:
+ d.open()
+ except Error:
+ log.error("Unable to print to printer. Please check device and try again.")
+ else:
+ ok = d.isIdleAndNoError()
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ if ok:
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ d.printTestPage(self.printer_name)
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ self.close()
+
+ else:
+ FailureUI(self, self.__tr("<b>A error occured sending the test page to printer %s.</b><p>Please check the printer and try again."% self.printer_name))
+
+ d.close()
+
+
+ def __tr(self, s, c=None):
+ return qApp.translate("PrintTestPageDialog", s, c)
+
+
diff --git a/ui5/printtestpagedialog_base.py b/ui5/printtestpagedialog_base.py
new file mode 100644
index 000000000..b8da824a8
--- /dev/null
+++ b/ui5/printtestpagedialog_base.py
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/printtestpagedialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtWidgets.QLabel(Dialog)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(Dialog)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 4)
+ self.PrinterNameCombo = PrinterNameComboBox(Dialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.PrinterNameCombo.sizePolicy().hasHeightForWidth())
+ self.PrinterNameCombo.setSizePolicy(sizePolicy)
+ self.PrinterNameCombo.setObjectName("PrinterNameCombo")
+ self.gridlayout.addWidget(self.PrinterNameCombo, 2, 0, 1, 4)
+ self.groupBox = QtWidgets.QGroupBox(Dialog)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.HPLIPTestPageRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.HPLIPTestPageRadioButton.setObjectName("HPLIPTestPageRadioButton")
+ self.gridlayout1.addWidget(self.HPLIPTestPageRadioButton, 0, 0, 1, 1)
+ self.PrinterDiagnosticRadioButto = QtWidgets.QRadioButton(self.groupBox)
+ self.PrinterDiagnosticRadioButto.setEnabled(False)
+ self.PrinterDiagnosticRadioButto.setObjectName("PrinterDiagnosticRadioButto")
+ self.gridlayout1.addWidget(self.PrinterDiagnosticRadioButto, 1, 0, 1, 1)
+ self.gridlayout.addWidget(self.groupBox, 3, 0, 1, 4)
+ self.LoadPaper = LoadPaperGroupBox(Dialog)
+ self.LoadPaper.setTitle("")
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 4, 0, 1, 4)
+ spacerItem = QtWidgets.QSpacerItem(189, 61, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.MinimumExpanding)
+ self.gridlayout.addItem(spacerItem, 5, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(400, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 6, 0, 1, 2)
+ self.PrintTestpageButton = QtWidgets.QPushButton(Dialog)
+ self.PrintTestpageButton.setObjectName("PrintTestpageButton")
+ self.gridlayout.addWidget(self.PrintTestpageButton, 6, 2, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 6, 3, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Print Test Page"))
+ self.label.setText(_translate("Dialog", "Print Test Page"))
+ self.groupBox.setTitle(_translate("Dialog", "Type"))
+ self.HPLIPTestPageRadioButton.setText(_translate("Dialog", "HPLIP test page (tests print driver)"))
+ self.PrinterDiagnosticRadioButto.setText(_translate("Dialog", "Printer diagnostic page (does not test print driver)"))
+ self.PrintTestpageButton.setText(_translate("Dialog", "Print Test Page"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .loadpapergroupbox import LoadPaperGroupBox
+from .printernamecombobox import PrinterNameComboBox
diff --git a/ui5/printtestpagedialog_base.ui b/ui5/printtestpagedialog_base.ui
new file mode 100644
index 000000000..d21cfe2f0
--- /dev/null
+++ b/ui5/printtestpagedialog_base.ui
@@ -0,0 +1,142 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Print Test Page</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Print Test Page</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="4" >
+ <widget class="PrinterNameComboBox" name="PrinterNameCombo" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="4" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Type</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QRadioButton" name="HPLIPTestPageRadioButton" >
+ <property name="text" >
+ <string>HPLIP test page (tests print driver)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QRadioButton" name="PrinterDiagnosticRadioButto" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Printer diagnostic page (does not test print driver)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0" colspan="4" >
+ <widget class="LoadPaperGroupBox" name="LoadPaper" >
+ <property name="title" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>189</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>400</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="2" >
+ <widget class="QPushButton" name="PrintTestpageButton" >
+ <property name="text" >
+ <string>Print Test Page</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>PrinterNameComboBox</class>
+ <extends>QComboBox</extends>
+ <header>printernamecombobox.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>LoadPaperGroupBox</class>
+ <extends>QGroupBox</extends>
+ <header>loadpapergroupbox.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/queuesconf.py b/ui5/queuesconf.py
new file mode 100644
index 000000000..cf2206490
--- /dev/null
+++ b/ui5/queuesconf.py
@@ -0,0 +1,258 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2011-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Amarnath Chitumalla
+#
+
+#global
+import os
+import os.path
+import sys
+import signal
+
+# Local
+from base.g import *
+from base import utils
+from prnt import cups
+from base.codes import *
+from base import validation
+from .ui_utils import *
+
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+HPLIP_INFO_SITE ="http://hplip.sourceforge.net/hplip_web.conf"
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog, printerName, device_uri,Error_msg):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 180)
+ self.printerName=printerName
+ self.device_uri=device_uri
+ self.Error_msg=Error_msg
+ self.gridlayout = QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QLabel(self.page)
+ font = QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.line = QFrame(self.page)
+ self.line.setFrameShape(QFrame.HLine)
+ self.line.setFrameShadow(QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+ spacerItem2 = QSpacerItem(200, 51, QSizePolicy.Minimum, QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem2, 5, 1, 1, 1)
+ self.StackedWidget.addWidget(self.page)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.line_2 = QFrame(Dialog)
+ self.line_2.setFrameShape(QFrame.HLine)
+ self.line_2.setFrameShadow(QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 4)
+ self.NextButton = QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ Dialog.setWindowTitle(QApplication.translate("Dialog", "HP SmartInstall/Mass storage Disabler", None))
+ else:
+ Dialog.setWindowTitle(QApplication.translate("Dialog", "HP Device Manager - Queues diagnose", None))
+ if self.Error_msg == QUEUES_PAUSED:
+ self.label.setText(QApplication.translate("Dialog", "Print/Fax Queue is Paused", None))
+ elif self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ self.label.setText(QApplication.translate("Dialog", "Smart Install Device(s) Detected", None))
+ else:
+ self.label.setText(QApplication.translate("Dialog", "Queue needs to be reconfigured", None))
+
+ if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ text= "Smart Install is enabled in "+ self.printerName + " device(s). \nDo you want to download and disable smart install to perform device functionalities?"
+ elif self.Error_msg == QUEUES_INCORRECT_PPD:
+ text= "'"+ self.printerName + "' is using incorrect PPD file. Do you want to remove and reconfigure queue?"
+ elif self.Error_msg == QUEUES_PAUSED:
+ text="'"+ self.printerName + "' is paused. Do you want to enable queue?"
+ elif self.Error_msg == QUEUES_CONFIG_ERROR:
+ text="'"+ self.printerName + "' is not configured using hp-setup utility. Click 'Remove and Setup' to remove and reconfigure queue."
+
+ if self.Error_msg != QUEUES_MSG_SENDING:
+ self.TitleLabel.setText(QApplication.translate("Dialog", text, None))
+# if self.Error_msg == QUEUES_PAUSED or self.Error_msg == QUEUES_INCORRECT_PPD or self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ if self.Error_msg == QUEUES_PAUSED or self.Error_msg == QUEUES_INCORRECT_PPD:
+ self.NextButton.setText(QApplication.translate("Dialog", "Yes", None))
+ self.CancelButton.setText(QApplication.translate("Dialog", "No", None))
+
+ elif self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ self.NextButton.setText(QApplication.translate("Dialog", "Download and Disable", None))
+ self.CancelButton.setText(QApplication.translate("Dialog", "Cancel", None))
+
+ else:
+ self.NextButton.setText(QApplication.translate("Dialog", "Remove and Setup", None))
+ self.CancelButton.setText(QApplication.translate("Dialog", "Cancel", None))
+
+
+# Ui
+
+class QueuesDiagnose(QDialog, Ui_Dialog):
+ def __init__(self, parent, printerName, device_uri, Error_msg,passwordObj=None):
+ QDialog.__init__(self, parent)
+ self.result = False
+ self.printerName = printerName
+ self.device_uri = device_uri
+ self.Error_msg = Error_msg
+ self.passwordObj = passwordObj
+ self.setupUi(self, self.printerName, self.device_uri,self.Error_msg)
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+ def init(self, printerName, device_uri, Error_msg):
+ QDialog.__init__(self,None)
+ self.printerName = printerName
+ self.device_uri = device_uri
+ self.Error_msg = Error_msg
+ self.setupUi(self, printerName, device_uri,Error_msg)
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ #
+ # Misc
+ #
+ def displayPage(self, page):
+ self.updateStepText(page)
+ self.StackedWidget.setCurrentIndex(page)
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def NextButton_clicked(self):
+ beginWaitCursor()
+ try:
+ if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
+ self.disable_smart_install()
+
+ elif self.Error_msg == QUEUES_PAUSED:
+ cups.enablePrinter(self.printerName)
+ msg ="'"+self.printerName+"' is enabled successfully"
+ SuccessUI(self, self.__tr(msg))
+
+ else:
+ status, status_str = cups.cups_operation(cups.delPrinter, GUI_MODE, 'qt4', self, self.printerName)
+
+ if status != cups.IPP_OK:
+ msg="Failed to remove ' "+self.printerName+" ' queue.\nRemove using hp-toolbox..."
+ FailureUI(self, self.__tr(msg))
+ else:
+ msg="' "+self.printerName+" ' removed successfully.\nRe-configuring this printer by hp-setup..."
+ log.debug(msg)
+ path = utils.which('hp-setup')
+ if path:
+ log.debug("Starting hp-setup")
+ utils.run('hp-setup --gui')
+
+ finally:
+ endWaitCursor()
+ self.result = True
+ self.close()
+
+ def showMessage(self,msg):
+ FailureUI(self, self.__tr(msg))
+
+ def showSuccessMessage(self,msg):
+ SuccessUI(self, self.__tr(msg))
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PluginDialog",s,c)
+
+
+ def disable_smart_install(self):
+ if not utils.check_network_connection():
+ FailureUI(self, queryString(ERROR_NO_NETWORK))
+ else:
+ sts, HPLIP_file = utils.download_from_network(HPLIP_INFO_SITE)
+ if sts == 0:
+ hplip_si_conf = ConfigBase(HPLIP_file)
+ source = hplip_si_conf.get("SMART_INSTALL","url","")
+ if not source :
+ FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, HPLIP_INFO_SITE))
+ return
+
+ response_file, smart_install_run = utils.download_from_network(source)
+ response_asc, smart_install_asc = utils.download_from_network(source+'.asc')
+
+ if response_file == 0 and response_asc == 0:
+
+ gpg_obj = validation.GPG_Verification()
+ digsig_sts, error_str = gpg_obj.validate(smart_install_run, smart_install_asc)
+
+ if ERROR_SUCCESS == digsig_sts:
+ sts, out = utils.run("sh %s"%smart_install_run)
+ else:
+
+ if QMessageBox.question(self, " ",
+ self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate this tool prior to installation.</p>Do you still want to run Smart Install disabler?" %error_str),
+ QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
+ # Disabling without verification.
+ sts, out = utils.run("sh %s"%smart_install_run)
+
+ else:
+ if response_asc:
+ FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source + ".asc"))
+ else:
+ FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source))
+
+
diff --git a/ui5/readonlyradiobutton.py b/ui5/readonlyradiobutton.py
new file mode 100644
index 000000000..52c45c992
--- /dev/null
+++ b/ui5/readonlyradiobutton.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+
+class ReadOnlyRadioButton(QRadioButton):
+ def __init__(self, parent):
+ QRadioButton.__init__(self, parent)
+ self.setFocusPolicy(Qt.NoFocus)
+ self.clearFocus()
+
+
+ def mousePressEvent(self, e):
+ if e.button() == Qt.LeftButton:
+ return
+
+ QRadioButton.mousePressEvent(e)
+
+
+ def mouseReleaseEvent(self, e):
+ if e.button() == Qt.LeftButton:
+ return
+
+ QRadioButton.mouseReleaseEvent(e)
+
+
+ def mouseMoveEvent(self, e):
+ return
+
+
+ def keyPressEvent(self, e):
+ if e.key() not in (Qt.Key_Up, Qt.Key_Left, Qt.Key_Right,
+ Qt.Key_Down, Qt.Key_Escape):
+ return
+
+ QRadioButton.keyPressEvent(e)
+
+
+ def keyReleaseEvent(self, e):
+ return
diff --git a/ui5/sendfaxdialog.py b/ui5/sendfaxdialog.py
new file mode 100644
index 000000000..d2d736741
--- /dev/null
+++ b/ui5/sendfaxdialog.py
@@ -0,0 +1,1060 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import struct
+from base.sixext.moves import queue
+from base.sixext import to_unicode
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, pml
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+
+# Ui
+from .sendfaxdialog_base import Ui_Dialog
+from .filetable import FileTable, FILETABLE_TYPE_FAX
+from .printernamecombobox import PrinterNameComboBox, PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY
+from .printsettingsdialog import PrintSettingsDialog
+from .faxsetupdialog import FaxSetupDialog
+
+
+PAGE_SELECT_FAX = 0
+PAGE_COVERPAGE = 1
+PAGE_FILES = 2
+PAGE_RECIPIENTS = 3
+PAGE_SEND_FAX = 4
+PAGE_MAX = 4
+
+STATUS_INFORMATION = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+
+MIME_TYPE_COVERPAGE = "application/hplip-fax-coverpage"
+
+fax_enabled = prop.fax_build
+
+if fax_enabled:
+ try:
+ from fax import fax
+ except ImportError:
+ # This can fail on Python < 2.3 due to the datetime module
+ # or if fax was diabled during the build
+ fax_enabled = False
+
+if not fax_enabled:
+ log.warn("Fax disabled.")
+
+coverpages_enabled = False
+if fax_enabled:
+ try:
+ import reportlab
+ ver = str(reportlab.Version)
+
+ if ver >= "2.0":
+ coverpages_enabled = True
+ else:
+ log.warn("Pre-2.0 version of Reportlab installed. Fax coverpages disabled.")
+
+ except ImportError:
+ log.warn("Reportlab not installed. Fax coverpages disabled.")
+
+if not coverpages_enabled:
+ log.warn("Please install version 2.0+ of Reportlab for coverpage support.")
+
+if fax_enabled:
+ from .fabwindow import FABWindow
+
+if coverpages_enabled:
+ from fax import coverpages
+
+
+class SendFaxDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, printer_name, device_uri=None, args=None):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.printer_name = printer_name
+ if device_uri is not None:
+ self.device_uri = device_uri
+ else:
+ self.device_uri = device.getDeviceURIByPrinterName(self.printer_name)
+
+ self.args = args
+ self.dev = None
+
+ self.dbus_avail, self.service, session_bus = device.init_dbus()
+
+ self.CheckTimer = None
+ self.lock_file = None
+ self.file_list = []
+ self.recipient_list = []
+
+ self.initUi()
+
+ if self.printer_name:
+ if coverpages_enabled:
+ QTimer.singleShot(0, self.displayCoverpagePage)
+ else:
+ self.lockAndLoad()
+ QTimer.singleShot(0, self.displayFilesPage)
+ else:
+ QTimer.singleShot(0, self.displaySelectFaxPage)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.BackButton.clicked.connect(self.BackButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ self.initSelectFaxPage()
+ self.initCoverpagePage()
+ self.initFilesPage()
+ self.initRecipientsPage()
+ self.initSendFaxPage()
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def lockAndLoad(self):
+ # Start up check timer here, since the fax name is now known
+ if self.CheckTimer is None:
+ self.CheckTimer = QTimer(self)
+ self.CheckTimer.timeout.connect(self.CheckTimer_timeout)
+ self.CheckTimer.start(3000)
+
+ # Lock the app
+ if self.printer_name and self.lock_file is None:
+ ok, self.lock_file = utils.lock_app('hp-sendfax-%s' % self.printer_name, True)
+
+ if not ok:
+ log.error("hp-sendfax is already running for fax %s" % self.printer_name)
+ # TODO:
+
+ #
+ # Select Fax Page
+ #
+
+ def initSelectFaxPage(self):
+ self.FaxComboBox.setType(PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY)
+ self.FaxComboBox.PrinterNameComboBox_currentChanged.connect(self.FaxComboBox_currentChanged)
+ self.FaxComboBox.PrinterNameComboBox_noPrinters.connect(self.FaxComboBox_noPrinters)
+ self.FaxOptionsButton.clicked.connect(self.FaxOptionsButton_clicked)
+ self.FaxSetupButton.clicked.connect(self.FaxSetupButton_clicked)
+
+ if self.printer_name is not None:
+ self.FaxComboBox.setInitialPrinter(self.printer_name)
+
+
+ def displaySelectFaxPage(self):
+ self.BackButton.setEnabled(False)
+ self.updateStepText(PAGE_SELECT_FAX)
+
+ if not fax_enabled:
+ FailureUI(self, self.__tr("<b>PC send fax support is not enabled.</b><p>Re-install HPLIP with fax support or use the device front panel to send a fax.</p><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+ return
+
+ if not self.dbus_avail:
+ FailureUI(self, self.__tr("<b>PC send fax support requires DBus and hp-systray.</b><p>Please check the HPLIP installation for proper installation of DBus and hp-systray support.</p><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+ return
+
+ self.FaxComboBox.updateUi()
+ self.displayPage(PAGE_SELECT_FAX)
+
+
+ def FaxComboBox_currentChanged(self, device_uri, printer_name):
+ self.printer_name = printer_name
+ self.device_uri = device_uri
+
+
+ def FaxComboBox_noPrinters(self):
+ FailureUI(self, self
+ .__tr("<b>No installed fax devices found.</b><p>Please setup a fax device and try again (try using 'hp-setup').</p><p>Click <i>OK</i> to exit.</p>"))
+ self.close()
+
+
+ def FaxOptionsButton_clicked(self):
+ dlg = PrintSettingsDialog(self, self.printer_name, fax_mode=True)
+ dlg.exec_()
+
+
+ def FaxSetupButton_clicked(self):
+ dlg = FaxSetupDialog(self, self.device_uri)
+ dlg.exec_()
+
+ #
+ # Coverpage Page
+ #
+
+ def initCoverpagePage(self):
+ self.cover_page_message = ''
+ self.cover_page_re = ''
+ self.preserve_formatting = False
+ self.cover_page_func, cover_page_png = None, None
+ self.last_job_id = 0
+ self.busy = False
+ self.PrevCoverPageButton.setIcon(QIcon(load_pixmap("prev", "16x16")))
+ self.NextCoverPageButton.setIcon(QIcon(load_pixmap("next", "16x16")))
+
+ if coverpages_enabled:
+ self.cover_page_list = list(coverpages.COVERPAGES.keys())
+ self.cover_page_index = self.cover_page_list.index("basic")
+ self.cover_page_max = len(self.cover_page_list)-1
+ self.cover_page_name = self.cover_page_list[self.cover_page_index]
+
+ self.PrevCoverPageButton.clicked.connect(self.PrevCoverPageButton_clicked)
+ self.NextCoverPageButton.clicked.connect(self.NextCoverPageButton_clicked)
+ self.CoverPageGroupBox.toggled[bool].connect(self.CoverPageGroupBox_toggled)
+ self.MessageEdit.textChanged.connect(self.MessageEdit_textChanged)
+ self.RegardingEdit.textChanged["const QString &"].connect(self.RegardingEdit_textChanged)
+ self.PreserveFormattingCheckBox.toggled[bool].connect(self.PreserveFormattingCheckBox_toggled)
+ else:
+ self.CoverPageGroupBox.setEnabled(False)
+
+
+ def displayCoverpagePage(self):
+ self.BackButton.setEnabled(False) # No going back once printer is chosen
+ self.NextButton.setEnabled(True)
+
+ self.lockAndLoad()
+
+ self.updateCoverpageButtons()
+ self.displayCoverpagePreview()
+ self.displayPage(PAGE_COVERPAGE)
+
+
+ def MessageEdit_textChanged(self):
+ self.cover_page_message = to_unicode(self.MessageEdit.toPlainText())
+
+
+ def RegardingEdit_textChanged(self, t):
+ self.cover_page_re = to_unicode(t)
+
+
+ def PreserveFormattingCheckBox_toggled(self, b):
+ self.preserve_formatting = b
+
+
+ def PrevCoverPageButton_clicked(self):
+ self.cover_page_index -= 1
+ if self.cover_page_index < 0:
+ self.cover_page_index = 0
+ else:
+ self.updateCoverpageButtons()
+ self.displayCoverpagePage()
+
+
+ def NextCoverPageButton_clicked(self):
+ self.cover_page_index += 1
+ if self.cover_page_index > self.cover_page_max:
+ self.cover_page_index = self.cover_page_max
+ else:
+ self.updateCoverpageButtons()
+ self.displayCoverpagePage()
+
+
+ def displayCoverpagePreview(self):
+ if coverpages_enabled:
+ self.cover_page_name = self.cover_page_list[self.cover_page_index]
+ self.cover_page_func = coverpages.COVERPAGES[self.cover_page_name][0]
+ self.CoverPageName.setText(str('<i>"%s"</i>'%self.cover_page_name))
+ self.CoverPagePreview.setPixmap(load_pixmap(coverpages.COVERPAGES[self.cover_page_name][1], 'other'))
+
+ if self.CoverPageGroupBox.isChecked():
+ self.addCoverPage()
+ else:
+ self.removeCoverPage()
+
+
+ def updateCoverpageButtons(self):
+ enabled = self.CoverPageGroupBox.isChecked()
+ self.PrevCoverPageButton.setEnabled(enabled and self.cover_page_index != 0)
+ self.NextCoverPageButton.setEnabled(enabled and self.cover_page_index != self.cover_page_max)
+
+
+ def CoverPageGroupBox_toggled(self, b):
+ self.updateCoverpageButtons()
+ if b:
+ self.addCoverPage()
+ else:
+ self.removeCoverPage()
+
+
+ def addCoverPage(self):
+ self.removeCoverPage()
+ self.FilesTable.addFile(self.cover_page_name, MIME_TYPE_COVERPAGE,
+ self.__tr('HP Fax Coverpage: "%s"'%self.cover_page_name),
+ self.__tr("Cover Page"), 1)
+
+
+ def removeCoverPage(self):
+ self.FilesTable.removeFileByMIMEType(MIME_TYPE_COVERPAGE)
+
+
+ def toggleCoverPage(self, b):
+ # XXX: qt5port: disconnect method requires attention
+ self.CoverPageGroupBox.toggled[bool].connect(self.CoverPageGroupBox_toggled)
+ self.CoverPageGroupBox.setChecked(b)
+ self.CoverPageGroupBox.toggled[bool].connect(self.CoverPageGroupBox_toggled)
+
+
+ #
+ # Files Page
+ #
+
+ def initFilesPage(self):
+ self.FilesTable.setType(FILETABLE_TYPE_FAX)
+ self.FilesTable.setFaxCallback(self.FileTable_callback)
+ self.FilesTable.isEmpty.connect(self.FilesTable_isEmpty)
+ self.FilesTable.isNotEmpt.connect(self.FilesTable_isNotEmpty)
+ self.FilesTable.fileListChanged.connect(self.FilesTable_fileListChanged)
+
+
+ def displayFilesPage(self):
+ self.FilesTable.updateUi(False)
+
+ if self.args is not None:
+ for a in self.args:
+ f = os.path.abspath(os.path.expanduser(a))
+ if os.path.exists(f) and os.access(f, os.R_OK):
+ self.renderFile(f)
+
+ self.args = None
+
+ self.restoreNextButton()
+ self.NextButton.setEnabled(self.FilesTable.isNotEmpty())
+ self.BackButton.setEnabled(coverpages_enabled)
+ self.FilesPageNote.setText(self.__tr("Note: You may also add files to the fax by printing from any application to the '%s' fax printer."%self.printer_name))
+ self.displayPage(PAGE_FILES)
+
+
+ def FilesTable_isEmpty(self):
+ if self.StackedWidget.currentIndex() == PAGE_FILES:
+ self.NextButton.setEnabled(False)
+
+
+ def FilesTable_isNotEmpty(self):
+ if self.StackedWidget.currentIndex() == PAGE_FILES:
+ self.NextButton.setEnabled(True)
+
+
+ def FilesTable_fileListChanged(self):
+ self.file_list = self.FilesTable.file_list
+ self.toggleCoverPage(self.FilesTable.isMIMETypeInList(MIME_TYPE_COVERPAGE))
+
+
+ #
+ # Recipients Page
+ #
+
+ def initRecipientsPage(self):
+ # setup validators
+ self.QuickAddFaxEdit.setValidator(PhoneNumValidator(self.QuickAddFaxEdit))
+
+ # Fax address book database
+ self.db = fax.FaxAddressBook()
+
+ # Fax address book window
+ self.fab = FABWindow(self)
+ self.fab.setWindowFlags(Qt.Tool) # Keeps the Fab window on top
+
+ self.fab.databaseChanged.connect(self.FABWindow_databaseChanged)
+
+ # connect signals
+ # self.connect(self.QuickAddFaxEdit, SIGNAL("textChanged(const QString &)"),
+ # self.QuickAddFaxEdit_textChanged)
+ self.QuickAddFaxEdit.textChanged["const QString &"].connect(self.QuickAddFaxEdit_textChanged)
+ # self.connect(self.QuickAddNameEdit, SIGNAL("textChanged(const QString &)"),
+ # self.QuickAddNameEdit_textChanged)
+ self.QuickAddNameEdit.textChanged["const QString &"].connect(self.QuickAddNameEdit_textChanged)
+ self.QuickAddButton.clicked.connect(self.QuickAddButton_clicked)
+ self.FABButton.clicked.connect(self.FABButton_clicked)
+ self.AddIndividualButton.clicked.connect(self.AddIndividualButton_clicked)
+ self.AddGroupButton.clicked.connect(self.AddGroupButton_clicked)
+ self.RemoveRecipientButton.clicked.connect(self.RemoveRecipientButton_clicked)
+ self.MoveRecipientUpButton.clicked.connect(self.MoveRecipientUpButton_clicked)
+ self.MoveRecipientDownButton.clicked.connect(self.MoveRecipientDownButton_clicked)
+ # self.connect(self.RecipientsTable, SIGNAL("itemSelectionChanged()"),
+ # self.RecipientsTable_itemSelectionChanged)
+ self.RecipientsTable.itemSelectionChanged.connect(self.RecipientsTable_itemSelectionChanged)
+
+ #self.connect(self.RecipientsTable, SIGNAL("itemDoubleClicked(QTableWidgetItem *)"),
+ # self.RecipientsTable_itemDoubleClicked)
+ self.RecipientsTable.itemDoubleClicked["QTableWidgetItem *"].connect(self.RecipientsTable_itemDoubleClicked)
+
+ # setup icons
+ self.FABButton.setIcon(QIcon(load_pixmap("fab", "16x16")))
+ self.AddIndividualButton.setIcon(QIcon(load_pixmap("add_user", "16x16")))
+ self.AddGroupButton.setIcon(QIcon(load_pixmap("add_users", "16x16")))
+ self.RemoveRecipientButton.setIcon(QIcon(load_pixmap("remove_user", "16x16")))
+ self.MoveRecipientUpButton.setIcon(QIcon(load_pixmap("up_user", "16x16")))
+ self.MoveRecipientDownButton.setIcon(QIcon(load_pixmap("down_user", "16x16")))
+ self.QuickAddButton.setIcon(QIcon(load_pixmap("add_user_quick", "16x16")))
+
+ # setup initial state
+ self.QuickAddButton.setEnabled(False)
+
+ self.recipient_headers = [self.__tr("Name"), self.__tr("Fax number"), self.__tr("Notes")]
+
+
+ def FABWindow_databaseChanged(self, action, s1='', s2=''):
+ self.db.load()
+
+ if action in (FAB_NAME_ADD, FAB_GROUP_ADD, FAB_GROUP_RENAME,
+ FAB_GROUP_REMOVE, FAB_GROUP_MEMBERSHIP_CHANGED):
+
+ log.debug("Fax address book has changed")
+ self.updateAddressBook()
+
+ elif action == FAB_NAME_REMOVE:
+ log.debug("Fax address book has changed: '%s' removed" % s1)
+ all_names = self.db.get_all_names()
+ self.recipient_list = [x for x in all_names if x in self.recipient_list]
+ self.updateAddressBook()
+ self.updateRecipientTable()
+
+ elif action == FAB_NAME_RENAME:
+ log.debug("Fax address book has changed: '%s' renamed to '%s'" % (s1, s2))
+ for i, n in enumerate(self.recipient_list):
+ if n == s1:
+ self.recipient_list[i] = s2
+ self.updateRecipientTable()
+ break
+ else:
+ self.updateAddressBook()
+
+ elif action == FAB_NAME_DETAILS_CHANGED:
+ log.debug("Fax address book has changed: '%s' details changed" % s1)
+ self.updateRecipientTable()
+
+
+ def displayRecipientsPage(self):
+ self.updateAddressBook()
+ self.updateRecipientTable()
+ self.enableQuickAddButton()
+ self.displayPage(PAGE_RECIPIENTS)
+ self.restoreNextButton()
+ self.BackButton.setEnabled(True)
+
+
+ def updateAddressBook(self):
+ names = [n for n in self.db.get_all_names() if not n.startswith('__')]
+ groups = self.db.get_all_groups()
+ self.AddIndividualComboBox.clear()
+ self.AddGroupComboBox.clear()
+
+ i = 0
+ names.sort()
+ for n in names:
+ if n not in self.recipient_list:
+ data = self.db.get(n)
+ if data['fax']:
+ self.AddIndividualComboBox.addItem(n)
+ i += 1
+
+ if i:
+ self.AddIndividualButton.setEnabled(True)
+ self.AddIndividualComboBox.setEnabled(True)
+ #self.AddIndividualButton.setIcon(QIcon(load_pixmap("add_user", "16x16")))
+
+ else:
+ self.AddIndividualButton.setEnabled(False)
+ self.AddIndividualComboBox.setEnabled(False)
+ #self.AddIndividualButton.setIcon(QIcon(load_pixmap("add_user-disabled", "16x16")))
+
+ i = 0
+ groups.sort()
+ for g in groups:
+ for n in self.db.group_members(g):
+ if not n.startswith('__') and n not in self.recipient_list:
+ self.AddGroupComboBox.addItem(g)
+ i += 1
+ break
+
+ if i:
+ self.AddGroupButton.setEnabled(True)
+ self.AddGroupComboBox.setEnabled(True)
+ #self.AddGroupButton.setIcon(QIcon(load_pixmap("add_users", "16x16")))
+
+ else:
+ self.AddGroupButton.setEnabled(False)
+ self.AddGroupComboBox.setEnabled(False)
+ #self.AddGroupButton.setIcon(QIcon(load_pixmap("add_users-disabled", "16x16")))
+
+
+ def updateRecipientTable(self):
+ try:
+ prev = self.getCurrentRecipient()
+ except (TypeError, AttributeError):
+ prev = None
+
+ self.RecipientsTable.clear()
+ self.RecipientsTable.setRowCount(0)
+ self.RecipientsTable.setColumnCount(0)
+
+ if self.recipient_list:
+ num_recipients = len(self.recipient_list)
+
+ self.RecipientsTable.setColumnCount(len(self.recipient_headers))
+ self.RecipientsTable.setHorizontalHeaderLabels(self.recipient_headers)
+ self.RecipientsTable.setRowCount(num_recipients)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ j = None
+ for row, n in enumerate(self.recipient_list):
+ i = QTableWidgetItem(str(n))
+ i.setFlags(flags)
+ self.RecipientsTable.setItem(row, 0, i)
+ if prev is not None and n == prev:
+ j = i
+
+ k = self.db.get(n)
+ if not k:
+ continue
+
+ i = QTableWidgetItem(str(k['fax']))
+ i.setFlags(flags)
+ self.RecipientsTable.setItem(row, 1, i)
+
+ i = QTableWidgetItem(str(k['notes']))
+ i.setFlags(flags)
+ self.RecipientsTable.setItem(row, 2, i)
+
+ self.RecipientsTable.resizeColumnsToContents()
+ self.RecipientsTable.resizeRowsToContents()
+
+ if j is not None:
+ self.RecipientsTable.setCurrentItem(j)
+ else:
+ self.RecipientsTable.setCurrentItem(self.RecipientsTable.item(0, 0))
+
+ self.NextButton.setEnabled(True)
+
+ else:
+ self.enableRecipientListButtons()
+ self.NextButton.setEnabled(False)
+
+
+ def RecipientsTable_itemSelectionChanged(self):
+ current_row = self.RecipientsTable.currentRow()
+ num_recipients = len(self.recipient_list)
+ self.enableRecipientListButtons(num_recipients > 0, # remove
+ num_recipients > 1 and current_row > 0, # up
+ num_recipients > 1 and current_row < (num_recipients-1)) # down
+
+
+ def enableRecipientListButtons(self, enable_remove=False, enable_up_move=False, enable_down_move=False):
+ if enable_remove:
+ self.RemoveRecipientButton.setEnabled(True)
+ else:
+ self.RemoveRecipientButton.setEnabled(False)
+
+ if enable_up_move:
+ self.MoveRecipientUpButton.setEnabled(True)
+ else:
+ self.MoveRecipientUpButton.setEnabled(False)
+
+ if enable_down_move:
+ self.MoveRecipientDownButton.setEnabled(True)
+ else:
+ self.MoveRecipientDownButton.setEnabled(False)
+
+
+ def QuickAddFaxEdit_textChanged(self, fax):
+ self.enableQuickAddButton(None, to_unicode(fax))
+
+
+ def QuickAddNameEdit_textChanged(self, name):
+ self.enableQuickAddButton(to_unicode(name))
+
+
+ def enableQuickAddButton(self, name=None, fax=None):
+ if name is None:
+ name = to_unicode(self.QuickAddNameEdit.text())
+ if fax is None:
+ fax = to_unicode(self.QuickAddFaxEdit.text())
+
+ existing_name = False
+ if name:
+ existing_name = name in self.db.get_all_names()
+
+ if existing_name:
+ try:
+ self.QuickAddNameEdit.setStyleSheet("background-color: yellow")
+ except AttributeError:
+ pass
+ else:
+ try:
+ self.QuickAddNameEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+
+ if name and not existing_name and fax:
+ self.QuickAddButton.setEnabled(True)
+ else:
+ self.QuickAddButton.setEnabled(False)
+
+
+ def QuickAddButton_clicked(self):
+ name = to_unicode(self.QuickAddNameEdit.text())
+ fax = to_unicode(self.QuickAddFaxEdit.text())
+ self.fab.addName(name, fax)
+ self.addRecipient(name)
+ self.updateRecipientTable()
+ self.QuickAddNameEdit.clear()
+ self.QuickAddFaxEdit.clear()
+ self.enableQuickAddButton('', '')
+
+
+ def AddIndividualButton_clicked(self):
+ self.addRecipient(to_unicode(self.AddIndividualComboBox.currentText()))
+
+
+ def AddGroupButton_clicked(self):
+ self.addGroup(to_unicode(self.AddGroupComboBox.currentText()))
+
+
+ def RemoveRecipientButton_clicked(self):
+ name = self.getCurrentRecipient()
+ temp = self.recipient_list[:]
+ for i, n in enumerate(temp):
+ if name == n:
+ del self.recipient_list[i]
+ self.updateRecipientTable()
+ self.updateAddressBook()
+ break
+
+
+ def MoveRecipientUpButton_clicked(self):
+ utils.list_move_up(self.recipient_list, self.getCurrentRecipient())
+ self.updateRecipientTable()
+
+
+ def MoveRecipientDownButton_clicked(self):
+ utils.list_move_down(self.recipient_list, self.getCurrentRecipient())
+ self.updateRecipientTable()
+
+
+ def getCurrentRecipient(self):
+ item = self.RecipientsTable.item(self.RecipientsTable.currentRow(), 0)
+ if item is not None:
+ return to_unicode(item.text())
+ else:
+ return to_unicode('')
+
+
+ def addRecipient(self, name, update=True):
+ if name not in self.recipient_list and not name.startswith('__'):
+ self.recipient_list.append(name)
+ if update:
+ self.updateRecipientTable()
+ self.updateAddressBook()
+
+
+ def addGroup(self, group):
+ for n in self.db.group_members(group):
+ self.addRecipient(n, False)
+
+ self.updateRecipientTable()
+ self.updateAddressBook()
+
+
+ def FABButton_clicked(self):
+ self.fab.show()
+
+
+ def RecipientsTable_itemDoubleClicked(self, item):
+ if item is not None:
+ row, col = item.row(), item.column()
+ if col != 0:
+ item = self.RecipientsTable.item(row, 0)
+
+ self.fab.selectByName(to_unicode(item.text()))
+ self.fab.show()
+
+
+ #
+ # Send Fax Page
+ #
+
+ def initSendFaxPage(self):
+ self.info_icon = QIcon(load_pixmap("info", "16x16"))
+ self.warn_icon = QIcon(load_pixmap("warning", "16x16"))
+ self.error_icon = QIcon(load_pixmap("error", "16x16"))
+ self.busy_icon = QIcon(load_pixmap("busy", "16x16"))
+ self.update_queue = queue.Queue() # UI updates from send thread
+ self.event_queue = queue.Queue() # UI events (cancel) to send thread
+ self.send_fax_active = False
+
+
+ def displaySendFaxPage(self):
+ self.displayPage(PAGE_SEND_FAX)
+ self.addStatusMessage(self.__tr("Ready to send fax."), self.info_icon)
+ self.NextButton.setText(self.__tr("Send Fax"))
+
+
+
+ #
+ # Fax
+ #
+
+ def executeSendFax(self):
+ self.NextButton.setEnabled(False)
+ self.BackButton.setEnabled(False)
+ self.CheckTimer.stop()
+ self.busy = True
+ phone_num_list = []
+
+ ppd_file = cups.getPPD(self.printer_name)
+
+ if ppd_file is not None and os.path.exists(ppd_file):
+ if open(ppd_file, 'rb').read().find(b'HP Fax') == -1:
+ FailureUI(self, self.__tr("<b>Fax configuration error.</b><p>The CUPS fax queue for '%s' is incorrectly configured.<p>Please make sure that the CUPS fax queue is configured with the 'HPLIP Fax' Model/Driver."%self.printer_name))
+ self.close()
+ return
+
+ beginWaitCursor()
+
+ mq = device.queryModelByURI(self.device_uri)
+
+ self.dev = fax.getFaxDevice(self.device_uri,
+ self.printer_name, None,
+ mq['fax-type'])
+
+ try:
+ try:
+ self.dev.open()
+ except Error as e:
+ log.warn(e.msg)
+
+ try:
+ self.dev.queryDevice(quick=True)
+ except Error as e:
+ log.error("Query device error (%s)." % e.msg)
+ self.dev.error_state = ERROR_STATE_ERROR
+
+ finally:
+ self.dev.close()
+ endWaitCursor()
+
+ if self.dev.error_state > ERROR_STATE_MAX_OK and \
+ self.dev.error_state not in (ERROR_STATE_LOW_SUPPLIES, ERROR_STATE_LOW_PAPER):
+
+ FailureUI(self, self.__tr("<b>Device is busy or in an error state (code=%s)</b><p>Please wait for the device to become idle or clear the error and try again."%self.dev.status_code))
+ self.NextButton.setEnabled(True)
+ return
+
+ # Check to make sure queue in CUPS is idle
+ self.cups_printers = cups.getPrinters()
+ for p in self.cups_printers:
+ if p.name == self.printer_name:
+ if p.state == cups.IPP_PRINTER_STATE_STOPPED:
+ FailureUI(self, self.__tr("<b>The CUPS queue for '%s' is in a stopped or busy state.</b><p>Please check the queue and try again."%self.printer_name))
+ self.NextButton.setEnabled(False)
+ return
+ break
+
+ log.debug("Recipient list:")
+
+ for p in self.recipient_list:
+ entry = self.db.get(p)
+ phone_num_list.append(entry)
+ log.debug("Name=%s Number=%s" % (entry["name"], entry["fax"]))
+
+ log.debug("File list:")
+
+ for f in self.file_list:
+ log.debug(f)
+
+ self.dev.sendEvent(EVENT_START_FAX_JOB, self.printer_name, 0, '')
+
+ if not self.dev.sendFaxes(phone_num_list, self.file_list, self.cover_page_message,
+ self.cover_page_re, self.cover_page_func, self.preserve_formatting,
+ self.printer_name, self.update_queue, self.event_queue):
+
+ FailureUI(self, self.__tr("<b>Send fax is active.</b><p>Please wait for operation to complete."))
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+ self.busy = False
+ self.send_fax_active = False
+ #self.NextButton.setEnabled(False)
+ self.setCancelCloseButton()
+ return
+
+ self.send_fax_active = True
+ self.setCancelCloseButton()
+ self.SendFaxTimer = QTimer(self)
+ self.SendFaxTimer.timeout.connect(self.SendFaxTimer_timeout)
+ self.SendFaxTimer.start(1000) # 1 sec UI updates
+
+
+ def setCancelCloseButton(self):
+ if self.send_fax_active:
+ self.CancelButton.setText(self.__tr("Cancel Send"))
+ else:
+ self.CancelButton.setText(self.__tr("Close"))
+
+
+ def CancelButton_clicked(self):
+ if self.send_fax_active:
+ self.addStatusMessage(self.__tr("Cancelling job..."), self.warn_icon)
+ self.event_queue.put((fax.EVENT_FAX_SEND_CANCELED, '', '', ''))
+ self.dev.sendEvent(EVENT_FAX_JOB_CANCELED, self.printer_name, 0, '')
+ else:
+ self.close()
+
+
+ def SendFaxTimer_timeout(self):
+ while self.update_queue.qsize():
+ try:
+ status, page_num, arg = self.update_queue.get(0)
+ except queue.Empty:
+ break
+
+ if status == fax.STATUS_IDLE:
+ self.busy = False
+ self.send_fax_active = False
+ self.setCancelCloseButton()
+ self.SendFaxTimer.stop()
+
+ elif status == fax.STATUS_PROCESSING_FILES:
+ self.addStatusMessage(self.__tr("Processing page %s..."%page_num), self.busy_icon)
+
+ elif status == fax.STATUS_SENDING_TO_RECIPIENT:
+ self.addStatusMessage(self.__tr("Sending fax to %s..."%arg), self.busy_icon)
+
+ elif status == fax.STATUS_DIALING:
+ self.addStatusMessage(self.__tr("Dialing %s..."%arg), self.busy_icon)
+
+ elif status == fax.STATUS_CONNECTING:
+ self.addStatusMessage(self.__tr("Connecting to %s..."%arg), self.busy_icon)
+
+ elif status == fax.STATUS_SENDING:
+ self.addStatusMessage(self.__tr("Sending page %s to %s..."%(page_num,arg)),
+ self.busy_icon)
+
+ elif status == fax.STATUS_CLEANUP:
+ self.addStatusMessage(self.__tr("Cleaning up..."), self.busy_icon)
+
+ elif status in (fax.STATUS_ERROR, fax.STATUS_BUSY, fax.STATUS_COMPLETED, fax.STATUS_ERROR_IN_CONNECTING,
+ fax.STATUS_ERROR_IN_TRANSMITTING, fax.STATUS_ERROR_PROBLEM_IN_FAXLINE, fax.STATUS_JOB_CANCEL ):
+ self.busy = False
+ self.send_fax_active = False
+ self.setCancelCloseButton()
+ self.SendFaxTimer.stop()
+
+ if status == fax.STATUS_ERROR:
+ result_code, error_state = self.dev.getPML(pml.OID_FAX_DOWNLOAD_ERROR)
+ #FailureUI(self, self.__tr("<b>Fax send error (%s).</b><p>" % pml.DN_ERROR_STR.get(error_state, "Unknown error")))
+ if error_state == pml.DN_ERROR_NONE:
+ self.addStatusMessage(self.__tr("Fax send error (Possible cause: No answer or dialtone)"), self.error_icon)
+ else:
+ self.addStatusMessage(self.__tr("Fax send error (%s)"%pml.DN_ERROR_STR.get(error_state, "Unknown error")), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_ERROR_IN_CONNECTING:
+ self.addStatusMessage(self.__tr("Fax send error (Error in connecting)"), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_ERROR_IN_TRANSMITTING:
+ self.addStatusMessage(self.__tr("Fax send error (Error in transmitting)"), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_ERROR_PROBLEM_IN_FAXLINE:
+ self.addStatusMessage(self.__tr("Fax send error (Problem with the fax line)"), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_JOB_CANCEL:
+ self.addStatusMessage(self.__tr("(Fax Job Cancelled)"), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_BUSY:
+ #FailureUI(self, self.__tr("<b>Fax device is busy.</b><p>Please try again later."))
+ self.addStatusMessage(self.__tr("Fax is busy."), self.error_icon)
+ self.dev.sendEvent(EVENT_FAX_JOB_FAIL, self.printer_name, 0, '')
+
+ elif status == fax.STATUS_COMPLETED:
+ self.addStatusMessage(self.__tr("Send fax job complete."), self.info_icon)
+
+ self.dev.sendEvent(EVENT_END_FAX_JOB, self.printer_name, 0, '')
+
+
+ def addStatusMessage(self, text, icon):
+ log.debug(text)
+ #self.StatusList.addItem(QListWidgetItem(icon, text, self.StatusList))
+ QListWidgetItem(icon, text, self.StatusList)
+
+ #
+ # CheckTimer and Fax Rendering
+ #
+
+ def FileTable_callback(self, f):
+ # Called by FileTable when user adds a file using "Add file..."
+ log.debug("FileTable_callback(%s)" % f)
+ self.renderFile(f)
+
+
+ def renderFile(self, f):
+ self.busy = True
+ beginWaitCursor()
+ try:
+ self.last_job_id = cups.printFile(self.printer_name, f, os.path.basename(f))
+ finally:
+ self.busy = False
+ endWaitCursor()
+
+
+ def CheckTimer_timeout(self):
+ if not self.busy:
+ #log.debug("Checking for incoming faxes...")
+ try:
+ device_uri, printer_name, event_code, username, job_id, title, timedate, fax_file = \
+ self.service.CheckForWaitingFax(self.device_uri, prop.username, self.last_job_id)
+ except Exception as e:
+ log.debug("Exception caught in CheckTimer_timeout: %s" % e)
+ fax_file = None
+
+ if fax_file:
+ self.last_job_id = 0
+ log.debug("A new fax has arrived: %s (%d)" % (fax_file, job_id))
+ self.addFileFromJob(fax_file, title)
+
+
+ def addFileFromJob(self, fax_file, title):
+ self.busy = True
+ #beginWaitCursor()
+ try:
+ ok, num_pages, hort_dpi, vert_dpi, page_size, resolution, encoding = \
+ self.getFileInfo(fax_file)
+ if ok:
+ self.FilesTable.addFile(fax_file, 'application/hplip-fax', 'HPLIP Fax', title, num_pages)
+
+ finally:
+ self.busy = False
+ endWaitCursor()
+
+
+ def getFileInfo(self, fax_file):
+ f = open(fax_file, 'rb')
+ header = f.read(fax.FILE_HEADER_SIZE)
+ f.close()
+
+ if len(header) != fax.FILE_HEADER_SIZE:
+ log.error("Invalid fax file! (truncated header or no data)")
+ return (False, 0, 0, 0, 0, 0, 0)
+
+ mg, version, num_pages, hort_dpi, vert_dpi, page_size, \
+ resolution, encoding, reserved1, reserved2 = \
+ struct.unpack(">8sBIHHBBBII", header[:fax.FILE_HEADER_SIZE])
+
+ log.debug("Magic=%s Ver=%d Pages=%d hDPI=%d vDPI=%d Size=%d Res=%d Enc=%d" %
+ (mg, version, num_pages, hort_dpi, vert_dpi, page_size, resolution, encoding))
+
+ return (True, num_pages, hort_dpi, vert_dpi, page_size, resolution, encoding)
+
+
+ #
+ # Misc
+ #
+
+ def closeEvent(self, e):
+ if self.lock_file is not None:
+ utils.unlock(self.lock_file)
+ e.accept()
+
+
+ def displayPage(self, page):
+ self.updateStepText(page)
+ self.StackedWidget.setCurrentIndex(page)
+
+
+# def CancelButton_clicked(self):
+# self.close()
+
+
+ def BackButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_SELECT_FAX:
+ log.error("Invalid!")
+
+ elif p == PAGE_COVERPAGE:
+ log.error("Invalid!")
+
+ elif p == PAGE_FILES:
+ self.StackedWidget.setCurrentIndex(PAGE_COVERPAGE)
+ self.displayCoverpagePage()
+
+ elif p == PAGE_RECIPIENTS:
+ self.StackedWidget.setCurrentIndex(PAGE_FILES)
+ self.displayFilesPage()
+
+ elif p == PAGE_SEND_FAX:
+ self.StackedWidget.setCurrentIndex(PAGE_RECIPIENTS)
+ self.displayRecipientsPage()
+
+
+ def NextButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_SELECT_FAX:
+ self.StackedWidget.setCurrentIndex(PAGE_COVERPAGE)
+ self.displayCoverpagePage()
+
+ elif p == PAGE_COVERPAGE:
+ self.StackedWidget.setCurrentIndex(PAGE_FILES)
+ self.displayFilesPage()
+
+ elif p == PAGE_FILES:
+ self.StackedWidget.setCurrentIndex(PAGE_RECIPIENTS)
+ self.displayRecipientsPage()
+
+ elif p == PAGE_RECIPIENTS:
+ self.StackedWidget.setCurrentIndex(PAGE_SEND_FAX)
+ self.displaySendFaxPage()
+
+ elif p == PAGE_SEND_FAX:
+ self.executeSendFax()
+
+
+ def updateStepText(self, p):
+ self.StepText.setText(self.__tr("Step %s of %s"%(p+1,PAGE_MAX+1)))
+
+
+ def restoreNextButton(self):
+ self.NextButton.setText(self.__tr("Next >"))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SendFaxDialog",s.encode('utf-8'),c)
+
+
diff --git a/ui5/sendfaxdialog_base.py b/ui5/sendfaxdialog_base.py
new file mode 100644
index 000000000..01f31c468
--- /dev/null
+++ b/ui5/sendfaxdialog_base.py
@@ -0,0 +1,392 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/sendfaxdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(600, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.SelectFax = QtWidgets.QWidget()
+ self.SelectFax.setObjectName("SelectFax")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.SelectFax)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_8 = QtWidgets.QLabel(self.SelectFax)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_8.setFont(font)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout1.addWidget(self.label_8, 0, 0, 1, 1)
+ self.line_4 = QtWidgets.QFrame(self.SelectFax)
+ self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout1.addWidget(self.line_4, 1, 0, 1, 1)
+ self.gridlayout2 = QtWidgets.QGridLayout()
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.FaxComboBox = PrinterNameComboBox(self.SelectFax)
+ self.FaxComboBox.setObjectName("FaxComboBox")
+ self.gridlayout2.addWidget(self.FaxComboBox, 0, 0, 1, 3)
+ spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 1, 0, 1, 1)
+ self.FaxOptionsButton = QtWidgets.QPushButton(self.SelectFax)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.FaxOptionsButton.sizePolicy().hasHeightForWidth())
+ self.FaxOptionsButton.setSizePolicy(sizePolicy)
+ self.FaxOptionsButton.setObjectName("FaxOptionsButton")
+ self.gridlayout2.addWidget(self.FaxOptionsButton, 1, 1, 1, 1)
+ self.FaxSetupButton = QtWidgets.QPushButton(self.SelectFax)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.FaxSetupButton.sizePolicy().hasHeightForWidth())
+ self.FaxSetupButton.setSizePolicy(sizePolicy)
+ self.FaxSetupButton.setObjectName("FaxSetupButton")
+ self.gridlayout2.addWidget(self.FaxSetupButton, 1, 2, 1, 1)
+ self.gridlayout1.addLayout(self.gridlayout2, 2, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(564, 221, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 3, 0, 1, 1)
+ self.label_12 = QtWidgets.QLabel(self.SelectFax)
+ self.label_12.setWordWrap(True)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout1.addWidget(self.label_12, 4, 0, 1, 1)
+ self.StackedWidget.addWidget(self.SelectFax)
+ self.CoverPage = QtWidgets.QWidget()
+ self.CoverPage.setObjectName("CoverPage")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.CoverPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.label_3 = QtWidgets.QLabel(self.CoverPage)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_3.setFont(font)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout3.addWidget(self.label_3, 0, 0, 1, 1)
+ self.line_2 = QtWidgets.QFrame(self.CoverPage)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout3.addWidget(self.line_2, 1, 0, 1, 1)
+ self.CoverPageGroupBox = QtWidgets.QGroupBox(self.CoverPage)
+ self.CoverPageGroupBox.setEnabled(True)
+ self.CoverPageGroupBox.setCheckable(True)
+ self.CoverPageGroupBox.setChecked(False)
+ self.CoverPageGroupBox.setObjectName("CoverPageGroupBox")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.CoverPageGroupBox)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.gridlayout5 = QtWidgets.QGridLayout()
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.CoverPageName = QtWidgets.QLabel(self.CoverPageGroupBox)
+ self.CoverPageName.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.CoverPageName.setText("")
+ self.CoverPageName.setAlignment(QtCore.Qt.AlignCenter)
+ self.CoverPageName.setObjectName("CoverPageName")
+ self.gridlayout5.addWidget(self.CoverPageName, 0, 0, 1, 4)
+ self.CoverPagePreview = QtWidgets.QLabel(self.CoverPageGroupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.CoverPagePreview.sizePolicy().hasHeightForWidth())
+ self.CoverPagePreview.setSizePolicy(sizePolicy)
+ self.CoverPagePreview.setMinimumSize(QtCore.QSize(134, 192))
+ self.CoverPagePreview.setMaximumSize(QtCore.QSize(134, 192))
+ self.CoverPagePreview.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.CoverPagePreview.setText("")
+ self.CoverPagePreview.setScaledContents(True)
+ self.CoverPagePreview.setAlignment(QtCore.Qt.AlignCenter)
+ self.CoverPagePreview.setObjectName("CoverPagePreview")
+ self.gridlayout5.addWidget(self.CoverPagePreview, 1, 0, 1, 4)
+ spacerItem2 = QtWidgets.QSpacerItem(16, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem2, 2, 0, 1, 1)
+ self.PrevCoverPageButton = QtWidgets.QPushButton(self.CoverPageGroupBox)
+ self.PrevCoverPageButton.setText("")
+ self.PrevCoverPageButton.setObjectName("PrevCoverPageButton")
+ self.gridlayout5.addWidget(self.PrevCoverPageButton, 2, 1, 1, 1)
+ self.NextCoverPageButton = QtWidgets.QPushButton(self.CoverPageGroupBox)
+ self.NextCoverPageButton.setText("")
+ self.NextCoverPageButton.setObjectName("NextCoverPageButton")
+ self.gridlayout5.addWidget(self.NextCoverPageButton, 2, 2, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(31, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem3, 2, 3, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(20, 21, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem4, 3, 1, 1, 1)
+ self.gridlayout4.addLayout(self.gridlayout5, 0, 0, 2, 1)
+ self.vboxlayout = QtWidgets.QVBoxLayout()
+ self.vboxlayout.setObjectName("vboxlayout")
+ self.label_16 = QtWidgets.QLabel(self.CoverPageGroupBox)
+ self.label_16.setObjectName("label_16")
+ self.vboxlayout.addWidget(self.label_16)
+ self.RegardingEdit = QtWidgets.QLineEdit(self.CoverPageGroupBox)
+ self.RegardingEdit.setObjectName("RegardingEdit")
+ self.vboxlayout.addWidget(self.RegardingEdit)
+ self.gridlayout4.addLayout(self.vboxlayout, 0, 1, 1, 1)
+ self.gridlayout6 = QtWidgets.QGridLayout()
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_17 = QtWidgets.QLabel(self.CoverPageGroupBox)
+ self.label_17.setObjectName("label_17")
+ self.gridlayout6.addWidget(self.label_17, 0, 0, 1, 1)
+ self.MessageEdit = QtWidgets.QTextEdit(self.CoverPageGroupBox)
+ self.MessageEdit.setObjectName("MessageEdit")
+ self.gridlayout6.addWidget(self.MessageEdit, 1, 0, 1, 1)
+ self.PreserveFormattingCheckBox = QtWidgets.QCheckBox(self.CoverPageGroupBox)
+ self.PreserveFormattingCheckBox.setObjectName("PreserveFormattingCheckBox")
+ self.gridlayout6.addWidget(self.PreserveFormattingCheckBox, 2, 0, 1, 1)
+ self.gridlayout4.addLayout(self.gridlayout6, 1, 1, 1, 1)
+ self.gridlayout3.addWidget(self.CoverPageGroupBox, 2, 0, 1, 1)
+ self.label_13 = QtWidgets.QLabel(self.CoverPage)
+ self.label_13.setWordWrap(True)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout3.addWidget(self.label_13, 3, 0, 1, 1)
+ self.StackedWidget.addWidget(self.CoverPage)
+ self.SelectFiles = QtWidgets.QWidget()
+ self.SelectFiles.setObjectName("SelectFiles")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.SelectFiles)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_2 = QtWidgets.QLabel(self.SelectFiles)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_2.setFont(font)
+ self.label_2.setWordWrap(True)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout7.addWidget(self.label_2, 0, 0, 1, 1)
+ self.line = QtWidgets.QFrame(self.SelectFiles)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout7.addWidget(self.line, 1, 0, 1, 1)
+ self.FilesTable = FileTable(self.SelectFiles)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.FilesTable.sizePolicy().hasHeightForWidth())
+ self.FilesTable.setSizePolicy(sizePolicy)
+ self.FilesTable.setObjectName("FilesTable")
+ self.gridlayout7.addWidget(self.FilesTable, 2, 0, 1, 1)
+ self.FilesPageNote = QtWidgets.QLabel(self.SelectFiles)
+ self.FilesPageNote.setWordWrap(True)
+ self.FilesPageNote.setObjectName("FilesPageNote")
+ self.gridlayout7.addWidget(self.FilesPageNote, 3, 0, 1, 1)
+ self.StackedWidget.addWidget(self.SelectFiles)
+ self.SelectRecipients = QtWidgets.QWidget()
+ self.SelectRecipients.setObjectName("SelectRecipients")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.SelectRecipients)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_4 = QtWidgets.QLabel(self.SelectRecipients)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_4.setFont(font)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout8.addWidget(self.label_4, 0, 0, 1, 1)
+ self.line_3 = QtWidgets.QFrame(self.SelectRecipients)
+ self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout8.addWidget(self.line_3, 1, 0, 1, 1)
+ self.groupBox_4 = QtWidgets.QGroupBox(self.SelectRecipients)
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.groupBox_4)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.RecipientsTable = QtWidgets.QTableWidget(self.groupBox_4)
+ self.RecipientsTable.setObjectName("RecipientsTable")
+ self.RecipientsTable.setColumnCount(0)
+ self.RecipientsTable.setRowCount(0)
+ self.gridlayout9.addWidget(self.RecipientsTable, 0, 0, 1, 5)
+ self.RemoveRecipientButton = QtWidgets.QPushButton(self.groupBox_4)
+ self.RemoveRecipientButton.setEnabled(False)
+ self.RemoveRecipientButton.setObjectName("RemoveRecipientButton")
+ self.gridlayout9.addWidget(self.RemoveRecipientButton, 1, 0, 1, 1)
+ self.MoveRecipientUpButton = QtWidgets.QPushButton(self.groupBox_4)
+ self.MoveRecipientUpButton.setEnabled(False)
+ self.MoveRecipientUpButton.setObjectName("MoveRecipientUpButton")
+ self.gridlayout9.addWidget(self.MoveRecipientUpButton, 1, 1, 1, 1)
+ self.MoveRecipientDownButton = QtWidgets.QPushButton(self.groupBox_4)
+ self.MoveRecipientDownButton.setEnabled(False)
+ self.MoveRecipientDownButton.setObjectName("MoveRecipientDownButton")
+ self.gridlayout9.addWidget(self.MoveRecipientDownButton, 1, 2, 1, 1)
+ spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem5, 1, 3, 1, 1)
+ self.FABButton = QtWidgets.QPushButton(self.groupBox_4)
+ self.FABButton.setObjectName("FABButton")
+ self.gridlayout9.addWidget(self.FABButton, 1, 4, 1, 1)
+ self.gridlayout8.addWidget(self.groupBox_4, 2, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.SelectRecipients)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label = QtWidgets.QLabel(self.groupBox)
+ self.label.setObjectName("label")
+ self.hboxlayout.addWidget(self.label)
+ spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem6)
+ self.AddIndividualComboBox = QtWidgets.QComboBox(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AddIndividualComboBox.sizePolicy().hasHeightForWidth())
+ self.AddIndividualComboBox.setSizePolicy(sizePolicy)
+ self.AddIndividualComboBox.setObjectName("AddIndividualComboBox")
+ self.hboxlayout.addWidget(self.AddIndividualComboBox)
+ self.AddIndividualButton = QtWidgets.QPushButton(self.groupBox)
+ self.AddIndividualButton.setEnabled(False)
+ self.AddIndividualButton.setObjectName("AddIndividualButton")
+ self.hboxlayout.addWidget(self.AddIndividualButton)
+ self.gridlayout10.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.label_5 = QtWidgets.QLabel(self.groupBox)
+ self.label_5.setObjectName("label_5")
+ self.hboxlayout1.addWidget(self.label_5)
+ spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.hboxlayout1.addItem(spacerItem7)
+ self.AddGroupComboBox = QtWidgets.QComboBox(self.groupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AddGroupComboBox.sizePolicy().hasHeightForWidth())
+ self.AddGroupComboBox.setSizePolicy(sizePolicy)
+ self.AddGroupComboBox.setObjectName("AddGroupComboBox")
+ self.hboxlayout1.addWidget(self.AddGroupComboBox)
+ self.AddGroupButton = QtWidgets.QPushButton(self.groupBox)
+ self.AddGroupButton.setEnabled(False)
+ self.AddGroupButton.setObjectName("AddGroupButton")
+ self.hboxlayout1.addWidget(self.AddGroupButton)
+ self.gridlayout10.addLayout(self.hboxlayout1, 1, 0, 1, 1)
+ self.gridlayout8.addWidget(self.groupBox, 3, 0, 1, 1)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.SelectRecipients)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout11 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout11.setObjectName("gridlayout11")
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.label_6 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout2.addWidget(self.label_6)
+ self.QuickAddNameEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.QuickAddNameEdit.setObjectName("QuickAddNameEdit")
+ self.hboxlayout2.addWidget(self.QuickAddNameEdit)
+ self.label_7 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_7.setObjectName("label_7")
+ self.hboxlayout2.addWidget(self.label_7)
+ self.QuickAddFaxEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.QuickAddFaxEdit.setObjectName("QuickAddFaxEdit")
+ self.hboxlayout2.addWidget(self.QuickAddFaxEdit)
+ self.QuickAddButton = QtWidgets.QPushButton(self.groupBox_3)
+ self.QuickAddButton.setEnabled(False)
+ self.QuickAddButton.setObjectName("QuickAddButton")
+ self.hboxlayout2.addWidget(self.QuickAddButton)
+ self.gridlayout11.addLayout(self.hboxlayout2, 0, 0, 1, 1)
+ self.gridlayout8.addWidget(self.groupBox_3, 4, 0, 1, 1)
+ self.StackedWidget.addWidget(self.SelectRecipients)
+ self.SendFax = QtWidgets.QWidget()
+ self.SendFax.setObjectName("SendFax")
+ self.gridlayout12 = QtWidgets.QGridLayout(self.SendFax)
+ self.gridlayout12.setObjectName("gridlayout12")
+ self.label_9 = QtWidgets.QLabel(self.SendFax)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_9.setFont(font)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout12.addWidget(self.label_9, 0, 0, 1, 1)
+ self.line_5 = QtWidgets.QFrame(self.SendFax)
+ self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_5.setObjectName("line_5")
+ self.gridlayout12.addWidget(self.line_5, 1, 0, 1, 1)
+ self.label_10 = QtWidgets.QLabel(self.SendFax)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout12.addWidget(self.label_10, 2, 0, 1, 1)
+ self.StatusList = QtWidgets.QListWidget(self.SendFax)
+ self.StatusList.setObjectName("StatusList")
+ self.gridlayout12.addWidget(self.StatusList, 3, 0, 1, 1)
+ self.label_15 = QtWidgets.QLabel(self.SendFax)
+ self.label_15.setObjectName("label_15")
+ self.gridlayout12.addWidget(self.label_15, 4, 0, 1, 1)
+ self.StackedWidget.addWidget(self.SendFax)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.line_6 = QtWidgets.QFrame(Dialog)
+ self.line_6.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_6.setObjectName("line_6")
+ self.gridlayout.addWidget(self.line_6, 1, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem8 = QtWidgets.QSpacerItem(231, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem8, 2, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(1)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Send Fax"))
+ self.label_8.setText(_translate("Dialog", "Select Fax"))
+ self.FaxOptionsButton.setText(_translate("Dialog", "Fax Settings..."))
+ self.FaxSetupButton.setText(_translate("Dialog", "Fax Device Setup..."))
+ self.label_12.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Select the desired fax printer queue and click <span style=\" font-style:italic;\">Next</span> to continue. Note: Once you continue to the next step, you will not be able to change to a different fax queue.</p></body></html>"))
+ self.label_3.setText(_translate("Dialog", "Select and Edit Fax Coverpage (Optional)"))
+ self.CoverPageGroupBox.setTitle(_translate("Dialog", "Include Coverpage"))
+ self.label_16.setText(_translate("Dialog", "Regarding:"))
+ self.label_17.setText(_translate("Dialog", "Optional Message: (max. 2000 characters or 32 preformatted lines)"))
+ self.PreserveFormattingCheckBox.setText(_translate("Dialog", "Preformatted (preserve formatting)"))
+ self.label_13.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Sans Serif\'; font-size:9pt;\">Check<span style=\" font-style:italic;\"> Include Coverpage </span>to add a coverpage to this fax. To continue without a coverpage, click <span style=\" font-style:italic;\">Next &gt;</span>.</p></body></html>"))
+ self.label_2.setText(_translate("Dialog", "Select Files to Send"))
+ self.FilesPageNote.setText(_translate("Dialog", "Note: You may also add files to the fax by printing from any application to the \'%1\' fax printer."))
+ self.label_4.setText(_translate("Dialog", "Select Fax Recipients"))
+ self.groupBox_4.setTitle(_translate("Dialog", "Recipients"))
+ self.RemoveRecipientButton.setText(_translate("Dialog", "Remove"))
+ self.MoveRecipientUpButton.setText(_translate("Dialog", "Move Up"))
+ self.MoveRecipientDownButton.setText(_translate("Dialog", "Move Down"))
+ self.FABButton.setText(_translate("Dialog", "Fax Address Book..."))
+ self.groupBox.setTitle(_translate("Dialog", "Add Recipients or Groups from the Fax Address Book"))
+ self.label.setText(_translate("Dialog", "Add an individual:"))
+ self.AddIndividualButton.setText(_translate("Dialog", "Add"))
+ self.label_5.setText(_translate("Dialog", "Add a group:"))
+ self.AddGroupButton.setText(_translate("Dialog", "Add"))
+ self.groupBox_3.setTitle(_translate("Dialog", "Quick Add an Individual Recipient (recipient will automatically be added to fax address book)"))
+ self.label_6.setText(_translate("Dialog", "Name:"))
+ self.label_7.setText(_translate("Dialog", "Fax Number:"))
+ self.QuickAddButton.setText(_translate("Dialog", "Add"))
+ self.label_9.setText(_translate("Dialog", "Send Fax"))
+ self.label_10.setText(_translate("Dialog", "Status:"))
+ self.label_15.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Click <span style=\" font-style:italic;\">Send Fax</span> to start the fax transmission.</p></body></html>"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .filetable import FileTable
+from .printernamecombobox import PrinterNameComboBox
diff --git a/ui5/sendfaxdialog_base.ui b/ui5/sendfaxdialog_base.ui
new file mode 100644
index 000000000..e873050d9
--- /dev/null
+++ b/ui5/sendfaxdialog_base.ui
@@ -0,0 +1,711 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Send Fax</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="currentIndex" >
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="SelectFax" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Fax</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_4" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="3" >
+ <widget class="PrinterNameComboBox" name="FaxComboBox" />
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="FaxOptionsButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Fax Settings...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="FaxSetupButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Fax Device Setup...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>564</width>
+ <height>221</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_12" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Select the desired fax printer queue and click &lt;span style=" font-style:italic;">Next&lt;/span> to continue. Note: Once you continue to the next step, you will not be able to change to a different fax queue.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="CoverPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select and Edit Fax Coverpage (Optional)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QGroupBox" name="CoverPageGroupBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="title" >
+ <string>Include Coverpage</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" >
+ <item rowspan="2" row="0" column="0" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="4" >
+ <widget class="QLabel" name="CoverPageName" >
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="4" >
+ <widget class="QLabel" name="CoverPagePreview" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>134</width>
+ <height>192</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>134</width>
+ <height>192</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QPushButton" name="PrevCoverPageButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="NextCoverPageButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>31</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_16" >
+ <property name="text" >
+ <string>Regarding:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="RegardingEdit" />
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_17" >
+ <property name="text" >
+ <string>Optional Message: (max. 2000 characters or 32 preformatted lines)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QTextEdit" name="MessageEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="PreserveFormattingCheckBox" >
+ <property name="text" >
+ <string>Preformatted (preserve formatting)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_13" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">Check&lt;span style=" font-style:italic;"> Include Coverpage &lt;/span>to add a coverpage to this fax. To continue without a coverpage, click &lt;span style=" font-style:italic;">Next &amp;gt;&lt;/span>.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="SelectFiles" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Files to Send</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="FileTable" native="1" name="FilesTable" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="FilesPageNote" >
+ <property name="text" >
+ <string>Note: You may also add files to the fax by printing from any application to the '%1' fax printer.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="SelectRecipients" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Fax Recipients</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QGroupBox" name="groupBox_4" >
+ <property name="title" >
+ <string>Recipients</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QTableWidget" name="RecipientsTable" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QPushButton" name="RemoveRecipientButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="MoveRecipientUpButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Move Up</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="MoveRecipientDownButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Move Down</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="4" >
+ <widget class="QPushButton" name="FABButton" >
+ <property name="text" >
+ <string>Fax Address Book...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Add Recipients or Groups from the Fax Address Book</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Add an individual:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QComboBox" name="AddIndividualComboBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="AddIndividualButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Add a group:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QComboBox" name="AddGroupComboBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="AddGroupButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string>Quick Add an Individual Recipient (recipient will automatically be added to fax address book)</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="QuickAddNameEdit" />
+ </item>
+ <item>
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>Fax Number:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="QuickAddFaxEdit" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="QuickAddButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Add</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="SendFax" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_9" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Send Fax</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_5" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_10" >
+ <property name="text" >
+ <string>Status:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QListWidget" name="StatusList" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_15" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Click &lt;span style=" font-style:italic;">Send Fax&lt;/span> to start the fax transmission.&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="5" >
+ <widget class="Line" name="line_6" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>231</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>FileTable</class>
+ <extends>QWidget</extends>
+ <header>filetable.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>PrinterNameComboBox</class>
+ <extends>QComboBox</extends>
+ <header>printernamecombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/settingsdialog.py b/ui5/settingsdialog.py
new file mode 100644
index 000000000..dedb1cfe4
--- /dev/null
+++ b/ui5/settingsdialog.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Local
+from base.g import *
+from base.codes import *
+from base.sixext import to_unicode
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from .settingsdialog_base import Ui_SettingsDialog_base
+
+
+
+class SettingsDialog(QDialog, Ui_SettingsDialog_base):
+ def __init__(self, parent=None):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.SetDefaultsButton.clicked.connect(self.SetDefaultsButton_clicked)
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+
+ cur_vers = sys_conf.get('hplip', 'version')
+ last_ver = user_conf.get('upgrade','latest_available_version')
+ if utils.Is_HPLIP_older_version(cur_vers, last_ver):
+ upgrade_msg ="Currently HPLIP-%s version is installed.\nLatest HPLIP-%s version is available for installation"%(cur_vers, last_ver)
+ else:
+ upgrade_msg ="HPLIP-%s version is installed"%(cur_vers)
+
+ self.SystemTraySettings.initUi(self.user_settings.systray_visible,
+ self.user_settings.polling,
+ self.user_settings.polling_interval,
+ self.user_settings.device_list,
+ self.user_settings.systray_messages,
+ self.user_settings.upgrade_notify,
+ self.user_settings.upgrade_pending_update_time,
+ upgrade_msg)
+
+ self.updateControls()
+
+
+ def updateControls(self):
+ self.AutoRefreshCheckBox.setChecked(self.user_settings.auto_refresh)
+ self.AutoRefreshRateSpinBox.setValue(self.user_settings.auto_refresh_rate) # min
+ if self.user_settings.auto_refresh_type == 1:
+ self.RefreshCurrentRadioButton.setChecked(True)
+ else:
+ self.RefreshAllRadioButton.setChecked(True)
+
+ self.ScanCommandLineEdit.setText(self.user_settings.cmd_scan)
+ self.SystemTraySettings.systray_visible = self.user_settings.systray_visible
+ self.SystemTraySettings.systray_messages = self.user_settings.systray_messages
+ self.SystemTraySettings.upgrade_notify = self.user_settings.upgrade_notify
+ self.SystemTraySettings.updateUi()
+
+
+ def updateData(self):
+ self.user_settings.systray_visible = self.SystemTraySettings.systray_visible
+ self.user_settings.systray_messages = self.SystemTraySettings.systray_messages
+ self.user_settings.cmd_scan = to_unicode(self.ScanCommandLineEdit.text())
+ self.user_settings.auto_refresh = bool(self.AutoRefreshCheckBox.isChecked())
+ self.user_settings.upgrade_notify = self.SystemTraySettings.upgrade_notify
+
+ if self.RefreshCurrentRadioButton.isChecked():
+ self.user_settings.auto_refresh_type = 1
+ else:
+ self.user_settings.auto_refresh_type = 2
+
+ self.user_settings.auto_refresh_rate = self.AutoRefreshRateSpinBox.value()
+
+
+ def SetDefaultsButton_clicked(self):
+ self.user_settings.loadDefaults()
+ self.updateControls()
+
+
+ def accept(self):
+ self.updateData()
+ self.user_settings.save()
+ QDialog.accept(self)
+
+ # TODO: Need a way to signal hp-systray if systray_visible has changed
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SettingsDialog",s,c)
+
+
diff --git a/ui5/settingsdialog_base.py b/ui5/settingsdialog_base.py
new file mode 100644
index 000000000..2e4aa4458
--- /dev/null
+++ b/ui5/settingsdialog_base.py
@@ -0,0 +1,253 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/settingsdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_SettingsDialog_base(object):
+ def setupUi(self, SettingsDialog_base):
+ SettingsDialog_base.setObjectName("SettingsDialog_base")
+ SettingsDialog_base.resize(500, 540)
+ self.gridlayout = QtWidgets.QGridLayout(SettingsDialog_base)
+ self.gridlayout.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout.setSpacing(6)
+ self.gridlayout.setObjectName("gridlayout")
+ self.TabWidget = QtWidgets.QTabWidget(SettingsDialog_base)
+ self.TabWidget.setObjectName("TabWidget")
+ self.AutoRefresh = QtWidgets.QWidget()
+ self.AutoRefresh.setObjectName("AutoRefresh")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.AutoRefresh)
+ self.gridlayout1.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout1.setSpacing(6)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.textLabel3_2_2 = QtWidgets.QLabel(self.AutoRefresh)
+ self.textLabel3_2_2.setWordWrap(False)
+ self.textLabel3_2_2.setObjectName("textLabel3_2_2")
+ self.gridlayout1.addWidget(self.textLabel3_2_2, 0, 0, 1, 1)
+ self.line1_2_2 = QtWidgets.QFrame(self.AutoRefresh)
+ self.line1_2_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line1_2_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line1_2_2.setObjectName("line1_2_2")
+ self.gridlayout1.addWidget(self.line1_2_2, 1, 0, 1, 1)
+ self.AutoRefreshCheckBox = QtWidgets.QCheckBox(self.AutoRefresh)
+ self.AutoRefreshCheckBox.setObjectName("AutoRefreshCheckBox")
+ self.gridlayout1.addWidget(self.AutoRefreshCheckBox, 2, 0, 1, 1)
+ self.RefreshRateGroupBox = QtWidgets.QGroupBox(self.AutoRefresh)
+ self.RefreshRateGroupBox.setEnabled(True)
+ self.RefreshRateGroupBox.setObjectName("RefreshRateGroupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.RefreshRateGroupBox)
+ self.gridlayout2.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout2.setSpacing(6)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.textLabel1_4 = QtWidgets.QLabel(self.RefreshRateGroupBox)
+ self.textLabel1_4.setWordWrap(False)
+ self.textLabel1_4.setObjectName("textLabel1_4")
+ self.gridlayout2.addWidget(self.textLabel1_4, 0, 0, 1, 1)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setContentsMargins(11, 11, 11, 11)
+ self.hboxlayout.setSpacing(6)
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.AutoRefreshRateSpinBox = QtWidgets.QSpinBox(self.RefreshRateGroupBox)
+ self.AutoRefreshRateSpinBox.setEnabled(False)
+ self.AutoRefreshRateSpinBox.setWrapping(True)
+ self.AutoRefreshRateSpinBox.setButtonSymbols(QtWidgets.QAbstractSpinBox.PlusMinus)
+ self.AutoRefreshRateSpinBox.setMinimum(10)
+ self.AutoRefreshRateSpinBox.setMaximum(300)
+ self.AutoRefreshRateSpinBox.setProperty("value", 30)
+ self.AutoRefreshRateSpinBox.setObjectName("AutoRefreshRateSpinBox")
+ self.hboxlayout.addWidget(self.AutoRefreshRateSpinBox)
+ self.gridlayout2.addLayout(self.hboxlayout, 0, 1, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 0, 2, 1, 1)
+ self.gridlayout1.addWidget(self.RefreshRateGroupBox, 3, 0, 1, 1)
+ self.RefreshTypeGroupBox = QtWidgets.QGroupBox(self.AutoRefresh)
+ self.RefreshTypeGroupBox.setObjectName("RefreshTypeGroupBox")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.RefreshTypeGroupBox)
+ self.gridlayout3.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout3.setSpacing(6)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.RefreshCurrentRadioButton = QtWidgets.QRadioButton(self.RefreshTypeGroupBox)
+ self.RefreshCurrentRadioButton.setEnabled(False)
+ self.RefreshCurrentRadioButton.setChecked(True)
+ self.RefreshCurrentRadioButton.setObjectName("RefreshCurrentRadioButton")
+ self.gridlayout3.addWidget(self.RefreshCurrentRadioButton, 0, 0, 1, 1)
+ self.RefreshAllRadioButton = QtWidgets.QRadioButton(self.RefreshTypeGroupBox)
+ self.RefreshAllRadioButton.setEnabled(False)
+ self.RefreshAllRadioButton.setObjectName("RefreshAllRadioButton")
+ self.gridlayout3.addWidget(self.RefreshAllRadioButton, 1, 0, 1, 1)
+ self.gridlayout1.addWidget(self.RefreshTypeGroupBox, 4, 0, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(446, 41, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 5, 0, 1, 1)
+ self.TabWidget.addTab(self.AutoRefresh, "")
+ self.SystemTray = QtWidgets.QWidget()
+ self.SystemTray.setObjectName("SystemTray")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.SystemTray)
+ self.gridlayout4.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout4.setSpacing(6)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.textLabel3_2_3 = QtWidgets.QLabel(self.SystemTray)
+ self.textLabel3_2_3.setWordWrap(False)
+ self.textLabel3_2_3.setObjectName("textLabel3_2_3")
+ self.gridlayout4.addWidget(self.textLabel3_2_3, 0, 0, 1, 1)
+ self.line1_2_3 = QtWidgets.QFrame(self.SystemTray)
+ self.line1_2_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line1_2_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line1_2_3.setObjectName("line1_2_3")
+ self.gridlayout4.addWidget(self.line1_2_3, 1, 0, 1, 1)
+ self.SystemTraySettings = SystrayFrame(self.SystemTray)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SystemTraySettings.sizePolicy().hasHeightForWidth())
+ self.SystemTraySettings.setSizePolicy(sizePolicy)
+ self.SystemTraySettings.setFrameShadow(QtWidgets.QFrame.Raised)
+ self.SystemTraySettings.setObjectName("SystemTraySettings")
+ self.gridlayout4.addWidget(self.SystemTraySettings, 2, 0, 1, 1)
+ self.TabWidget.addTab(self.SystemTray, "")
+ self.Commands = QtWidgets.QWidget()
+ self.Commands.setObjectName("Commands")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.Commands)
+ self.gridlayout5.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout5.setSpacing(6)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.textLabel3_2_2_2 = QtWidgets.QLabel(self.Commands)
+ self.textLabel3_2_2_2.setWordWrap(False)
+ self.textLabel3_2_2_2.setObjectName("textLabel3_2_2_2")
+ self.gridlayout5.addWidget(self.textLabel3_2_2_2, 0, 0, 1, 2)
+ self.line1_2_2_3 = QtWidgets.QFrame(self.Commands)
+ self.line1_2_2_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line1_2_2_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line1_2_2_3.setObjectName("line1_2_2_3")
+ self.gridlayout5.addWidget(self.line1_2_2_3, 1, 0, 1, 2)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.Commands)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout6.setContentsMargins(11, 11, 11, 11)
+ self.gridlayout6.setSpacing(6)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.textLabel1_2 = QtWidgets.QLabel(self.groupBox_3)
+ self.textLabel1_2.setEnabled(False)
+ self.textLabel1_2.setWordWrap(False)
+ self.textLabel1_2.setObjectName("textLabel1_2")
+ self.gridlayout6.addWidget(self.textLabel1_2, 0, 0, 1, 1)
+ self.PrintCommandLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.PrintCommandLineEdit.setEnabled(False)
+ self.PrintCommandLineEdit.setObjectName("PrintCommandLineEdit")
+ self.gridlayout6.addWidget(self.PrintCommandLineEdit, 1, 0, 1, 1)
+ self.textLabel2_2 = QtWidgets.QLabel(self.groupBox_3)
+ self.textLabel2_2.setWordWrap(False)
+ self.textLabel2_2.setObjectName("textLabel2_2")
+ self.gridlayout6.addWidget(self.textLabel2_2, 2, 0, 1, 1)
+ self.ScanCommandLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.ScanCommandLineEdit.setObjectName("ScanCommandLineEdit")
+ self.gridlayout6.addWidget(self.ScanCommandLineEdit, 3, 0, 1, 1)
+ self.textLabel3_3 = QtWidgets.QLabel(self.groupBox_3)
+ self.textLabel3_3.setEnabled(False)
+ self.textLabel3_3.setWordWrap(False)
+ self.textLabel3_3.setObjectName("textLabel3_3")
+ self.gridlayout6.addWidget(self.textLabel3_3, 4, 0, 1, 1)
+ self.SendFaxCommandLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.SendFaxCommandLineEdit.setEnabled(False)
+ self.SendFaxCommandLineEdit.setObjectName("SendFaxCommandLineEdit")
+ self.gridlayout6.addWidget(self.SendFaxCommandLineEdit, 5, 0, 1, 1)
+ self.textLabel4 = QtWidgets.QLabel(self.groupBox_3)
+ self.textLabel4.setEnabled(False)
+ self.textLabel4.setWordWrap(False)
+ self.textLabel4.setObjectName("textLabel4")
+ self.gridlayout6.addWidget(self.textLabel4, 6, 0, 1, 1)
+ self.AccessPCardCommandLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.AccessPCardCommandLineEdit.setEnabled(False)
+ self.AccessPCardCommandLineEdit.setObjectName("AccessPCardCommandLineEdit")
+ self.gridlayout6.addWidget(self.AccessPCardCommandLineEdit, 7, 0, 1, 1)
+ self.textLabel5 = QtWidgets.QLabel(self.groupBox_3)
+ self.textLabel5.setEnabled(False)
+ self.textLabel5.setWordWrap(False)
+ self.textLabel5.setObjectName("textLabel5")
+ self.gridlayout6.addWidget(self.textLabel5, 8, 0, 1, 1)
+ self.MakeCopiesCommandLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.MakeCopiesCommandLineEdit.setEnabled(False)
+ self.MakeCopiesCommandLineEdit.setObjectName("MakeCopiesCommandLineEdit")
+ self.gridlayout6.addWidget(self.MakeCopiesCommandLineEdit, 9, 0, 1, 1)
+ self.gridlayout5.addWidget(self.groupBox_3, 2, 0, 1, 2)
+ spacerItem2 = QtWidgets.QSpacerItem(20, 60, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem2, 3, 1, 1, 1)
+ self.SetDefaultsButton = QtWidgets.QPushButton(self.Commands)
+ self.SetDefaultsButton.setEnabled(True)
+ self.SetDefaultsButton.setObjectName("SetDefaultsButton")
+ self.gridlayout5.addWidget(self.SetDefaultsButton, 4, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem3, 4, 1, 1, 1)
+ self.TabWidget.addTab(self.Commands, "")
+ self.gridlayout.addWidget(self.TabWidget, 0, 0, 1, 2)
+ spacerItem4 = QtWidgets.QSpacerItem(301, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem4, 1, 0, 1, 1)
+ self.StdButtons = QtWidgets.QDialogButtonBox(SettingsDialog_base)
+ self.StdButtons.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.NoButton|QtWidgets.QDialogButtonBox.Ok)
+ self.StdButtons.setCenterButtons(False)
+ self.StdButtons.setObjectName("StdButtons")
+ self.gridlayout.addWidget(self.StdButtons, 1, 1, 1, 1)
+ self.textLabel1_4.setBuddy(self.AutoRefreshRateSpinBox)
+ self.textLabel1_2.setBuddy(self.PrintCommandLineEdit)
+ self.textLabel2_2.setBuddy(self.ScanCommandLineEdit)
+ self.textLabel3_3.setBuddy(self.SendFaxCommandLineEdit)
+ self.textLabel4.setBuddy(self.AccessPCardCommandLineEdit)
+ self.textLabel5.setBuddy(self.MakeCopiesCommandLineEdit)
+
+ self.retranslateUi(SettingsDialog_base)
+ self.TabWidget.setCurrentIndex(2)
+ self.AutoRefreshCheckBox.toggled['bool'].connect(self.AutoRefreshRateSpinBox.setEnabled)
+ self.AutoRefreshCheckBox.toggled['bool'].connect(self.RefreshAllRadioButton.setEnabled)
+ self.AutoRefreshCheckBox.toggled['bool'].connect(self.RefreshCurrentRadioButton.setEnabled)
+ self.StdButtons.accepted.connect(SettingsDialog_base.accept)
+ self.StdButtons.rejected.connect(SettingsDialog_base.reject)
+ QtCore.QMetaObject.connectSlotsByName(SettingsDialog_base)
+ SettingsDialog_base.setTabOrder(self.TabWidget, self.AutoRefreshCheckBox)
+ SettingsDialog_base.setTabOrder(self.AutoRefreshCheckBox, self.AutoRefreshRateSpinBox)
+ SettingsDialog_base.setTabOrder(self.AutoRefreshRateSpinBox, self.RefreshCurrentRadioButton)
+ SettingsDialog_base.setTabOrder(self.RefreshCurrentRadioButton, self.RefreshAllRadioButton)
+ SettingsDialog_base.setTabOrder(self.RefreshAllRadioButton, self.PrintCommandLineEdit)
+ SettingsDialog_base.setTabOrder(self.PrintCommandLineEdit, self.ScanCommandLineEdit)
+ SettingsDialog_base.setTabOrder(self.ScanCommandLineEdit, self.SendFaxCommandLineEdit)
+ SettingsDialog_base.setTabOrder(self.SendFaxCommandLineEdit, self.AccessPCardCommandLineEdit)
+ SettingsDialog_base.setTabOrder(self.AccessPCardCommandLineEdit, self.MakeCopiesCommandLineEdit)
+ SettingsDialog_base.setTabOrder(self.MakeCopiesCommandLineEdit, self.SetDefaultsButton)
+ SettingsDialog_base.setTabOrder(self.SetDefaultsButton, self.StdButtons)
+
+ def retranslateUi(self, SettingsDialog_base):
+ _translate = QtCore.QCoreApplication.translate
+ SettingsDialog_base.setWindowTitle(_translate("SettingsDialog_base", "HP Device Manager - Settings"))
+ self.textLabel3_2_2.setText(_translate("SettingsDialog_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Configure if and when devices are automatically refreshed</span></p></body></html>"))
+ self.AutoRefreshCheckBox.setText(_translate("SettingsDialog_base", "&Enable device auto refresh"))
+ self.RefreshRateGroupBox.setTitle(_translate("SettingsDialog_base", "Refresh Interval"))
+ self.textLabel1_4.setText(_translate("SettingsDialog_base", "&Refresh every:"))
+ self.AutoRefreshRateSpinBox.setSuffix(_translate("SettingsDialog_base", " sec"))
+ self.RefreshTypeGroupBox.setTitle(_translate("SettingsDialog_base", "Devices to Refresh"))
+ self.RefreshCurrentRadioButton.setText(_translate("SettingsDialog_base", "Only &currently selected device"))
+ self.RefreshAllRadioButton.setText(_translate("SettingsDialog_base", "&All devices"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.AutoRefresh), _translate("SettingsDialog_base", "Auto Refresh"))
+ self.textLabel3_2_3.setText(_translate("SettingsDialog_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Configure the behavior of the HP Status Service (hp-systray)</span></p></body></html>"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.SystemTray), _translate("SettingsDialog_base", "System Tray Icon"))
+ self.textLabel3_2_2_2.setText(_translate("SettingsDialog_base", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'DejaVu Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Configure what commands to run for device actions</span></p></body></html>"))
+ self.groupBox_3.setTitle(_translate("SettingsDialog_base", "Commands"))
+ self.textLabel1_2.setText(_translate("SettingsDialog_base", "&Print:"))
+ self.textLabel2_2.setText(_translate("SettingsDialog_base", "&Scan:"))
+ self.textLabel3_3.setText(_translate("SettingsDialog_base", "Send PC &Fax:"))
+ self.textLabel4.setText(_translate("SettingsDialog_base", "&Unload Photo Cards:"))
+ self.textLabel5.setText(_translate("SettingsDialog_base", "Make &Copies:"))
+ self.SetDefaultsButton.setText(_translate("SettingsDialog_base", "Set &Defaults"))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.Commands), _translate("SettingsDialog_base", "Commands (Advanced)"))
+
+from .systrayframe import SystrayFrame
diff --git a/ui5/settingsdialog_base.ui b/ui5/settingsdialog_base.ui
new file mode 100644
index 000000000..8ec841fb2
--- /dev/null
+++ b/ui5/settingsdialog_base.ui
@@ -0,0 +1,542 @@
+<ui version="4.0" >
+ <class>SettingsDialog_base</class>
+ <widget class="QDialog" name="SettingsDialog_base" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>500</width>
+ <height>540</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Settings</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QTabWidget" name="TabWidget" >
+ <property name="currentIndex" >
+ <number>2</number>
+ </property>
+ <widget class="QWidget" name="AutoRefresh" >
+ <attribute name="title" >
+ <string>Auto Refresh</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel3_2_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Configure if and when devices are automatically refreshed&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line1_2_2" >
+ <property name="frameShape" >
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="AutoRefreshCheckBox" >
+ <property name="text" >
+ <string>&amp;Enable device auto refresh</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QGroupBox" name="RefreshRateGroupBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="title" >
+ <string>Refresh Interval</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1_4" >
+ <property name="text" >
+ <string>&amp;Refresh every:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>AutoRefreshRateSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QSpinBox" name="AutoRefreshRateSpinBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="wrapping" >
+ <bool>true</bool>
+ </property>
+ <property name="buttonSymbols" >
+ <enum>QAbstractSpinBox::PlusMinus</enum>
+ </property>
+ <property name="suffix" >
+ <string> sec</string>
+ </property>
+ <property name="minimum" >
+ <number>10</number>
+ </property>
+ <property name="maximum" >
+ <number>300</number>
+ </property>
+ <property name="value" >
+ <number>30</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QGroupBox" name="RefreshTypeGroupBox" >
+ <property name="title" >
+ <string>Devices to Refresh</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QRadioButton" name="RefreshCurrentRadioButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Only &amp;currently selected device</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QRadioButton" name="RefreshAllRadioButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>&amp;All devices</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>446</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="SystemTray" >
+ <attribute name="title" >
+ <string>System Tray Icon</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel3_2_3" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Configure the behavior of the HP Status Service (hp-systray)&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line1_2_3" >
+ <property name="frameShape" >
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="SystrayFrame" name="SystemTraySettings" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="Commands" >
+ <attribute name="title" >
+ <string>Commands (Advanced)</string>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel3_2_2_2" >
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Configure what commands to run for device actions&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line1_2_2_3" >
+ <property name="frameShape" >
+ <enum>QFrame::HLine</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string>Commands</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1_2" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>&amp;Print:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>PrintCommandLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLineEdit" name="PrintCommandLineEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel2_2" >
+ <property name="text" >
+ <string>&amp;Scan:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>ScanCommandLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLineEdit" name="ScanCommandLineEdit" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel3_3" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Send PC &amp;Fax:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>SendFaxCommandLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLineEdit" name="SendFaxCommandLineEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="textLabel4" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>&amp;Unload Photo Cards:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>AccessPCardCommandLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" >
+ <widget class="QLineEdit" name="AccessPCardCommandLineEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QLabel" name="textLabel5" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Make &amp;Copies:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>MakeCopiesCommandLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" >
+ <widget class="QLineEdit" name="MakeCopiesCommandLineEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QPushButton" name="SetDefaultsButton" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Set &amp;Defaults</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>301</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QDialogButtonBox" name="StdButtons" >
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ <property name="centerButtons" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>SystrayFrame</class>
+ <extends>QFrame</extends>
+ <header>systrayframe.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>TabWidget</tabstop>
+ <tabstop>AutoRefreshCheckBox</tabstop>
+ <tabstop>AutoRefreshRateSpinBox</tabstop>
+ <tabstop>RefreshCurrentRadioButton</tabstop>
+ <tabstop>RefreshAllRadioButton</tabstop>
+ <tabstop>PrintCommandLineEdit</tabstop>
+ <tabstop>ScanCommandLineEdit</tabstop>
+ <tabstop>SendFaxCommandLineEdit</tabstop>
+ <tabstop>AccessPCardCommandLineEdit</tabstop>
+ <tabstop>MakeCopiesCommandLineEdit</tabstop>
+ <tabstop>SetDefaultsButton</tabstop>
+ <tabstop>StdButtons</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>AutoRefreshCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>AutoRefreshRateSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>31</x>
+ <y>81</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>161</x>
+ <y>157</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>AutoRefreshCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>RefreshAllRadioButton</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>243</x>
+ <y>92</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>243</x>
+ <y>259</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>AutoRefreshCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>RefreshCurrentRadioButton</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>243</x>
+ <y>92</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>243</x>
+ <y>233</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>StdButtons</sender>
+ <signal>accepted()</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>398</x>
+ <y>541</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>243</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>StdButtons</sender>
+ <signal>rejected()</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>398</x>
+ <y>541</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>243</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/ui5/setupdialog.py b/ui5/setupdialog.py
new file mode 100644
index 000000000..bc4eb8a3e
--- /dev/null
+++ b/ui5/setupdialog.py
@@ -0,0 +1,1381 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch, Naga Samrat Chowdary Narla
+#
+
+# StdLib
+import socket
+import operator
+import subprocess
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, models, pkit
+from prnt import cups
+from base.codes import *
+from .ui_utils import *
+from installer import pluginhandler
+from base.sixext import to_unicode, PY3, from_unicode_to_str
+# Qt
+try:
+ from PyQt5.QtCore import *
+ from PyQt5.QtGui import *
+except ImportError:
+ from PyQt5.QtCore import *
+ from PyQt5.QtGui import *
+ from PyQt5.QtWidgets import *
+
+
+# Ui
+from .setupdialog_base import Ui_Dialog
+from .plugindialog import PluginDialog
+from .wifisetupdialog import WifiSetupDialog, SUCCESS_CONNECTED
+
+# Fax
+try:
+ from fax import fax
+ fax_import_ok = True
+except ImportError:
+ # This can fail on Python < 2.3 due to the datetime module
+ fax_import_ok = False
+ log.warning("Fax setup disabled - Python 2.3+ required.")
+
+
+PAGE_DISCOVERY = 0
+PAGE_DEVICES = 1
+PAGE_ADD_PRINTER = 2
+PAGE_REMOVE = 3
+
+
+BUTTON_NEXT = 0
+BUTTON_FINISH = 1
+BUTTON_ADD_PRINTER = 2
+BUTTON_REMOVE = 3
+
+ADVANCED_SHOW = 0
+ADVANCED_HIDE = 1
+
+DEVICE_DESC_ALL = 0
+DEVICE_DESC_SINGLE_FUNC = 1
+DEVICE_DESC_MULTI_FUNC = 2
+
+
+class PasswordDialog(QDialog):
+ def __init__(self, prompt, parent=None, name=None, modal=0, fl=0):
+ QDialog.__init__(self, parent)
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+ self.prompt = prompt
+
+ Layout= QGridLayout(self)
+ Layout.setContentsMargins(11, 11, 11, 11)
+ Layout.setSpacing(6)
+
+ self.PromptTextLabel = QLabel(self)
+ Layout.addWidget(self.PromptTextLabel,0,0,1,3)
+
+ self.UsernameTextLabel = QLabel(self)
+ Layout.addWidget(self.UsernameTextLabel,1,0)
+
+ self.UsernameLineEdit = QLineEdit(self)
+ self.UsernameLineEdit.setEchoMode(QLineEdit.Normal)
+ Layout.addWidget(self.UsernameLineEdit,1,1,1,2)
+
+ self.PasswordTextLabel = QLabel(self)
+ Layout.addWidget(self.PasswordTextLabel,2,0)
+
+ self.PasswordLineEdit = QLineEdit(self)
+ self.PasswordLineEdit.setEchoMode(QLineEdit.Password)
+ Layout.addWidget(self.PasswordLineEdit,2,1,1,2)
+
+ self.OkPushButton = QPushButton(self)
+ Layout.addWidget(self.OkPushButton,3,2)
+
+ self.languageChange()
+
+ self.resize(QSize(420,163).expandedTo(self.minimumSizeHint()))
+
+ self.OkPushButton.clicked.connect(self.accept)
+ self.PasswordLineEdit.returnPressed.connect(self.accept)
+
+ def setDefaultUsername(self, defUser, allowUsernameEdit = True):
+ self.UsernameLineEdit.setText(defUser)
+ if not allowUsernameEdit:
+ self.UsernameLineEdit.setReadOnly(True)
+ self.UsernameLineEdit.setStyleSheet("QLineEdit {background-color: lightgray}")
+
+ def getUsername(self):
+ return to_unicode(self.UsernameLineEdit.text())
+
+
+ def getPassword(self):
+ return to_unicode(self.PasswordLineEdit.text())
+
+
+ def languageChange(self):
+ self.setWindowTitle(self.__tr("HP Device Manager - Enter Username/Password"))
+ self.PromptTextLabel.setText(self.__tr(self.prompt))
+ self.UsernameTextLabel.setText(self.__tr("Username:"))
+ self.PasswordTextLabel.setText(self.__tr("Password:"))
+ self.OkPushButton.setText(self.__tr("OK"))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SetupDialog",s,c)
+
+
+def FailureMessageUI(prompt):
+ try:
+ dlg = PasswordDialog(prompt, None)
+ FailureUI(dlg, prompt)
+ finally:
+ pass
+
+
+def showPasswordUI(prompt, userName=None, allowUsernameEdit=True):
+ try:
+ dlg = PasswordDialog(prompt, None)
+
+ if userName != None:
+ dlg.setDefaultUsername(userName, allowUsernameEdit)
+
+ if dlg.exec_() == QDialog.Accepted:
+ return (dlg.getUsername(), dlg.getPassword())
+
+ finally:
+ pass
+
+ return ("", "")
+
+
+
+class DeviceTableWidgetItem(QTableWidgetItem):
+ def __init__(self, text, device_uri):
+ QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType)
+ self.device_uri = device_uri
+
+
+
+class SetupDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, param, jd_port, device_uri=None, remove=False):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.param = param
+ self.jd_port = jd_port
+ self.device_uri = device_uri
+ self.remove = remove
+
+ if device_uri:
+ log.info("Using device: %s" % device_uri)
+
+ self.initUi()
+
+ if self.remove:
+ QTimer.singleShot(0, self.showRemovePage)
+ else:
+ if self.skip_discovery:
+ self.discovery_method = 0 # SLP
+ QTimer.singleShot(0, self.showDevicesPage)
+ else:
+ QTimer.singleShot(0, self.showDiscoveryPage)
+
+ cups.setPasswordCallback(showPasswordUI)
+
+
+ #
+ # INIT
+ #
+
+ def initUi(self):
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ # connect signals/slots
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.BackButton.clicked.connect(self.BackButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ self.ManualGroupBox.clicked.connect(self.ManualGroupBox_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ if self.remove:
+ self.initRemovePage()
+ self.max_page = 1
+ else:
+ self.initDiscoveryPage()
+ self.initDevicesPage()
+ self.initAddPrinterPage()
+ self.max_page = PAGE_ADD_PRINTER
+
+ #
+ # DISCOVERY PAGE
+ #
+
+ def initDiscoveryPage(self):
+ self.UsbRadioButton.setChecked(True)
+ self.setUsbRadioButton(True)
+ self.ManualGroupBox.setChecked(False)
+
+ self.advanced = False
+ self.manual = False
+ self.skip_discovery = False
+ self.discovery_method = 0
+ self.NetworkRadioButton.setEnabled(prop.net_build)
+ self.WirelessButton.setEnabled(prop.net_build)
+ self.ParallelRadioButton.setEnabled(prop.par_build)
+ self.devices = {}
+ self.bus = 'usb'
+ self.timeout = 5
+ self.ttl = 4
+ self.search = ''
+ self.print_test_page = False
+ self.device_desc = DEVICE_DESC_ALL
+
+ if self.param:
+ log.info("Searching for device...")
+ self.manual = True
+ self.advanced = True
+ self.ManualParamLineEdit.setText(self.param)
+ self.JetDirectSpinBox.setValue(self.jd_port)
+ self.ManualGroupBox.setChecked(True)
+ self.DiscoveryOptionsGroupBox.setEnabled(False)
+
+ if self.manualDiscovery():
+ self.skip_discovery = True
+ else:
+ FailureUI(self, self.__tr("<b>Device not found.</b> <p>Please make sure your printer is properly connected and powered-on."))
+
+ match = device.usb_pat.match(self.param)
+ if match is not None:
+ self.UsbRadioButton.setChecked(True)
+ self.setUsbRadioButton(True)
+
+ else:
+ match = device.dev_pat.match(self.param)
+ if match is not None and prop.par_build:
+ self.ParallelRadioButton.setChecked(True)
+ self.setParallelRadioButton(True)
+
+ else:
+ match = device.ip_pat.match(self.param)
+ if match is not None and prop.net_build:
+ self.NetworkRadioButton.setChecked(True)
+ self.setNetworkRadioButton(True)
+
+ else:
+ FailureUI(self, self.__tr("<b>Invalid manual discovery parameter.</b>"))
+
+ elif self.device_uri: # If device URI specified on the command line, skip discovery
+ # if the device URI is well-formed (but not necessarily valid)
+ try:
+ back_end, is_hp, self.bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(self.device_uri)
+
+ except Error:
+ log.error("Invalid device URI specified: %s" % self.device_uri)
+
+ else:
+ name = host
+ if self.bus == 'net':
+ try:
+ log.debug("Trying to get hostname for device...")
+ name = socket.gethostbyaddr(host)[0]
+ except socket.herror:
+ log.debug("Failed.")
+ else:
+ log.debug("Host name=%s" % name)
+
+ self.devices = {self.device_uri : (model, model, name)}
+ self.skip_discovery = True
+
+ # If no network or parallel, usb is only option, skip initial page...
+ elif not prop.par_build and not prop.net_build:
+ self.skip_discovery = True
+ self.bus = 'usb'
+ self.UsbRadioButton.setChecked(True)
+ self.setUsbRadioButton(True)
+
+ if prop.fax_build and prop.scan_build:
+ self.DeviceTypeComboBox.addItem("All devices/printers", DEVICE_DESC_ALL)
+ self.DeviceTypeComboBox.addItem("Single function printers only", DEVICE_DESC_SINGLE_FUNC)
+ self.DeviceTypeComboBox.addItem("All-in-one/MFP devices only", DEVICE_DESC_MULTI_FUNC)
+ else:
+ self.DeviceTypeComboBox.setEnabled(False)
+
+ self.AdvancedButton.clicked.connect(self.AdvancedButton_clicked)
+ self.UsbRadioButton.toggled.connect(self.UsbRadioButton_toggled)
+ self.NetworkRadioButton.toggled.connect(self.NetworkRadioButton_toggled)
+ self.WirelessButton.toggled.connect(self.WirelessButton_toggled)
+ self.ParallelRadioButton.toggled.connect(self.ParallelRadioButton_toggled)
+ self.NetworkTTLSpinBox.valueChanged.connect(self.NetworkTTLSpinBox_valueChanged)
+ self.NetworkTimeoutSpinBox.valueChanged.connect(self.NetworkTimeoutSpinBox_valueChanged)
+ self.ManualGroupBox.toggled.connect(self.ManualGroupBox_toggled)
+
+ self.showAdvanced()
+
+
+ def ManualGroupBox_toggled(self, checked):
+ self.DiscoveryOptionsGroupBox.setEnabled(not checked)
+
+
+ def manualDiscovery(self):
+ # Validate param...
+ device_uri, sane_uri, fax_uri = device.makeURI(self.param, self.jd_port)
+
+ if device_uri:
+ log.info("Found device: %s" % device_uri)
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(device_uri)
+
+ name = host
+ if bus == 'net':
+ try:
+ if device.ip_pat.search(name) is not None:
+ log.debug("Getting host name from IP address (%s)" % name)
+ name = socket.gethostbyaddr(host)[0]
+ except (socket.herror, socket.gaierror):
+ pass
+
+ self.devices = {device_uri : (model, model, name)}
+
+ if bus == 'usb':
+ self.UsbRadioButton.setChecked(True)
+ self.setUsbRadioButton(True)
+
+ elif bus == 'net' and prop.net_build:
+ self.NetworkRadioButton.setChecked(True)
+ self.setNetworkRadioButton(True)
+
+ elif bus == 'par' and prop.par_build:
+ self.ParallelRadioButton.setChecked(True)
+ self.setParallelRadioButton(True)
+
+ return True
+
+
+ return False
+
+
+ def ManualGroupBox_clicked(self, checked):
+ self.manual = checked
+ network = self.NetworkRadioButton.isChecked()
+ self.setJetDirect(network)
+
+
+ def showDiscoveryPage(self):
+ self.BackButton.setEnabled(False)
+ self.NextButton.setEnabled(True)
+ self.setNextButton(BUTTON_NEXT)
+ self.displayPage(PAGE_DISCOVERY)
+
+
+ def AdvancedButton_clicked(self):
+ self.advanced = not self.advanced
+ self.showAdvanced()
+
+
+ def showAdvanced(self):
+ if self.advanced:
+ self.AdvancedStackedWidget.setCurrentIndex(ADVANCED_SHOW)
+ self.AdvancedButton.setText(self.__tr("Hide Advanced Options"))
+ self.AdvancedButton.setIcon(QIcon(load_pixmap("minus", "16x16")))
+ else:
+ self.AdvancedStackedWidget.setCurrentIndex(ADVANCED_HIDE)
+ self.AdvancedButton.setText(self.__tr("Show Advanced Options"))
+ self.AdvancedButton.setIcon(QIcon(load_pixmap("plus", "16x16")))
+
+
+ def setJetDirect(self, enabled):
+ self.JetDirectLabel.setEnabled(enabled and self.manual)
+ self.JetDirectSpinBox.setEnabled(enabled and self.manual)
+
+
+ def setNetworkOptions(self, enabled):
+ self.NetworkTimeoutLabel.setEnabled(enabled)
+ self.NetworkTimeoutSpinBox.setEnabled(enabled)
+ self.NetworkTTLLabel.setEnabled(enabled)
+ self.NetworkTTLSpinBox.setEnabled(enabled)
+
+
+ def setSearchOptions(self, enabled):
+ self.SearchLineEdit.setEnabled(enabled)
+ self.DeviceTypeComboBox.setEnabled(enabled)
+ self.DeviceTypeLabel.setEnabled(enabled)
+
+
+ def setManualDiscovery(self, enabled):
+ self.ManualGroupBox.setEnabled(enabled)
+
+
+ def setNetworkDiscovery(self, enabled):
+ self.NetworkDiscoveryMethodLabel.setEnabled(enabled)
+ self.NetworkDiscoveryMethodComboBox.setEnabled(enabled)
+ self.NetworkDiscoveryMethodComboBox.setCurrentIndex(0)
+
+
+ def UsbRadioButton_toggled(self, radio_enabled):
+ self.setUsbRadioButton(radio_enabled)
+
+
+ def setUsbRadioButton(self, checked):
+ self.setNetworkDiscovery(not checked)
+ self.setJetDirect(not checked)
+ self.setNetworkOptions(not checked)
+ self.setSearchOptions(checked)
+ self.setManualDiscovery(checked)
+
+ if checked:
+ self.ManualParamLabel.setText(self.__tr("USB bus ID:device ID (bbb:ddd):"))
+ self.bus = 'usb'
+ # TODO: Set bbb:ddd validator
+
+
+ def NetworkRadioButton_toggled(self, radio_enabled):
+ self.setNetworkRadioButton(radio_enabled)
+
+
+ def setNetworkRadioButton(self, checked):
+ self.setNetworkDiscovery(checked)
+ self.setJetDirect(checked)
+ self.setNetworkOptions(checked)
+ self.setSearchOptions(checked)
+ self.setManualDiscovery(checked)
+
+
+ if checked:
+ self.ManualParamLabel.setText(self.__tr("IP Address or network name:"))
+ self.bus = 'net'
+ # TODO: Reset validator
+
+ def WirelessButton_toggled(self, radio_enabled):
+ self.setWirelessButton(radio_enabled)
+
+
+ def setWirelessButton(self, checked):
+ self.setNetworkDiscovery(not checked)
+ self.setJetDirect(not checked)
+ self.setNetworkOptions(not checked)
+ self.setSearchOptions(not checked)
+ self.setManualDiscovery(not checked)
+
+
+ if checked:
+ self.ManualParamLabel.setText(self.__tr("IP Address or network name:"))
+ self.bus = 'net'
+
+
+ def ParallelRadioButton_toggled(self, radio_enabled):
+ self.setParallelRadioButton(radio_enabled)
+
+
+ def setParallelRadioButton(self, checked):
+ self.setNetworkDiscovery(not checked)
+ self.setJetDirect(not checked)
+ self.setNetworkOptions(not checked)
+ self.setSearchOptions(not checked)
+ self.setManualDiscovery(not checked)
+
+
+ if checked:
+ self.ManualParamLabel.setText(self.__tr("Device node (/dev/...):"))
+ self.bus = 'par'
+ # TODO: Set /dev/... validator
+
+
+ def NetworkTTLSpinBox_valueChanged(self, ttl):
+ self.ttl = ttl
+
+
+ def NetworkTimeoutSpinBox_valueChanged(self, timeout):
+ self.timeout = timeout
+
+ #
+ # DEVICES PAGE
+ #
+
+ def initDevicesPage(self):
+ self.RefreshButton.clicked.connect(self.RefreshButton_clicked)
+
+
+ def showDevicesPage(self):
+ self.BackButton.setEnabled(True)
+ self.setNextButton(BUTTON_NEXT)
+ search = ""
+
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ if not self.devices:
+ if self.manual and self.param: # manual, but not passed-in on command line
+ self.manualDiscovery()
+
+ else: # probe
+ net_search_type = ''
+
+ if self.bus == 'net':
+ if self.discovery_method == 0:
+ net_search_type = "slp"
+ elif self.discovery_method == 1:
+ net_search_type = "mdns"
+ else:
+ net_search_type = "avahi"
+
+ log.info("Searching... (bus=%s, timeout=%d, ttl=%d, search=%s desc=%d, method=%s)" %
+ (self.bus, self.timeout, self.ttl, self.search or "(None)",
+ self.device_desc, net_search_type))
+ else:
+ log.info("Searching... (bus=%s, search=%s, desc=%d)" %
+ (self.bus, self.search or "(None)", self.device_desc))
+
+ if self.device_desc == DEVICE_DESC_SINGLE_FUNC:
+ filter_dict = {'scan-type' : (operator.le, SCAN_TYPE_NONE)}
+
+ elif self.device_desc == DEVICE_DESC_MULTI_FUNC:
+ filter_dict = {'scan-type': (operator.gt, SCAN_TYPE_NONE)}
+
+ else: # DEVICE_DESC_ALL
+ filter_dict = {}
+
+ if self.bus == 'usb':
+ try:
+ from base import smart_install
+ except ImportError:
+ log.error("Failed to Import smart_install.py from base")
+ else: #if no Smart Install device found, ignores.
+ QApplication.restoreOverrideCursor()
+ smart_install.disable(GUI_MODE, 'qt4')
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+
+ self.devices = device.probeDevices([self.bus], self.timeout, self.ttl,
+ filter_dict, self.search, net_search=net_search_type)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ self.clearDevicesTable()
+
+ if self.devices:
+ self.NextButton.setEnabled(True)
+ self.DevicesFoundIcon.setPixmap(load_pixmap('info', '16x16'))
+
+ if len(self.devices) == 1:
+ self.DevicesFoundLabel.setText(self.__tr("<b>1 device found.</b> Click <i>Next</i> to continue."))
+ else:
+ self.DevicesFoundLabel.setText(self.__tr("<b>%s devices found.</b> Select the device to install and click <i>Next</i> to continue."%(len(self.devices))))
+
+ self.loadDevicesTable()
+
+ else:
+ self.NextButton.setEnabled(False)
+ self.DevicesFoundIcon.setPixmap(load_pixmap('error', '16x16'))
+ log.error("No devices found on bus: %s" % self.bus)
+ self.DevicesFoundLabel.setText(self.__tr("<b>No devices found.</b><br>Click <i>Back</i> to change discovery options, or <i>Refresh</i> to search again."))
+ if self.bus == 'net' and utils.check_lan():
+ FailureUI(self, self.__tr('''<b>HPLIP cannot detect printers in your network.</b><p>This may be due to existing firewall settings blocking the required ports.
+ When you are in a trusted network environment, you may open the ports for network services like mdns and slp in the firewall. For detailed steps follow the link.
+ <b>http://hplipopensource.com/node/374</b></p>'''),
+ self.__tr("HP Device Manager"))
+
+
+ self.displayPage(PAGE_DEVICES)
+
+
+ def loadDevicesTable(self):
+ self.DevicesTableWidget.setRowCount(len(self.devices))
+
+ if self.bus == 'net':
+ if self.discovery_method == 0:
+ headers = [self.__tr('Model'), self.__tr('IP Address'), self.__tr('Host Name'), self.__tr('Device URI')]
+ device_uri_col = 3
+ else:
+ headers = [self.__tr('Model'), self.__tr('Host Name'), self.__tr('Device URI')]
+ device_uri_col = 2
+ else:
+ headers = [self.__tr('Model'), self.__tr('Device URI')]
+ device_uri_col = 1
+
+ self.DevicesTableWidget.setColumnCount(len(headers))
+ self.DevicesTableWidget.setHorizontalHeaderLabels(headers)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ for row, d in enumerate(self.devices):
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(d)
+ model_ui = models.normalizeModelUIName(model)
+
+ i = DeviceTableWidgetItem(str(model_ui), d)
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(str(d))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, device_uri_col, i)
+
+ if self.bus == 'net':
+ i = QTableWidgetItem(str(host))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 1, i)
+
+ if self.discovery_method == 0:
+ i = QTableWidgetItem(str(self.devices[d][2]))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 2, i)
+
+ self.DevicesTableWidget.resizeColumnsToContents()
+ self.DevicesTableWidget.selectRow(0)
+ self.DevicesTableWidget.setSortingEnabled(True)
+ self.DevicesTableWidget.sortItems(0)
+
+
+ def clearDevicesTable(self):
+ self.DevicesTableWidget.clear()
+ self.DevicesTableWidget.setRowCount(0)
+ self.DevicesTableWidget.setColumnCount(0)
+
+
+ def RefreshButton_clicked(self):
+ self.clearDevicesTable()
+ self.devices = []
+ QTimer.singleShot(0, self.showDevicesPage)
+
+ #
+ # ADD PRINTER PAGE
+ #
+
+ def initAddPrinterPage(self):
+ self.mq = {}
+
+ self.PrinterNameLineEdit.textEdited.connect(self.PrinterNameLineEdit_textEdited)
+
+ self.FaxNameLineEdit.textEdited.connect(self.FaxNameLineEdit_textEdited)
+
+ self.SetupPrintGroupBox.clicked.connect(self.SetupPrintGroupBox_clicked)
+ self.SetupFaxGroupBox.clicked.connect(self.SetupFaxGroupBox_clicked)
+ self.PrinterNameLineEdit.setValidator(PrinterNameValidator(self.PrinterNameLineEdit))
+ self.FaxNameLineEdit.setValidator(PrinterNameValidator(self.FaxNameLineEdit))
+ self.FaxNumberLineEdit.setValidator(PhoneNumValidator(self.FaxNumberLineEdit))
+ self.OtherPPDButton.setIcon(QIcon(load_pixmap('folder_open', '16x16')))
+ self.OtherPPDButton.clicked.connect(self.OtherPPDButton_clicked)
+
+ self.OtherPPDButton.setToolTip(self.__tr("Browse for an alternative PPD file for this printer."))
+
+ self.printer_fax_names_same = False
+ self.printer_name = ''
+ self.fax_name = ''
+ self.fax_setup_ok = True
+ self.fax_setup = False
+ self.print_setup = False
+
+
+ def showAddPrinterPage(self):
+ # Install the plugin if needed...
+ pluginObj = pluginhandler.PluginHandle()
+ plugin = self.mq.get('plugin', PLUGIN_NONE)
+ plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE)
+ if plugin > PLUGIN_NONE:
+
+ if pluginObj.getStatus() != pluginhandler.PLUGIN_INSTALLED:
+ ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
+ if not sudo_ok:
+ FailureUI(self, self.__tr("<b>Unable to find an appropriate su/sudo utiltity to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"))
+ return
+ if not ok or pluginObj.getStatus() != pluginhandler.PLUGIN_INSTALLED:
+ if plugin == PLUGIN_REQUIRED:
+ FailureUI(self, self.__tr("<b>The device you are trying to setup requires a binary plug-in. Some functionalities may not work as expected without plug-ins.<p> Please run 'hp-plugin' as normal user to install plug-ins.</b></p><p>Visit <u>http://hplipopensource.com</u> for more infomation.</p>"))
+ return
+ else:
+ WarningUI(self, self.__tr("Either you have chosen to skip the installation of the optional plug-in or that installation has failed. Your printer may not function at optimal performance."))
+
+ self.setNextButton(BUTTON_ADD_PRINTER)
+ self.print_setup = self.setDefaultPrinterName()
+ if self.print_setup:
+ self.SetupPrintGroupBox.setCheckable(True)
+ self.SetupPrintGroupBox.setEnabled(True)
+ self.SendTestPageCheckBox.setCheckable(True)
+ self.SendTestPageCheckBox.setEnabled(True)
+ self.findPrinterPPD()
+ self.updatePPD()
+ else:
+ self.print_ppd = None
+ self.SetupPrintGroupBox.setCheckable(False)
+ self.SetupPrintGroupBox.setEnabled(False)
+ self.SendTestPageCheckBox.setCheckable(False)
+ self.SendTestPageCheckBox.setEnabled(False)
+
+ if fax_import_ok and prop.fax_build and \
+ self.mq.get('fax-type', FAX_TYPE_NONE) not in (FAX_TYPE_NONE, FAX_TYPE_NOT_SUPPORTED):
+ self.fax_setup = True
+ self.SetupFaxGroupBox.setChecked(True)
+ self.SetupFaxGroupBox.setEnabled(True)
+
+ self.fax_setup = self.setDefaultFaxName()
+ if self.fax_setup:
+ self.findFaxPPD()
+ self.readwriteFaxInformation()
+ else:
+ self.fax_setup = False
+ self.SetupFaxGroupBox.setChecked(False)
+ self.SetupFaxGroupBox.setEnabled(False)
+
+ else:
+ self.SetupFaxGroupBox.setChecked(False)
+ self.SetupFaxGroupBox.setEnabled(False)
+ self.fax_name = ''
+ self.fax_name_ok = True
+ self.fax_setup = False
+ self.fax_setup_ok = True
+
+
+
+ if self.print_setup or self.fax_setup:
+ self.setAddPrinterButton()
+ self.displayPage(PAGE_ADD_PRINTER)
+ else:
+ log.info("Exiting the setup...")
+ self.close()
+
+
+
+
+ def updatePPD(self):
+ if self.print_ppd is None:
+ log.error("No appropriate print PPD file found for model %s" % self.model)
+ self.PPDFileLineEdit.setText(self.__tr('(Not found. Click browse button to select a PPD file.)'))
+ try:
+ self.PPDFileLineEdit.setStyleSheet("background-color: yellow")
+ except AttributeError:
+ pass
+ self.PrinterDescriptionLineEdit.setText(str(""))
+
+ else:
+ self.PPDFileLineEdit.setText(self.print_ppd[0])
+ self.PrinterDescriptionLineEdit.setText(self.print_ppd[1])
+ try:
+ self.PPDFileLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+
+
+ def OtherPPDButton_clicked(self, b):
+ ppd_file = to_unicode(QFileDialog.getOpenFileName(self, self.__tr("Select PPD File"),
+ sys_conf.get('dirs', 'ppd'),
+ self.__tr("PPD Files (*.ppd *.ppd.gz);;All Files (*)")))
+
+ if ppd_file and os.path.exists(ppd_file):
+ self.print_ppd = (ppd_file, cups.getPPDDescription(ppd_file))
+ self.updatePPD()
+ self.setAddPrinterButton()
+
+
+ def findPrinterPPD(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ self.print_ppd = None
+ self.ppds = cups.getSystemPPDs()
+ self.print_ppd = cups.getPPDFile2(self.mq, self.model, self.ppds)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def findFaxPPD(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ self.fax_ppd, fax_ppd_name, nick = cups.getFaxPPDFile(self.mq, self.model)
+ if self.fax_ppd:
+ self.fax_setup_ok = True
+ else:
+ self.fax_setup_ok = False
+ FailureUI(self, self.__tr("<b>Unable to locate the HPLIP Fax PPD file:</b><p>%s.ppd.gz</p><p>Fax setup has been disabled."%fax_ppd_name))
+ self.fax_setup = False
+ self.SetupFaxGroupBox.setChecked(False)
+ self.SetupFaxGroupBox.setEnabled(False)
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def setDefaultPrinterName(self):
+ self.installed_print_devices = device.getSupportedCUPSDevices(['hp'])
+ log.debug(self.installed_print_devices)
+
+ self.installed_queues = [p.name for p in cups.getPrinters()]
+
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
+ default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
+
+ printer_name = default_model
+ installed_printer_names = device.getSupportedCUPSPrinterNames(['hp'])
+ # Check for duplicate names
+ if (self.device_uri in self.installed_print_devices and printer_name in self.installed_print_devices[self.device_uri]) \
+ or (printer_name in installed_printer_names):
+ warn_text = self.__tr("<b>One or more print queues already exist for this device: %s</b>.<br> <b>Would you like to install another print queue for this device ?</b>" %
+ ', '.join([printer for printer in installed_printer_names if printer_name in printer]))
+ if ( QMessageBox.warning(self,
+ self.windowTitle(),
+ warn_text,
+ QMessageBox.Yes|\
+ QMessageBox.No,
+ QMessageBox.NoButton) == QMessageBox.Yes ):
+
+ i = 2
+ while True:
+ t = printer_name + "_%d" % i
+ if (t not in installed_printer_names) and (self.device_uri not in self.installed_print_devices or t not in self.installed_print_devices[self.device_uri]):
+ printer_name += "_%d" % i
+ break
+ i += 1
+ else:
+ self.printer_name_ok = False
+ return False
+
+ self.printer_name_ok = True
+ self.PrinterNameLineEdit.setText(printer_name)
+ log.debug(printer_name)
+ self.printer_name = printer_name
+ return True
+
+
+ def setDefaultFaxName(self):
+ self.installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
+ log.debug(self.installed_fax_devices)
+
+ self.fax_uri = self.device_uri.replace('hp:', 'hpfax:')
+
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.fax_uri)
+ default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
+
+ fax_name = default_model + "_fax"
+ installed_fax_names = device.getSupportedCUPSPrinterNames(['hpfax'])
+ # Check for duplicate names
+ if (self.fax_uri in self.installed_fax_devices and fax_name in self.installed_fax_devices[self.fax_uri]) \
+ or (fax_name in installed_fax_names):
+ warn_text = self.__tr(
+ "<b>One or more fax queues already exist for this device: %s</b>.<br> <b>Would you like to install another fax queue for this device ?</b>" %
+ ', '.join([fax_device for fax_device in installed_fax_names if fax_name in fax_device]))
+ if ( QMessageBox.warning(self,
+ self.windowTitle(),
+ warn_text,
+ QMessageBox.Yes|\
+ QMessageBox.No|\
+ QMessageBox.NoButton) == QMessageBox.Yes ):
+ i = 2
+ while True:
+ t = fax_name + "_%d" % i
+ if (t not in installed_fax_names) and (self.fax_uri not in self.installed_fax_devices or t not in self.installed_fax_devices[self.fax_uri]):
+ fax_name += "_%d" % i
+ break
+ i += 1
+ else:
+ self.fax_name_ok = False
+ return False
+
+ self.fax_name_ok = True
+ self.FaxNameLineEdit.setText(fax_name)
+ self.fax_name = fax_name
+ return True
+
+
+ def PrinterNameLineEdit_textEdited(self, t):
+ self.printer_name = to_unicode(t)
+ self.printer_name_ok = True
+
+ if not self.printer_name:
+ self.PrinterNameLineEdit.setToolTip(self.__tr('You must enter a name for the printer.'))
+ self.printer_name_ok = False
+
+ elif self.fax_name == self.printer_name:
+ s = self.__tr('The printer name and fax name must be different. Please choose different names.')
+ self.PrinterNameLineEdit.setToolTip(s)
+ self.FaxNameLineEdit.setToolTip(s)
+ self.fax_name_ok = False
+ self.printer_name_ok = False
+ self.printer_fax_names_same = True
+
+ elif self.printer_name in self.installed_queues:
+ self.PrinterNameLineEdit.setToolTip(self.__tr('A printer already exists with this name. Please choose a different name.'))
+ self.printer_name_ok = False
+
+ elif self.printer_fax_names_same:
+ if self.fax_name != self.printer_name:
+ self.printer_fax_names_same = False
+ self.printer_name_ok = True
+
+ self.FaxNameLineEdit.emit(SIGNAL("textEdited(const QString &)"),
+ self.FaxNameLineEdit.text())
+
+ self.setIndicators()
+ self.setAddPrinterButton()
+
+
+ def FaxNameLineEdit_textEdited(self, t):
+ self.fax_name = to_unicode(t)
+ self.fax_name_ok = True
+
+ if not self.fax_name:
+ self.FaxNameLineEdit.setToolTip(self.__tr('You must enter a fax name.'))
+ self.fax_name_ok = False
+
+ elif self.fax_name == self.printer_name:
+ s = self.__tr('The printer name and fax name must be different. Please choose different names.')
+ self.PrinterNameLineEdit.setToolTip(s)
+ self.FaxNameLineEdit.setToolTip(s)
+ self.printer_name_ok = False
+ self.fax_name_ok = False
+ self.printer_fax_names_same = True
+
+ elif self.fax_name in self.installed_queues:
+ self.FaxNameLineEdit.setToolTip(self.__tr('A fax already exists with this name. Please choose a different name.'))
+ self.fax_name_ok = False
+
+ elif self.printer_fax_names_same:
+ if self.fax_name != self.printer_name:
+ self.printer_fax_names_same = False
+ self.fax_name_ok = True
+
+ self.PrinterNameLineEdit.emit(SIGNAL("textEdited(const QString&)"),
+ self.PrinterNameLineEdit.text())
+
+ self.setIndicators()
+ self.setAddPrinterButton()
+
+ def SetupPrintGroupBox_clicked(self):
+ if not self.SetupPrintGroupBox.isChecked():
+ self.SendTestPageCheckBox.setCheckable(False)
+ self.SendTestPageCheckBox.setEnabled(False)
+ else:
+ self.SendTestPageCheckBox.setCheckable(True)
+ self.SendTestPageCheckBox.setEnabled(True)
+ self.setAddPrinterButton()
+
+ def SetupFaxGroupBox_clicked(self):
+ self.setAddPrinterButton()
+
+
+ def setIndicators(self):
+ if self.printer_name_ok:
+ self.PrinterNameLineEdit.setToolTip(str(""))
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ else:
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("background-color: yellow")
+ except AttributeError:
+ pass
+
+ if self.fax_name_ok:
+ self.FaxNameLineEdit.setToolTip(str(""))
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ else:
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("background-color: yellow")
+ except AttributeError:
+ pass
+
+
+ def setAddPrinterButton(self):
+ if self.SetupPrintGroupBox.isChecked() or self.SetupFaxGroupBox.isChecked():
+ self.NextButton.setEnabled((self.print_setup and self.printer_name_ok and self.print_ppd is not None) or
+ (self.fax_setup and self.fax_name_ok))
+ else:
+ self.NextButton.setEnabled(False)
+
+
+ #
+ # ADD PRINTER
+ #
+
+ def addPrinter(self):
+ if self.print_setup:
+ print_sts = self.setupPrinter()
+ if print_sts == cups.IPP_FORBIDDEN or print_sts == cups.IPP_NOT_AUTHENTICATED or print_sts == cups.IPP_NOT_AUTHORIZED:
+ pass # User doesn't have sufficient permissions so ignored.
+ if print_sts == cups.IPP_OK:
+ self.flashFirmware()
+ if self.print_test_page:
+ self.printTestPage()
+
+ if self.fax_setup:
+ if self.setupFax() == cups.IPP_OK:
+ self.readwriteFaxInformation(False)
+
+ self.close()
+
+
+ #
+ # Updating firmware download for supported devices.
+ #
+ def flashFirmware(self):
+ if self.mq.get('fw-download', False):
+ try:
+ d = device.Device(self.device_uri)
+ except Error as e:
+ FailureUI(self, self.__tr("<b>Error opening device. Firmware download is Failed.</b><p>%s (%s)." % (e.msg, e.opt)))
+ else:
+ if d.downloadFirmware():
+ log.info("Firmware download successful.\n")
+ else:
+ FailureUI(self, self.__tr("<b>Firmware download is Failed.</b>"))
+ d.close()
+
+ #
+ # SETUP PRINTER/FAX
+ #
+
+ def setupPrinter(self):
+ status = cups.IPP_BAD_REQUEST
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ if not os.path.exists(self.print_ppd[0]): # assume foomatic: or some such
+ add_prnt_args = (from_unicode_to_str(self.printer_name), self.device_uri, self.print_location, '', self.print_ppd[0], self.print_desc)
+ else:
+ add_prnt_args = (from_unicode_to_str(self.printer_name), self.device_uri, self.print_location, self.print_ppd[0], '', self.print_desc)
+
+ status, status_str = cups.cups_operation(cups.addPrinter, GUI_MODE, 'qt4', self, *add_prnt_args)
+ log.debug(device.getSupportedCUPSDevices(['hp']))
+
+ if status != cups.IPP_OK:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Printer queue setup failed.</b> <p>Error : %s"%status_str))
+ else:
+ # sending Event to add this device in hp-systray
+ utils.sendEvent(EVENT_CUPS_QUEUES_ADDED,self.device_uri, self.printer_name)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+ return status
+
+
+ def setupFax(self):
+ status = cups.IPP_BAD_REQUEST
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ if not os.path.exists(self.fax_ppd):
+ status, status_str = cups.addPrinter(self.fax_name,
+ self.fax_uri, self.fax_location, '', self.fax_ppd, self.fax_desc)
+ else:
+ status, status_str = cups.addPrinter(self.fax_name,
+ self.fax_uri, self.fax_location, self.fax_ppd, '', self.fax_desc)
+
+ log.debug(device.getSupportedCUPSDevices(['hpfax']))
+
+ if status != cups.IPP_OK:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Fax queue setup failed.</b><p>Error : %s"%status_str))
+ else:
+ # sending Event to add this device in hp-systray
+ utils.sendEvent(EVENT_CUPS_QUEUES_ADDED,self.fax_uri, self.fax_name)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ return status
+
+
+ def readwriteFaxInformation(self, read=True):
+ try:
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+
+ d = fax.getFaxDevice(self.fax_uri, disable_dbus=True)
+
+ while True:
+ try:
+ d.open()
+ except Error:
+ error_text = self.__tr("Unable to communicate with the device. Please check the device and try again.")
+ log.error(to_unicode(error_text))
+ if QMessageBox.critical(self,
+ self.windowTitle(),
+ error_text,
+ QMessageBox.Retry | QMessageBox.Default,
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+
+ else:
+ try:
+ tries = 0
+ ok = True
+
+ while True:
+ tries += 1
+
+ try:
+ if read:
+ #self.fax_number = str(d.getPhoneNum())
+ #self.fax_name_company = str(d.getStationName())
+ self.fax_number = to_unicode(d.getPhoneNum())
+ self.fax_name_company = to_unicode(d.getStationName())
+ else:
+ d.setStationName(self.fax_name_company)
+ d.setPhoneNum(self.fax_number)
+
+ except Error:
+ error_text = self.__tr("<b>Device I/O Error</b><p>Could not communicate with device. Device may be busy.")
+ log.error(to_unicode(error_text))
+
+ if QMessageBox.critical(self,
+ self.windowTitle(),
+ error_text,
+ QMessageBox.Retry | QMessageBox.Default,
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+
+
+ time.sleep(5)
+ ok = False
+
+ if tries > 12:
+ break
+
+ else:
+ ok = True
+ break
+
+ finally:
+ d.close()
+
+ if ok and read:
+ self.FaxNumberLineEdit.setText(self.fax_number)
+ self.NameCompanyLineEdit.setText(self.fax_name_company)
+
+ break
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def printTestPage(self):
+ try:
+ d = device.Device(self.device_uri)
+ except Error as e:
+ FailureUI(self, self.__tr("<b>Device error:</b><p>%s (%s)." % (e.msg, e.opt)))
+
+ else:
+ try:
+ d.open()
+ except Error:
+ FailureUI(self, self.__tr("<b>Unable to print to printer.</b><p>Please check device and try again."))
+ else:
+ if d.isIdleAndNoError():
+ d.close()
+
+ try:
+ d.printTestPage(self.printer_name)
+ except Error as e:
+ if e.opt == ERROR_NO_CUPS_QUEUE_FOUND_FOR_DEVICE:
+ FailureUI(self, self.__tr("<b>No CUPS queue found for device.</b><p>Please install the printer in CUPS and try again."))
+ else:
+ FailureUI(self, self.__tr("<b>Printer Error</b><p>An error occured: %s (code=%d)." % (e.msg, e.opt)))
+ else:
+ FailureUI(self, self.__tr("<b>Printer Error.</b><p>Printer is busy, offline, or in an error state. Please check the device and try again."))
+ d.close()
+
+ #
+ # Remove Page
+ #
+
+ def initRemovePage(self):
+ pass
+
+
+ def showRemovePage(self):
+ self.displayPage(PAGE_REMOVE)
+ self.StepText.setText(self.__tr("Step 1 of 1"))
+ self.setNextButton(BUTTON_REMOVE)
+ self.BackButton.setEnabled(False)
+ self.NextButton.setEnabled(False)
+
+ self.RemoveDevicesTableWidget.verticalHeader().hide()
+
+ self.installed_printers = device.getSupportedCUPSPrinters(['hp', 'hpfax'])
+ log.debug(self.installed_printers)
+
+ if not self.installed_printers:
+ FailureUI(self, self.__tr("<b>No printers or faxes found to remove.</b><p>You must setup a least one printer or fax before you can remove it."))
+ self.close()
+ return
+
+ self.RemoveDevicesTableWidget.setRowCount(len(self.installed_printers))
+
+ headers = [self.__tr("Select"), self.__tr('Printer (Queue) Name'), self.__tr('Type'), self.__tr('Device URI')]
+
+ self.RemoveDevicesTableWidget.setColumnCount(len(headers))
+ self.RemoveDevicesTableWidget.setHorizontalHeaderLabels(headers)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ row = 0
+ for p in self.installed_printers:
+ widget = QCheckBox(self.RemoveDevicesTableWidget)
+ widget.stateChanged.connect(self.CheckBox_stateChanged)
+ self.RemoveDevicesTableWidget.setCellWidget(row, 0, widget)
+
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(p.device_uri)
+
+ if self.device_uri is not None and self.device_uri == p.device_uri:
+ widget.setCheckState(Qt.Checked)
+
+ i = QTableWidgetItem(str(p.name))
+ i.setFlags(flags)
+ i.setData(Qt.UserRole, p.name)
+ self.RemoveDevicesTableWidget.setItem(row, 1, i)
+
+ if back_end == 'hpfax':
+ typ = self.__tr("Fax")
+ else:
+ typ = self.__tr("Printer")
+
+ i = QTableWidgetItem(typ)
+ i.setFlags(flags)
+ self.RemoveDevicesTableWidget.setItem(row, 2, i)
+
+ i = QTableWidgetItem(str(p.device_uri))
+ i.setFlags(flags)
+ self.RemoveDevicesTableWidget.setItem(row, 3, i)
+
+ row += 1
+
+ self.RemoveDevicesTableWidget.resizeColumnsToContents()
+
+
+ def CheckBox_stateChanged(self, i):
+ for row in range(self.RemoveDevicesTableWidget.rowCount()):
+ widget = self.RemoveDevicesTableWidget.cellWidget(row, 0)
+ if widget.checkState() == Qt.Checked:
+ self.NextButton.setEnabled(True)
+ break
+ else:
+ self.NextButton.setEnabled(False)
+
+
+ #
+ # Misc
+ #
+
+ def NextButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_DISCOVERY:
+ self.manual = self.ManualGroupBox.isChecked()
+ self.param = to_unicode(self.ManualParamLineEdit.text())
+ self.jd_port = self.JetDirectSpinBox.value()
+ self.search = to_unicode(self.SearchLineEdit.text())
+ self.device_desc = value_int(self.DeviceTypeComboBox.itemData(self.DeviceTypeComboBox.currentIndex()))[0]
+ self.discovery_method = self.NetworkDiscoveryMethodComboBox.currentIndex()
+
+ if self.WirelessButton.isChecked():
+ dlg = WifiSetupDialog(self, device_uri=None, standalone=False)
+ dlg.exec_()
+
+ if dlg.success == SUCCESS_CONNECTED:
+ self.manual = True
+ self.param = dlg.hn
+ self.bus = 'net'
+ if not self.WirelessButton.isChecked():
+ self.showDevicesPage()
+
+ elif p == PAGE_DEVICES:
+ row = self.DevicesTableWidget.currentRow()
+ self.device_uri = self.DevicesTableWidget.item(row, 0).device_uri
+ self.mq = device.queryModelByURI(self.device_uri)
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
+ self.model = models.normalizeModelName(model).lower()
+ self.showAddPrinterPage()
+
+ elif p == PAGE_ADD_PRINTER:
+ self.print_test_page = self.SendTestPageCheckBox.isChecked()
+ self.print_setup = self.SetupPrintGroupBox.isChecked()
+ self.fax_setup = self.SetupFaxGroupBox.isChecked()
+ self.print_location = from_unicode_to_str(to_unicode(self.PrinterLocationLineEdit.text()))
+ self.print_desc = from_unicode_to_str(to_unicode(self.PrinterDescriptionLineEdit.text()))
+ self.fax_desc = from_unicode_to_str(to_unicode(self.FaxDescriptionLineEdit.text()))
+ self.fax_location = from_unicode_to_str(to_unicode(self.FaxLocationLineEdit.text()))
+ self.fax_name_company = to_unicode(self.NameCompanyLineEdit.text())
+ self.fax_number = to_unicode(self.FaxNumberLineEdit.text())
+ self.addPrinter()
+
+ elif p == PAGE_REMOVE:
+ for row in range(self.RemoveDevicesTableWidget.rowCount()):
+ widget = self.RemoveDevicesTableWidget.cellWidget(row, 0)
+ if widget.checkState() == Qt.Checked:
+ item = self.RemoveDevicesTableWidget.item(row, 1)
+ printer = to_unicode(value_str(item.data(Qt.UserRole)))
+ uri = device.getDeviceURIByPrinterName(printer)
+ log.debug("Removing printer: %s" % printer)
+ status, status_str = cups.cups_operation(cups.delPrinter, GUI_MODE, 'qt4', self, printer)
+
+ if status != cups.IPP_OK:
+ FailureUI(self, self.__tr("<b>Unable to delete '%s' queue. </b><p>Error : %s"%(printer,status_str)))
+ if status == cups.IPP_FORBIDDEN or status == cups.IPP_NOT_AUTHENTICATED or status == cups.IPP_NOT_AUTHORIZED:
+ break
+ else:
+ # sending Event to add this device in hp-systray
+ utils.sendEvent(EVENT_CUPS_QUEUES_REMOVED, uri, printer)
+
+ self.close()
+
+ else:
+ log.error("Invalid page!") # shouldn't happen!
+
+
+ def BackButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_DEVICES:
+ self.devices = {}
+ self.showDiscoveryPage()
+
+ elif p == PAGE_ADD_PRINTER:
+ self.showDevicesPage()
+
+ else:
+ log.error("Invalid page!") # shouldn't happen!
+
+
+ def CancelButton_clicked(self):
+ self.close()
+
+
+ def displayPage(self, page):
+ self.StackedWidget.setCurrentIndex(page)
+ self.updateStepText(page)
+
+
+ def setNextButton(self, typ=BUTTON_FINISH):
+ if typ == BUTTON_ADD_PRINTER:
+ self.NextButton.setText(self.__tr("Add Printer"))
+ elif typ == BUTTON_NEXT:
+ self.NextButton.setText(self.__tr("Next >"))
+ elif typ == BUTTON_FINISH:
+ self.NextButton.setText(self.__tr("Finish"))
+ elif typ == BUTTON_REMOVE:
+ self.NextButton.setText(self.__tr("Remove"))
+
+
+ def updateStepText(self, p):
+ self.StepText.setText(self.__tr("Step %s of %s"%(p+1, self.max_page+1))) #Python 3.2
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SetupDialog",s,c)
+
+
diff --git a/ui5/setupdialog_base.py b/ui5/setupdialog_base.py
new file mode 100644
index 000000000..59cd4a995
--- /dev/null
+++ b/ui5/setupdialog_base.py
@@ -0,0 +1,387 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'setupdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.DiscoveryPage = QtWidgets.QWidget()
+ self.DiscoveryPage.setObjectName("DiscoveryPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.DiscoveryPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.DiscoveryPage)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 2)
+ self.line = QtWidgets.QFrame(self.DiscoveryPage)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.groupBox = QtWidgets.QGroupBox(self.DiscoveryPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.UsbRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.UsbRadioButton.setChecked(True)
+ self.UsbRadioButton.setObjectName("UsbRadioButton")
+ self.gridlayout2.addWidget(self.UsbRadioButton, 0, 0, 1, 1)
+ self.NetworkRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.NetworkRadioButton.setObjectName("NetworkRadioButton")
+ self.gridlayout2.addWidget(self.NetworkRadioButton, 1, 0, 1, 1)
+ self.ParallelRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.ParallelRadioButton.setEnabled(True)
+ self.ParallelRadioButton.setObjectName("ParallelRadioButton")
+ self.gridlayout2.addWidget(self.ParallelRadioButton, 3, 0, 1, 1)
+ self.WirelessButton = QtWidgets.QRadioButton(self.groupBox)
+ self.WirelessButton.setObjectName("WirelessButton")
+ self.gridlayout2.addWidget(self.WirelessButton, 2, 0, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 2, 0, 1, 2)
+ self.AdvancedButton = QtWidgets.QPushButton(self.DiscoveryPage)
+ self.AdvancedButton.setText("")
+ self.AdvancedButton.setObjectName("AdvancedButton")
+ self.gridlayout1.addWidget(self.AdvancedButton, 3, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(381, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ self.AdvancedStackedWidget = QtWidgets.QStackedWidget(self.DiscoveryPage)
+ self.AdvancedStackedWidget.setObjectName("AdvancedStackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.DiscoveryOptionsGroupBox = QtWidgets.QGroupBox(self.page)
+ self.DiscoveryOptionsGroupBox.setObjectName("DiscoveryOptionsGroupBox")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.DiscoveryOptionsGroupBox)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label_2 = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.label_2.setObjectName("label_2")
+ self.hboxlayout.addWidget(self.label_2)
+ self.SearchLineEdit = QtWidgets.QLineEdit(self.DiscoveryOptionsGroupBox)
+ self.SearchLineEdit.setObjectName("SearchLineEdit")
+ self.hboxlayout.addWidget(self.SearchLineEdit)
+ self.gridlayout4.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.DeviceTypeLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeLabel.setObjectName("DeviceTypeLabel")
+ self.hboxlayout1.addWidget(self.DeviceTypeLabel)
+ self.DeviceTypeComboBox = QtWidgets.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeComboBox.setObjectName("DeviceTypeComboBox")
+ self.hboxlayout1.addWidget(self.DeviceTypeComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout1, 0, 1, 1, 2)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.NetworkDiscoveryMethodLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodLabel.setObjectName("NetworkDiscoveryMethodLabel")
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodLabel)
+ self.NetworkDiscoveryMethodComboBox = QtWidgets.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodComboBox.setObjectName("NetworkDiscoveryMethodComboBox")
+ self.NetworkDiscoveryMethodComboBox.addItem("")
+ self.NetworkDiscoveryMethodComboBox.addItem("")
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout2, 1, 0, 1, 1)
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.NetworkTimeoutLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutLabel.setObjectName("NetworkTimeoutLabel")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutLabel)
+ self.NetworkTimeoutSpinBox = QtWidgets.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutSpinBox.setMinimum(1)
+ self.NetworkTimeoutSpinBox.setMaximum(90)
+ self.NetworkTimeoutSpinBox.setProperty("value", 5)
+ self.NetworkTimeoutSpinBox.setObjectName("NetworkTimeoutSpinBox")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutSpinBox)
+ self.gridlayout4.addLayout(self.hboxlayout3, 1, 1, 1, 1)
+ self.hboxlayout4 = QtWidgets.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.NetworkTTLLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLLabel.setObjectName("NetworkTTLLabel")
+ self.hboxlayout4.addWidget(self.NetworkTTLLabel)
+ self.NetworkTTLSpinBox = QtWidgets.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLSpinBox.setSuffix("")
+ self.NetworkTTLSpinBox.setMinimum(1)
+ self.NetworkTTLSpinBox.setMaximum(8)
+ self.NetworkTTLSpinBox.setProperty("value", 4)
+ self.NetworkTTLSpinBox.setObjectName("NetworkTTLSpinBox")
+ self.hboxlayout4.addWidget(self.NetworkTTLSpinBox)
+ self.gridlayout4.addLayout(self.hboxlayout4, 1, 2, 1, 1)
+ self.gridlayout3.addWidget(self.DiscoveryOptionsGroupBox, 0, 0, 1, 1)
+ self.ManualGroupBox = QtWidgets.QGroupBox(self.page)
+ self.ManualGroupBox.setCheckable(True)
+ self.ManualGroupBox.setObjectName("ManualGroupBox")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.ManualGroupBox)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.ManualParamLabel = QtWidgets.QLabel(self.ManualGroupBox)
+ self.ManualParamLabel.setObjectName("ManualParamLabel")
+ self.gridlayout5.addWidget(self.ManualParamLabel, 0, 0, 1, 1)
+ self.ManualParamLineEdit = QtWidgets.QLineEdit(self.ManualGroupBox)
+ self.ManualParamLineEdit.setObjectName("ManualParamLineEdit")
+ self.gridlayout5.addWidget(self.ManualParamLineEdit, 0, 1, 1, 1)
+ self.JetDirectLabel = QtWidgets.QLabel(self.ManualGroupBox)
+ self.JetDirectLabel.setObjectName("JetDirectLabel")
+ self.gridlayout5.addWidget(self.JetDirectLabel, 0, 2, 1, 1)
+ self.JetDirectSpinBox = QtWidgets.QSpinBox(self.ManualGroupBox)
+ self.JetDirectSpinBox.setMinimum(1)
+ self.JetDirectSpinBox.setMaximum(3)
+ self.JetDirectSpinBox.setObjectName("JetDirectSpinBox")
+ self.gridlayout5.addWidget(self.JetDirectSpinBox, 0, 3, 1, 1)
+ self.gridlayout3.addWidget(self.ManualGroupBox, 1, 0, 1, 1)
+ self.AdvancedStackedWidget.addWidget(self.page)
+ self.page_4 = QtWidgets.QWidget()
+ self.page_4.setObjectName("page_4")
+ self.AdvancedStackedWidget.addWidget(self.page_4)
+ self.gridlayout1.addWidget(self.AdvancedStackedWidget, 4, 0, 1, 2)
+ spacerItem1 = QtWidgets.QSpacerItem(478, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 5, 0, 1, 2)
+ self.StackedWidget.addWidget(self.DiscoveryPage)
+ self.page_2 = QtWidgets.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.page_2)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_4 = QtWidgets.QLabel(self.page_2)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_4.setFont(font)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout6.addWidget(self.label_4, 0, 0, 1, 2)
+ self.line_2 = QtWidgets.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout6.addWidget(self.line_2, 1, 0, 1, 3)
+ self.DevicesTableWidget = QtWidgets.QTableWidget(self.page_2)
+ self.DevicesTableWidget.setAlternatingRowColors(True)
+ self.DevicesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.DevicesTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.DevicesTableWidget.setObjectName("DevicesTableWidget")
+ self.DevicesTableWidget.setColumnCount(0)
+ self.DevicesTableWidget.setRowCount(0)
+ self.gridlayout6.addWidget(self.DevicesTableWidget, 2, 0, 1, 3)
+ self.hboxlayout5 = QtWidgets.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.DevicesFoundIcon = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundIcon.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundIcon.setSizePolicy(sizePolicy)
+ self.DevicesFoundIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.DevicesFoundIcon.setText("")
+ self.DevicesFoundIcon.setObjectName("DevicesFoundIcon")
+ self.hboxlayout5.addWidget(self.DevicesFoundIcon)
+ self.DevicesFoundLabel = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundLabel.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundLabel.setSizePolicy(sizePolicy)
+ self.DevicesFoundLabel.setWordWrap(True)
+ self.DevicesFoundLabel.setObjectName("DevicesFoundLabel")
+ self.hboxlayout5.addWidget(self.DevicesFoundLabel)
+ self.gridlayout6.addLayout(self.hboxlayout5, 3, 0, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(21, 28, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem2, 3, 1, 1, 1)
+ self.RefreshButton = QtWidgets.QPushButton(self.page_2)
+ self.RefreshButton.setObjectName("RefreshButton")
+ self.gridlayout6.addWidget(self.RefreshButton, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.page_2)
+ self.page_3 = QtWidgets.QWidget()
+ self.page_3.setObjectName("page_3")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.page_3)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_5 = QtWidgets.QLabel(self.page_3)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_5.setFont(font)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout7.addWidget(self.label_5, 0, 0, 1, 1)
+ self.line_3 = QtWidgets.QFrame(self.page_3)
+ self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout7.addWidget(self.line_3, 1, 0, 1, 1)
+ self.SetupPrintGroupBox = QtWidgets.QGroupBox(self.page_3)
+ self.SetupPrintGroupBox.setObjectName("SetupPrintGroupBox")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.SetupPrintGroupBox)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_6 = QtWidgets.QLabel(self.SetupPrintGroupBox)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout8.addWidget(self.label_6, 0, 0, 1, 1)
+ self.PrinterNameLineEdit = QtWidgets.QLineEdit(self.SetupPrintGroupBox)
+ self.PrinterNameLineEdit.setObjectName("PrinterNameLineEdit")
+ self.gridlayout8.addWidget(self.PrinterNameLineEdit, 0, 1, 1, 2)
+ self.label_7 = QtWidgets.QLabel(self.SetupPrintGroupBox)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout8.addWidget(self.label_7, 1, 0, 1, 1)
+ self.PrinterDescriptionLineEdit = QtWidgets.QLineEdit(self.SetupPrintGroupBox)
+ self.PrinterDescriptionLineEdit.setObjectName("PrinterDescriptionLineEdit")
+ self.gridlayout8.addWidget(self.PrinterDescriptionLineEdit, 1, 1, 1, 2)
+ self.label_8 = QtWidgets.QLabel(self.SetupPrintGroupBox)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout8.addWidget(self.label_8, 2, 0, 1, 1)
+ self.PrinterLocationLineEdit = QtWidgets.QLineEdit(self.SetupPrintGroupBox)
+ self.PrinterLocationLineEdit.setObjectName("PrinterLocationLineEdit")
+ self.gridlayout8.addWidget(self.PrinterLocationLineEdit, 2, 1, 1, 2)
+ self.label_3 = QtWidgets.QLabel(self.SetupPrintGroupBox)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout8.addWidget(self.label_3, 3, 0, 1, 1)
+ self.PPDFileLineEdit = QtWidgets.QLineEdit(self.SetupPrintGroupBox)
+ self.PPDFileLineEdit.setReadOnly(True)
+ self.PPDFileLineEdit.setObjectName("PPDFileLineEdit")
+ self.gridlayout8.addWidget(self.PPDFileLineEdit, 3, 1, 1, 1)
+ self.OtherPPDButton = QtWidgets.QToolButton(self.SetupPrintGroupBox)
+ self.OtherPPDButton.setText("")
+ self.OtherPPDButton.setObjectName("OtherPPDButton")
+ self.gridlayout8.addWidget(self.OtherPPDButton, 3, 2, 1, 1)
+ self.gridlayout7.addWidget(self.SetupPrintGroupBox, 2, 0, 1, 1)
+ self.SetupFaxGroupBox = QtWidgets.QGroupBox(self.page_3)
+ self.SetupFaxGroupBox.setCheckable(True)
+ self.SetupFaxGroupBox.setObjectName("SetupFaxGroupBox")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.SetupFaxGroupBox)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_9 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout9.addWidget(self.label_9, 0, 0, 1, 1)
+ self.FaxNameLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNameLineEdit.setObjectName("FaxNameLineEdit")
+ self.gridlayout9.addWidget(self.FaxNameLineEdit, 0, 1, 1, 3)
+ self.label_10 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout9.addWidget(self.label_10, 1, 0, 1, 1)
+ self.FaxNumberLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout9.addWidget(self.FaxNumberLineEdit, 1, 1, 1, 1)
+ self.label_11 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_11.setObjectName("label_11")
+ self.gridlayout9.addWidget(self.label_11, 1, 2, 1, 1)
+ self.NameCompanyLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.NameCompanyLineEdit.setObjectName("NameCompanyLineEdit")
+ self.gridlayout9.addWidget(self.NameCompanyLineEdit, 1, 3, 1, 1)
+ self.label_12 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout9.addWidget(self.label_12, 2, 0, 1, 1)
+ self.FaxDescriptionLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxDescriptionLineEdit.setObjectName("FaxDescriptionLineEdit")
+ self.gridlayout9.addWidget(self.FaxDescriptionLineEdit, 2, 1, 1, 3)
+ self.label_13 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout9.addWidget(self.label_13, 3, 0, 1, 1)
+ self.FaxLocationLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxLocationLineEdit.setObjectName("FaxLocationLineEdit")
+ self.gridlayout9.addWidget(self.FaxLocationLineEdit, 3, 1, 1, 3)
+ self.gridlayout7.addWidget(self.SetupFaxGroupBox, 3, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(341, 16, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem3, 4, 0, 1, 1)
+ self.SendTestPageCheckBox = QtWidgets.QCheckBox(self.page_3)
+ self.SendTestPageCheckBox.setChecked(False)
+ self.SendTestPageCheckBox.setObjectName("SendTestPageCheckBox")
+ self.gridlayout7.addWidget(self.SendTestPageCheckBox, 5, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_3)
+ self.page_5 = QtWidgets.QWidget()
+ self.page_5.setObjectName("page_5")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.page_5)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_15 = QtWidgets.QLabel(self.page_5)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_15.setFont(font)
+ self.label_15.setObjectName("label_15")
+ self.gridlayout10.addWidget(self.label_15, 0, 0, 1, 1)
+ self.line_4 = QtWidgets.QFrame(self.page_5)
+ self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout10.addWidget(self.line_4, 1, 0, 1, 1)
+ self.RemoveDevicesTableWidget = QtWidgets.QTableWidget(self.page_5)
+ self.RemoveDevicesTableWidget.setAlternatingRowColors(True)
+ self.RemoveDevicesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.RemoveDevicesTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.RemoveDevicesTableWidget.setObjectName("RemoveDevicesTableWidget")
+ self.RemoveDevicesTableWidget.setColumnCount(0)
+ self.RemoveDevicesTableWidget.setRowCount(0)
+ self.gridlayout10.addWidget(self.RemoveDevicesTableWidget, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_5)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 1, 0, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(181, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem4, 1, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 1, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 1, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 1, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ self.AdvancedStackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Setup"))
+ self.label.setText(_translate("Dialog", "Device Discovery"))
+ self.groupBox.setTitle(_translate("Dialog", "Connection (I/O) Type"))
+ self.UsbRadioButton.setText(_translate("Dialog", "Universal Serial Bus (USB)"))
+ self.NetworkRadioButton.setText(_translate("Dialog", "Network/Ethernet/Wireless network (direct connection or JetDirect)"))
+ self.ParallelRadioButton.setText(_translate("Dialog", "Parallel Port (LPT)"))
+ self.WirelessButton.setText(_translate("Dialog", "Wireless/802.11 (requires a temporary USB connection and is only available for select devices)"))
+ self.DiscoveryOptionsGroupBox.setTitle(_translate("Dialog", "Discovery Options"))
+ self.label_2.setText(_translate("Dialog", "Search term:"))
+ self.DeviceTypeLabel.setText(_translate("Dialog", "Type:"))
+ self.NetworkDiscoveryMethodLabel.setText(_translate("Dialog", "Network discovery method:"))
+ self.NetworkDiscoveryMethodComboBox.setItemText(0, _translate("Dialog", "SLP"))
+ self.NetworkDiscoveryMethodComboBox.setItemText(1, _translate("Dialog", "mDNS/Bonjour"))
+ self.NetworkTimeoutLabel.setText(_translate("Dialog", "Timeout:"))
+ self.NetworkTimeoutSpinBox.setSuffix(_translate("Dialog", "sec"))
+ self.NetworkTTLLabel.setText(_translate("Dialog", "TTL:"))
+ self.ManualGroupBox.setTitle(_translate("Dialog", "Manual Discovery"))
+ self.ManualParamLabel.setText(_translate("Dialog", "Parameter:"))
+ self.JetDirectLabel.setText(_translate("Dialog", "Jetdirect port:"))
+ self.label_4.setText(_translate("Dialog", "Select From Discovered Devices"))
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesFoundLabel.setText(_translate("Dialog", "Found %1 devices on the %1 bus."))
+ self.RefreshButton.setText(_translate("Dialog", "Refresh"))
+ self.label_5.setText(_translate("Dialog", "Setup Device"))
+ self.SetupPrintGroupBox.setTitle(_translate("Dialog", "Printer Setup"))
+ self.label_6.setText(_translate("Dialog", "Printer name:"))
+ self.label_7.setText(_translate("Dialog", "Description:"))
+ self.label_8.setText(_translate("Dialog", "Location:"))
+ self.label_3.setText(_translate("Dialog", "PPD file:"))
+ self.SetupFaxGroupBox.setTitle(_translate("Dialog", "Fax Setup"))
+ self.label_9.setText(_translate("Dialog", "Fax name:"))
+ self.label_10.setText(_translate("Dialog", "Fax number:"))
+ self.label_11.setText(_translate("Dialog", "Name/company:"))
+ self.label_12.setText(_translate("Dialog", "Description:"))
+ self.label_13.setText(_translate("Dialog", "Location:"))
+ self.SendTestPageCheckBox.setText(_translate("Dialog", "Send test page to printer"))
+ self.label_15.setText(_translate("Dialog", "Select Printer/Fax Queues to Remove"))
+ self.RemoveDevicesTableWidget.setSortingEnabled(False)
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
diff --git a/ui5/setupdialog_base.ui b/ui5/setupdialog_base.ui
new file mode 100644
index 000000000..29ade408e
--- /dev/null
+++ b/ui5/setupdialog_base.ui
@@ -0,0 +1,654 @@
+<ui version="4.0" >
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="windowModality" >
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>HP Device Manager - Setup</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="5" >
+ <widget class="QStackedWidget" name="StackedWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="DiscoveryPage" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Device Discovery</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Connection (I/O) Type</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QRadioButton" name="UsbRadioButton" >
+ <property name="text" >
+ <string>Universal Serial Bus (USB)</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QRadioButton" name="NetworkRadioButton" >
+ <property name="text" >
+ <string>Network/Ethernet/Wireless network (direct connection or JetDirect)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QRadioButton" name="ParallelRadioButton" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="text" >
+ <string>Parallel Port (LPT)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QRadioButton" name="WirelessButton" >
+ <property name="text" >
+ <string>Wireless/802.11 (requires a temporary USB connection and is only available for select devices)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QPushButton" name="AdvancedButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>381</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <widget class="QStackedWidget" name="AdvancedStackedWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QGroupBox" name="DiscoveryOptionsGroupBox" >
+ <property name="title" >
+ <string>Discovery Options</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Search term:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="SearchLineEdit" />
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="DeviceTypeLabel" >
+ <property name="text" >
+ <string>Type:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="DeviceTypeComboBox" />
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="NetworkDiscoveryMethodLabel" >
+ <property name="text" >
+ <string>Network discovery method:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="NetworkDiscoveryMethodComboBox" >
+ <item>
+ <property name="text" >
+ <string>SLP</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>mDNS/Bonjour</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="NetworkTimeoutLabel" >
+ <property name="text" >
+ <string>Timeout:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="NetworkTimeoutSpinBox" >
+ <property name="suffix" >
+ <string>sec</string>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>90</number>
+ </property>
+ <property name="value" >
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="2" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="NetworkTTLLabel" >
+ <property name="text" >
+ <string>TTL:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="NetworkTTLSpinBox" >
+ <property name="suffix" >
+ <string/>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>8</number>
+ </property>
+ <property name="value" >
+ <number>4</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QGroupBox" name="ManualGroupBox" >
+ <property name="title" >
+ <string>Manual Discovery</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="ManualParamLabel" >
+ <property name="text" >
+ <string>Parameter:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="ManualParamLineEdit" />
+ </item>
+ <item row="0" column="2" >
+ <widget class="QLabel" name="JetDirectLabel" >
+ <property name="text" >
+ <string>Jetdirect port:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" >
+ <widget class="QSpinBox" name="JetDirectSpinBox" >
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_4" />
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>478</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label_4" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select From Discovered Devices</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3" >
+ <widget class="Line" name="line_2" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3" >
+ <widget class="QTableWidget" name="DevicesTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="sortingEnabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QLabel" name="DevicesFoundIcon" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize" >
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="DevicesFoundLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Found %1 devices on the %1 bus.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>21</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QPushButton" name="RefreshButton" >
+ <property name="text" >
+ <string>Refresh</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_3" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Setup Device</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_3" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QGroupBox" name="SetupPrintGroupBox" >
+ <property name="title" >
+ <string>Printer Setup</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Printer name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QLineEdit" name="PrinterNameLineEdit" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>Description:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2" >
+ <widget class="QLineEdit" name="PrinterDescriptionLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_8" >
+ <property name="text" >
+ <string>Location:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2" >
+ <widget class="QLineEdit" name="PrinterLocationLineEdit" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>PPD file:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="PPDFileLineEdit" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QToolButton" name="OtherPPDButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QGroupBox" name="SetupFaxGroupBox" >
+ <property name="title" >
+ <string>Fax Setup</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_9" >
+ <property name="text" >
+ <string>Fax name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3" >
+ <widget class="QLineEdit" name="FaxNameLineEdit" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_10" >
+ <property name="text" >
+ <string>Fax number:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="FaxNumberLineEdit" />
+ </item>
+ <item row="1" column="2" >
+ <widget class="QLabel" name="label_11" >
+ <property name="text" >
+ <string>Name/company:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3" >
+ <widget class="QLineEdit" name="NameCompanyLineEdit" />
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_12" >
+ <property name="text" >
+ <string>Description:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="3" >
+ <widget class="QLineEdit" name="FaxDescriptionLineEdit" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_13" >
+ <property name="text" >
+ <string>Location:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="3" >
+ <widget class="QLineEdit" name="FaxLocationLineEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>341</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QCheckBox" name="SendTestPageCheckBox" >
+ <property name="text" >
+ <string>Send test page to printer</string>
+ </property>
+ <property name="checked" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_5" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_15" >
+ <property name="font" >
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Select Printer/Fax Queues to Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line_4" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QTableWidget" name="RemoveDevicesTableWidget" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior" >
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="sortingEnabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="StepText" >
+ <property name="text" >
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>181</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="BackButton" >
+ <property name="text" >
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3" >
+ <widget class="QPushButton" name="NextButton" >
+ <property name="text" >
+ <string>Next ></string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="4" >
+ <widget class="QPushButton" name="CancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/setupdialog_base5.py b/ui5/setupdialog_base5.py
new file mode 100644
index 000000000..4f7260789
--- /dev/null
+++ b/ui5/setupdialog_base5.py
@@ -0,0 +1,387 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/setupdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.DiscoveryPage = QtWidgets.QWidget()
+ self.DiscoveryPage.setObjectName("DiscoveryPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.DiscoveryPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.DiscoveryPage)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 2)
+ self.line = QtWidgets.QFrame(self.DiscoveryPage)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.groupBox = QtWidgets.QGroupBox(self.DiscoveryPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.UsbRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.UsbRadioButton.setChecked(True)
+ self.UsbRadioButton.setObjectName("UsbRadioButton")
+ self.gridlayout2.addWidget(self.UsbRadioButton, 0, 0, 1, 1)
+ self.NetworkRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.NetworkRadioButton.setObjectName("NetworkRadioButton")
+ self.gridlayout2.addWidget(self.NetworkRadioButton, 1, 0, 1, 1)
+ self.ParallelRadioButton = QtWidgets.QRadioButton(self.groupBox)
+ self.ParallelRadioButton.setEnabled(True)
+ self.ParallelRadioButton.setObjectName("ParallelRadioButton")
+ self.gridlayout2.addWidget(self.ParallelRadioButton, 3, 0, 1, 1)
+ self.WirelessButton = QtWidgets.QRadioButton(self.groupBox)
+ self.WirelessButton.setObjectName("WirelessButton")
+ self.gridlayout2.addWidget(self.WirelessButton, 2, 0, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 2, 0, 1, 2)
+ self.AdvancedButton = QtWidgets.QPushButton(self.DiscoveryPage)
+ self.AdvancedButton.setText("")
+ self.AdvancedButton.setObjectName("AdvancedButton")
+ self.gridlayout1.addWidget(self.AdvancedButton, 3, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(381, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ self.AdvancedStackedWidget = QtWidgets.QStackedWidget(self.DiscoveryPage)
+ self.AdvancedStackedWidget.setObjectName("AdvancedStackedWidget")
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.DiscoveryOptionsGroupBox = QtWidgets.QGroupBox(self.page)
+ self.DiscoveryOptionsGroupBox.setObjectName("DiscoveryOptionsGroupBox")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.DiscoveryOptionsGroupBox)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label_2 = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.label_2.setObjectName("label_2")
+ self.hboxlayout.addWidget(self.label_2)
+ self.SearchLineEdit = QtWidgets.QLineEdit(self.DiscoveryOptionsGroupBox)
+ self.SearchLineEdit.setObjectName("SearchLineEdit")
+ self.hboxlayout.addWidget(self.SearchLineEdit)
+ self.gridlayout4.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.DeviceTypeLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeLabel.setObjectName("DeviceTypeLabel")
+ self.hboxlayout1.addWidget(self.DeviceTypeLabel)
+ self.DeviceTypeComboBox = QtWidgets.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeComboBox.setObjectName("DeviceTypeComboBox")
+ self.hboxlayout1.addWidget(self.DeviceTypeComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout1, 0, 1, 1, 2)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.NetworkDiscoveryMethodLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodLabel.setObjectName("NetworkDiscoveryMethodLabel")
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodLabel)
+ self.NetworkDiscoveryMethodComboBox = QtWidgets.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodComboBox.setObjectName("NetworkDiscoveryMethodComboBox")
+ self.NetworkDiscoveryMethodComboBox.addItem("")
+ self.NetworkDiscoveryMethodComboBox.addItem("")
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout2, 1, 0, 1, 1)
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.NetworkTimeoutLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutLabel.setObjectName("NetworkTimeoutLabel")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutLabel)
+ self.NetworkTimeoutSpinBox = QtWidgets.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutSpinBox.setMinimum(1)
+ self.NetworkTimeoutSpinBox.setMaximum(90)
+ self.NetworkTimeoutSpinBox.setProperty("value", 5)
+ self.NetworkTimeoutSpinBox.setObjectName("NetworkTimeoutSpinBox")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutSpinBox)
+ self.gridlayout4.addLayout(self.hboxlayout3, 1, 1, 1, 1)
+ self.hboxlayout4 = QtWidgets.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.NetworkTTLLabel = QtWidgets.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLLabel.setObjectName("NetworkTTLLabel")
+ self.hboxlayout4.addWidget(self.NetworkTTLLabel)
+ self.NetworkTTLSpinBox = QtWidgets.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLSpinBox.setSuffix("")
+ self.NetworkTTLSpinBox.setMinimum(1)
+ self.NetworkTTLSpinBox.setMaximum(8)
+ self.NetworkTTLSpinBox.setProperty("value", 4)
+ self.NetworkTTLSpinBox.setObjectName("NetworkTTLSpinBox")
+ self.hboxlayout4.addWidget(self.NetworkTTLSpinBox)
+ self.gridlayout4.addLayout(self.hboxlayout4, 1, 2, 1, 1)
+ self.gridlayout3.addWidget(self.DiscoveryOptionsGroupBox, 0, 0, 1, 1)
+ self.ManualGroupBox = QtWidgets.QGroupBox(self.page)
+ self.ManualGroupBox.setCheckable(True)
+ self.ManualGroupBox.setObjectName("ManualGroupBox")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.ManualGroupBox)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.ManualParamLabel = QtWidgets.QLabel(self.ManualGroupBox)
+ self.ManualParamLabel.setObjectName("ManualParamLabel")
+ self.gridlayout5.addWidget(self.ManualParamLabel, 0, 0, 1, 1)
+ self.ManualParamLineEdit = QtWidgets.QLineEdit(self.ManualGroupBox)
+ self.ManualParamLineEdit.setObjectName("ManualParamLineEdit")
+ self.gridlayout5.addWidget(self.ManualParamLineEdit, 0, 1, 1, 1)
+ self.JetDirectLabel = QtWidgets.QLabel(self.ManualGroupBox)
+ self.JetDirectLabel.setObjectName("JetDirectLabel")
+ self.gridlayout5.addWidget(self.JetDirectLabel, 0, 2, 1, 1)
+ self.JetDirectSpinBox = QtWidgets.QSpinBox(self.ManualGroupBox)
+ self.JetDirectSpinBox.setMinimum(1)
+ self.JetDirectSpinBox.setMaximum(3)
+ self.JetDirectSpinBox.setObjectName("JetDirectSpinBox")
+ self.gridlayout5.addWidget(self.JetDirectSpinBox, 0, 3, 1, 1)
+ self.gridlayout3.addWidget(self.ManualGroupBox, 1, 0, 1, 1)
+ self.AdvancedStackedWidget.addWidget(self.page)
+ self.page_4 = QtWidgets.QWidget()
+ self.page_4.setObjectName("page_4")
+ self.AdvancedStackedWidget.addWidget(self.page_4)
+ self.gridlayout1.addWidget(self.AdvancedStackedWidget, 4, 0, 1, 2)
+ spacerItem1 = QtWidgets.QSpacerItem(478, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 5, 0, 1, 2)
+ self.StackedWidget.addWidget(self.DiscoveryPage)
+ self.page_2 = QtWidgets.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.page_2)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_4 = QtWidgets.QLabel(self.page_2)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_4.setFont(font)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout6.addWidget(self.label_4, 0, 0, 1, 2)
+ self.line_2 = QtWidgets.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout6.addWidget(self.line_2, 1, 0, 1, 3)
+ self.DevicesTableWidget = QtWidgets.QTableWidget(self.page_2)
+ self.DevicesTableWidget.setAlternatingRowColors(True)
+ self.DevicesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.DevicesTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.DevicesTableWidget.setObjectName("DevicesTableWidget")
+ self.DevicesTableWidget.setColumnCount(0)
+ self.DevicesTableWidget.setRowCount(0)
+ self.gridlayout6.addWidget(self.DevicesTableWidget, 2, 0, 1, 3)
+ self.hboxlayout5 = QtWidgets.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.DevicesFoundIcon = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundIcon.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundIcon.setSizePolicy(sizePolicy)
+ self.DevicesFoundIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.DevicesFoundIcon.setText("")
+ self.DevicesFoundIcon.setObjectName("DevicesFoundIcon")
+ self.hboxlayout5.addWidget(self.DevicesFoundIcon)
+ self.DevicesFoundLabel = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundLabel.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundLabel.setSizePolicy(sizePolicy)
+ self.DevicesFoundLabel.setWordWrap(True)
+ self.DevicesFoundLabel.setObjectName("DevicesFoundLabel")
+ self.hboxlayout5.addWidget(self.DevicesFoundLabel)
+ self.gridlayout6.addLayout(self.hboxlayout5, 3, 0, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(21, 28, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem2, 3, 1, 1, 1)
+ self.RefreshButton = QtWidgets.QPushButton(self.page_2)
+ self.RefreshButton.setObjectName("RefreshButton")
+ self.gridlayout6.addWidget(self.RefreshButton, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.page_2)
+ self.page_3 = QtWidgets.QWidget()
+ self.page_3.setObjectName("page_3")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.page_3)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_5 = QtWidgets.QLabel(self.page_3)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_5.setFont(font)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout7.addWidget(self.label_5, 0, 0, 1, 1)
+ self.line_3 = QtWidgets.QFrame(self.page_3)
+ self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout7.addWidget(self.line_3, 1, 0, 1, 1)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.page_3)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_6 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout8.addWidget(self.label_6, 0, 0, 1, 1)
+ self.PrinterNameLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.PrinterNameLineEdit.setObjectName("PrinterNameLineEdit")
+ self.gridlayout8.addWidget(self.PrinterNameLineEdit, 0, 1, 1, 2)
+ self.label_7 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout8.addWidget(self.label_7, 1, 0, 1, 1)
+ self.PrinterDescriptionLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.PrinterDescriptionLineEdit.setObjectName("PrinterDescriptionLineEdit")
+ self.gridlayout8.addWidget(self.PrinterDescriptionLineEdit, 1, 1, 1, 2)
+ self.label_8 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout8.addWidget(self.label_8, 2, 0, 1, 1)
+ self.PrinterLocationLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.PrinterLocationLineEdit.setObjectName("PrinterLocationLineEdit")
+ self.gridlayout8.addWidget(self.PrinterLocationLineEdit, 2, 1, 1, 2)
+ self.label_3 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout8.addWidget(self.label_3, 3, 0, 1, 1)
+ self.PPDFileLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.PPDFileLineEdit.setReadOnly(True)
+ self.PPDFileLineEdit.setObjectName("PPDFileLineEdit")
+ self.gridlayout8.addWidget(self.PPDFileLineEdit, 3, 1, 1, 1)
+ self.OtherPPDButton = QtWidgets.QToolButton(self.groupBox_3)
+ self.OtherPPDButton.setText("")
+ self.OtherPPDButton.setObjectName("OtherPPDButton")
+ self.gridlayout8.addWidget(self.OtherPPDButton, 3, 2, 1, 1)
+ self.gridlayout7.addWidget(self.groupBox_3, 2, 0, 1, 1)
+ self.SetupFaxGroupBox = QtWidgets.QGroupBox(self.page_3)
+ self.SetupFaxGroupBox.setCheckable(True)
+ self.SetupFaxGroupBox.setObjectName("SetupFaxGroupBox")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.SetupFaxGroupBox)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_9 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout9.addWidget(self.label_9, 0, 0, 1, 1)
+ self.FaxNameLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNameLineEdit.setObjectName("FaxNameLineEdit")
+ self.gridlayout9.addWidget(self.FaxNameLineEdit, 0, 1, 1, 3)
+ self.label_10 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout9.addWidget(self.label_10, 1, 0, 1, 1)
+ self.FaxNumberLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout9.addWidget(self.FaxNumberLineEdit, 1, 1, 1, 1)
+ self.label_11 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_11.setObjectName("label_11")
+ self.gridlayout9.addWidget(self.label_11, 1, 2, 1, 1)
+ self.NameCompanyLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.NameCompanyLineEdit.setObjectName("NameCompanyLineEdit")
+ self.gridlayout9.addWidget(self.NameCompanyLineEdit, 1, 3, 1, 1)
+ self.label_12 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout9.addWidget(self.label_12, 2, 0, 1, 1)
+ self.FaxDescriptionLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxDescriptionLineEdit.setObjectName("FaxDescriptionLineEdit")
+ self.gridlayout9.addWidget(self.FaxDescriptionLineEdit, 2, 1, 1, 3)
+ self.label_13 = QtWidgets.QLabel(self.SetupFaxGroupBox)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout9.addWidget(self.label_13, 3, 0, 1, 1)
+ self.FaxLocationLineEdit = QtWidgets.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxLocationLineEdit.setObjectName("FaxLocationLineEdit")
+ self.gridlayout9.addWidget(self.FaxLocationLineEdit, 3, 1, 1, 3)
+ self.gridlayout7.addWidget(self.SetupFaxGroupBox, 3, 0, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(341, 16, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem3, 4, 0, 1, 1)
+ self.SendTestPageCheckBox = QtWidgets.QCheckBox(self.page_3)
+ self.SendTestPageCheckBox.setChecked(False)
+ self.SendTestPageCheckBox.setObjectName("SendTestPageCheckBox")
+ self.gridlayout7.addWidget(self.SendTestPageCheckBox, 5, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_3)
+ self.page_5 = QtWidgets.QWidget()
+ self.page_5.setObjectName("page_5")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.page_5)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_15 = QtWidgets.QLabel(self.page_5)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_15.setFont(font)
+ self.label_15.setObjectName("label_15")
+ self.gridlayout10.addWidget(self.label_15, 0, 0, 1, 1)
+ self.line_4 = QtWidgets.QFrame(self.page_5)
+ self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout10.addWidget(self.line_4, 1, 0, 1, 1)
+ self.RemoveDevicesTableWidget = QtWidgets.QTableWidget(self.page_5)
+ self.RemoveDevicesTableWidget.setAlternatingRowColors(True)
+ self.RemoveDevicesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.RemoveDevicesTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.RemoveDevicesTableWidget.setObjectName("RemoveDevicesTableWidget")
+ self.RemoveDevicesTableWidget.setColumnCount(0)
+ self.RemoveDevicesTableWidget.setRowCount(0)
+ self.gridlayout10.addWidget(self.RemoveDevicesTableWidget, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_5)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 1, 0, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(181, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem4, 1, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 1, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 1, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 1, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ self.AdvancedStackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Setup"))
+ self.label.setText(_translate("Dialog", "Device Discovery"))
+ self.groupBox.setTitle(_translate("Dialog", "Connection (I/O) Type"))
+ self.UsbRadioButton.setText(_translate("Dialog", "Universal Serial Bus (USB)"))
+ self.NetworkRadioButton.setText(_translate("Dialog", "Network/Ethernet/Wireless network (direct connection or JetDirect)"))
+ self.ParallelRadioButton.setText(_translate("Dialog", "Parallel Port (LPT)"))
+ self.WirelessButton.setText(_translate("Dialog", "Wireless/802.11 (requires a temporary USB connection and is only available for select devices)"))
+ self.DiscoveryOptionsGroupBox.setTitle(_translate("Dialog", "Discovery Options"))
+ self.label_2.setText(_translate("Dialog", "Search term:"))
+ self.DeviceTypeLabel.setText(_translate("Dialog", "Type:"))
+ self.NetworkDiscoveryMethodLabel.setText(_translate("Dialog", "Network discovery method:"))
+ self.NetworkDiscoveryMethodComboBox.setItemText(0, _translate("Dialog", "SLP"))
+ self.NetworkDiscoveryMethodComboBox.setItemText(1, _translate("Dialog", "mDNS/Bonjour"))
+ self.NetworkTimeoutLabel.setText(_translate("Dialog", "Timeout:"))
+ self.NetworkTimeoutSpinBox.setSuffix(_translate("Dialog", "sec"))
+ self.NetworkTTLLabel.setText(_translate("Dialog", "TTL:"))
+ self.ManualGroupBox.setTitle(_translate("Dialog", "Manual Discovery"))
+ self.ManualParamLabel.setText(_translate("Dialog", "Parameter:"))
+ self.JetDirectLabel.setText(_translate("Dialog", "Jetdirect port:"))
+ self.label_4.setText(_translate("Dialog", "Select From Discovered Devices"))
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesFoundLabel.setText(_translate("Dialog", "Found %1 devices on the %1 bus."))
+ self.RefreshButton.setText(_translate("Dialog", "Refresh"))
+ self.label_5.setText(_translate("Dialog", "Setup Device"))
+ self.groupBox_3.setTitle(_translate("Dialog", "Printer Setup"))
+ self.label_6.setText(_translate("Dialog", "Printer name:"))
+ self.label_7.setText(_translate("Dialog", "Description:"))
+ self.label_8.setText(_translate("Dialog", "Location:"))
+ self.label_3.setText(_translate("Dialog", "PPD file:"))
+ self.SetupFaxGroupBox.setTitle(_translate("Dialog", "Fax Setup"))
+ self.label_9.setText(_translate("Dialog", "Fax name:"))
+ self.label_10.setText(_translate("Dialog", "Fax number:"))
+ self.label_11.setText(_translate("Dialog", "Name/company:"))
+ self.label_12.setText(_translate("Dialog", "Description:"))
+ self.label_13.setText(_translate("Dialog", "Location:"))
+ self.SendTestPageCheckBox.setText(_translate("Dialog", "Send test page to printer"))
+ self.label_15.setText(_translate("Dialog", "Select Printer/Fax Queues to Remove"))
+ self.RemoveDevicesTableWidget.setSortingEnabled(False)
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
diff --git a/ui5/systemtray.py b/ui5/systemtray.py
new file mode 100644
index 000000000..5b69d2be9
--- /dev/null
+++ b/ui5/systemtray.py
@@ -0,0 +1,862 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+
+# Std Lib
+import sys
+import struct
+import select
+import os
+import signal
+import os.path
+import time
+
+# Local
+from base.g import *
+from base import device, utils, models
+from base.codes import *
+from .ui_utils import *
+
+# PyQt
+try:
+ from PyQt5.QtCore import *
+ from PyQt5.QtGui import *
+except ImportError:
+ log.error("Python bindings for Qt4 not found. Try using --qt3. Exiting!")
+ sys.exit(1)
+
+from .systrayframe import SystrayFrame
+
+# dbus (required)
+try:
+ import dbus
+ from dbus import SessionBus, lowlevel
+except ImportError:
+ log.error("Python bindings for dbus not found. Exiting!")
+ sys.exit(1)
+
+import warnings
+# Ignore: .../dbus/connection.py:242: DeprecationWarning: object.__init__() takes no parameters
+# (occurring on Python 2.6/dBus 0.83/Ubuntu 9.04)
+warnings.simplefilter("ignore", DeprecationWarning)
+
+
+# pynotify (optional)
+have_pynotify = True
+try:
+ import notify2 as pynotify
+except ImportError:
+ try:
+ import pynotify
+ except ImportError:
+ have_pynotify = False
+
+
+TRAY_MESSAGE_DELAY = 10000
+HIDE_INACTIVE_DELAY = 5000
+BLIP_DELAY = 2000
+SET_MENU_DELAY = 1000
+MAX_MENU_EVENTS = 10
+UPGRADE_CHECK_DELAY=24*60*60*1000 #1 day
+#CLEAN_EXEC_DELAY=4*60*60*1000 #4 Hrs
+
+ERROR_STATE_TO_ICON = {
+ ERROR_STATE_CLEAR: QSystemTrayIcon.Information,
+ ERROR_STATE_OK: QSystemTrayIcon.Information,
+ ERROR_STATE_WARNING: QSystemTrayIcon.Warning,
+ ERROR_STATE_ERROR: QSystemTrayIcon.Critical,
+ ERROR_STATE_LOW_SUPPLIES: QSystemTrayIcon.Warning,
+ ERROR_STATE_BUSY: QSystemTrayIcon.Warning,
+ ERROR_STATE_LOW_PAPER: QSystemTrayIcon.Warning,
+ ERROR_STATE_PRINTING: QSystemTrayIcon.Information,
+ ERROR_STATE_SCANNING: QSystemTrayIcon.Information,
+ ERROR_STATE_PHOTOCARD: QSystemTrayIcon.Information,
+ ERROR_STATE_FAXING: QSystemTrayIcon.Information,
+ ERROR_STATE_COPYING: QSystemTrayIcon.Information,
+}
+
+if have_pynotify:
+ info = getPynotifyIcon('info')
+ warn = getPynotifyIcon('warning')
+ err = getPynotifyIcon('error')
+ ERROR_STATE_TO_ICON_AND_URGENCY_PYNOTIFY = {
+ ERROR_STATE_CLEAR: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_OK: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_WARNING: (warn, pynotify.URGENCY_NORMAL),
+ ERROR_STATE_ERROR: (err, pynotify.URGENCY_CRITICAL),
+ ERROR_STATE_LOW_SUPPLIES: (warn, pynotify.URGENCY_NORMAL),
+ ERROR_STATE_BUSY: (warn, pynotify.URGENCY_NORMAL),
+ ERROR_STATE_LOW_PAPER: (warn, pynotify.URGENCY_NORMAL),
+ ERROR_STATE_PRINTING: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_SCANNING: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_PHOTOCARD: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_FAXING: (info, pynotify.URGENCY_LOW),
+ ERROR_STATE_COPYING: (info, pynotify.URGENCY_LOW),
+ }
+
+devices = {} # { <device_uri> : HistoryDevice(), ... }
+
+
+class DeviceMenu(QMenu):
+ def __init__(self, title, parent, device_uri, device_hist, index):
+ QMenu.__init__(self, title, parent)
+ self.device_uri = device_uri
+ self.device_hist = device_hist
+ self.index = index
+
+
+ def update(self):
+ self.clear()
+
+ if self.device_hist:
+ first = True
+ for e in self.device_hist:
+ error_state = STATUS_TO_ERROR_STATE_MAP.get(e.event_code, ERROR_STATE_CLEAR)
+ ess = device.queryString(e.event_code, 0)
+
+ a = QAction(QIcon(getStatusListIcon(error_state)[self.index]),
+ "%s %s"%(ess,getTimeDeltaDesc(e.timedate)), self)
+
+ if first:
+ f = a.font()
+ f.setBold(True)
+ a.setFont(f)
+ self.setIcon(QIcon(getStatusListIcon(error_state)[self.index]))
+ first = False
+
+ self.addAction(a)
+
+ else:
+ self.addAction(QIcon(load_pixmap("warning", "16x16")),
+ QApplication.translate("SystemTray", "(No events)", None))
+
+
+
+class HistoryDevice(QObject):
+ def __init__(self, device_uri, needs_update=True):
+ self.needs_update = needs_update
+ self.device_uri = device_uri
+
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(device_uri)
+
+ if bus == 'usb':
+ self.id = serial
+ elif bus == 'net':
+ self.id = host
+ elif bus == 'par':
+ self.id = dev_file
+ else:
+ self.id = 'unknown'
+
+ self.model = models.normalizeModelUIName(model)
+
+ if back_end == 'hp':
+ self.device_type = DEVICE_TYPE_PRINTER
+ self.menu_text = self.__tr("%s Printer (%s)"%(self.model,self.id))
+
+ elif back_end == 'hpaio':
+ self.device_type = DEVICE_TYPE_SCANNER
+ self.menu_text = self.__tr("%s Scanner (%s)"%(self.model,self.id))
+
+ elif back_end == 'hpfax':
+ self.device_type = DEVICE_TYPE_FAX
+ self.menu_text = self.__tr("%s Fax (%s)"%(self.model,self.id))
+
+ else:
+ self.device_type = DEVICE_TYPE_UNKNOWN
+ self.menu_text = self.__tr("%s (%s)"%(self.model,self.id))
+
+ self.mq = device.queryModelByURI(self.device_uri)
+ self.index = 0
+ if self.mq.get('tech-type', TECH_TYPE_NONE) in (TECH_TYPE_MONO_LASER, TECH_TYPE_COLOR_LASER):
+ self.index = 1
+ self.history = None
+
+
+ def getHistory(self, service):
+ if service is not None and self.needs_update:
+ device_uri, h = service.GetHistory(self.device_uri)
+ self.history = [device.Event(*tuple(e)) for e in list(h)[:-MAX_MENU_EVENTS:-1]]
+ self.needs_update = False
+
+
+ def __tr(self, s, c=None):
+ return QApplication.translate("SystemTray", s, c)
+
+
+
+
+class SystraySettingsDialog(QDialog):
+ def __init__(self, parent, systray_visible, polling,
+ polling_interval, systray_messages,
+ device_list=None,
+ upgrade_notify=True,
+ upgrade_pending_time=0,
+ upgrade_last_update_time=0,
+ upgrade_msg=""
+ ):
+# upgrade_pending_update_time=0,
+
+
+ QDialog.__init__(self, parent)
+
+ self.systray_visible = systray_visible
+ self.systray_messages = systray_messages
+
+ if device_list is not None:
+ self.device_list = device_list
+ else:
+ self.device_list = {}
+
+ self.polling = polling
+ self.polling_interval = polling_interval
+ self.upgrade_notify =upgrade_notify
+ self.upgrade_last_update_time=upgrade_last_update_time
+ self.upgrade_pending_time=upgrade_pending_time
+ self.upgrade_msg=upgrade_msg
+
+ self.initUi()
+ self.SystemTraySettings.updateUi()
+
+
+ def initUi(self):
+ self.setObjectName("SystraySettingsDialog")
+ self.resize(QSize(QRect(0,0,488,565).size()).expandedTo(self.minimumSizeHint()))
+
+ self.gridlayout = QGridLayout(self)
+ self.gridlayout.setObjectName("gridlayout")
+
+ self.SystemTraySettings = SystrayFrame(self)
+ self.SystemTraySettings.initUi(self.systray_visible,
+ self.polling, self.polling_interval,
+ self.device_list,
+ self.systray_messages,
+ self.upgrade_notify,
+ self.upgrade_pending_time,
+ self.upgrade_msg)
+
+ sizePolicy = QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SystemTraySettings.sizePolicy().hasHeightForWidth())
+ self.SystemTraySettings.setSizePolicy(sizePolicy)
+ self.SystemTraySettings.setFrameShadow(QFrame.Raised)
+ self.SystemTraySettings.setObjectName("SystemTraySettings")
+ self.gridlayout.addWidget(self.SystemTraySettings,0,0,1,2)
+
+ spacerItem = QSpacerItem(301,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem,1,0,1,1)
+
+ self.StdButtons = QDialogButtonBox(self)
+ self.StdButtons.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.NoButton|QDialogButtonBox.Ok)
+ self.StdButtons.setCenterButtons(False)
+ self.StdButtons.setObjectName("StdButtons")
+ self.gridlayout.addWidget(self.StdButtons,1,1,1,1)
+
+ # QObject.StdButtons.accepted.connect(self.acceptClicked)
+ # QObject.StdButtons.rejected.connect(self.reject)
+
+ self.StdButtons.accepted.connect(self.acceptClicked)
+ self.StdButtons.rejected.connect(self.reject)
+
+ #QMetaObject.connectSlotsByName(self)
+
+ self.setWindowTitle(self.__tr("HP Device Manager - System Tray Settings"))
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+# pm = load_pixmap("hp_logo", "32x32")
+# self.prop_icon = QIcon(pm)
+
+
+ def acceptClicked(self):
+ self.systray_visible = self.SystemTraySettings.systray_visible
+ self.polling = self.SystemTraySettings.polling
+ self.polling_interval = self.SystemTraySettings.polling_interval
+ self.device_list = self.SystemTraySettings.device_list
+ self.systray_messages = self.SystemTraySettings.systray_messages
+ self.upgrade_notify =self.SystemTraySettings.upgrade_notify
+ self.accept()
+
+
+ def __tr(self, s, c=None):
+ return QApplication.translate("SystraySettingsDialog", s, c)
+
+
+class SystemTrayApp(QApplication):
+
+ def __init__(self, args, read_pipe):
+ QApplication.__init__(self, args)
+
+ self.menu = None
+ self.read_pipe = read_pipe
+ self.fmt = "80s80sI32sI80sf"
+ self.fmt_size = struct.calcsize(self.fmt)
+ self.timer_active = False
+ self.active_icon = False
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.tray_icon = QSystemTrayIcon()
+
+ pm = load_pixmap("hp_logo", "32x32")
+ self.prop_icon = QIcon(pm)
+
+ a = load_pixmap('active', '16x16')
+ painter = QPainter(pm)
+ painter.drawPixmap(32, 0, a)
+ painter.end()
+
+ self.prop_active_icon = QIcon(pm)
+
+ self.tray_icon.setIcon(self.prop_icon)
+
+ self.session_bus = SessionBus()
+ self.service = None
+
+ for d in device.getSupportedCUPSDevices(back_end_filter=['hp', 'hpfax']):
+ self.addDevice(d)
+
+ self.tray_icon.setToolTip(self.__tr("HPLIP Status Service"))
+ # QObject.tray_icon.messageClicked.connect(self.messageClicked)
+ self.tray_icon.messageClicked.connect(self.messageClicked)
+ notifier = QSocketNotifier(self.read_pipe, QSocketNotifier.Read)
+ # QObject.notifier.activated[int].connect(self.notifierActivated)
+ notifier.activated[int].connect(self.notifierActivated)
+ # QObject.tray_icon.activated[QSystemTrayIcon::ActivationReason].connect(self.trayActivated)
+ self.tray_icon.activated["QSystemTrayIcon::ActivationReason"].connect(self.trayActivated)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+ self.tray_icon.show()
+
+ if self.user_settings.systray_visible == SYSTRAY_VISIBLE_SHOW_ALWAYS:
+ self.tray_icon.setVisible(True)
+ else:
+ QTimer.singleShot(HIDE_INACTIVE_DELAY, self.timeoutHideWhenInactive) # show icon for awhile @ startup
+
+ self.tray_icon.setIcon(self.prop_active_icon)
+ self.active_icon = True
+
+ if "--ignore-update-firsttime" not in args:
+ self.handle_hplip_updation()
+
+ QTimer.singleShot(SET_MENU_DELAY, self.initDone)
+
+ self.update_timer = QTimer()
+ # self.update_timer.connect(self.update_timer,SIGNAL("timeout()"),self.handle_hplip_updation)
+ self.update_timer.timeout.connect(self.handle_hplip_updation)
+ self.update_timer.start(UPGRADE_CHECK_DELAY)
+
+ # Cleans the /var/log/hp/tmp directory
+ #self.handle_hplip_clean()
+
+ #self.clean_timer = QTimer()
+ #self.clean_timer.connect(self.clean_timer,SIGNAL("timeout()"),self.handle_hplip_clean)
+ #self.clean_timer.start(CLEAN_EXEC_DELAY)
+
+
+
+
+ def initDone(self):
+ self.tray_icon.setIcon(self.prop_icon)
+ self.active_icon = False
+
+ self.setMenu()
+
+ def resetDevice(self):
+ devices.clear()
+
+ def addDevice(self, device_uri):
+ try:
+ devices[device_uri]
+ except KeyError:
+ devices[device_uri] = HistoryDevice(device_uri)
+ else:
+ devices[device_uri].needs_update = True
+
+ def handle_hplip_clean(self):
+ log.debug("handle_hplip_clean ")
+ home_dir = sys_conf.get('dirs', 'home')
+ cmd = 'sh %s/hplip_clean.sh'%home_dir
+ os.system(cmd)
+
+
+ def handle_hplip_updation(self):
+ log.debug("handle_hplip_updation upgrade_notify =%d"%(self.user_settings.upgrade_notify))
+ path = utils.which('hp-upgrade')
+ if self.user_settings.upgrade_notify is False:
+ log.debug("upgrade notification is disabled in systray ")
+ if path:
+ path = os.path.join(path, 'hp-upgrade')
+ log.debug("Running hp-upgrade: %s " % (path))
+ # this just updates the available version in conf file. But won't notify
+ os.spawnlp(os.P_NOWAIT, path, 'hp-upgrade', '--check')
+ time.sleep(5)
+ try:
+ os.waitpid(0, os.WNOHANG)
+ except OSError:
+ pass
+
+ return
+
+
+ current_time = time.time()
+
+ if int(current_time) > self.user_settings.upgrade_pending_update_time:
+ path = utils.which('hp-upgrade')
+ if path:
+ path = os.path.join(path, 'hp-upgrade')
+ log.debug("Running hp-upgrade: %s " % (path))
+ os.spawnlp(os.P_NOWAIT, path, 'hp-upgrade', '--notify')
+ time.sleep(5)
+ else:
+ log.error("Unable to find hp-upgrade --notify on PATH.")
+ else:
+ log.debug("upgrade schedule time is not yet completed. schedule time =%d current time =%d " %(self.user_settings.upgrade_pending_update_time, current_time))
+
+ try:
+ os.waitpid(0, os.WNOHANG)
+ except OSError:
+ pass
+
+
+
+
+
+ def setMenu(self):
+ self.menu = QMenu()
+
+ title = QWidgetAction(self.menu)
+ #title.setDisabled(True)
+
+ hbox = QFrame(self.menu)
+ layout = QHBoxLayout(hbox)
+ # layout.setMargin(3)
+ layout.setContentsMargins(3, 3, 3, 3)
+ layout.setSpacing(5)
+ pix_label = QLabel(hbox)
+
+ layout.insertWidget(-1, pix_label, 0)
+
+ icon_size = self.menu.style().pixelMetric(QStyle.PM_SmallIconSize)
+ pix_label.setPixmap(self.prop_icon.pixmap(icon_size))
+
+ label = QLabel(hbox)
+ layout.insertWidget(-1, label, 20)
+ title.setDefaultWidget(hbox)
+
+ label.setText(self.__tr("HPLIP Status Service"))
+
+ f = label.font()
+ f.setBold(True)
+ label.setFont(f)
+ self.menu.insertAction(None, title)
+
+ if devices:
+ if self.service is None:
+ t = 0
+ while t < 3:
+ try:
+ self.service = self.session_bus.get_object('com.hplip.StatusService',
+ "/com/hplip/StatusService")
+ except dbus.DBusException:
+ log.warn("Unable to connect to StatusService. Retrying...")
+
+ t += 1
+ time.sleep(0.5)
+
+ if self.service is not None:
+ self.menu.addSeparator()
+
+ for d in devices:
+ devices[d].getHistory(self.service)
+
+ menu = DeviceMenu(devices[d].menu_text, self.menu, d, devices[d].history, devices[d].index)
+ self.menu.addMenu(menu)
+ menu.update()
+
+
+ self.menu.addSeparator()
+ self.menu.addAction(self.__tr("HP Device Manager..."), self.toolboxTriggered)
+
+ self.menu.addSeparator()
+
+ self.settings_action = self.menu.addAction(QIcon(load_pixmap('settings', '16x16')),
+ self.__tr("Settings..."), self.settingsTriggered)
+
+ self.menu.addSeparator()
+ self.menu.addAction(QIcon(load_pixmap('quit', '16x16')), "Quit", self.quitTriggered)
+ self.tray_icon.setContextMenu(self.menu)
+
+
+
+
+ def settingsTriggered(self):
+ if self.menu is None:
+ return
+
+ self.sendMessage('', '', EVENT_DEVICE_STOP_POLLING)
+# sys_conf
+ cur_vers = sys_conf.get('hplip', 'version')
+ self.user_settings.load()
+ installed_time =time.strftime("%d-%m-%Y", time.localtime(self.user_settings.upgrade_last_update_time))
+ if utils.Is_HPLIP_older_version(cur_vers, self.user_settings.latest_available_version):
+ if int(time.time()) < self.user_settings.upgrade_pending_update_time :
+ postponed_time =time.strftime("%d-%m-%Y", time.localtime(self.user_settings.upgrade_pending_update_time))
+ upgrade_msg ="HPLIP-%s version was installed on %s.\n\nNew version of HPLIP-%s is available for upgrade. HPLIP upgrade is scheduled on %s." %(cur_vers,installed_time , self.user_settings.latest_available_version, postponed_time)
+ elif self.user_settings.upgrade_last_update_time:
+ upgrade_msg ="HPLIP-%s version was installed on %s.\n\nNew version of HPLIP-%s is available for upgrade." %(cur_vers,installed_time , self.user_settings.latest_available_version)
+ else:
+ upgrade_msg ="HPLIP-%s version was installed.\n\nNew version of HPLIP-%s is available for upgrade." %(cur_vers, self.user_settings.latest_available_version)
+ elif self.user_settings.upgrade_last_update_time:
+ upgrade_msg ="HPLIP-%s version was installed on %s."%(cur_vers, installed_time)
+ else:
+ upgrade_msg ="HPLIP-%s version was installed."%(cur_vers)
+
+
+ try:
+ dlg = SystraySettingsDialog(self.menu, self.user_settings.systray_visible,
+ self.user_settings.polling, self.user_settings.polling_interval,
+ self.user_settings.systray_messages,
+ self.user_settings.polling_device_list,
+ self.user_settings.upgrade_notify,
+ self.user_settings.upgrade_pending_update_time,
+ self.user_settings.upgrade_last_update_time,
+ upgrade_msg)
+
+
+ if dlg.exec_() == QDialog.Accepted:
+ self.user_settings.systray_visible = dlg.systray_visible
+ self.user_settings.systray_messages = dlg.systray_messages
+ self.user_settings.upgrade_notify = dlg.upgrade_notify
+
+ log.debug("HPLIP update notification = %d"%(self.user_settings.upgrade_notify))
+ self.user_settings.save()
+
+ if self.user_settings.systray_visible == SYSTRAY_VISIBLE_SHOW_ALWAYS:
+ log.debug("Showing...")
+ self.tray_icon.setVisible(True)
+
+ else:
+ log.debug("Waiting to hide...")
+ QTimer.singleShot(HIDE_INACTIVE_DELAY, self.timeoutHideWhenInactive)
+
+ self.sendMessage('', '', EVENT_USER_CONFIGURATION_CHANGED)
+
+ finally:
+ self.sendMessage('', '', EVENT_DEVICE_START_POLLING)
+
+
+ def timeoutHideWhenInactive(self):
+ log.debug("Hiding...")
+ if self.user_settings.systray_visible in (SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVE, SYSTRAY_VISIBLE_HIDE_ALWAYS):
+ self.tray_icon.setVisible(False)
+ log.debug("Hidden")
+
+
+ def updateMenu(self):
+ if self.menu is None:
+ return
+ for a in self.menu.actions():
+ try:
+ a.menu().update()
+ except AttributeError:
+ continue
+
+
+
+ def trayActivated(self, reason):
+ if reason == QSystemTrayIcon.Context:
+ self.updateMenu()
+
+
+ elif reason == QSystemTrayIcon.DoubleClick:
+ #print "double click"
+ self.toolboxTriggered()
+ pass
+
+ elif reason == QSystemTrayIcon.Trigger:
+ #print "single click"
+ pass
+
+ elif reason == QSystemTrayIcon.MiddleClick:
+ #print "middle click"
+ pass
+
+
+ def messageClicked(self):
+ #print "\nPARENT: message clicked"
+ pass
+
+
+ def quitTriggered(self):
+ log.debug("Exiting")
+ self.sendMessage('', '', EVENT_SYSTEMTRAY_EXIT)
+ self.quit()
+ del self.tray_icon
+
+ def toolboxTriggered(self):
+ try:
+ os.waitpid(-1, os.WNOHANG)
+ except OSError:
+ pass
+
+ # See if it is already running...
+ ok, lock_file = utils.lock_app('hp-toolbox', True)
+
+ if ok: # able to lock, not running...
+ utils.unlock(lock_file)
+
+ path = utils.which('hp-toolbox')
+ if path:
+ path = os.path.join(path, 'hp-toolbox')
+ else:
+ self.tray_icon.showMessage(self.__tr("HPLIP Status Service"),
+ self.__tr("Unable to locate hp-toolbox on system PATH."),
+ QSystemTrayIcon.Critical, TRAY_MESSAGE_DELAY)
+
+ log.error("Unable to find hp-toolbox on PATH.")
+ return
+
+ #log.debug(path)
+ log.debug("Running hp-toolbox: hp-toolbox")
+ os.spawnlp(os.P_NOWAIT, path, 'hp-toolbox')
+
+ else: # ...already running, raise it
+ self.sendMessage('', '', EVENT_RAISE_DEVICE_MANAGER, interface='com.hplip.Toolbox')
+
+
+ def sendMessage(self, device_uri, printer_name, event_code, username=prop.username,
+ job_id=0, title='', pipe_name='', interface='com.hplip.StatusService'):
+ #device.Event(device_uri, printer_name, event_code, username, job_id, title).send_via_dbus(SessionBus(), interface)
+ device.Event(device_uri, printer_name, event_code, username, job_id, title).send_via_dbus(self.session_bus, interface)
+
+
+ def notifierActivated(self, s):
+ m = ''
+ while True:
+ try:
+ r, w, e = select.select([self.read_pipe], [], [self.read_pipe], 1.0)
+ except select.error:
+ log.debug("Error in select()")
+ break
+
+ if e:
+ log.error("Pipe error: %s" % e)
+ break
+
+ if r:
+ #m = ''.join([m, os.read(self.read_pipe, self.fmt_size)])
+ m = os.read(self.read_pipe, self.fmt_size)
+ while len(m) >= self.fmt_size:
+ event = device.Event(*[x.rstrip(b'\x00').decode('utf-8') if isinstance(x, bytes) else x for x in struct.unpack(self.fmt, m[:self.fmt_size])])
+ m = m[self.fmt_size:]
+
+ if event.event_code == EVENT_CUPS_QUEUES_REMOVED or event.event_code == EVENT_CUPS_QUEUES_ADDED:
+ self.resetDevice()
+ for d in device.getSupportedCUPSDevices(back_end_filter=['hp', 'hpfax']):
+ self.addDevice(d)
+
+ self.setMenu()
+
+ if event.event_code == EVENT_USER_CONFIGURATION_CHANGED:
+ log.debug("Re-reading configuration (EVENT_USER_CONFIGURATION_CHANGED)")
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ elif event.event_code == EVENT_SYSTEMTRAY_EXIT:
+ self.quit()
+ return
+
+ if self.user_settings.systray_visible in \
+ (SYSTRAY_VISIBLE_SHOW_ALWAYS, SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVE):
+
+ log.debug("Showing...")
+ self.tray_icon.setVisible(True)
+
+ if event.event_code == EVENT_DEVICE_UPDATE_ACTIVE:
+ if not self.active_icon:
+ self.tray_icon.setIcon(self.prop_active_icon)
+ self.active_icon = True
+ continue
+
+ elif event.event_code == EVENT_DEVICE_UPDATE_INACTIVE:
+ if self.active_icon:
+ self.tray_icon.setIcon(self.prop_icon)
+ self.active_icon = False
+ continue
+
+ elif event.event_code == EVENT_DEVICE_UPDATE_BLIP:
+ if not self.active_icon:
+ self.tray_icon.setIcon(self.prop_active_icon)
+ self.active_icon = True
+ QTimer.singleShot(BLIP_DELAY, self.blipTimeout)
+ continue
+
+ if self.user_settings.systray_visible in (SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVE, SYSTRAY_VISIBLE_HIDE_ALWAYS):
+ log.debug("Waiting to hide...")
+ QTimer.singleShot(HIDE_INACTIVE_DELAY, self.timeoutHideWhenInactive)
+
+ if event.event_code <= EVENT_MAX_USER_EVENT or \
+ event.event_code == EVENT_CUPS_QUEUES_REMOVED or event.event_code == EVENT_CUPS_QUEUES_ADDED:
+
+ if event.event_code != EVENT_CUPS_QUEUES_REMOVED:
+ self.addDevice(event.device_uri)
+ self.setMenu()
+
+ if self.tray_icon.supportsMessages():
+
+ log.debug("Tray icon message:")
+ event.debug()
+
+ error_state = STATUS_TO_ERROR_STATE_MAP.get(event.event_code, ERROR_STATE_CLEAR)
+ desc = device.queryString(event.event_code)
+
+ show_message = False
+ if self.user_settings.systray_messages == SYSTRAY_MESSAGES_SHOW_ALL: # OK, Busy
+ show_message = True
+
+ elif self.user_settings.systray_messages in (SYSTRAY_MESSAGES_SHOW_ERRORS_AND_WARNINGS, SYSTRAY_MESSAGES_SHOW_ERRORS_ONLY):
+ if error_state == ERROR_STATE_ERROR:
+ show_message = True
+
+ elif self.user_settings.systray_messages == SYSTRAY_MESSAGES_SHOW_ERRORS_AND_WARNINGS and \
+ error_state in (ERROR_STATE_WARNING, ERROR_STATE_LOW_SUPPLIES, ERROR_STATE_LOW_PAPER):
+
+ show_message = True
+
+ if event.printer_name:
+ d = event.printer_name
+ else:
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
+ device.parseDeviceURI(event.device_uri)
+
+ if bus == 'usb':
+ idd = serial
+ elif bus == 'net':
+ idd = host
+ elif bus == 'par':
+ idd = dev_file
+ else:
+ idd = 'unknown'
+
+ self.model = models.normalizeModelUIName(model)
+
+ if back_end == 'hp':
+ d = self.__tr("%s Printer (%s)"%(model,idd))
+
+ elif back_end == 'hpaio':
+ d = self.__tr("%s Scanner (%s)"%(model,idd))
+
+ elif back_end == 'hpfax':
+ d = self.__tr("%s Fax (%s)"%(model,idd))
+
+ else:
+ d = self.__tr("%s (%s)"%(model,idd))
+
+ if show_message:
+ if have_pynotify and pynotify.init("hplip"): # Use libnotify/pynotify
+ icon, urgency = ERROR_STATE_TO_ICON_AND_URGENCY_PYNOTIFY.get(error_state,
+ (getPynotifyIcon('info'), pynotify.URGENCY_NORMAL))
+
+ if event.job_id and event.title:
+ msg = "%s\n%s: %s\n(%s/%s)" % (to_unicode(d), desc, event.title, event.username, event.job_id)
+ log.debug("Notify: uri=%s desc=%s title=%s user=%s job_id=%d code=%d" %
+ (event.device_uri, desc, event.title, event.username, event.job_id, event.event_code))
+ else:
+ msg = "%s\n%s (%s)" % (to_unicode(d), desc, event.event_code)
+ log.debug("Notify: uri=%s desc=%s code=%d" % (event.device_uri, desc, event.event_code))
+
+ n = pynotify.Notification("HPLIP Device Status", msg, icon)
+ # CRID: 11833 Debian Traceback error notification exceeded
+ n.set_hint('transient', True)
+ n.set_urgency(urgency)
+
+ if error_state == ERROR_STATE_ERROR:
+ n.set_timeout(pynotify.EXPIRES_NEVER)
+ else:
+ n.set_timeout(TRAY_MESSAGE_DELAY)
+
+ n.show()
+
+ else: # Use "standard" message bubbles
+ icon = ERROR_STATE_TO_ICON.get(error_state, QSystemTrayIcon.Information)
+ if event.job_id and event.title:
+ log.debug("Bubble: uri=%s desc=%s title=%s user=%s job_id=%d code=%d" %
+ (event.device_uri, desc, event.title, event.username, event.job_id, event.event_code))
+ self.tray_icon.showMessage(self.__tr("HPLIP Device Status"),
+ "%s\n%s: %s\n(%s/%s)"%(d,desc, event.title,event.username,event.job_id),
+ icon, TRAY_MESSAGE_DELAY)
+
+ else:
+ log.debug("Bubble: uri=%s desc=%s code=%d" % (event.device_uri, desc, event.event_code))
+ self.tray_icon.showMessage(self.__tr("HPLIP Device Status"),
+ "%s\n%s (%s)"%(d,desc,event.event_code),
+ icon, TRAY_MESSAGE_DELAY)
+
+ else:
+ break
+ # return
+
+
+ def blipTimeout(self):
+ if self.active_icon:
+ self.tray_icon.setIcon(self.prop_icon)
+ self.active_icon = False
+
+
+
+ def __tr(self, s, c=None):
+ return QApplication.translate("SystemTray", s, c)
+
+
+
+def run(read_pipe):
+ log.set_module("hp-systray(qt5)")
+ log.debug("PID=%d" % os.getpid())
+
+ try:
+ app = SystemTrayApp(sys.argv, read_pipe)
+ except dbus.DBusException as e:
+ # No session bus
+ log.debug("Caught exception: %s" % e)
+ sys.exit(1)
+
+ app.setQuitOnLastWindowClosed(False) # If not set, settings dlg closes app
+
+ i = 0
+ while i < 60:
+ if QSystemTrayIcon.isSystemTrayAvailable():
+ break
+ time.sleep(1.0)
+ i += 1
+
+ if not QSystemTrayIcon.isSystemTrayAvailable():
+ FailureUI(None,
+ QApplication.translate("SystemTray",
+ "<b>No system tray detected on this system.</b><p>Unable to start, exiting.</p>",
+ None),
+ QApplication.translate("SystemTray", "HPLIP Status Service",
+ None))
+ else:
+ notifier = QSocketNotifier(read_pipe, QSocketNotifier.Read)
+ # QObject.notifier.activated[int].connect(app.notifierActivated)
+ notifier.activated[int].connect(app.notifierActivated)
+
+ app.exec_()
diff --git a/ui5/systrayframe.py b/ui5/systrayframe.py
new file mode 100644
index 000000000..f8021bfe5
--- /dev/null
+++ b/ui5/systrayframe.py
@@ -0,0 +1,218 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Local
+from base.g import *
+from base.codes import *
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+
+class SystrayFrame(QFrame):
+ def __init__(self, parent):
+ QFrame.__init__(self, parent)
+
+
+ def initUi(self, systray_visible, polling, polling_interval, device_list, systray_messages,upgrade_notify,
+ upgrade_postpone_time, upgrade_msg):
+
+ self.systray_visible = systray_visible
+ self.polling = polling
+ self.polling_interval = polling_interval
+ self.device_list = device_list
+ self.systray_messages = systray_messages
+ self.upgrade_notify = upgrade_notify
+ self.upgrade_postpone_time =upgrade_postpone_time
+ self.upgrade_msg = upgrade_msg
+
+ self.gridlayout = QGridLayout(self)
+
+ self.frame = QFrame(self)
+ self.frame.setFrameShape(QFrame.StyledPanel)
+ self.frame.setFrameShadow(QFrame.Raised)
+
+ self.gridlayout1 = QGridLayout(self.frame)
+
+ self.groupBox_2 = QGroupBox(self.frame)
+
+ self.gridlayout2 = QGridLayout(self.groupBox_2)
+
+ self.ShowAlwaysRadioButton = QRadioButton(self.groupBox_2)
+ self.gridlayout2.addWidget(self.ShowAlwaysRadioButton,0,0,1,1)
+
+ self.HideWhenInactiveRadioButton = QRadioButton(self.groupBox_2)
+ self.gridlayout2.addWidget(self.HideWhenInactiveRadioButton,1,0,1,1)
+
+ self.HideAlwaysRadioButton = QRadioButton(self.groupBox_2)
+ self.gridlayout2.addWidget(self.HideAlwaysRadioButton,2,0,1,1)
+
+ self.gridlayout1.addWidget(self.groupBox_2,0,0,1,1)
+
+ self.groupBox_3 = QGroupBox(self.frame)
+
+ self.gridlayout3 = QGridLayout(self.groupBox_3)
+
+ self.label_2 = QLabel(self.groupBox_3)
+ self.gridlayout3.addWidget(self.label_2,0,0,1,1)
+
+ self.MessageShowComboBox = QComboBox(self.groupBox_3)
+ self.gridlayout3.addWidget(self.MessageShowComboBox,1,0,1,1)
+
+ self.MessageShowComboBox.addItem(self.__tr("All"), SYSTRAY_MESSAGES_SHOW_ALL)
+ self.MessageShowComboBox.addItem(self.__tr("Errors and Warnings"), SYSTRAY_MESSAGES_SHOW_ERRORS_AND_WARNINGS)
+ self.MessageShowComboBox.addItem(self.__tr("Errors Only"), SYSTRAY_MESSAGES_SHOW_ERRORS_ONLY)
+ self.MessageShowComboBox.addItem(self.__tr("None"), SYSTRAY_MESSAGES_SHOW_NONE)
+
+ spacerItem = QSpacerItem(20,40,QSizePolicy.Minimum,QSizePolicy.Minimum)
+ self.gridlayout3.addItem(spacerItem,2,0,1,1)
+ self.gridlayout1.addWidget(self.groupBox_3,0,1,1,1)
+
+ self.MonitorGroupBox = QGroupBox(self.frame)
+ self.MonitorGroupBox.setCheckable(True)
+
+ self.MonitorGroupBox.setEnabled(False)
+
+ self.gridlayout4 = QGridLayout(self.MonitorGroupBox)
+
+ self.label = QLabel(self.MonitorGroupBox)
+ self.gridlayout4.addWidget(self.label,0,0,1,1)
+
+ self.listWidget = QListWidget(self.MonitorGroupBox)
+ self.gridlayout4.addWidget(self.listWidget,1,0,1,1)
+ self.gridlayout1.addWidget(self.MonitorGroupBox,1,0,1,2)
+
+
+ #UpdategroupBox is same as "gridlayout5"
+ self.groupBox_4 = QGroupBox(self.frame)
+ self.UpdategroupBox = QGridLayout(self.groupBox_4)
+ self.UpdategroupBox.setObjectName("UpdategroupBox")
+ self.UpdatecheckBox = QCheckBox(self.groupBox_4)
+ self.UpdatecheckBox.setObjectName("UpdatecheckBox")
+ self.UpdategroupBox.addWidget(self.UpdatecheckBox,0,0,1,4)
+ self.label_5 = QLabel(self.groupBox_4)
+ self.label_5.setObjectName("label_5")
+ self.UpdategroupBox.addWidget(self.label_5, 1, 0, 1, 4)
+ self.textEdit = QTextEdit(self.groupBox_4)
+ self.textEdit.setObjectName("textEdit")
+ self.textEdit.setReadOnly(True)
+ self.UpdategroupBox.addWidget(self.textEdit, 2, 0, 1, 4)
+ self.gridlayout1.addWidget(self.groupBox_4,2,0,1,2)
+
+ self.gridlayout.addWidget(self.frame,0,0,1,1)
+
+
+
+ self.setWindowTitle(QApplication.translate("self", "self", None))
+ self.groupBox_2.setTitle(QApplication.translate("self", "System tray icon visibility", None))
+ self.ShowAlwaysRadioButton.setText(QApplication.translate("self", "Always show", None))
+ self.HideWhenInactiveRadioButton.setText(QApplication.translate("self", "Hide when inactive", None))
+ self.HideAlwaysRadioButton.setText(QApplication.translate("self", "Always hide", None))
+ self.groupBox_3.setTitle(QApplication.translate("self", "System tray icon messages", None))
+ self.label_2.setText(QApplication.translate("self", "Messages to show:", None))
+ self.MonitorGroupBox.setTitle(QApplication.translate("self", "Monitor button presses on devices", None))
+ self.label.setText(QApplication.translate("self", "Devices to monitor:", None))
+
+
+ self.groupBox_4.setTitle(QApplication.translate("Dialog", "Update Settings", None))
+ self.UpdatecheckBox.setText(QApplication.translate("Dialog", "Check and notify HPLIP updates", None))
+ self.label_5.setText(QApplication.translate("Dialog", "Status:", None))
+ self.textEdit.setPlainText(self.upgrade_msg)
+
+
+ self.ShowAlwaysRadioButton.clicked[bool].connect(self.ShowAlwaysRadioButton_clicked)
+ self.HideWhenInactiveRadioButton.clicked[bool].connect(self.HideWhenInactiveRadioButton_clicked)
+ self.HideAlwaysRadioButton.clicked[bool].connect(self.HideAlwaysRadioButton_clicked)
+ self.MessageShowComboBox.activated[int].connect(self.MessageShowComboBox_activated)
+ self.UpdatecheckBox.clicked[bool].connect(self.UpdatecheckBox_clicked)
+
+
+
+
+ def UpdatecheckBox_clicked(self, b):
+ log.debug("Update HPLIP val =%d "%b)
+ if b is False:
+ self.upgrade_notify = False
+ else:
+ self.upgrade_notify = True
+
+ def updateUi(self):
+ self.updateVisibility()
+ self.updateMessages()
+ self.updateDeviceList()
+ self.updateUpgradeSettings()
+
+
+ def updateVisibility(self):
+ if self.systray_visible == SYSTRAY_VISIBLE_SHOW_ALWAYS:
+ self.ShowAlwaysRadioButton.setChecked(True)
+
+ elif self.systray_visible == SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVE:
+ self.HideWhenInactiveRadioButton.setChecked(True)
+
+ else: # SYSTRAY_VISIBLE_HIDE_ALWAYS
+ self.HideAlwaysRadioButton.setChecked(True)
+
+
+ def ShowAlwaysRadioButton_clicked(self, b):
+ if b: self.systray_visible = SYSTRAY_VISIBLE_SHOW_ALWAYS
+
+
+ def HideWhenInactiveRadioButton_clicked(self, b):
+ if b: self.systray_visible = SYSTRAY_VISIBLE_HIDE_WHEN_INACTIVE
+
+
+ def HideAlwaysRadioButton_clicked(self, b):
+ if b: self.systray_visible = SYSTRAY_VISIBLE_HIDE_ALWAYS
+
+
+ def updateMessages(self):
+ #i = self.MessageShowComboBox.findData(QVariant(self.systray_messages))
+ i = self.MessageShowComboBox.findData(self.systray_messages)
+ if i != -1:
+ self.MessageShowComboBox.setCurrentIndex(i)
+
+
+ def MessageShowComboBox_activated(self, i):
+ sender = self.sender()
+ mode, ok = value_int(sender.itemData(i))
+
+ if ok:
+ self.systray_messages = mode
+
+
+ def updateDeviceList(self):
+ pass
+
+ def updateUpgradeSettings(self):
+ if self.upgrade_notify is True:
+ self.UpdatecheckBox.setChecked(True)
+ else:
+ self.UpdatecheckBox.setChecked(False)
+
+
+
+
+ def __tr(self, s, c=None):
+ return QApplication.translate("SystrayFrame", s, c)
+
diff --git a/ui5/systrayframe_base.py b/ui5/systrayframe_base.py
new file mode 100644
index 000000000..c73ad762c
--- /dev/null
+++ b/ui5/systrayframe_base.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/systrayframe_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(476, 653)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.frame = QtWidgets.QFrame(Dialog)
+ self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
+ self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
+ self.frame.setObjectName("frame")
+ self.groupBox_2 = QtWidgets.QGroupBox(self.frame)
+ self.groupBox_2.setGeometry(QtCore.QRect(11, 11, 201, 114))
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.radioButton = QtWidgets.QRadioButton(self.groupBox_2)
+ self.radioButton.setObjectName("radioButton")
+ self.gridlayout1.addWidget(self.radioButton, 0, 0, 1, 1)
+ self.radioButton_2 = QtWidgets.QRadioButton(self.groupBox_2)
+ self.radioButton_2.setObjectName("radioButton_2")
+ self.gridlayout1.addWidget(self.radioButton_2, 1, 0, 1, 1)
+ self.radioButton_3 = QtWidgets.QRadioButton(self.groupBox_2)
+ self.radioButton_3.setObjectName("radioButton_3")
+ self.gridlayout1.addWidget(self.radioButton_3, 2, 0, 1, 1)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.frame)
+ self.groupBox_3.setGeometry(QtCore.QRect(232, 11, 197, 136))
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtWidgets.QLabel(self.groupBox_3)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout2.addWidget(self.label_2, 0, 0, 1, 1)
+ self.MessageShowComboBox = QtWidgets.QComboBox(self.groupBox_3)
+ self.MessageShowComboBox.setObjectName("MessageShowComboBox")
+ self.gridlayout2.addWidget(self.MessageShowComboBox, 1, 0, 1, 1)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 2, 0, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.frame)
+ self.groupBox.setGeometry(QtCore.QRect(10, 385, 411, 241))
+ self.groupBox.setCheckable(True)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.listWidget = QtWidgets.QListWidget(self.groupBox)
+ self.listWidget.setObjectName("listWidget")
+ self.gridlayout3.addWidget(self.listWidget, 4, 0, 1, 1)
+ self.label = QtWidgets.QLabel(self.groupBox)
+ self.label.setObjectName("label")
+ self.gridlayout3.addWidget(self.label, 3, 0, 1, 1)
+ self.groupBox_4 = QtWidgets.QGroupBox(self.frame)
+ self.groupBox_4.setGeometry(QtCore.QRect(10, 130, 411, 231))
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.checkBox = QtWidgets.QCheckBox(self.groupBox_4)
+ self.checkBox.setGeometry(QtCore.QRect(20, 20, 331, 22))
+ self.checkBox.setChecked(True)
+ self.checkBox.setObjectName("checkBox")
+ self.label_3 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_3.setGeometry(QtCore.QRect(50, 44, 221, 17))
+ self.label_3.setObjectName("label_3")
+ self.spinBox = QtWidgets.QSpinBox(self.groupBox_4)
+ self.spinBox.setGeometry(QtCore.QRect(270, 40, 55, 27))
+ self.spinBox.setMinimum(1)
+ self.spinBox.setMaximum(365)
+ self.spinBox.setProperty("value", 30)
+ self.spinBox.setObjectName("spinBox")
+ self.label_4 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_4.setGeometry(QtCore.QRect(329, 45, 67, 17))
+ self.label_4.setObjectName("label_4")
+ self.checkBox_2 = QtWidgets.QCheckBox(self.groupBox_4)
+ self.checkBox_2.setGeometry(QtCore.QRect(49, 78, 301, 22))
+ self.checkBox_2.setObjectName("checkBox_2")
+ self.textEdit = QtWidgets.QTextEdit(self.groupBox_4)
+ self.textEdit.setGeometry(QtCore.QRect(50, 129, 331, 81))
+ self.textEdit.setObjectName("textEdit")
+ self.label_5 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_5.setGeometry(QtCore.QRect(50, 107, 61, 17))
+ self.label_5.setObjectName("label_5")
+ self.gridlayout.addWidget(self.frame, 0, 1, 1, 1)
+
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
+ self.groupBox_2.setTitle(_translate("Dialog", "System tray icon visibility"))
+ self.radioButton.setText(_translate("Dialog", "Always show"))
+ self.radioButton_2.setText(_translate("Dialog", "Hide when inactive"))
+ self.radioButton_3.setText(_translate("Dialog", "Always hide"))
+ self.groupBox_3.setTitle(_translate("Dialog", "System tray icon messages"))
+ self.label_2.setText(_translate("Dialog", "Which messages to show:"))
+ self.groupBox.setTitle(_translate("Dialog", "Monitor button presses on devices"))
+ self.label.setText(_translate("Dialog", "Devices to monitor:"))
+ self.groupBox_4.setTitle(_translate("Dialog", "Update Settings"))
+ self.checkBox.setText(_translate("Dialog", "Check for HPLIP Updates"))
+ self.label_3.setText(_translate("Dialog", "Repeat Check for Updates every "))
+ self.label_4.setText(_translate("Dialog", "Days"))
+ self.checkBox_2.setText(_translate("Dialog", "Check when ever new version available"))
+ self.label_5.setText(_translate("Dialog", "Status:"))
+
diff --git a/ui5/systrayframe_base.ui b/ui5/systrayframe_base.ui
new file mode 100644
index 000000000..68e2d0d37
--- /dev/null
+++ b/ui5/systrayframe_base.ui
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>476</width>
+ <height>653</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="1">
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="geometry">
+ <rect>
+ <x>11</x>
+ <y>11</y>
+ <width>201</width>
+ <height>114</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>System tray icon visibility</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="radioButton">
+ <property name="text">
+ <string>Always show</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="radioButton_2">
+ <property name="text">
+ <string>Hide when inactive</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QRadioButton" name="radioButton_3">
+ <property name="text">
+ <string>Always hide</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="geometry">
+ <rect>
+ <x>232</x>
+ <y>11</y>
+ <width>197</width>
+ <height>136</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>System tray icon messages</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Which messages to show:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QComboBox" name="MessageShowComboBox"/>
+ </item>
+ <item row="2" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>385</y>
+ <width>411</width>
+ <height>241</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Monitor button presses on devices</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout">
+ <item row="4" column="0">
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Devices to monitor:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>130</y>
+ <width>411</width>
+ <height>231</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Update Settings</string>
+ </property>
+ <widget class="QCheckBox" name="checkBox">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>331</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Check for HPLIP Updates</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_3">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>44</y>
+ <width>221</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Repeat Check for Updates every </string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="spinBox">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>40</y>
+ <width>55</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>365</number>
+ </property>
+ <property name="value">
+ <number>30</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>329</x>
+ <y>45</y>
+ <width>67</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Days</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" name="checkBox_2">
+ <property name="geometry">
+ <rect>
+ <x>49</x>
+ <y>78</y>
+ <width>301</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Check when ever new version available</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit" name="textEdit">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>129</y>
+ <width>331</width>
+ <height>81</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_5">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>107</y>
+ <width>61</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Status:</string>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/ui_utils.py b/ui5/ui_utils.py
new file mode 100644
index 000000000..caba33910
--- /dev/null
+++ b/ui5/ui_utils.py
@@ -0,0 +1,607 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Author: Don Welch
+#
+
+# Std Lib
+import re
+import os
+import time
+
+# Local
+from base.g import *
+from base.codes import *
+from base import utils
+from prnt import cups
+from base.sixext import PY3, to_unicode
+
+
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+from PyQt5.QtWidgets import *
+ # End
+pat_html_remove = re.compile("(?is)<.*?>", re.I)
+
+# databaseChanged signal values (for FABWindow)
+FAB_NAME_ADD = 0 # s1 - new name
+FAB_NAME_RENAME = 1 # s1 - old name, s2 - new name
+FAB_NAME_REMOVE = 2 # s1 - removed name
+FAB_NAME_DETAILS_CHANGED = 3 # s1 - name
+FAB_GROUP_ADD = 4 # s1 - new group
+FAB_GROUP_RENAME = 5 # s1 - old group, s2 - new group
+FAB_GROUP_REMOVE = 6 # s1 - removed group
+FAB_GROUP_MEMBERSHIP_CHANGED = 7 # s1 - group
+
+
+def __translate(t):
+ return QApplication.translate("ui_utils", t, None)
+
+
+def beginWaitCursor():
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+
+
+def endWaitCursor():
+ QApplication.restoreOverrideCursor()
+
+
+# TODO: Cache pixmaps
+def load_pixmap(name, subdir=None, resize_to=None):
+ name = ''.join([os.path.splitext(name)[0], '.png'])
+
+ if subdir is None:
+ image_dir = prop.image_dir
+ ldir = os.path.join(os.getcwd(), 'data', 'images')
+ else:
+ image_dir = os.path.join(prop.image_dir, subdir)
+ ldir = os.path.join(os.getcwd(), 'data', 'images', subdir)
+
+ for d in [image_dir, ldir]:
+ f = os.path.join(d, name)
+ if os.path.exists(f):
+ if resize_to is not None:
+ img = QImage(f)
+ x, y = resize_to
+ return QPixmap.fromImage(img.scaled(x, y, Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
+ else:
+ return QPixmap(f)
+
+ for w in utils.walkFiles(image_dir, recurse=True, abs_paths=True, return_folders=False, pattern=name):
+ if resize_to is not None:
+ img = QImage(w)
+ x, y = resize_to
+ return QPixmap.fromImage(img.scaled(x, y, Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
+ else:
+ return QPixmap(w)
+
+ log.error("Pixmap '%s' not found!" % name)
+ return QPixmap()
+
+loadPixmap = load_pixmap
+
+
+def getPynotifyIcon(name, subdir='32x32'):
+ name = ''.join([os.path.splitext(name)[0], '.png'])
+ return "file://" + os.path.join(prop.image_dir, subdir, name)
+
+
+def value_str(data):
+ if data is None:
+ return ""
+ try:
+ if not PY3:
+ try:
+ data = data.toString()
+ except AttributeError as e:
+ return data
+ except(ValueError, TypeError) as e:
+ log.warn("value_str() Failed to convert data: %s" % e)
+
+ return data
+
+
+def value_int(data):
+ i, ok = 0, False
+ if data is None:
+ return i, ok
+ try:
+ if PY3:
+ i = int(data)
+ ok = True
+ else:
+ try:
+ i, ok = data.toInt()
+ except AttributeError as e:
+ i = int(data)
+ ok = True
+ except (ValueError,TypeError) as e:
+ log.warn("value_int() Failed to convert data[%s]:%s "%(data,e))
+
+ return i, ok
+
+
+def value_bool( data ):
+ b = False
+ if data is None:
+ return b
+ try:
+ if PY3:
+ if type(data) == str and data.lower() in ['false', '0']:
+ b = False
+ elif data in [False, 0]:
+ b = False
+ else:
+ b= True
+ else:
+ try:
+ b = data.toBool()
+ except AttributeError as e:
+ if type(data) == str and data.lower() in ['false', '0']:
+ b = False
+ elif data in [False, 0]:
+ b = False
+ else:
+ b= True
+
+ except (ValueError,TypeError) as e:
+ log.warn("value_bool() Failed to convert data :%s"%e)
+
+ return b
+
+
+
+class UserSettings(QSettings):
+ def __init__(self):
+ if prop.user_dir is None:
+ QSettings.__init__(self)
+ else:
+ QSettings.__init__(self, os.path.join(prop.user_dir, 'hplip.conf'), QSettings.IniFormat)
+
+ self.systray_visible = SYSTRAY_VISIBLE_SHOW_ALWAYS
+ self.systray_messages = SYSTRAY_MESSAGES_SHOW_ALL
+ self.last_used_device_uri = ''
+ self.last_used_printer = ''
+ self.version = ''
+ self.date_time = ''
+ self.auto_refresh = False
+ self.auto_refresh_rate = 30
+ self.auto_refresh_type = 1
+ self.polling_interval = 5
+ self.polling = True
+ self.device_list = []
+ self.working_dir = '.'
+ self.voice_phone = ''
+ self.email_address = ''
+ self.upgrade_notify=True
+ self.upgrade_last_update_time=0
+ self.upgrade_pending_update_time=0
+ self.latest_available_version=""
+ self.loadDefaults()
+
+
+ def __setup(self, cmds):
+ for c in cmds:
+ basename = c.split()[0]
+ path = utils.which(basename)
+ if path:
+ return ' '.join([os.path.join(path, basename), ' '.join(c.split()[1:])])
+
+ return ''
+
+ def loadDefaults(self):
+ self.cmd_scan = self.__setup(['xsane -V %SANE_URI%', 'kooka', 'xscanimage'])
+ self.cmd_fab = self.__setup(['hp-fab'])
+
+
+ def load(self):
+ log.debug("Loading user settings...")
+ self.sync()
+
+ self.beginGroup("settings")
+ self.systray_visible = value_int(self.value("systray_visible"))[0]
+
+ self.systray_messages = value_int(self.value("systray_messages"))[0]
+
+ self.endGroup()
+
+ self.beginGroup("last_used")
+ self.last_used_device_uri = value_str(self.value("device_uri")) or self.last_used_device_uri
+ self.last_used_printer = value_str(self.value("printer_name")) or self.last_used_printer
+ self.working_dir = value_str(self.value("working_dir")) or self.working_dir
+ self.endGroup()
+
+ self.beginGroup("commands")
+ self.cmd_scan = value_str(self.value("scan")) or self.cmd_scan
+ self.endGroup()
+
+ self.beginGroup("refresh")
+ self.auto_refresh_rate = value_int(self.value("rate"))[0] or int(self.auto_refresh_rate)
+ self.auto_refresh = value_bool(self.value("enable"))
+ self.auto_refresh_type = value_int(self.value("type"))[0] or int(self.auto_refresh_type)
+ self.endGroup()
+
+ self.beginGroup("installation")
+ self.version = value_str(self.value("version"))
+ self.date_time = value_str(self.value("date_time"))
+ self.endGroup()
+
+ self.beginGroup("polling")
+ self.polling = value_bool(self.value("enable"))
+ self.polling_interval = value_int(self.value("interval"))[0] or int(self.polling_interval)
+ self.polling_device_list = to_unicode(value_str(self.value("device_list"))).split(to_unicode(','))
+ self.endGroup()
+
+ self.beginGroup("fax")
+ self.voice_phone = value_str(self.value("voice_phone"))
+ self.email_address = to_unicode(value_str(self.value("email_address")))
+ self.endGroup()
+
+ self.beginGroup("upgrade")
+ self.upgrade_notify= value_bool(self.value("notify_upgrade"))
+ self.latest_available_version=value_str(self.value("latest_available_version"))
+
+ self.upgrade_last_update_time = value_int(self.value("last_upgraded_time"))[0]
+
+ self.upgrade_pending_update_time = value_int(self.value("pending_upgrade_time"))[0]
+
+ self.endGroup()
+
+
+ def save(self):
+ log.debug("Saving user settings...")
+
+ self.beginGroup("settings")
+ self.setValue("systray_visible", self.systray_visible)
+ self.setValue("systray_messages", self.systray_messages)
+ self.endGroup()
+
+ self.beginGroup("last_used")
+ self.setValue("device_uri", self.last_used_device_uri)
+ self.setValue("printer_name", self.last_used_printer)
+ self.setValue("working_dir", self.working_dir)
+ self.endGroup()
+
+ self.beginGroup("commands")
+ self.setValue("scan", self.cmd_scan)
+ self.endGroup()
+
+ self.beginGroup("refresh")
+ self.setValue("rate", self.auto_refresh_rate)
+ self.setValue("enable", self.auto_refresh)
+ self.setValue("type", self.auto_refresh_type)
+ self.endGroup()
+
+ self.beginGroup("polling")
+ self.setValue("enable", self.polling)
+ self.setValue("interval", self.polling_interval)
+ self.setValue("device_list", (to_unicode(',').join(self.polling_device_list)))
+ self.endGroup()
+
+ self.beginGroup("fax")
+ self.setValue("voice_phone", self.voice_phone)
+ self.setValue("email_address", self.email_address)
+ self.endGroup()
+
+ self.beginGroup("upgrade")
+ self.setValue("notify_upgrade", self.upgrade_notify)
+ if self.upgrade_last_update_time <1:
+ self.upgrade_last_update_time = int(time.time()) # <---Need to verify code once
+
+ self.setValue("last_upgraded_time", self.upgrade_last_update_time)
+ self.setValue("pending_upgrade_time", self.upgrade_pending_update_time)
+ self.endGroup()
+
+
+ self.sync()
+
+
+ def debug(self):
+ log.debug("FAB command: %s" % self.cmd_fab)
+ log.debug("Scan command: %s" % self.cmd_scan)
+ log.debug("Auto refresh: %s" % self.auto_refresh)
+ log.debug("Auto refresh rate: %s" % self.auto_refresh_rate)
+ log.debug("Auto refresh type: %s" % self.auto_refresh_type)
+ log.debug("Systray visible: %d" % self.systray_visible)
+ log.debug("Systray messages: %d" % self.systray_messages)
+ log.debug("Last used device URI: %s" % self.last_used_device_uri)
+ log.debug("Last used printer: %s" % self.last_used_printer)
+ log.debug("Working directory: %s" % self.working_dir)
+
+
+DEFAULT_TITLE = __translate("HP Device Manager")
+
+
+def FailureUI(parent, error_text, title_text=None):
+ log.error(pat_html_remove.sub(' ', to_unicode(error_text)))
+
+ if title_text is None:
+ if parent is not None:
+ title_text = parent.windowTitle()
+ else:
+ title_text = DEFAULT_TITLE
+
+ QMessageBox.critical(parent,
+ title_text,
+ error_text,
+ QMessageBox.Ok|\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+showFailureUi = FailureUI
+
+
+def WarningUI(parent, warn_text, title_text=None):
+ log.warn(pat_html_remove.sub(' ', to_unicode(warn_text)))
+
+ if title_text is None:
+ if parent is not None:
+ title_text = parent.windowTitle()
+ else:
+ title_text = DEFAULT_TITLE
+
+
+ QMessageBox.warning(parent,
+ title_text,
+ warn_text,
+ QMessageBox.Ok|\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+showWarningUi = WarningUI
+
+
+def SuccessUI(parent, text, title_text=None):
+ log.info(pat_html_remove.sub(' ', to_unicode(text)))
+
+ if title_text is None:
+ if parent is not None:
+ title_text = parent.windowTitle()
+ else:
+ title_text = DEFAULT_TITLE
+
+
+ QMessageBox.information(parent,
+ title_text,
+ text,
+ QMessageBox.Ok|\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+showSuccessUi = SuccessUI
+
+
+def CheckDeviceUI(parent, title_text=None):
+ text = __translate("<b>Unable to communicate with device or device is in an error state.</b><p>Please check device setup and try again.</p>")
+ return FailureUI(parent, text, title_text)
+
+checkDeviceUi = CheckDeviceUI
+
+
+class PrinterNameValidator(QValidator):
+ def __init__(self, parent=None):
+ QValidator.__init__(self, parent)
+
+ def validate(self, input_data, pos):
+ returnCode = QValidator.Invalid
+ input_data = to_unicode(input_data)
+
+ if not input_data:
+ returnCode = QValidator.Acceptable
+ elif input_data[pos-1] in cups.INVALID_PRINTER_NAME_CHARS:
+ returnCode = QValidator.Invalid
+ else:
+ returnCode = QValidator.Acceptable
+
+ # TODO: How to determine if unicode char is "printable" and acceptable
+ # to CUPS?
+ #elif input_data != utils.printable(input_data):
+ # return QValidator.Invalid, pos
+
+ return returnCode, input_data, pos
+
+
+class PhoneNumValidator(QValidator):
+ def __init__(self, parent=None):
+ QValidator.__init__(self, parent)
+
+ def validate(self, input_data, pos):
+ returnCode = QValidator.Invalid
+ input_data = to_unicode(input_data)
+
+ if not input_data:
+ returnCode = QValidator.Acceptable
+ elif input_data[pos-1] not in to_unicode('0123456789-(+).,#* '):
+ returnCode = QValidator.Invalid
+ else:
+ returnCode = QValidator.Acceptable
+
+ return returnCode, input_data, pos
+
+
+class AddressBookNameValidator(QValidator):
+ def __init__(self, db, parent=None):
+ QValidator.__init__(self, parent)
+ self.db = db
+
+ def validate(self, input_data, pos):
+ returnCode = QValidator.Invalid
+ input_data = to_unicode(input_data)
+
+ if not input_data:
+ returnCode = QValidator.Acceptable
+ elif input_data in self.db.get_all_names():
+ returnCode = QValidator.Invalid
+ elif input_data[pos-1] in to_unicode('''|\\/"'''): # | is the drag 'n drop separator
+ returnCode = QValidator.Invalid
+ else:
+ returnCode = QValidator.Acceptable
+
+ return returnCode, input_data, pos
+
+
+
+MIME_TYPES_DESC = \
+{
+ "application/pdf" : (__translate("PDF Document"), '.pdf'),
+ "application/postscript" : (__translate("Postscript Document"), '.ps'),
+ "application/vnd.hp-HPGL" : (__translate("HP Graphics Language File"), '.hgl, .hpg, .plt, .prn'),
+ "application/x-cshell" : (__translate("C Shell Script"), '.csh, .sh'),
+ "application/x-csource" : (__translate("C Source Code"), '.c'),
+ "text/cpp": (__translate("C/C++ Source Code"), '.c, .cpp, .cxx'),
+ "application/x-perl" : (__translate("Perl Script"), '.pl'),
+ "application/x-python" : (__translate("Python Program"), '.py'),
+ "application/x-shell" : (__translate("Shell Script"), '.sh'),
+ "application/x-sh" : (__translate("Shell Script"), '.sh'),
+ "text/plain" : (__translate("Plain Text"), '.txt, .log'),
+ "text/html" : (__translate("HTML Dcoument"), '.htm, .html'),
+ "image/gif" : (__translate("GIF Image"), '.gif'),
+ "image/png" : (__translate("PNG Image"), '.png'),
+ "image/jpeg" : (__translate("JPEG Image"), '.jpg, .jpeg'),
+ "image/tiff" : (__translate("TIFF Image"), '.tif, .tiff'),
+ "image/x-bitmap" : (__translate("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-bmp" : (__translate("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-photocd" : (__translate("Photo CD Image"), '.pcd'),
+ "image/x-portable-anymap" : (__translate("Portable Image (PNM)"), '.pnm'),
+ "image/x-portable-bitmap" : (__translate("Portable B&W Image (PBM)"), '.pbm'),
+ "image/x-portable-graymap" : (__translate("Portable Grayscale Image (PGM)"), '.pgm'),
+ "image/x-portable-pixmap" : (__translate("Portable Color Image (PPM)"), '.ppm'),
+ "image/x-sgi-rgb" : (__translate("SGI RGB"), '.rgb'),
+ "image/x-xbitmap" : (__translate("X11 Bitmap (XBM)"), '.xbm'),
+ "image/x-xpixmap" : (__translate("X11 Pixmap (XPM)"), '.xpm'),
+ "image/x-sun-raster" : (__translate("Sun Raster Format"), '.ras'),
+ "application/hplip-fax" : (__translate("HPLIP Fax File"), '.g3, .g4'),
+}
+
+# pixmaps for status list(s) (inkjet, laserjet)
+status_icons = None
+
+def getStatusListIcon(error_state):
+ global status_icons
+ if status_icons is None:
+ status_icons = {
+ ERROR_STATE_CLEAR : (load_pixmap('idle', '16x16'), load_pixmap('idle', '16x16')),
+ ERROR_STATE_BUSY : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_ERROR : (load_pixmap('error', '16x16'), load_pixmap('error', '16x16')),
+ ERROR_STATE_LOW_SUPPLIES : (load_pixmap('inkdrop', '16x16'), load_pixmap('toner', '16x16')),
+ ERROR_STATE_OK : (load_pixmap('ok', '16x16'), load_pixmap('ok', '16x16')),
+ ERROR_STATE_WARNING : (load_pixmap('warning', '16x16'), load_pixmap('warning', '16x16')),
+ ERROR_STATE_LOW_PAPER: (load_pixmap('paper', '16x16'), load_pixmap('paper', '16x16')),
+ ERROR_STATE_PRINTING : (load_pixmap("print", '16x16'), load_pixmap("print", '16x16')),
+ ERROR_STATE_SCANNING : (load_pixmap("scan", '16x16'), load_pixmap("scan", '16x16')),
+ ERROR_STATE_PHOTOCARD : (load_pixmap("pcard", '16x16'), load_pixmap("pcard", '16x16')),
+ ERROR_STATE_FAXING : (load_pixmap("fax", '16x16'), load_pixmap("fax", '16x16')),
+ ERROR_STATE_COPYING : (load_pixmap("makecopies", '16x16'), load_pixmap("makecopies", '16x16')),
+ }
+
+ return status_icons.get(error_state, status_icons[ERROR_STATE_CLEAR])
+
+# pixmaps for device icons (inkjet, laserjet)
+overlay_icons = None
+
+def getStatusOverlayIcon(error_state):
+ global overlay_icons
+ if overlay_icons is None:
+ overlay_icons = {
+ ERROR_STATE_CLEAR : (None, None),
+ ERROR_STATE_BUSY : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_ERROR : (load_pixmap('error', '16x16'), load_pixmap('error', '16x16')),
+ ERROR_STATE_LOW_SUPPLIES : (load_pixmap('inkdrop', '16x16'), load_pixmap('toner', '16x16')),
+ ERROR_STATE_OK : (load_pixmap('ok', '16x16'), load_pixmap('ok', '16x16')),
+ ERROR_STATE_WARNING : (load_pixmap('warning', '16x16'), load_pixmap('warning', '16x16')),
+ ERROR_STATE_LOW_PAPER: (load_pixmap('paper', '16x16'), load_pixmap('paper', '16x16')),
+ ERROR_STATE_PRINTING : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_SCANNING : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_PHOTOCARD : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_FAXING : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_COPYING : (load_pixmap('busy', '16x16'), load_pixmap('busy', '16x16')),
+ ERROR_STATE_REFRESHING : (load_pixmap('refresh1', '16x16'), load_pixmap('refresh1', '16x16')),
+ }
+
+ return overlay_icons.get(error_state, overlay_icons[ERROR_STATE_CLEAR])
+
+
+NUM_REPRS = {
+ 1 : __translate("one"),
+ 2 : __translate("two"),
+ 3 : __translate("three"),
+ 4 : __translate("four"),
+ 5 : __translate("five"),
+ 6 : __translate("six"),
+ 7 : __translate("seven"),
+ 8 : __translate("eight"),
+ 9 : __translate("nine"),
+ 10 : __translate("ten"),
+ 11 : __translate("eleven"),
+ 12 : __translate("twelve")
+}
+
+UNIT_NAMES = {
+ "year" : (__translate("year"), __translate("years")),
+ "month" : (__translate("month"), __translate("months")),
+ "week" : (__translate("week"), __translate("weeks")),
+ "day" : (__translate("day"), __translate("days")),
+ "hour" : (__translate("hour"), __translate("hours")),
+ "minute" : (__translate("minute"), __translate("minutes")),
+ "second" : (__translate("second"), __translate("seconds")),
+}
+
+
+def getTimeDeltaDesc(past):
+ t1 = QDateTime()
+ t1.setTime_t(int(past))
+ t2 = QDateTime.currentDateTime()
+ delta = t1.secsTo(t2)
+ return __translate("(%s ago)"%stringify(delta))
+
+
+# "Nicely readable timedelta"
+# Credit: Bjorn Lindqvist
+# ASPN Python Recipe 498062
+# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498062
+# Note: Modified from recipe
+def getSecondsInUnits(seconds):
+ unit_limits = [("year", 31536000),
+ ("month", 2592000),
+ ("week", 604800),
+ ("day", 86400),
+ ("hour", 3600),
+ ("minute", 60)]
+
+ for unit_name, limit in unit_limits:
+ if seconds >= limit:
+ amount = int(round(float(seconds) / limit))
+ return amount, unit_name
+
+ return seconds, "second"
+
+
+def stringify(seconds):
+ amount, unit_name = getSecondsInUnits(seconds)
+
+ try:
+ i18n_amount = NUM_REPRS[amount]
+ except KeyError:
+ i18n_amount = to_unicode(amount)
+
+ if amount == 1:
+ i18n_unit = UNIT_NAMES[unit_name][0]
+ else:
+ i18n_unit = UNIT_NAMES[unit_name][1]
+
+ return "%s %s"%(i18n_amount, i18n_unit)
diff --git a/ui5/upgradedialog.py b/ui5/upgradedialog.py
new file mode 100644
index 000000000..1d1e003c1
--- /dev/null
+++ b/ui5/upgradedialog.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Amarnath Chitumalla
+#
+
+#Global
+import os
+import time
+import signal
+
+# Local
+from base.g import *
+from base import device, utils, pkit, os_utils
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .upgradedialog_base import Ui_Dialog
+
+MANUAL_INSTALL_LINK = "http://hplipopensource.com/hplip-web/install/manual/index.html"
+
+
+class UpgradeDialog(QDialog, Ui_Dialog):
+ def __init__(self, parent, distro_tier, msg):
+ QDialog.__init__(self, parent)
+ self.distro_tier = distro_tier
+ self.msg = msg
+ self.result = False
+ self.setupUi(self, distro_tier, msg)
+ self.initUi()
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+# self.connect (self.comboBox, SIGNAL ("currentIndexChanged (const QString&)"), self.slotIndexChanged)
+ self.installRadioBtton.toggled[bool].connect(self.installRadioBtton_toggled)
+ self.remindRadioBtton.toggled[bool].connect(self.remindRadioBtton_toggled)
+ self.dontRemindRadioBtton.toggled[bool].connect(self.dontRemindRadioBtton_toggled)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def installRadioBtton_toggled(self, radio_enabled):
+ if radio_enabled is True:
+ self.installRadioBtton.setChecked(True)
+ else:
+ self.installRadioBtton.setChecked(False)
+
+
+ def remindRadioBtton_toggled(self, radio_enabled):
+ if radio_enabled is True:
+ self.remindRadioBtton.setChecked(True)
+ self.daysSpinBox.setEnabled(True)
+ else:
+ self.remindRadioBtton.setChecked(False)
+ self.daysSpinBox.setEnabled(False)
+
+
+ def dontRemindRadioBtton_toggled(self, radio_enabled):
+ if radio_enabled is True:
+ self.dontRemindRadioBtton.setChecked(True)
+ else:
+ self.dontRemindRadioBtton.setChecked(False)
+
+
+ def NextButton_clicked (self):
+ if self.dontRemindRadioBtton.isChecked():
+ log.debug("HPLIP Upgrade, selected Don't remind again radiobutton")
+ user_conf.set('upgrade', 'notify_upgrade', 'false')
+ msg= "Check for HPLIP updates is disabled. To enable it again, change 'Settings' in 'HP systemtray' "
+ SuccessUI(self, self.__tr(msg))
+
+ elif self.remindRadioBtton.isChecked():
+ schedule_days = str(self.daysSpinBox.value())
+ log.debug("HPLIP Upgrade, selected remind later radiobutton days= %d" %(int(schedule_days)))
+ next_time = time.time() + (int(schedule_days) *24 * 60 *60)
+ user_conf.set('upgrade', 'pending_upgrade_time', str(int(next_time)))
+ else:
+ log.debug("HPLIP Upgrade, selected Install radiobutton distro_type=%d" %self.distro_tier)
+ self.NextButton.setEnabled(False)
+ if self.distro_tier != 1: # not tier 1 distro
+ log.debug("OK pressed for tier 2 distro pressed")
+ utils.openURL(MANUAL_INSTALL_LINK)
+
+ ## TBD::open browser
+ else:
+ terminal_cmd = utils.get_terminal()
+ if terminal_cmd is not None and utils.which("hp-upgrade"):
+ cmd = terminal_cmd + " 'hp-upgrade -w'"
+ os_utils.execute(cmd)
+ self.result = True
+ else:
+ log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd)
+ FailureUI(self, self.__tr("Failed to run hp-upgrade"))
+
+ self.close()
+
+
+ def CancelButton_clicked(self):
+ log.debug("User exit")
+ self.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("UpgradeDialog",s,c)
+
diff --git a/ui5/upgradedialog_base.py b/ui5/upgradedialog_base.py
new file mode 100644
index 000000000..48020abf5
--- /dev/null
+++ b/ui5/upgradedialog_base.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/gaurav/work_qt5/src_qt5/ui5/upgradedialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(369, 239)
+ self.centralwidget = QtWidgets.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
+ self.pushButton_2.setGeometry(QtCore.QRect(270, 160, 91, 31))
+ self.pushButton_2.setObjectName("pushButton_2")
+ self.pushButton = QtWidgets.QPushButton(self.centralwidget)
+ self.pushButton.setGeometry(QtCore.QRect(159, 160, 96, 31))
+ self.pushButton.setObjectName("pushButton")
+ self.radioButton = QtWidgets.QRadioButton(self.centralwidget)
+ self.radioButton.setGeometry(QtCore.QRect(10, 65, 181, 22))
+ self.radioButton.setObjectName("radioButton")
+ self.radioButton_2 = QtWidgets.QRadioButton(self.centralwidget)
+ self.radioButton_2.setGeometry(QtCore.QRect(8, 96, 141, 22))
+ self.radioButton_2.setObjectName("radioButton_2")
+ self.radioButton_3 = QtWidgets.QRadioButton(self.centralwidget)
+ self.radioButton_3.setGeometry(QtCore.QRect(9, 126, 161, 22))
+ self.radioButton_3.setObjectName("radioButton_3")
+ self.spinBox = QtWidgets.QSpinBox(self.centralwidget)
+ self.spinBox.setGeometry(QtCore.QRect(152, 94, 55, 27))
+ self.spinBox.setMinimum(1)
+ self.spinBox.setMaximum(365)
+ self.spinBox.setProperty("value", 30)
+ self.spinBox.setObjectName("spinBox")
+ self.label = QtWidgets.QLabel(self.centralwidget)
+ self.label.setGeometry(QtCore.QRect(211, 98, 67, 21))
+ self.label.setObjectName("label")
+ self.label_2 = QtWidgets.QLabel(self.centralwidget)
+ self.label_2.setGeometry(QtCore.QRect(10, 10, 351, 51))
+ self.label_2.setObjectName("label_2")
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.menubar = QtWidgets.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 369, 27))
+ self.menubar.setObjectName("menubar")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtWidgets.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+
+ self.retranslateUi(MainWindow)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ _translate = QtCore.QCoreApplication.translate
+ MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
+ self.pushButton_2.setText(_translate("MainWindow", "OK"))
+ self.pushButton.setText(_translate("MainWindow", "Cancel"))
+ self.radioButton.setText(_translate("MainWindow", "Download and Install"))
+ self.radioButton_2.setText(_translate("MainWindow", "Remind me after"))
+ self.radioButton_3.setText(_translate("MainWindow", "Don\'t remind again"))
+ self.label.setText(_translate("MainWindow", "days"))
+ self.label_2.setText(_translate("MainWindow", "New version of HPLIP-X.X.X is available.\n"
+"Do you want to install"))
+
diff --git a/ui5/upgradedialog_base.ui b/ui5/upgradedialog_base.ui
new file mode 100644
index 000000000..15737527a
--- /dev/null
+++ b/ui5/upgradedialog_base.ui
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>369</width>
+ <height>239</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>270</x>
+ <y>160</y>
+ <width>91</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>159</x>
+ <y>160</y>
+ <width>96</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="radioButton">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>65</y>
+ <width>181</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Download and Install</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="radioButton_2">
+ <property name="geometry">
+ <rect>
+ <x>8</x>
+ <y>96</y>
+ <width>141</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Remind me after</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" name="radioButton_3">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>126</y>
+ <width>161</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Don't remind again</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" name="spinBox">
+ <property name="geometry">
+ <rect>
+ <x>152</x>
+ <y>94</y>
+ <width>55</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>365</number>
+ </property>
+ <property name="value">
+ <number>30</number>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>211</x>
+ <y>98</y>
+ <width>67</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>days</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>351</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>New version of HPLIP-X.X.X is available.
+Do you want to install</string>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>369</width>
+ <height>27</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/ui5/wifisetupdialog.py b/ui5/wifisetupdialog.py
new file mode 100644
index 000000000..ec4e2dfd0
--- /dev/null
+++ b/ui5/wifisetupdialog.py
@@ -0,0 +1,859 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Authors: Don Welch
+#
+
+# StdLib
+import operator
+import signal
+
+# Local
+from base.g import *
+from base import device, models, wifi, LedmWifi
+from base.codes import *
+from base.sixext import to_unicode
+from .ui_utils import *
+
+# Qt
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
+
+# Ui
+from .wifisetupdialog_base import Ui_Dialog
+
+
+
+PAGE_INTRO = 0 # Ask user to plugin temp USB connection
+PAGE_DEVICES = 1 # Select a probed USB device
+PAGE_NETWORK = 2 # Select a discovered SSID
+PAGE_CONFIGURE_WIFI = 3 # Configure USB device on network
+PAGE_EXIT = 4 # Tell user if successful, unplug USB onnection
+
+
+BUTTON_NEXT = 0
+BUTTON_FINISH = 1
+BUTTON_CONNECT = 3
+
+SUCCESS_NOT_CONNECTED = 0
+SUCCESS_AUTO_IP = 1
+SUCCESS_CONNECTED = 2
+
+ASSOCIATE_DELAY = 30
+REFRESH_INTERVAL = 20
+
+
+class DeviceTableWidgetItem(QTableWidgetItem):
+ def __init__(self, text, device_uri):
+ QTableWidgetItem.__init__(self, text, QTableWidgetItem.UserType)
+ self.device_uri = device_uri
+
+
+class WifiSetupDialog(QDialog, Ui_Dialog):
+
+ itemSelectionChanged = pyqtSignal()
+ def __init__(self, parent, device_uri=None, standalone=True):
+ QDialog.__init__(self, parent)
+ self.setupUi(self)
+
+ self.device_uri = device_uri
+ self.devices = {}
+ self.networks = {}
+ self.ssid = ''
+ self.directed = False
+ self.show_extended = False
+ self.bus = 'usb'
+ self.search = ''
+ self.max_page = PAGE_EXIT
+ self.location_cache = {} # { 'bssid' : <location>, ... }
+ self.dev = None
+ self.success = SUCCESS_NOT_CONNECTED
+ self.ip = '0.0.0.0'
+ self.hn = ''
+ self.standalone = standalone
+ self.initUi()
+ self.adapterName = 'Wifi0'
+ self.wifiObj = wifi
+
+ #if self.device_uri is None:
+ # QTimer.singleShot(0, self.showIntroPage)
+ #else:
+ # QTimer.singleShot(0, self.showNetworkPage)
+
+ QTimer.singleShot(0, self.showIntroPage)
+
+
+ #
+ # INIT
+ #
+
+ def initUi(self):
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+ # connect signals/slots
+ # self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.CancelButton.clicked.connect(self.CancelButton_clicked)
+ self.BackButton.clicked.connect(self.BackButton_clicked)
+ self.NextButton.clicked.connect(self.NextButton_clicked)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+ self.initIntroPage()
+ self.initDevicesPage()
+ self.initNetworkPage()
+ self.initConfigWifiPage()
+ self.initExitPage()
+
+ #
+ # INTRO PAGE
+ #
+
+ def initIntroPage(self):
+ self.Picture.setPixmap(load_pixmap("usb_connection", "other"))
+ self.InfoIcon.setPixmap(load_pixmap("info", "16x16"))
+
+ if self.standalone:
+ self.MainTitleLabel.setText(self.__tr("""This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete.
+
+<p><i>Note: This configuration utility does not setup (install) your printer on this computer. Use hp-setup to setup your printer after it has been configured on the network by this utility.</i></p>
+<p><i>Note: Only select wireless capable printers are supported by this utility.</i></p>"""))
+ else:
+ self.MainTitleLabel.setText(self.__tr("""This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete.
+
+<p><i>Note: Printer setup (installation) will continue after your printer is configured on the network.</i></p>
+<p><i>Note: Only select wireless capable printers are supported by this utility.</i></p>"""))
+
+
+ def showIntroPage(self):
+ self.BackButton.setEnabled(False)
+ self.NextButton.setEnabled(True)
+
+ self.displayPage(PAGE_INTRO)
+
+
+ #
+ # DEVICES PAGE
+ #
+
+ def initDevicesPage(self):
+ self.RefreshButton.clicked.connect(self.RefreshButton_clicked)
+
+
+ def showDevicesPage(self):
+ self.BackButton.setEnabled(True)
+ self.setNextButton(BUTTON_NEXT)
+
+ beginWaitCursor()
+ try:
+ if not self.devices:
+ log.info("Searching on USB bus...")
+ filter_dict = {'wifi-config' : (operator.gt, WIFI_CONFIG_NONE)}
+
+ try:
+ from base import smart_install
+ except ImportError:
+ log.error("Failed to Import smart_install.py from base")
+ else:
+ endWaitCursor()
+ smart_install.disable(GUI_MODE, 'qt4')
+ beginWaitCursor()
+
+ self.devices = device.probeDevices([self.bus], 0, 0, filter_dict, self.search)
+
+ finally:
+ endWaitCursor()
+
+ self.clearDevicesTable()
+
+ if self.devices:
+ self.NextButton.setEnabled(True)
+ self.DevicesFoundIcon.setPixmap(load_pixmap('info', '16x16'))
+
+ if len(self.devices) == 1:
+ self.DevicesFoundLabel.setText(self.__tr("<b>1 wireless capable device found.</b> Click <i>Next</i> to continue."))
+ else:
+ self.DevicesFoundLabel.setText(self.__tr("<b>%s wireless capable devices found.</b> Select the device to install and click <i>Next</i> to continue." % len(self.devices)))
+
+ self.loadDevicesTable()
+
+ else:
+ self.NextButton.setEnabled(False)
+ self.DevicesFoundIcon.setPixmap(load_pixmap('error', '16x16'))
+ log.error("No devices found on bus: %s" % self.bus)
+ self.DevicesFoundLabel.setText(self.__tr("<b>No wireless capable devices found.</b><br>Plug in your printer with a USB cable and click <i>Refresh</i> to search again."))
+
+ self.displayPage(PAGE_DEVICES)
+
+
+ def loadDevicesTable(self):
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesTableWidget.setRowCount(len(self.devices))
+
+ headers = [self.__tr('Model'), self.__tr('Device URI')]
+ device_uri_col = 1
+
+ self.DevicesTableWidget.setColumnCount(len(headers))
+ self.DevicesTableWidget.setHorizontalHeaderLabels(headers)
+ flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+
+ for row, d in enumerate(self.devices):
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(d)
+ model_ui = models.normalizeModelUIName(model)
+
+ i = DeviceTableWidgetItem(str(model_ui), d)
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(str(d))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, device_uri_col, i)
+
+ self.DevicesTableWidget.resizeColumnsToContents()
+ self.DevicesTableWidget.setSortingEnabled(True)
+ self.DevicesTableWidget.sortItems(0)
+ self.DevicesTableWidget.selectRow(0)
+
+
+ def clearDevicesTable(self):
+ self.DevicesTableWidget.clear()
+ self.DevicesTableWidget.setRowCount(0)
+ self.DevicesTableWidget.setColumnCount(0)
+
+
+ def RefreshButton_clicked(self):
+ self.clearDevicesTable()
+ self.devices = []
+ QTimer.singleShot(0, self.showDevicesPage)
+
+
+ #
+ # NETWORK
+ #
+
+ def initNetworkPage(self):
+ self.NetworksTableWidget.setIconSize(QSize(34, 20))
+ self.ShowExtendedCheckBox.setChecked(False)
+ self.ShowExtendedCheckBox.clicked[bool].connect(self.ShowExtendedCheckBox_clicked)
+ self.SearchPushButton.clicked.connect(self.SearchPushButton_clicked)
+ self.UndirectedRadioButton.clicked[bool].connect(self.UndirectedRadioButton_clicked)
+ self.DirectedRadioButton.clicked[bool].connect(self.DirectedRadioButton_clicked)
+ self.NetworksTableWidget.itemSelectionChanged.connect(self.NetworksTableWidget_itemSelectionChanged)
+
+
+ def showNetworkPage(self):
+ if self.dev is None:
+ try:
+ self.dev = device.Device(self.device_uri)
+ except Error as e:
+ FailureUI(self, self.__tr("<b>Error opening device:</b><p>%s</p><p>(%s)</p>") %(self.device_uri, str(e[0])))
+
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+ return
+
+ self.networks.clear()
+ self.num_networks = 0
+
+ try:
+ adaptor_list = self.wifiObj.getWifiAdaptorID(self.dev)
+ except Error as e:
+ self.showIOError(e)
+ return
+
+ if len(adaptor_list) == 0:
+ FailureUI(self, self.__tr("<b>Unable to locate wireless hardware on device.</b>"))
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+ log.debug("Turning on wireless radio...")
+ try:
+ self.adaptor_id, self.adapterName, state, presence = self.wifiObj.setAdaptorPower(self.dev, adaptor_list )
+ except Error as e:
+ self.showIOError(e)
+ return
+ if self.adaptor_id == -1:
+ FailureUI(self, self.__tr("<b>Unable to turn on wireless adaptor.</b>"))
+ if self.dev is not None:
+ self.dev.close()
+
+ log.debug("Adaptor ID: %s" % self.adaptor_id)
+ log.debug("Adaptor name: %s" % self.adapterName)
+ log.debug("Adaptor state: %s" % state)
+ log.debug("Adaptor presence: %s" % presence)
+
+ self.performScan()
+ self.setNextButton(BUTTON_NEXT)
+ self.displayPage(PAGE_NETWORK)
+
+
+ def performScan(self):
+ beginWaitCursor()
+ try:
+ self.ssid = to_unicode(self.SSIDLineEdit.text())
+ if self.directed and self.ssid:
+ try:
+ self.networks = self.wifiObj.performScan(self.dev, self.adapterName, self.ssid)
+ except Error as e:
+ self.showIOError(e)
+ return
+ else:
+ try:
+ self.networks = self.wifiObj.performScan(self.dev, self.adapterName)
+ except Error as e:
+ self.showIOError(e)
+ return
+ finally:
+ self.dev.close()
+ endWaitCursor()
+ self.num_networks = self.networks['numberofscanentries']
+ self.clearNetworksTable()
+
+ if self.num_networks:
+ self.NextButton.setEnabled(True)
+ self.NetworksFoundIcon.setPixmap(load_pixmap('info', '16x16'))
+
+ if self.num_networks == 1:
+ self.NetworksFoundLabel.setText(self.__tr("<b>1 wireless network found. </b> If the wireless network you would like to connect to is not listed, try entering a wireless network name and/or press <i>Search</i> to search again."))
+ else:
+ self.NetworksFoundLabel.setText(self.__tr("<b>%d wireless networks found.</b> If the wireless network you would like to connect to is not listed, try entering a wireless network name and/or press <i>Search</i> to search again." %self.num_networks))
+
+ self.loadNetworksTable()
+
+ else:
+ self.NextButton.setEnabled(False)
+ self.NetworksFoundIcon.setPixmap(load_pixmap('error', '16x16'))
+ log.warning("No wireless networks found.")
+ self.NetworksFoundLabel.setText(self.__tr("<b>No wireless networks found.</b><br>Enter a wireless network name and/or press <i>Search</i> to search again."))
+
+
+ def ShowExtendedCheckBox_clicked(self, b):
+ self.show_extended = b
+ self.loadNetworksTable()
+
+
+ def SearchPushButton_clicked(self):
+ self.performScan()
+ self.loadNetworksTable()
+
+
+ def UndirectedRadioButton_clicked(self, b):
+ self.directed = not b
+ self.SSIDLineEdit.setEnabled(not b)
+
+
+ def DirectedRadioButton_clicked(self, b):
+ self.directed = b
+ self.SSIDLineEdit.setEnabled(b)
+
+
+ def loadNetworksTable(self):
+ self.n, self.network = 0, to_unicode('')
+ if self.num_networks:
+ beginWaitCursor()
+ try:
+ if self.show_extended:
+ for n in range(self.num_networks):
+ bssid = self.networks['bssid-%d' % n]
+ ss = self.networks['signalstrength-%d' % n]
+ try:
+ self.location_cache[bssid]
+ except KeyError:
+ location = wifi.getLocation(bssid, ss)
+ lat = self.networks['latitude-%d' % n] = location.get('latitude', 'Unknown')
+ lng = self.networks['longitude-%d' % n] = location.get('longitude', 'Unknown')
+ address = self.networks['address-%d' % n] = location.get('address', 'Unknown')
+ self.location_cache[bssid] = (lat, lng, address)
+ else:
+ self.networks['latitude-%d' % n], self.networks['longitude-%d' % n], self.networks['address-%d' % n] = \
+ self.location_cache[bssid]
+
+ self.NetworksTableWidget.setSortingEnabled(False)
+ self.NetworksTableWidget.setRowCount(self.num_networks)
+
+ headers = [self.__tr('Network Name (SSID)'), self.__tr('Signal Strength'),
+ self.__tr("Security"), self.__tr("Mode")]
+
+ if self.show_extended:
+ headers.extend([self.__tr('Channel'),
+ self.__tr("Address (BSSID)"), self.__tr("Location"),
+ self.__tr("Lat/Long")])
+
+ self.NetworksTableWidget.setColumnCount(len(headers))
+ self.NetworksTableWidget.setHorizontalHeaderLabels(headers)
+ enabled_flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled
+ for n in range(self.num_networks):
+ name = self.networks['ssid-%d' % n]
+
+ if name == '(unknown)':
+ flags = None
+ else:
+ flags = enabled_flags
+
+ ss = self.networks['signalstrength-%d' % n]
+ sec = self.networks['encryptiontype-%d' % n]
+ mode = self.networks['communicationmode-%d' % n]
+
+ log.debug("%d: Name=%s, strength=%s, security=%s, mode=%s" % #, channel=%d bssid=%s" %
+ (n, name, ss, sec, mode))
+
+ if self.show_extended:
+ chn = self.networks['channel-%d' % n]
+ dbm = self.networks['dbm-%d' % n]
+ bssid = self.networks['bssid-%d' % n]
+ address = self.networks['address-%d' % n]
+ lat = self.networks['latitude-%d' % n]
+ lng = self.networks['longitude-%d' % n]
+
+ log.debug("%d: channel=%d bssid=%s dbm=%s lat=%s long=%s address=%s" %
+ (n, chn, bssid, dbm, lat, lng, address))
+
+ i = QTableWidgetItem(str(name))
+ if flags is not None: i.setFlags(flags)
+ i.setData(Qt.UserRole, n)
+ self.NetworksTableWidget.setItem(n, 0, i)
+
+ pixmap = load_pixmap('signal%d' % ss, 'other')
+ if self.show_extended:
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr("%s/5 (%s dBm)" %(ss, dbm)))
+ else:
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr("%s/5" % ss))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 1, i)
+
+ i = QTableWidgetItem(str(sec))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 2, i)
+
+ i = QTableWidgetItem(str(mode))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 3, i)
+
+ if self.show_extended:
+ i = QTableWidgetItem(str(str(chn)))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 4, i)
+
+ i = QTableWidgetItem(str(bssid))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 5, i)
+
+ i = QTableWidgetItem(str(address))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 6, i)
+
+ i = QTableWidgetItem(str("%s/%s" % (lat, lng)))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 7, i)
+
+
+ self.NetworksTableWidget.resizeColumnsToContents()
+ self.NetworksTableWidget.setSortingEnabled(True)
+ self.NetworksTableWidget.sortItems(1, Qt.DescendingOrder)
+ self.NetworksTableWidget.selectRow(0)
+ # itemSelectionChanged = pyqtSignal()
+ # self.NetworksTableWidget.emit(SIGNAL("itemSelectionChanged()"))
+ self.NetworksTableWidget.itemSelectionChanged.emit()
+
+ finally:
+ endWaitCursor()
+ self.NextButton.setEnabled(True)
+
+ else:
+ self.NextButton.setEnabled(False)
+
+
+ def NetworksTableWidget_itemSelectionChanged(self):
+ row = self.NetworksTableWidget.currentRow()
+ item = self.NetworksTableWidget.item(row, 0)
+ n, ok = value_int(item.data(Qt.UserRole))
+ if ok:
+ sec = self.networks['encryptiontype-%d' % n]
+ if sec.lower() == 'none':
+ self.setNextButton(BUTTON_CONNECT)
+ else:
+ self.setNextButton(BUTTON_NEXT)
+
+
+ def clearNetworksTable(self):
+ self.DevicesTableWidget.clear()
+ self.DevicesTableWidget.setRowCount(0)
+ self.DevicesTableWidget.setColumnCount(0)
+
+
+ def RefreshButton2_clicked(self):
+ self.clearNetworksTable()
+ self.networks = {}
+ QTimer.singleShot(0, self.showNetworkPage)
+
+
+ #
+ # CONFIGURE WIFI
+ #
+
+ def initConfigWifiPage(self):
+ self.ShowKeyCheckBox.toggled[bool].connect(self.ShowKeyCheckBox_toggled)
+
+
+ def showConfigWifiPage(self):
+ self.setNextButton(BUTTON_CONNECT)
+ self.SSIDLabel.setText(self.network)
+ font = QFont()
+ font.setPointSize(12)
+ self.SSIDLabel.setFont(font)
+ self.KeyLineEdit.setText(str())
+ self.ShowKeyCheckBox.setChecked(False)
+ self.StrengthIcon.setPixmap(load_pixmap('signal%d' % self.ss, 'other'))
+ self.ConfigureIcon.setPixmap(load_pixmap('info', '16x16'))
+ self.KeysIcon.setPixmap(load_pixmap('keys', '32x32'))
+
+ if 'wpa' in self.security.lower():
+ self.WPARadioButton.setChecked(True)
+
+ elif 'wep' in self.security.lower():
+ self.WEPRadioButton.setChecked(True)
+
+ self.KeyLineEdit.setFocus()
+ self.KeyLineEdit.setEchoMode(QLineEdit.Password)
+ self.displayPage(PAGE_CONFIGURE_WIFI)
+
+
+ def ShowKeyCheckBox_toggled(self, b):
+ if b:
+ self.KeyLineEdit.setEchoMode(QLineEdit.Normal)
+ else:
+ self.KeyLineEdit.setEchoMode(QLineEdit.Password)
+
+
+ #
+ # EXIT/CONNECT PAGE
+ #
+
+ def initExitPage(self):
+ self.PageSpinBox.valueChanged[int].connect(self.PageSpinBox_valueChanged)
+ self.RefreshTimer = QTimer(self)
+ # self.RefreshTimer.timeout.connect(self.RefreshTimer_timeout)
+ self.RefreshTimer.timeout.connect(self.RefreshTimer_timeout)
+ self.pages = []
+ self.page_index = 0
+ self.PageSpinBox.setMinimum(1)
+
+
+ def showExitPage(self):
+ self.setNextButton(BUTTON_FINISH)
+ self.NextButton.setEnabled(False)
+ self.CancelButton.setEnabled(True)
+ self.SSIDLabel_2.setText(str(self.network))
+ self.ip = '0.0.0.0'
+ self.hn = ''
+ self.success = SUCCESS_NOT_CONNECTED
+
+ beginWaitCursor()
+ try:
+ try:
+ self.ip,_,addressmode, subnetmask, gateway, pridns, sec_dns= self.wifiObj.getIPConfiguration(self.dev, self.adapterName)
+ vsa_codes = self.wifiObj.getVSACodes(self.dev, self.adapterName)
+ ss_max, ss_min, ss_val, ss_dbm = self.wifiObj.getSignalStrength(self.dev, self.adapterName,self.network, self.adaptor_id)
+ self.hn = self.wifiObj.getHostname(self.dev)
+ except Error as e:
+ self.showIOError(e)
+ return
+ finally:
+ self.dev.close()
+ endWaitCursor()
+
+ if addressmode.lower() == 'dhcp':
+ self.success = SUCCESS_CONNECTED
+
+ elif addressmode.lower() == 'autoip':
+ self.success = SUCCESS_AUTO_IP
+
+ if self.ip == '0.0.0.0':
+ self.success = SUCCESS_NOT_CONNECTED
+
+ self.pages = []
+
+ if self.success == SUCCESS_NOT_CONNECTED:
+ self.pages.append((self.__tr("<b>Your printer has not been connected to the wireless network.</b> A valid connection to a wireless network can take up to 2 minutes. This screen will automatically refresh every %s seconds.<p>If your printer fails to connect within a reasonable time, there may be a problem with your configuration." % REFRESH_INTERVAL), load_pixmap('error', '16x16')))
+ self.RefreshTimer.start(REFRESH_INTERVAL * 1000)
+
+ elif self.success == SUCCESS_AUTO_IP:
+# self.pages.append((self.__tr("Your printer has been connected to the wireless network, but it has been assigned an address which may not be usable."), load_pixmap('warning', '16x16')))
+ self.pages.append((self.__tr("Your printer has been connected to the wireless network and has been assinged a IP. Now run <pre>hp-setup %s</pre> If IP is not accessible, try again for another IP."%self.ip), load_pixmap('warning', '16x16')))
+ # self.RefreshTimer.start(REFRESH_INTERVAL * 1000)
+ self.CancelButton.setEnabled(False)
+ self.BackButton.setEnabled(False)
+ self.RefreshTimer.stop()
+
+ else: # SUCCESS_CONNECTED
+ self.pages.append((self.__tr("Your printer has been successfully configured on the wireless network. You may now unplug the USB cable. To setup the printer, now run <pre>hp-setup %s</pre>"%self.ip), load_pixmap('info', '16x16')))
+ self.CancelButton.setEnabled(False)
+ self.BackButton.setEnabled(False)
+ self.RefreshTimer.stop()
+
+ if addressmode is None:
+ self.AddressModeLabel.setText(self.__tr("Unknown"))
+ else:
+ self.AddressModeLabel.setText(str(addressmode))
+
+ if self.hn is None:
+ self.HostnameLabel.setText(self.__tr("Unknown"))
+ else:
+ self.HostnameLabel.setText(str(self.hn))
+
+ self.IPAddressLabel.setText(str(self.ip))
+ self.GatewayLabel.setText(str(gateway))
+ self.DNSLabel.setText(str(pridns))
+ self.NextButton.setEnabled(True)
+
+ self.SignalStrengthLabel.setText(str("%s/%s (%s dBm)" % (ss_val, ss_max, ss_dbm)))
+ self.SignalStrengthIcon.setPixmap(load_pixmap('signal%d' % ss_val, 'other'))
+
+ for c, s in vsa_codes:
+ if c :
+ ss = s.lower()
+ if ss.startswith("info"):
+ pixmap = load_pixmap('info', '16x16')
+
+ elif ss.startswith("warn"):
+ pixmap = load_pixmap('warning', '16x16')
+
+ elif ss.startswith("crit"):
+ pixmap = load_pixmap('error', '16x16')
+
+ else:
+ pixmap = load_pixmap('info', '16x16')
+
+ self.pages.append((device.queryString("vsa_%s" % str(c).zfill(3)), pixmap))
+
+ num_pages = len(self.pages)
+ self.PageSpinBox.setMaximum(num_pages)
+ self.PageSpinBox.setEnabled(num_pages>1)
+ self.PageSpinBox.setValue(1)
+ self.PageLabel.setEnabled(num_pages>1)
+ self.PageLabel2.setEnabled(num_pages>1)
+ self.PageLabel.setText(self.__tr("of %s", str(num_pages)))
+ self.page_index = 0
+ self.ExitLabel.setText(self.pages[self.page_index][0])
+ self.ExitIcon.setPixmap(self.pages[self.page_index][1])
+ self.displayPage(PAGE_EXIT)
+
+
+ def PageSpinBox_valueChanged(self, i):
+ self.page_index = i-1
+ self.ExitLabel.setText(self.pages[self.page_index][0])
+ self.ExitIcon.setPixmap(self.pages[self.page_index][1])
+
+
+ def RefreshTimer_timeout(self):
+ self.showExitPage()
+
+
+ #
+ # ASSOCIATE
+ #
+
+ def associate(self, key=to_unicode('')):
+ beginWaitCursor()
+ try:
+ try:
+ alg, mode, secretid = self.wifiObj.getCryptoSuite(self.dev, self.adapterName)
+ except Error as e:
+ self.showIOError(e)
+ return
+
+ log.debug("Crypto algorithm: %s" % alg)
+ log.debug("Crypto mode: %s" % mode)
+ finally:
+ endWaitCursor()
+
+ beginWaitCursor()
+ try:
+ try:
+ self.wifiObj.associate(self.dev, self.adapterName, self.network, self.mode, self.security, key)
+ except Error as e:
+ self.showIOError(e)
+ return
+ finally:
+ endWaitCursor()
+
+
+ #
+ # Misc
+ #
+
+ def NextButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_INTRO:
+ self.showDevicesPage()
+
+ elif p == PAGE_DEVICES:
+ row = self.DevicesTableWidget.currentRow()
+ if row != -1:
+ self.device_uri = self.DevicesTableWidget.item(row, 0).device_uri
+ self.mq = device.queryModelByURI(self.device_uri)
+
+ self.getWifiObject(self.mq['wifi-config'])
+ back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
+ self.model = models.normalizeModelName(model).lower()
+
+ self.showNetworkPage()
+
+ elif p == PAGE_NETWORK:
+ self.security = 'None'
+ self.mode = 'Infrastructure'
+ self.ss = 0
+ row = self.NetworksTableWidget.currentRow()
+ if row != -1:
+ i = self.NetworksTableWidget.item(row, 0)
+ if i is not None:
+ self.network = to_unicode(i.text())
+ log.debug("Selected network SSID: %s" % self.network)
+ self.n, ok = value_int(i.data(Qt.UserRole))
+ if ok:
+ self.security = self.networks['encryptiontype-%d' % self.n]
+ log.debug("Security: %s" % self.security)
+
+ self.mode = self.networks['communicationmode-%d' % self.n]
+ log.debug("Mode: %s" % self.mode)
+
+ self.ss = self.networks['signalstrength-%d' % self.n]
+ log.debug("Signal strength: %s" % self.ss)
+
+ if self.security.lower() != 'none':
+ self.showConfigWifiPage()
+ else:
+ # Skip config page if no security to setup
+ self.associate()
+ self.showAssociateProgressDialog()
+ self.showExitPage()
+
+ elif p == PAGE_CONFIGURE_WIFI:
+ key = to_unicode(self.KeyLineEdit.text())
+ self.associate(key)
+ self.showAssociateProgressDialog()
+ self.showExitPage()
+
+ elif p == PAGE_EXIT:
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+ else:
+ log.error("Invalid page!") # shouldn't happen!
+
+
+ def showAssociateProgressDialog(self):
+ AssociateProgressDialog = QProgressDialog(self.__tr("Waiting for printer to connect to the wireless network..."), self.__tr("Cancel"), 0, ASSOCIATE_DELAY, self)
+ AssociateProgressDialog.setWindowTitle(self.__tr("HP Device Manager - Please wait..."))
+ AssociateProgressDialog.setWindowModality(Qt.WindowModal)
+ AssociateProgressDialog.setMinimumDuration(0)
+ AssociateProgressDialog.forceShow()
+ canceled = False
+ for x in range(ASSOCIATE_DELAY):
+ AssociateProgressDialog.setValue(x)
+ QThread.sleep(1)
+ qApp.processEvents()
+
+ if AssociateProgressDialog.wasCanceled():
+ canceled = True
+ break
+
+ AssociateProgressDialog.setValue(ASSOCIATE_DELAY)
+ AssociateProgressDialog.close()
+
+ if canceled:
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+
+ def BackButton_clicked(self):
+ p = self.StackedWidget.currentIndex()
+ if p == PAGE_DEVICES:
+ self.devices = {}
+ self.showIntroPage()
+
+ elif p == PAGE_NETWORK:
+ self.showDevicesPage()
+
+ elif p == PAGE_CONFIGURE_WIFI:
+ self.showNetworkPage()
+
+ elif p == PAGE_EXIT:
+ self.RefreshTimer.stop()
+ if self.security.lower() != 'none':
+ self.showConfigWifiPage()
+ else:
+ self.showNetworkPage()
+
+ else:
+ log.error("Invalid page!") # shouldn't happen!
+
+
+ def CancelButton_clicked(self):
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+
+ def displayPage(self, page):
+ self.StackedWidget.setCurrentIndex(page)
+ self.updateStepText(page)
+
+
+ def setNextButton(self, typ=BUTTON_FINISH):
+ if typ == BUTTON_NEXT:
+ self.NextButton.setText(self.__tr("Next >"))
+
+ elif typ == BUTTON_FINISH:
+ self.NextButton.setText(self.__tr("Finish"))
+
+ elif typ == BUTTON_CONNECT:
+ self.NextButton.setText(self.__tr("Connect"))
+
+
+ def updateStepText(self, p):
+ self.StepText.setText(self.__tr("Step %s of %s" % (p+1, self.max_page+1)))
+
+
+ def showIOError(self, e):
+ FailureUI(self, self.__tr("<b>An I/O error occurred.</b><p>Please check the USB connection to your printer and try again.</p>(%s)" % str(e[0])))
+
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("WifiSetupDialog",s,c)
+
+ # The Wifi object here is not actual object, Dynamically relevant modules are selected based on
+ # wifi-config value in the models file.
+ def getWifiObject(self,wifiConfVal):
+ if wifiConfVal == WIFI_CONFIG_LEDM:
+ self.wifiObj = LedmWifi
+ else:
+ self.wifiObj = wifi
+
diff --git a/ui5/wifisetupdialog_base.py b/ui5/wifisetupdialog_base.py
new file mode 100644
index 000000000..66397be95
--- /dev/null
+++ b/ui5/wifisetupdialog_base.py
@@ -0,0 +1,596 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui5/wifisetupdialog_base.ui'
+#
+# Created by: PyQt5 UI code generator 5.4.2
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtWidgets.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtWidgets.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.DiscoveryPage = QtWidgets.QWidget()
+ self.DiscoveryPage.setObjectName("DiscoveryPage")
+ self.gridlayout1 = QtWidgets.QGridLayout(self.DiscoveryPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtWidgets.QLabel(self.DiscoveryPage)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label.setFont(font)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 3)
+ self.line = QtWidgets.QFrame(self.DiscoveryPage)
+ self.line.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 3)
+ self.MainTitleLabel = QtWidgets.QLabel(self.DiscoveryPage)
+ self.MainTitleLabel.setWordWrap(True)
+ self.MainTitleLabel.setObjectName("MainTitleLabel")
+ self.gridlayout1.addWidget(self.MainTitleLabel, 2, 0, 1, 3)
+ spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem1, 4, 0, 1, 1)
+ self.Picture = QtWidgets.QLabel(self.DiscoveryPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Picture.sizePolicy().hasHeightForWidth())
+ self.Picture.setSizePolicy(sizePolicy)
+ self.Picture.setMinimumSize(QtCore.QSize(396, 128))
+ self.Picture.setMaximumSize(QtCore.QSize(396, 128))
+ self.Picture.setText("")
+ self.Picture.setObjectName("Picture")
+ self.gridlayout1.addWidget(self.Picture, 4, 1, 1, 1)
+ spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem2, 4, 2, 1, 1)
+ spacerItem3 = QtWidgets.QSpacerItem(664, 61, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem3, 5, 0, 1, 3)
+ self.hboxlayout = QtWidgets.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.InfoIcon = QtWidgets.QLabel(self.DiscoveryPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.InfoIcon.sizePolicy().hasHeightForWidth())
+ self.InfoIcon.setSizePolicy(sizePolicy)
+ self.InfoIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.InfoIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.InfoIcon.setText("")
+ self.InfoIcon.setObjectName("InfoIcon")
+ self.hboxlayout.addWidget(self.InfoIcon)
+ self.label_14 = QtWidgets.QLabel(self.DiscoveryPage)
+ self.label_14.setWordWrap(True)
+ self.label_14.setObjectName("label_14")
+ self.hboxlayout.addWidget(self.label_14)
+ self.gridlayout1.addLayout(self.hboxlayout, 6, 0, 1, 3)
+ self.StackedWidget.addWidget(self.DiscoveryPage)
+ self.page_2 = QtWidgets.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout2 = QtWidgets.QGridLayout(self.page_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_4 = QtWidgets.QLabel(self.page_2)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_4.setFont(font)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout2.addWidget(self.label_4, 0, 0, 1, 2)
+ self.line_2 = QtWidgets.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout2.addWidget(self.line_2, 1, 0, 1, 3)
+ self.DevicesTableWidget = QtWidgets.QTableWidget(self.page_2)
+ self.DevicesTableWidget.setAlternatingRowColors(True)
+ self.DevicesTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.DevicesTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.DevicesTableWidget.setObjectName("DevicesTableWidget")
+ self.DevicesTableWidget.setColumnCount(0)
+ self.DevicesTableWidget.setRowCount(0)
+ self.gridlayout2.addWidget(self.DevicesTableWidget, 2, 0, 1, 3)
+ self.hboxlayout1 = QtWidgets.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.DevicesFoundIcon = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundIcon.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundIcon.setSizePolicy(sizePolicy)
+ self.DevicesFoundIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.DevicesFoundIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.DevicesFoundIcon.setText("")
+ self.DevicesFoundIcon.setObjectName("DevicesFoundIcon")
+ self.hboxlayout1.addWidget(self.DevicesFoundIcon)
+ self.DevicesFoundLabel = QtWidgets.QLabel(self.page_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DevicesFoundLabel.sizePolicy().hasHeightForWidth())
+ self.DevicesFoundLabel.setSizePolicy(sizePolicy)
+ self.DevicesFoundLabel.setWordWrap(True)
+ self.DevicesFoundLabel.setObjectName("DevicesFoundLabel")
+ self.hboxlayout1.addWidget(self.DevicesFoundLabel)
+ self.gridlayout2.addLayout(self.hboxlayout1, 3, 0, 1, 1)
+ spacerItem4 = QtWidgets.QSpacerItem(21, 28, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem4, 3, 1, 1, 1)
+ self.RefreshButton = QtWidgets.QPushButton(self.page_2)
+ self.RefreshButton.setObjectName("RefreshButton")
+ self.gridlayout2.addWidget(self.RefreshButton, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.page_2)
+ self.page_3 = QtWidgets.QWidget()
+ self.page_3.setObjectName("page_3")
+ self.gridlayout3 = QtWidgets.QGridLayout(self.page_3)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.label_5 = QtWidgets.QLabel(self.page_3)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_5.setFont(font)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout3.addWidget(self.label_5, 0, 0, 1, 1)
+ self.line_3 = QtWidgets.QFrame(self.page_3)
+ self.line_3.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout3.addWidget(self.line_3, 1, 0, 1, 1)
+ self.groupBox_3 = QtWidgets.QGroupBox(self.page_3)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout4 = QtWidgets.QGridLayout(self.groupBox_3)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.UndirectedRadioButton = QtWidgets.QRadioButton(self.groupBox_3)
+ self.UndirectedRadioButton.setChecked(True)
+ self.UndirectedRadioButton.setObjectName("UndirectedRadioButton")
+ self.gridlayout4.addWidget(self.UndirectedRadioButton, 0, 0, 1, 3)
+ self.DirectedRadioButton = QtWidgets.QRadioButton(self.groupBox_3)
+ self.DirectedRadioButton.setObjectName("DirectedRadioButton")
+ self.gridlayout4.addWidget(self.DirectedRadioButton, 1, 0, 1, 2)
+ self.SSIDLineEdit = QtWidgets.QLineEdit(self.groupBox_3)
+ self.SSIDLineEdit.setEnabled(False)
+ self.SSIDLineEdit.setObjectName("SSIDLineEdit")
+ self.gridlayout4.addWidget(self.SSIDLineEdit, 1, 2, 1, 1)
+ self.SearchPushButton = QtWidgets.QPushButton(self.groupBox_3)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SearchPushButton.sizePolicy().hasHeightForWidth())
+ self.SearchPushButton.setSizePolicy(sizePolicy)
+ self.SearchPushButton.setObjectName("SearchPushButton")
+ self.gridlayout4.addWidget(self.SearchPushButton, 2, 0, 1, 1)
+ spacerItem5 = QtWidgets.QSpacerItem(521, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem5, 2, 1, 1, 2)
+ self.gridlayout3.addWidget(self.groupBox_3, 2, 0, 1, 1)
+ self.SelectSSIDGroupBox = QtWidgets.QGroupBox(self.page_3)
+ self.SelectSSIDGroupBox.setCheckable(False)
+ self.SelectSSIDGroupBox.setObjectName("SelectSSIDGroupBox")
+ self.gridlayout5 = QtWidgets.QGridLayout(self.SelectSSIDGroupBox)
+ self.gridlayout5.setObjectName("gridlayout5")
+ spacerItem6 = QtWidgets.QSpacerItem(421, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem6, 0, 0, 1, 2)
+ self.ShowExtendedCheckBox = QtWidgets.QCheckBox(self.SelectSSIDGroupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ShowExtendedCheckBox.sizePolicy().hasHeightForWidth())
+ self.ShowExtendedCheckBox.setSizePolicy(sizePolicy)
+ self.ShowExtendedCheckBox.setObjectName("ShowExtendedCheckBox")
+ self.gridlayout5.addWidget(self.ShowExtendedCheckBox, 0, 2, 1, 1)
+ self.NetworksTableWidget = QtWidgets.QTableWidget(self.SelectSSIDGroupBox)
+ self.NetworksTableWidget.setAlternatingRowColors(True)
+ self.NetworksTableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
+ self.NetworksTableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
+ self.NetworksTableWidget.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerItem)
+ self.NetworksTableWidget.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
+ self.NetworksTableWidget.setObjectName("NetworksTableWidget")
+ self.NetworksTableWidget.setColumnCount(0)
+ self.NetworksTableWidget.setRowCount(0)
+ self.gridlayout5.addWidget(self.NetworksTableWidget, 1, 0, 1, 3)
+ self.NetworksFoundIcon = QtWidgets.QLabel(self.SelectSSIDGroupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.NetworksFoundIcon.sizePolicy().hasHeightForWidth())
+ self.NetworksFoundIcon.setSizePolicy(sizePolicy)
+ self.NetworksFoundIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.NetworksFoundIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.NetworksFoundIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.NetworksFoundIcon.setText("")
+ self.NetworksFoundIcon.setObjectName("NetworksFoundIcon")
+ self.gridlayout5.addWidget(self.NetworksFoundIcon, 2, 0, 1, 1)
+ self.NetworksFoundLabel = QtWidgets.QLabel(self.SelectSSIDGroupBox)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.NetworksFoundLabel.sizePolicy().hasHeightForWidth())
+ self.NetworksFoundLabel.setSizePolicy(sizePolicy)
+ self.NetworksFoundLabel.setWordWrap(True)
+ self.NetworksFoundLabel.setObjectName("NetworksFoundLabel")
+ self.gridlayout5.addWidget(self.NetworksFoundLabel, 2, 1, 1, 2)
+ self.gridlayout3.addWidget(self.SelectSSIDGroupBox, 3, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page_3)
+ self.page_5 = QtWidgets.QWidget()
+ self.page_5.setObjectName("page_5")
+ self.gridlayout6 = QtWidgets.QGridLayout(self.page_5)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_15 = QtWidgets.QLabel(self.page_5)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_15.setFont(font)
+ self.label_15.setObjectName("label_15")
+ self.gridlayout6.addWidget(self.label_15, 0, 0, 1, 2)
+ self.line_4 = QtWidgets.QFrame(self.page_5)
+ self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout6.addWidget(self.line_4, 1, 0, 1, 2)
+ self.hboxlayout2 = QtWidgets.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.label_3 = QtWidgets.QLabel(self.page_5)
+ self.label_3.setObjectName("label_3")
+ self.hboxlayout2.addWidget(self.label_3)
+ self.SSIDLabel = QtWidgets.QLabel(self.page_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SSIDLabel.sizePolicy().hasHeightForWidth())
+ self.SSIDLabel.setSizePolicy(sizePolicy)
+ self.SSIDLabel.setObjectName("SSIDLabel")
+ self.hboxlayout2.addWidget(self.SSIDLabel)
+ self.StrengthIcon = QtWidgets.QLabel(self.page_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.StrengthIcon.sizePolicy().hasHeightForWidth())
+ self.StrengthIcon.setSizePolicy(sizePolicy)
+ self.StrengthIcon.setMinimumSize(QtCore.QSize(34, 20))
+ self.StrengthIcon.setMaximumSize(QtCore.QSize(34, 20))
+ self.StrengthIcon.setText("")
+ self.StrengthIcon.setObjectName("StrengthIcon")
+ self.hboxlayout2.addWidget(self.StrengthIcon)
+ self.gridlayout6.addLayout(self.hboxlayout2, 2, 0, 1, 2)
+ spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem7, 3, 1, 1, 1)
+ self.groupBox = QtWidgets.QGroupBox(self.page_5)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout7 = QtWidgets.QGridLayout(self.groupBox)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.WEPRadioButton = ReadOnlyRadioButton(self.groupBox)
+ self.WEPRadioButton.setObjectName("WEPRadioButton")
+ self.gridlayout7.addWidget(self.WEPRadioButton, 0, 0, 1, 1)
+ self.WPARadioButton = ReadOnlyRadioButton(self.groupBox)
+ self.WPARadioButton.setObjectName("WPARadioButton")
+ self.gridlayout7.addWidget(self.WPARadioButton, 1, 0, 1, 1)
+ self.gridlayout6.addWidget(self.groupBox, 4, 0, 1, 2)
+ self.groupBox_2 = QtWidgets.QGroupBox(self.page_5)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout8 = QtWidgets.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_6 = QtWidgets.QLabel(self.groupBox_2)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout8.addWidget(self.label_6, 0, 0, 1, 1)
+ self.KeyLineEdit = QtWidgets.QLineEdit(self.groupBox_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.KeyLineEdit.sizePolicy().hasHeightForWidth())
+ self.KeyLineEdit.setSizePolicy(sizePolicy)
+ self.KeyLineEdit.setObjectName("KeyLineEdit")
+ self.gridlayout8.addWidget(self.KeyLineEdit, 0, 1, 1, 1)
+ self.KeysIcon = QtWidgets.QLabel(self.groupBox_2)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.KeysIcon.sizePolicy().hasHeightForWidth())
+ self.KeysIcon.setSizePolicy(sizePolicy)
+ self.KeysIcon.setMinimumSize(QtCore.QSize(32, 32))
+ self.KeysIcon.setMaximumSize(QtCore.QSize(32, 32))
+ self.KeysIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.KeysIcon.setText("")
+ self.KeysIcon.setObjectName("KeysIcon")
+ self.gridlayout8.addWidget(self.KeysIcon, 0, 2, 1, 1)
+ self.ShowKeyCheckBox = QtWidgets.QCheckBox(self.groupBox_2)
+ self.ShowKeyCheckBox.setObjectName("ShowKeyCheckBox")
+ self.gridlayout8.addWidget(self.ShowKeyCheckBox, 1, 1, 1, 2)
+ self.gridlayout6.addWidget(self.groupBox_2, 5, 0, 1, 2)
+ spacerItem8 = QtWidgets.QSpacerItem(638, 81, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem8, 6, 1, 1, 1)
+ self.ConfigureIcon = QtWidgets.QLabel(self.page_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ConfigureIcon.sizePolicy().hasHeightForWidth())
+ self.ConfigureIcon.setSizePolicy(sizePolicy)
+ self.ConfigureIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.ConfigureIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.ConfigureIcon.setText("")
+ self.ConfigureIcon.setObjectName("ConfigureIcon")
+ self.gridlayout6.addWidget(self.ConfigureIcon, 7, 0, 1, 1)
+ self.label_7 = QtWidgets.QLabel(self.page_5)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout6.addWidget(self.label_7, 7, 1, 1, 1)
+ self.StackedWidget.addWidget(self.page_5)
+ self.page = QtWidgets.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout9 = QtWidgets.QGridLayout(self.page)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_16 = QtWidgets.QLabel(self.page)
+ font = QtGui.QFont()
+ font.setPointSize(16)
+ self.label_16.setFont(font)
+ self.label_16.setObjectName("label_16")
+ self.gridlayout9.addWidget(self.label_16, 0, 0, 1, 1)
+ self.line_5 = QtWidgets.QFrame(self.page)
+ self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
+ self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.line_5.setObjectName("line_5")
+ self.gridlayout9.addWidget(self.line_5, 1, 0, 1, 1)
+ self.groupBox_4 = QtWidgets.QGroupBox(self.page)
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout10 = QtWidgets.QGridLayout(self.groupBox_4)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_8 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout10.addWidget(self.label_8, 0, 0, 1, 1)
+ self.SSIDLabel_2 = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SSIDLabel_2.sizePolicy().hasHeightForWidth())
+ self.SSIDLabel_2.setSizePolicy(sizePolicy)
+ self.SSIDLabel_2.setObjectName("SSIDLabel_2")
+ self.gridlayout10.addWidget(self.SSIDLabel_2, 0, 1, 1, 1)
+ self.hboxlayout3 = QtWidgets.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.SignalStrengthIcon = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SignalStrengthIcon.sizePolicy().hasHeightForWidth())
+ self.SignalStrengthIcon.setSizePolicy(sizePolicy)
+ self.SignalStrengthIcon.setMinimumSize(QtCore.QSize(34, 20))
+ self.SignalStrengthIcon.setMaximumSize(QtCore.QSize(34, 20))
+ self.SignalStrengthIcon.setObjectName("SignalStrengthIcon")
+ self.hboxlayout3.addWidget(self.SignalStrengthIcon)
+ self.SignalStrengthLabel = QtWidgets.QLabel(self.groupBox_4)
+ self.SignalStrengthLabel.setObjectName("SignalStrengthLabel")
+ self.hboxlayout3.addWidget(self.SignalStrengthLabel)
+ self.gridlayout10.addLayout(self.hboxlayout3, 0, 2, 1, 1)
+ self.label_9 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout10.addWidget(self.label_9, 1, 0, 1, 1)
+ self.AddressModeLabel = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.AddressModeLabel.sizePolicy().hasHeightForWidth())
+ self.AddressModeLabel.setSizePolicy(sizePolicy)
+ self.AddressModeLabel.setObjectName("AddressModeLabel")
+ self.gridlayout10.addWidget(self.AddressModeLabel, 1, 1, 1, 1)
+ self.label_12 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout10.addWidget(self.label_12, 2, 0, 1, 1)
+ self.HostnameLabel = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.HostnameLabel.sizePolicy().hasHeightForWidth())
+ self.HostnameLabel.setSizePolicy(sizePolicy)
+ self.HostnameLabel.setObjectName("HostnameLabel")
+ self.gridlayout10.addWidget(self.HostnameLabel, 2, 1, 1, 1)
+ self.label_10 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout10.addWidget(self.label_10, 3, 0, 1, 1)
+ self.IPAddressLabel = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.IPAddressLabel.sizePolicy().hasHeightForWidth())
+ self.IPAddressLabel.setSizePolicy(sizePolicy)
+ self.IPAddressLabel.setObjectName("IPAddressLabel")
+ self.gridlayout10.addWidget(self.IPAddressLabel, 3, 1, 1, 1)
+ self.label_11 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_11.setObjectName("label_11")
+ self.gridlayout10.addWidget(self.label_11, 4, 0, 1, 1)
+ self.GatewayLabel = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.GatewayLabel.sizePolicy().hasHeightForWidth())
+ self.GatewayLabel.setSizePolicy(sizePolicy)
+ self.GatewayLabel.setObjectName("GatewayLabel")
+ self.gridlayout10.addWidget(self.GatewayLabel, 4, 1, 1, 1)
+ self.label_13 = QtWidgets.QLabel(self.groupBox_4)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout10.addWidget(self.label_13, 5, 0, 1, 1)
+ self.DNSLabel = QtWidgets.QLabel(self.groupBox_4)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(1)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.DNSLabel.sizePolicy().hasHeightForWidth())
+ self.DNSLabel.setSizePolicy(sizePolicy)
+ self.DNSLabel.setObjectName("DNSLabel")
+ self.gridlayout10.addWidget(self.DNSLabel, 5, 1, 1, 1)
+ self.gridlayout9.addWidget(self.groupBox_4, 2, 0, 1, 1)
+ self.groupBox_5 = QtWidgets.QGroupBox(self.page)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(1)
+ sizePolicy.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth())
+ self.groupBox_5.setSizePolicy(sizePolicy)
+ self.groupBox_5.setObjectName("groupBox_5")
+ self.gridlayout11 = QtWidgets.QGridLayout(self.groupBox_5)
+ self.gridlayout11.setObjectName("gridlayout11")
+ self.ExitIcon = QtWidgets.QLabel(self.groupBox_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ExitIcon.sizePolicy().hasHeightForWidth())
+ self.ExitIcon.setSizePolicy(sizePolicy)
+ self.ExitIcon.setMinimumSize(QtCore.QSize(16, 16))
+ self.ExitIcon.setMaximumSize(QtCore.QSize(16, 16))
+ self.ExitIcon.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.ExitIcon.setText("")
+ self.ExitIcon.setObjectName("ExitIcon")
+ self.gridlayout11.addWidget(self.ExitIcon, 0, 0, 1, 1)
+ self.ExitLabel = QtWidgets.QLabel(self.groupBox_5)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ExitLabel.sizePolicy().hasHeightForWidth())
+ self.ExitLabel.setSizePolicy(sizePolicy)
+ self.ExitLabel.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.ExitLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.ExitLabel.setWordWrap(True)
+ self.ExitLabel.setObjectName("ExitLabel")
+ self.gridlayout11.addWidget(self.ExitLabel, 0, 1, 2, 2)
+ spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout11.addItem(spacerItem9, 1, 0, 1, 1)
+ spacerItem10 = QtWidgets.QSpacerItem(501, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout11.addItem(spacerItem10, 2, 0, 1, 2)
+ self.hboxlayout4 = QtWidgets.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.PageLabel2 = QtWidgets.QLabel(self.groupBox_5)
+ self.PageLabel2.setObjectName("PageLabel2")
+ self.hboxlayout4.addWidget(self.PageLabel2)
+ self.PageSpinBox = QtWidgets.QSpinBox(self.groupBox_5)
+ self.PageSpinBox.setMinimum(1)
+ self.PageSpinBox.setObjectName("PageSpinBox")
+ self.hboxlayout4.addWidget(self.PageSpinBox)
+ self.PageLabel = QtWidgets.QLabel(self.groupBox_5)
+ self.PageLabel.setObjectName("PageLabel")
+ self.hboxlayout4.addWidget(self.PageLabel)
+ self.gridlayout11.addLayout(self.hboxlayout4, 2, 2, 1, 1)
+ self.gridlayout9.addWidget(self.groupBox_5, 3, 0, 1, 1)
+ spacerItem11 = QtWidgets.QSpacerItem(664, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem11, 4, 0, 1, 1)
+ self.StackedWidget.addWidget(self.page)
+ self.gridlayout.addWidget(self.StackedWidget, 0, 0, 1, 5)
+ self.StepText = QtWidgets.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 1, 0, 1, 1)
+ spacerItem12 = QtWidgets.QSpacerItem(181, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem12, 1, 1, 1, 1)
+ self.BackButton = QtWidgets.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 1, 2, 1, 1)
+ self.NextButton = QtWidgets.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 1, 3, 1, 1)
+ self.CancelButton = QtWidgets.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 1, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ _translate = QtCore.QCoreApplication.translate
+ Dialog.setWindowTitle(_translate("Dialog", "HP Device Manager - Wifi Setup"))
+ self.label.setText(_translate("Dialog", "Wireless (Wifi/802.11) Setup"))
+ self.MainTitleLabel.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete.</p>\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-style:italic;\">Note: Only select wireless capable printers are supported by this utility.</span></p></body></html>"))
+ self.label_14.setText(_translate("Dialog", "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Please plug-in your wireless capable printer at this time (using a USB cable) and click<span style=\" font-style:italic;\"> Next &gt;</span> to continue.</p></body></html>"))
+ self.label_4.setText(_translate("Dialog", "Select From Discovered Wireless Capable Devices"))
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesFoundLabel.setText(_translate("Dialog", "Found 0 wireless capable devices on the USB bus."))
+ self.RefreshButton.setText(_translate("Dialog", "Refresh"))
+ self.label_5.setText(_translate("Dialog", "Find and Select a Wireless Network"))
+ self.groupBox_3.setTitle(_translate("Dialog", "Find Wireless Network"))
+ self.UndirectedRadioButton.setText(_translate("Dialog", "Search for wireless networks automatically"))
+ self.DirectedRadioButton.setText(_translate("Dialog", "Enter the name (SSID) of a known wireless network:"))
+ self.SearchPushButton.setText(_translate("Dialog", "Search"))
+ self.SelectSSIDGroupBox.setTitle(_translate("Dialog", "Wireless Networks"))
+ self.ShowExtendedCheckBox.setText(_translate("Dialog", "Show extended information"))
+ self.NetworksFoundLabel.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Found %1 wireless networks. Click <span style=\" font-style:italic;\">Search</span> to perform another search.</p></body></html>"))
+ self.label_15.setText(_translate("Dialog", "Configure Wireless"))
+ self.label_3.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\';\">Wireless Network Name (SSID):</span></p></body></html>"))
+ self.SSIDLabel.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\';\">(unknown)</span></p></body></html>"))
+ self.groupBox.setTitle(_translate("Dialog", "Wireless Security Type"))
+ self.WEPRadioButton.setText(_translate("Dialog", "WEP (Wired Equivalent Privacy)"))
+ self.WPARadioButton.setText(_translate("Dialog", "WPA (Wi-Fi Protected Access)"))
+ self.groupBox_2.setTitle(_translate("Dialog", "Wireless Security Key"))
+ self.label_6.setText(_translate("Dialog", "Key:"))
+ self.ShowKeyCheckBox.setText(_translate("Dialog", "Show key"))
+ self.label_7.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">Enter the security key for the network, and click </span><span style=\" font-family:\'Sans Serif\'; font-size:9pt; font-style:italic;\">Connect</span><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\"> to continue.</span></p></body></html>"))
+ self.label_16.setText(_translate("Dialog", "Wireless Configuration Results"))
+ self.groupBox_4.setTitle(_translate("Dialog", "Wireless Configuration"))
+ self.label_8.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">Network:</span></p></body></html>"))
+ self.SSIDLabel_2.setText(_translate("Dialog", "TextLabel"))
+ self.SignalStrengthIcon.setText(_translate("Dialog", "(icon)"))
+ self.SignalStrengthLabel.setText(_translate("Dialog", "0/5 (0dBm)"))
+ self.label_9.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">Address Mode:</span></p></body></html>"))
+ self.AddressModeLabel.setText(_translate("Dialog", "TextLabel"))
+ self.label_12.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">Hostname:</span></p></body></html>"))
+ self.HostnameLabel.setText(_translate("Dialog", "TextLabel"))
+ self.label_10.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">IP Address:</span></p></body></html>"))
+ self.IPAddressLabel.setText(_translate("Dialog", "TextLabel"))
+ self.label_11.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">Gateway Address:</span></p></body></html>"))
+ self.GatewayLabel.setText(_translate("Dialog", "TextLabel"))
+ self.label_13.setText(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Sans\'; font-size:10pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Sans Serif\'; font-size:9pt;\">DNS Address:</span></p></body></html>"))
+ self.DNSLabel.setText(_translate("Dialog", "TextLabel"))
+ self.groupBox_5.setTitle(_translate("Dialog", "Messages"))
+ self.ExitLabel.setText(_translate("Dialog", "TextLabel"))
+ self.PageLabel2.setText(_translate("Dialog", "Message:"))
+ self.PageLabel.setText(_translate("Dialog", "of XXX"))
+ self.StepText.setText(_translate("Dialog", "Step %1 of %2"))
+ self.BackButton.setText(_translate("Dialog", "< Back"))
+ self.NextButton.setText(_translate("Dialog", "Next >"))
+ self.CancelButton.setText(_translate("Dialog", "Cancel"))
+
+from .readonlyradiobutton import ReadOnlyRadioButton
diff --git a/ui5/wifisetupdialog_base.ui b/ui5/wifisetupdialog_base.ui
new file mode 100644
index 000000000..a85d14c3d
--- /dev/null
+++ b/ui5/wifisetupdialog_base.ui
@@ -0,0 +1,1102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>700</width>
+ <height>500</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>HP Device Manager - Wifi Setup</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="5">
+ <widget class="QStackedWidget" name="StackedWidget">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="DiscoveryPage">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Wireless (Wifi/802.11) Setup</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <widget class="Line" name="line">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This utility allows you configure your wireless capable printer using a temporary USB connection. You will be prompted to disconnect the USB cable once wireless network setup is complete.&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Note: Only select wireless capable printers are supported by this utility.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="Picture">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>396</width>
+ <height>128</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>396</width>
+ <height>128</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="0" colspan="3">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>664</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="0" colspan="3">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="InfoIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Please plug-in your wireless capable printer at this time (using a USB cable) and click&lt;span style=&quot; font-style:italic;&quot;&gt; Next &amp;gt;&lt;/span&gt; to continue.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="label_4">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Select From Discovered Wireless Capable Devices</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QTableWidget" name="DevicesTableWidget">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="sortingEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="DevicesFoundIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="DevicesFoundLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Found 0 wireless capable devices on the USB bus.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Preferred</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>28</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="RefreshButton">
+ <property name="text">
+ <string>Refresh</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_3">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Find and Select a Wireless Network</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Find Wireless Network</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QRadioButton" name="UndirectedRadioButton">
+ <property name="text">
+ <string>Search for wireless networks automatically</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QRadioButton" name="DirectedRadioButton">
+ <property name="text">
+ <string>Enter the name (SSID) of a known wireless network:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="SSIDLineEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QPushButton" name="SearchPushButton">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>521</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QGroupBox" name="SelectSSIDGroupBox">
+ <property name="title">
+ <string>Wireless Networks</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>421</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="2">
+ <widget class="QCheckBox" name="ShowExtendedCheckBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Show extended information</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <widget class="QTableWidget" name="NetworksTableWidget">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::SingleSelection</enum>
+ </property>
+ <property name="selectionBehavior">
+ <enum>QAbstractItemView::SelectRows</enum>
+ </property>
+ <property name="verticalScrollMode">
+ <enum>QAbstractItemView::ScrollPerItem</enum>
+ </property>
+ <property name="horizontalScrollMode">
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="NetworksFoundIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="QLabel" name="NetworksFoundLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Found %1 wireless networks. Click &lt;span style=&quot; font-style:italic;&quot;&gt;Search&lt;/span&gt; to perform another search.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_5">
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="label_15">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Configure Wireless</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="Line" name="line_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Wireless Network Name (SSID):&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="SSIDLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;(unknown)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="StrengthIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>34</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>34</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Wireless Security Type</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="ReadOnlyRadioButton" name="WEPRadioButton">
+ <property name="text">
+ <string>WEP (Wired Equivalent Privacy)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="ReadOnlyRadioButton" name="WPARadioButton">
+ <property name="text">
+ <string>WPA (Wi-Fi Protected Access)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2">
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Wireless Security Key</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Key:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="KeyLineEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="KeysIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QCheckBox" name="ShowKeyCheckBox">
+ <property name="text">
+ <string>Show key</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>638</width>
+ <height>81</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="7" column="0">
+ <widget class="QLabel" name="ConfigureIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Enter the security key for the network, and click &lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt; font-style:italic;&quot;&gt;Connect&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt; to continue.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page">
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_16">
+ <property name="font">
+ <font>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Wireless Configuration Results</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="Line" name="line_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Wireless Configuration</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Network:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="SSIDLabel_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="SignalStrengthIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>34</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>34</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>(icon)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="SignalStrengthLabel">
+ <property name="text">
+ <string>0/5 (0dBm)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Address Mode:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="AddressModeLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_12">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Hostname:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="HostnameLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;IP Address:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLabel" name="IPAddressLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;Gateway Address:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QLabel" name="GatewayLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;DNS Address:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="DNSLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QGroupBox" name="groupBox_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Messages</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="ExitIcon">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" rowspan="2" colspan="2">
+ <widget class="QLabel" name="ExitLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>501</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="2">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QLabel" name="PageLabel2">
+ <property name="text">
+ <string>Message:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="PageSpinBox">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="PageLabel">
+ <property name="text">
+ <string>of XXX</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>664</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="StepText">
+ <property name="text">
+ <string>Step %1 of %2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>181</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="BackButton">
+ <property name="text">
+ <string>&lt; Back</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QPushButton" name="NextButton">
+ <property name="text">
+ <string>Next &gt;</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="4">
+ <widget class="QPushButton" name="CancelButton">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ReadOnlyRadioButton</class>
+ <extends>QRadioButton</extends>
+ <header>readonlyradiobutton.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>