summaryrefslogtreecommitdiff
path: root/ui4
diff options
context:
space:
mode:
Diffstat (limited to 'ui4')
-rw-r--r--ui4/__init__.py19
-rw-r--r--ui4/aboutdialog.py58
-rw-r--r--ui4/aboutdialog_base.py119
-rw-r--r--ui4/aboutdialog_base.ui274
-rw-r--r--ui4/aligndialog.py768
-rw-r--r--ui4/aligndialog_base.py376
-rw-r--r--ui4/aligndialog_base.ui850
-rw-r--r--ui4/cleandialog.py346
-rw-r--r--ui4/cleandialog_base.py169
-rw-r--r--ui4/cleandialog_base.ui313
-rw-r--r--ui4/colorcaldialog.py435
-rw-r--r--ui4/colorcaldialog_base.py326
-rw-r--r--ui4/colorcaldialog_base.ui810
-rw-r--r--ui4/devicesetupdialog.py297
-rw-r--r--ui4/devicesetupdialog_base.py85
-rw-r--r--ui4/devicesetupdialog_base.ui179
-rw-r--r--ui4/deviceuricombobox.py163
-rw-r--r--ui4/devmgr5.py2260
-rw-r--r--ui4/devmgr5_base.py428
-rw-r--r--ui4/devmgr5_base.ui728
-rw-r--r--ui4/fabgrouptable.py75
-rw-r--r--ui4/fabnametable.py37
-rw-r--r--ui4/fabwindow.py607
-rw-r--r--ui4/fabwindow_base.py159
-rw-r--r--ui4/fabwindow_base.ui235
-rw-r--r--ui4/faxsetupdialog.py307
-rw-r--r--ui4/faxsetupdialog_base.py102
-rw-r--r--ui4/faxsetupdialog_base.ui170
-rw-r--r--ui4/filetable.py405
-rw-r--r--ui4/firmwaredialog.py108
-rw-r--r--ui4/firmwaredialog_base.py67
-rw-r--r--ui4/firmwaredialog_base.ui114
-rw-r--r--ui4/infodialog.py310
-rw-r--r--ui4/infodialog_base.py103
-rw-r--r--ui4/infodialog_base.ui179
-rw-r--r--ui4/linefeedcaldialog.py125
-rw-r--r--ui4/linefeedcaldialog_base.py56
-rw-r--r--ui4/linefeedcaldialog_base.ui102
-rw-r--r--ui4/loadpapergroupbox.py103
-rw-r--r--ui4/makecopiesdialog.py91
-rw-r--r--ui4/makecopiesdialog_base.py52
-rw-r--r--ui4/makecopiesdialog_base.ui89
-rw-r--r--ui4/mimetypesdialog.py58
-rw-r--r--ui4/mimetypesdialog_base.py67
-rw-r--r--ui4/mimetypesdialog_base.ui123
-rw-r--r--ui4/nodevicesdialog.py81
-rw-r--r--ui4/nodevicesdialog_base.py70
-rw-r--r--ui4/nodevicesdialog_base.ui136
-rw-r--r--ui4/plugindiagnose.py113
-rw-r--r--ui4/plugindiagnose_base.py70
-rw-r--r--ui4/plugindiagnose_base.ui85
-rw-r--r--ui4/plugindialog.py378
-rw-r--r--ui4/plugindialog_base.py117
-rw-r--r--ui4/plugindialog_base.ui219
-rw-r--r--ui4/pluginlicensedialog.py50
-rw-r--r--ui4/pluginlicensedialog_base.py87
-rw-r--r--ui4/pluginlicensedialog_base.ui179
-rw-r--r--ui4/pqdiagdialog.py124
-rw-r--r--ui4/pqdiagdialog_base.py56
-rw-r--r--ui4/pqdiagdialog_base.ui102
-rw-r--r--ui4/printdialog.py352
-rw-r--r--ui4/printdialog_base.py109
-rw-r--r--ui4/printdialog_base.ui169
-rw-r--r--ui4/printernamecombobox.py155
-rw-r--r--ui4/printsettingsdialog.py114
-rw-r--r--ui4/printsettingsdialog_base.py57
-rw-r--r--ui4/printsettingsdialog_base.ui91
-rw-r--r--ui4/printsettingstoolbox.py2013
-rw-r--r--ui4/printtestpagedialog.py157
-rw-r--r--ui4/printtestpagedialog_base.py77
-rw-r--r--ui4/printtestpagedialog_base.ui142
-rw-r--r--ui4/queuesconf.py181
-rw-r--r--ui4/readonlyradiobutton.py64
-rw-r--r--ui4/sendfaxdialog.py1050
-rw-r--r--ui4/sendfaxdialog_base.py388
-rw-r--r--ui4/sendfaxdialog_base.ui711
-rw-r--r--ui4/settingsdialog.py106
-rw-r--r--ui4/settingsdialog_base.py237
-rw-r--r--ui4/settingsdialog_base.ui542
-rw-r--r--ui4/setupdialog.py1323
-rw-r--r--ui4/setupdialog_base.py383
-rw-r--r--ui4/setupdialog_base.ui654
-rw-r--r--ui4/systemtray.py810
-rw-r--r--ui4/systrayframe.py216
-rw-r--r--ui4/systrayframe_base.py110
-rw-r--r--ui4/systrayframe_base.ui246
-rw-r--r--ui4/ui_utils.py553
-rw-r--r--ui4/upgradedialog.py127
-rw-r--r--ui4/upgradedialog_base.py62
-rw-r--r--ui4/upgradedialog_base.ui143
-rw-r--r--ui4/wifisetupdialog.py839
-rw-r--r--ui4/wifisetupdialog_base.py722
-rw-r--r--ui4/wifisetupdialog_base.ui1102
93 files changed, 28719 insertions, 0 deletions
diff --git a/ui4/__init__.py b/ui4/__init__.py
new file mode 100644
index 0000000..ffdcaff
--- /dev/null
+++ b/ui4/__init__.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2007 Hewlett-Packard 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/ui4/aboutdialog.py b/ui4/aboutdialog.py
new file mode 100644
index 0000000..a613e27
--- /dev/null
+++ b/ui4/aboutdialog.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.CloseButton, SIGNAL("clicked()"), 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/ui4/aboutdialog_base.py b/ui4/aboutdialog_base.py
new file mode 100644
index 0000000..ad1f6ba
--- /dev/null
+++ b/ui4/aboutdialog_base.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/aboutdialog_base.ui'
+#
+# Created: Mon May 4 14:30:30 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_AboutDlg_base(object):
+ def setupUi(self, AboutDlg_base):
+ AboutDlg_base.setObjectName("AboutDlg_base")
+ AboutDlg_base.resize(537, 543)
+ self.gridlayout = QtGui.QGridLayout(AboutDlg_base)
+ self.gridlayout.setObjectName("gridlayout")
+ self.textLabel1 = QtGui.QLabel(AboutDlg_base)
+ self.textLabel1.setWordWrap(False)
+ self.textLabel1.setObjectName("textLabel1")
+ self.gridlayout.addWidget(self.textLabel1, 0, 0, 1, 2)
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ spacerItem = QtGui.QSpacerItem(150, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem)
+ self.HPLIPLogo = QtGui.QLabel(AboutDlg_base)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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 = QtGui.QSpacerItem(151, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem1)
+ self.gridlayout.addLayout(self.hboxlayout, 1, 0, 1, 2)
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.textLabel4 = QtGui.QLabel(AboutDlg_base)
+ self.textLabel4.setWordWrap(False)
+ self.textLabel4.setObjectName("textLabel4")
+ self.hboxlayout1.addWidget(self.textLabel4)
+ self.HPLIPVersionText = QtGui.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 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.textLabel4_2 = QtGui.QLabel(AboutDlg_base)
+ self.textLabel4_2.setWordWrap(False)
+ self.textLabel4_2.setObjectName("textLabel4_2")
+ self.hboxlayout2.addWidget(self.textLabel4_2)
+ self.ToolboxVersionText = QtGui.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 = QtGui.QLabel(AboutDlg_base)
+ self.textLabel3.setWordWrap(True)
+ self.textLabel3.setObjectName("textLabel3")
+ self.gridlayout.addWidget(self.textLabel3, 4, 0, 1, 2)
+ self.textLabel2 = QtGui.QLabel(AboutDlg_base)
+ self.textLabel2.setWordWrap(True)
+ self.textLabel2.setObjectName("textLabel2")
+ self.gridlayout.addWidget(self.textLabel2, 5, 0, 1, 2)
+ self.hboxlayout3 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.PythonPixmap = QtGui.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 = QtGui.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 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem2, 7, 0, 1, 2)
+ spacerItem3 = QtGui.QSpacerItem(411, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 8, 0, 1, 1)
+ self.CloseButton = QtGui.QPushButton(AboutDlg_base)
+ self.CloseButton.setObjectName("CloseButton")
+ self.gridlayout.addWidget(self.CloseButton, 8, 1, 1, 1)
+
+ self.retranslateUi(AboutDlg_base)
+ QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL("clicked()"), AboutDlg_base.close)
+ QtCore.QMetaObject.connectSlotsByName(AboutDlg_base)
+
+ def retranslateUi(self, AboutDlg_base):
+ AboutDlg_base.setWindowTitle(QtGui.QApplication.translate("AboutDlg_base", "HP Device Manager - About", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel1.setText(QtGui.QApplication.translate("AboutDlg_base", "<font size=\"+3\"><p align=\"center\">HP Linux Imaging and Printing (HPLIP)</p></font>", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel4.setText(QtGui.QApplication.translate("AboutDlg_base", "<b>HPLIP Software Version:</b>", None, QtGui.QApplication.UnicodeUTF8))
+ self.HPLIPVersionText.setText(QtGui.QApplication.translate("AboutDlg_base", "0.0.0", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel4_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.ToolboxVersionText.setText(QtGui.QApplication.translate("AboutDlg_base", "0.0.0", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3.setText(QtGui.QApplication.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 2009 Hewlett-Packard 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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.CloseButton.setText(QtGui.QApplication.translate("AboutDlg_base", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/aboutdialog_base.ui b/ui4/aboutdialog_base.ui
new file mode 100644
index 0000000..61350cf
--- /dev/null
+++ b/ui4/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 2009 Hewlett-Packard 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/ui4/aligndialog.py b/ui4/aligndialog.py
new file mode 100644
index 0000000..75be5f6
--- /dev/null
+++ b/ui4/aligndialog.py
@@ -0,0 +1,768 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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
+
+# 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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.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.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.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.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.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.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.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.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.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.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.close, None),
+ ],
+
+ ALIGN_TYPE_OJ_PRO : [ # 12
+ (self.showLoadPaperPage, None),
+ (maint.AlignType12, (lambda : self.dev, lambda: true)),
+ (self.close, None),
+ ],
+
+ ALIGN_TYPE_AIO : [ #13
+ (self.showLoadPaperPage, None),
+ (maint.alignType13Phase1, (lambda: self.dev,)),
+ (self.setAlignButton, (BUTTON_FINISH,)),
+ (self.showAioPage, 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.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, 11)),
+ (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, 9)),
+ (self.endAlignmentNumberPage, ('H',)),
+ (self.showAlignmentNumberPage, ('I', 'v', 'c', 3, 9)),
+ (self.endAlignmentNumberPage, ('I',)),
+ (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)),
+ (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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+ #self.connect(self.BackButton, SIGNAL("clicked()"), self.BackButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'align-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 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.func_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 %1 where the line segments are <b>best</b> aligned.").arg(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(QString("%1%2").arg(line_id).arg(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)
+
+ 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(QString("%1").arg(x+1))
+ else:
+ self.PageEdgeComboBox.addItem(QString("%1%2").arg(prefix).arg(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 = 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 - %1, select the label representing the box in which in the inner lines are the <b>least</b> visible.").arg(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 = 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 %1:").arg(line_id))
+
+ for x in range(count):
+ self.ColorAdjustComboBox.addItem(QString("%1%2").arg(line_id).arg(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(QString(""))
+ else:
+ self.StepText.setText(self.__tr("Step %1 of %2").arg(p).arg(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/ui4/aligndialog_base.py b/ui4/aligndialog_base.py
new file mode 100644
index 0000000..fd02be3
--- /dev/null
+++ b/ui4/aligndialog_base.py
@@ -0,0 +1,376 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'aligndialog_base.ui'
+#
+# Created: Thu Jul 30 10:31:01 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 568)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 5)
+ self.line_2 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 3, 0, 1, 5)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 4, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(191, 29, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 1, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 4, 3, 1, 1)
+ self.CancelButton = QtGui.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 4, 1, 1)
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtGui.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtGui.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 = QtGui.QGroupBox(self.StartPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtGui.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 = QtGui.QSpacerItem(564, 161, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.LoadPaperPage = QtGui.QWidget()
+ self.LoadPaperPage.setObjectName("LoadPaperPage")
+ self.gridlayout3 = QtGui.QGridLayout(self.LoadPaperPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.LoadPaperPage)
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ spacerItem2 = QtGui.QSpacerItem(20, 181, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem2, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.LoadPaperPage)
+ self.PaperEdgePage = QtGui.QWidget()
+ self.PaperEdgePage.setObjectName("PaperEdgePage")
+ self.gridlayout4 = QtGui.QGridLayout(self.PaperEdgePage)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.PageEdgeTitle = QtGui.QLabel(self.PaperEdgePage)
+ self.PageEdgeTitle.setObjectName("PageEdgeTitle")
+ self.gridlayout4.addWidget(self.PageEdgeTitle, 0, 0, 1, 4)
+ spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem3, 1, 1, 1, 1)
+ spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem4, 2, 0, 1, 1)
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.PageEdgeIcon = QtGui.QLabel(self.PaperEdgePage)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.PageEdgeIcon.setObjectName("PageEdgeIcon")
+ self.hboxlayout.addWidget(self.PageEdgeIcon)
+ self.PageEdgeComboBox = QtGui.QComboBox(self.PaperEdgePage)
+ self.PageEdgeComboBox.setObjectName("PageEdgeComboBox")
+ self.hboxlayout.addWidget(self.PageEdgeComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout, 2, 1, 1, 2)
+ spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem5, 2, 3, 1, 1)
+ spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem6, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.PaperEdgePage)
+ self.AlignmentNumber = QtGui.QWidget()
+ self.AlignmentNumber.setObjectName("AlignmentNumber")
+ self.gridlayout5 = QtGui.QGridLayout(self.AlignmentNumber)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.AlignmentNumberTitle = QtGui.QLabel(self.AlignmentNumber)
+ self.AlignmentNumberTitle.setObjectName("AlignmentNumberTitle")
+ self.gridlayout5.addWidget(self.AlignmentNumberTitle, 0, 0, 1, 4)
+ spacerItem7 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem7, 1, 1, 1, 1)
+ spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem8, 2, 0, 1, 1)
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.AlignmentNumberIcon = QtGui.QLabel(self.AlignmentNumber)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.AlignmentNumberIcon.setObjectName("AlignmentNumberIcon")
+ self.hboxlayout1.addWidget(self.AlignmentNumberIcon)
+ self.AlignmentNumberComboBox = QtGui.QComboBox(self.AlignmentNumber)
+ self.AlignmentNumberComboBox.setObjectName("AlignmentNumberComboBox")
+ self.hboxlayout1.addWidget(self.AlignmentNumberComboBox)
+ self.gridlayout5.addLayout(self.hboxlayout1, 2, 1, 1, 2)
+ spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem9, 2, 3, 1, 1)
+ spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem10, 3, 2, 1, 1)
+ self.StackedWidget.addWidget(self.AlignmentNumber)
+ self.ColorAdjPage = QtGui.QWidget()
+ self.ColorAdjPage.setObjectName("ColorAdjPage")
+ self.gridlayout6 = QtGui.QGridLayout(self.ColorAdjPage)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_12 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem11, 1, 1, 1, 1)
+ spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem12, 2, 0, 1, 1)
+ self.ColorAdjustIcon = QtGui.QLabel(self.ColorAdjPage)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.ColorAdjustIcon.setObjectName("ColorAdjustIcon")
+ self.gridlayout6.addWidget(self.ColorAdjustIcon, 2, 1, 1, 1)
+ spacerItem13 = QtGui.QSpacerItem(31, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem13, 2, 2, 1, 1)
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.ColorAdjustLabel = QtGui.QLabel(self.ColorAdjPage)
+ self.ColorAdjustLabel.setObjectName("ColorAdjustLabel")
+ self.hboxlayout2.addWidget(self.ColorAdjustLabel)
+ self.ColorAdjustComboBox = QtGui.QComboBox(self.ColorAdjPage)
+ self.ColorAdjustComboBox.setObjectName("ColorAdjustComboBox")
+ self.hboxlayout2.addWidget(self.ColorAdjustComboBox)
+ self.gridlayout6.addLayout(self.hboxlayout2, 2, 3, 1, 1)
+ spacerItem14 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem14, 2, 4, 1, 1)
+ spacerItem15 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem15, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.ColorAdjPage)
+ self.LBowPage = QtGui.QWidget()
+ self.LBowPage.setObjectName("LBowPage")
+ self.gridlayout7 = QtGui.QGridLayout(self.LBowPage)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.LBowTitle = QtGui.QLabel(self.LBowPage)
+ self.LBowTitle.setWordWrap(True)
+ self.LBowTitle.setObjectName("LBowTitle")
+ self.gridlayout7.addWidget(self.LBowTitle, 0, 0, 1, 5)
+ spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem16, 1, 1, 1, 1)
+ spacerItem17 = QtGui.QSpacerItem(41, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem17, 2, 0, 1, 1)
+ self.LBowIcon = QtGui.QLabel(self.LBowPage)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.LBowIcon.setObjectName("LBowIcon")
+ self.gridlayout7.addWidget(self.LBowIcon, 2, 1, 1, 1)
+ spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem18, 2, 2, 1, 1)
+ spacerItem19 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem19, 2, 4, 1, 1)
+ spacerItem20 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem20, 3, 1, 1, 1)
+ self.groupBox_2 = QtGui.QGroupBox(self.LBowPage)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout8 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.hboxlayout3 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.label_4 = QtGui.QLabel(self.groupBox_2)
+ self.label_4.setObjectName("label_4")
+ self.hboxlayout3.addWidget(self.label_4)
+ self.aComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.aComboBox.setObjectName("aComboBox")
+ self.hboxlayout3.addWidget(self.aComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout3, 0, 0, 1, 1)
+ self.hboxlayout4 = QtGui.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.label_5 = QtGui.QLabel(self.groupBox_2)
+ self.label_5.setObjectName("label_5")
+ self.hboxlayout4.addWidget(self.label_5)
+ self.bComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.bComboBox.setObjectName("bComboBox")
+ self.hboxlayout4.addWidget(self.bComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout4, 1, 0, 1, 1)
+ self.hboxlayout5 = QtGui.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.label_6 = QtGui.QLabel(self.groupBox_2)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout5.addWidget(self.label_6)
+ self.cComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.cComboBox.setObjectName("cComboBox")
+ self.hboxlayout5.addWidget(self.cComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout5, 2, 0, 1, 1)
+ self.hboxlayout6 = QtGui.QHBoxLayout()
+ self.hboxlayout6.setObjectName("hboxlayout6")
+ self.label_7 = QtGui.QLabel(self.groupBox_2)
+ self.label_7.setObjectName("label_7")
+ self.hboxlayout6.addWidget(self.label_7)
+ self.dComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.dComboBox.setObjectName("dComboBox")
+ self.hboxlayout6.addWidget(self.dComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout6, 3, 0, 1, 1)
+ self.hboxlayout7 = QtGui.QHBoxLayout()
+ self.hboxlayout7.setObjectName("hboxlayout7")
+ self.label_8 = QtGui.QLabel(self.groupBox_2)
+ self.label_8.setObjectName("label_8")
+ self.hboxlayout7.addWidget(self.label_8)
+ self.eComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.eComboBox.setObjectName("eComboBox")
+ self.hboxlayout7.addWidget(self.eComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout7, 4, 0, 1, 1)
+ self.hboxlayout8 = QtGui.QHBoxLayout()
+ self.hboxlayout8.setObjectName("hboxlayout8")
+ self.label_9 = QtGui.QLabel(self.groupBox_2)
+ self.label_9.setObjectName("label_9")
+ self.hboxlayout8.addWidget(self.label_9)
+ self.fComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.fComboBox.setObjectName("fComboBox")
+ self.hboxlayout8.addWidget(self.fComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout8, 5, 0, 1, 1)
+ self.hboxlayout9 = QtGui.QHBoxLayout()
+ self.hboxlayout9.setObjectName("hboxlayout9")
+ self.label_10 = QtGui.QLabel(self.groupBox_2)
+ self.label_10.setObjectName("label_10")
+ self.hboxlayout9.addWidget(self.label_10)
+ self.gComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.gComboBox.setObjectName("gComboBox")
+ self.hboxlayout9.addWidget(self.gComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout9, 6, 0, 1, 1)
+ self.hboxlayout10 = QtGui.QHBoxLayout()
+ self.hboxlayout10.setObjectName("hboxlayout10")
+ self.label_11 = QtGui.QLabel(self.groupBox_2)
+ self.label_11.setObjectName("label_11")
+ self.hboxlayout10.addWidget(self.label_11)
+ self.hComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.hComboBox.setObjectName("hComboBox")
+ self.hboxlayout10.addWidget(self.hComboBox)
+ self.gridlayout8.addLayout(self.hboxlayout10, 7, 0, 1, 1)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label_14 = QtGui.QLabel(self.groupBox_2)
+ self.label_14.setObjectName("label_14")
+ self.horizontalLayout.addWidget(self.label_14)
+ self.iComboBox = QtGui.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 = QtGui.QWidget()
+ self.AioPage.setObjectName("AioPage")
+ self.gridlayout9 = QtGui.QGridLayout(self.AioPage)
+ self.gridlayout9.setObjectName("gridlayout9")
+ spacerItem21 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem21, 0, 1, 1, 1)
+ spacerItem22 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem22, 1, 0, 1, 1)
+ self.AioIcon = QtGui.QLabel(self.AioPage)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.AioIcon.setObjectName("AioIcon")
+ self.gridlayout9.addWidget(self.AioIcon, 1, 1, 1, 1)
+ spacerItem23 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem23, 1, 2, 1, 1)
+ self.label_3 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout9.addItem(spacerItem24, 2, 1, 1, 1)
+ self.StackedWidget.addWidget(self.AioPage)
+ self.FrontPanelPage = QtGui.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout10 = QtGui.QGridLayout(self.FrontPanelPage)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_13 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Align Print Cartridges", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Align Print Cartridges", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_12.setText(QtGui.QApplication.translate("Dialog", "Choose the numbered colored box that the color <b>best </b>matches the background color of the bar.", None, QtGui.QApplication.UnicodeUTF8))
+ self.ColorAdjustLabel.setText(QtGui.QApplication.translate("Dialog", "Line %1:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Row A:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "Row B:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Row C:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.translate("Dialog", "Row D:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_8.setText(QtGui.QApplication.translate("Dialog", "Row E:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_9.setText(QtGui.QApplication.translate("Dialog", "Row F:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_10.setText(QtGui.QApplication.translate("Dialog", "Row G:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_11.setText(QtGui.QApplication.translate("Dialog", "Row H:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_14.setText(QtGui.QApplication.translate("Dialog", "Row I:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_13.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+
+from loadpapergroupbox import LoadPaperGroupBox
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/aligndialog_base.ui b/ui4/aligndialog_base.ui
new file mode 100644
index 0000000..0b575c5
--- /dev/null
+++ b/ui4/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/ui4/cleandialog.py b/ui4/cleandialog.py
new file mode 100644
index 0000000..df84f85
--- /dev/null
+++ b/ui4/cleandialog.py
@@ -0,0 +1,346 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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
+
+
+#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,
+ }
+
+ 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),
+ ],
+ }
+
+
+ self.initUi()
+ QTimer.singleShot(0, self.nextSequence)
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'clean-type': (operator.gt, 0)})
+
+ 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.func_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 print cartridge 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)
+
+ elif level == 2:
+ maint.primeType1(self.dev)
+
+ else: # 3
+ maint.wipeAndSpitType1(self.dev)
+
+
+ elif self.clean_type == CLEAN_TYPE_LIDIL: # 2
+ if level == 1:
+ maint.cleanType2(self.dev)
+
+ elif level == 2:
+ maint.primeType2(self.dev)
+
+ else: # 3
+ maint.wipeAndSpitType2(self.dev)
+
+ maint.print_clean_test_page(self.dev)
+
+ 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(QString(""))
+ else:
+ self.StepText.setText(self.__tr("Step %1 of %2").arg(p).arg(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 __tr(self,s,c = None):
+ return qApp.translate("CleanDialog",s,c)
+
+
diff --git a/ui4/cleandialog_base.py b/ui4/cleandialog_base.py
new file mode 100644
index 0000000..319bc72
--- /dev/null
+++ b/ui4/cleandialog_base.py
@@ -0,0 +1,169 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/cleandialog_base.ui'
+#
+# Created: Mon May 4 14:30:31 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 4)
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtGui.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtGui.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtGui.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 = QtGui.QGroupBox(self.StartPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.Prompt = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.Level1Page = QtGui.QWidget()
+ self.Level1Page.setObjectName("Level1Page")
+ self.gridlayout3 = QtGui.QGridLayout(self.Level1Page)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.Level1Page)
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ self.groupBox_2 = QtGui.QGroupBox(self.Level1Page)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout4 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.Prompt_2 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem1, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level1Page)
+ self.Level2Page = QtGui.QWidget()
+ self.Level2Page.setObjectName("Level2Page")
+ self.gridlayout5 = QtGui.QGridLayout(self.Level2Page)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.LoadPaper_2 = LoadPaperGroupBox(self.Level2Page)
+ self.LoadPaper_2.setObjectName("LoadPaper_2")
+ self.gridlayout5.addWidget(self.LoadPaper_2, 0, 0, 1, 1)
+ self.groupBox_3 = QtGui.QGroupBox(self.Level2Page)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout6 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.Prompt_5 = QtGui.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 = QtGui.QSpacerItem(20, 91, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem2, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level2Page)
+ self.Level3Page = QtGui.QWidget()
+ self.Level3Page.setObjectName("Level3Page")
+ self.gridlayout7 = QtGui.QGridLayout(self.Level3Page)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.LoadPaper_3 = LoadPaperGroupBox(self.Level3Page)
+ self.LoadPaper_3.setObjectName("LoadPaper_3")
+ self.gridlayout7.addWidget(self.LoadPaper_3, 0, 0, 1, 1)
+ self.groupBox_4 = QtGui.QGroupBox(self.Level3Page)
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout8 = QtGui.QGridLayout(self.groupBox_4)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.Prompt_6 = QtGui.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 = QtGui.QSpacerItem(20, 71, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem3, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.Level3Page)
+ self.FrontPanelPage = QtGui.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout9 = QtGui.QGridLayout(self.FrontPanelPage)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_2 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 4, 0, 1, 4)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 5, 0, 1, 1)
+ spacerItem5 = QtGui.QSpacerItem(351, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem5, 5, 1, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 5, 2, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Clean Print Cartridges", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Clean Print Cartridges", None, QtGui.QApplication.UnicodeUTF8))
+ self.Prompt.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.Prompt_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.Prompt_5.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.Prompt_6.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from loadpapergroupbox import LoadPaperGroupBox
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/cleandialog_base.ui b/ui4/cleandialog_base.ui
new file mode 100644
index 0000000..0c8c481
--- /dev/null
+++ b/ui4/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 Print Cartridges</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 Cartridges</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/ui4/colorcaldialog.py b/ui4/colorcaldialog.py
new file mode 100644
index 0000000..d6956a1
--- /dev/null
+++ b/ui4/colorcaldialog.py
@@ -0,0 +1,435 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.DeviceUriComboBox_currentChanged)
+ self.DeviceComboBox.setFilter({'color-cal-type': (operator.gt, 0)})
+
+ 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.func_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(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 %1:").arg(line_id))
+
+ for x in range(count):
+ self.LBowComboBox.addItem(QString("%1%2").arg(line_id).arg(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(QString(x))
+
+ for x in range(13):
+ self.ConneryGrayNumberComboBox.addItem(QString("%1").arg(x+1))
+
+ for x in 'PQRSTUV':
+ self.ConneryColorLetterComboBox.addItem(QString(x))
+
+ for x in range(6):
+ self.ConneryColorNumberComboBox.addItem(QString("%1").arg(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(QString(""))
+ else:
+ self.StepText.setText(self.__tr("Step %1 of %2").arg(p).arg(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/ui4/colorcaldialog_base.py b/ui4/colorcaldialog_base.py
new file mode 100644
index 0000000..7199db5
--- /dev/null
+++ b/ui4/colorcaldialog_base.py
@@ -0,0 +1,326 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/colorcaldialog_base.ui'
+#
+# Created: Mon May 4 14:30:31 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 5)
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtGui.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.StartPage = QtGui.QWidget()
+ self.StartPage.setObjectName("StartPage")
+ self.gridlayout1 = QtGui.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 = QtGui.QGroupBox(self.StartPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 2, 0, 1, 1)
+ self.StackedWidget.addWidget(self.StartPage)
+ self.LoadPaperPage = QtGui.QWidget()
+ self.LoadPaperPage.setObjectName("LoadPaperPage")
+ self.gridlayout3 = QtGui.QGridLayout(self.LoadPaperPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.LoadPaper = LoadPaperGroupBox(self.LoadPaperPage)
+ self.LoadPaper.setObjectName("LoadPaper")
+ self.gridlayout3.addWidget(self.LoadPaper, 0, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(20, 181, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout3.addItem(spacerItem1, 1, 0, 1, 1)
+ self.StackedWidget.addWidget(self.LoadPaperPage)
+ self.Deskjet450Page = QtGui.QWidget()
+ self.Deskjet450Page.setObjectName("Deskjet450Page")
+ self.gridlayout4 = QtGui.QGridLayout(self.Deskjet450Page)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.label_3 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem2, 1, 1, 1, 1)
+ spacerItem3 = QtGui.QSpacerItem(111, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem3, 2, 0, 1, 1)
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label_4 = QtGui.QLabel(self.Deskjet450Page)
+ self.label_4.setObjectName("label_4")
+ self.hboxlayout.addWidget(self.label_4)
+ self.Deskjet450ComboBox = QtGui.QComboBox(self.Deskjet450Page)
+ self.Deskjet450ComboBox.setObjectName("Deskjet450ComboBox")
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.Deskjet450ComboBox.addItem(QtCore.QString())
+ self.hboxlayout.addWidget(self.Deskjet450ComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout, 2, 1, 1, 1)
+ spacerItem4 = QtGui.QSpacerItem(221, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem4, 2, 2, 1, 1)
+ spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout4.addItem(spacerItem5, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.Deskjet450Page)
+ self.CrickPage = QtGui.QWidget()
+ self.CrickPage.setObjectName("CrickPage")
+ self.gridlayout5 = QtGui.QGridLayout(self.CrickPage)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.label_5 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem6, 1, 1, 1, 1)
+ spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem7, 2, 0, 1, 1)
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.label_6 = QtGui.QLabel(self.CrickPage)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout1.addWidget(self.label_6)
+ self.CrickSpinBox = QtGui.QSpinBox(self.CrickPage)
+ self.CrickSpinBox.setMinimum(1)
+ self.CrickSpinBox.setMaximum(81)
+ self.CrickSpinBox.setProperty("value", QtCore.QVariant(41))
+ self.CrickSpinBox.setObjectName("CrickSpinBox")
+ self.hboxlayout1.addWidget(self.CrickSpinBox)
+ self.gridlayout5.addLayout(self.hboxlayout1, 2, 1, 1, 1)
+ spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem8, 2, 2, 1, 1)
+ spacerItem9 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem9, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.CrickPage)
+ self.LBowPage = QtGui.QWidget()
+ self.LBowPage.setObjectName("LBowPage")
+ self.gridlayout6 = QtGui.QGridLayout(self.LBowPage)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_12 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem10, 1, 1, 1, 1)
+ spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem11, 2, 0, 1, 1)
+ self.LBowIcon = QtGui.QLabel(self.LBowPage)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.LBowIcon.setObjectName("LBowIcon")
+ self.gridlayout6.addWidget(self.LBowIcon, 2, 1, 1, 1)
+ spacerItem12 = QtGui.QSpacerItem(31, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem12, 2, 2, 1, 1)
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.LBowLabel = QtGui.QLabel(self.LBowPage)
+ self.LBowLabel.setObjectName("LBowLabel")
+ self.hboxlayout2.addWidget(self.LBowLabel)
+ self.LBowComboBox = QtGui.QComboBox(self.LBowPage)
+ self.LBowComboBox.setObjectName("LBowComboBox")
+ self.hboxlayout2.addWidget(self.LBowComboBox)
+ self.gridlayout6.addLayout(self.hboxlayout2, 2, 3, 1, 1)
+ spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem13, 2, 4, 1, 1)
+ spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem14, 3, 1, 1, 1)
+ self.StackedWidget.addWidget(self.LBowPage)
+ self.ConneryPage = QtGui.QWidget()
+ self.ConneryPage.setObjectName("ConneryPage")
+ self.gridlayout7 = QtGui.QGridLayout(self.ConneryPage)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_7 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem15, 1, 2, 1, 1)
+ spacerItem16 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem16, 2, 0, 1, 1)
+ self.hboxlayout3 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.groupBox_2 = QtGui.QGroupBox(self.ConneryPage)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout8 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+ spacerItem17 = QtGui.QSpacerItem(21, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout8.addItem(spacerItem17, 0, 0, 1, 1)
+ self.ConneryGrayPatchIcon = QtGui.QLabel(self.groupBox_2)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.ConneryGrayPatchIcon.setObjectName("ConneryGrayPatchIcon")
+ self.gridlayout8.addWidget(self.ConneryGrayPatchIcon, 0, 1, 1, 2)
+ spacerItem18 = QtGui.QSpacerItem(21, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout8.addItem(spacerItem18, 0, 3, 1, 1)
+ self.ConneryGrayLetterComboBox = QtGui.QComboBox(self.groupBox_2)
+ self.ConneryGrayLetterComboBox.setObjectName("ConneryGrayLetterComboBox")
+ self.gridlayout8.addWidget(self.ConneryGrayLetterComboBox, 1, 0, 1, 2)
+ self.ConneryGrayNumberComboBox = QtGui.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 = QtGui.QGroupBox(self.ConneryPage)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout9 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout9.setObjectName("gridlayout9")
+ spacerItem19 = QtGui.QSpacerItem(21, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem19, 0, 0, 1, 1)
+ self.ConneryColorPatchIcon = QtGui.QLabel(self.groupBox_3)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.ConneryColorPatchIcon.setObjectName("ConneryColorPatchIcon")
+ self.gridlayout9.addWidget(self.ConneryColorPatchIcon, 0, 1, 1, 2)
+ spacerItem20 = QtGui.QSpacerItem(31, 75, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem20, 0, 3, 1, 1)
+ self.ConneryColorLetterComboBox = QtGui.QComboBox(self.groupBox_3)
+ self.ConneryColorLetterComboBox.setObjectName("ConneryColorLetterComboBox")
+ self.gridlayout9.addWidget(self.ConneryColorLetterComboBox, 1, 0, 1, 2)
+ self.ConneryColorNumberComboBox = QtGui.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 = QtGui.QSpacerItem(81, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout7.addItem(spacerItem21, 2, 4, 1, 1)
+ spacerItem22 = QtGui.QSpacerItem(20, 21, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem22, 3, 1, 1, 1)
+ spacerItem23 = QtGui.QSpacerItem(20, 51, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem23, 3, 3, 2, 1)
+ self.ConneryUseFactoryDefaultsCheckBox = QtGui.QCheckBox(self.ConneryPage)
+ self.ConneryUseFactoryDefaultsCheckBox.setObjectName("ConneryUseFactoryDefaultsCheckBox")
+ self.gridlayout7.addWidget(self.ConneryUseFactoryDefaultsCheckBox, 4, 0, 1, 2)
+ self.StackedWidget.addWidget(self.ConneryPage)
+ self.FrontPanelPage = QtGui.QWidget()
+ self.FrontPanelPage.setObjectName("FrontPanelPage")
+ self.gridlayout10 = QtGui.QGridLayout(self.FrontPanelPage)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_8 = QtGui.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 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 3, 0, 1, 5)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 4, 0, 1, 1)
+ spacerItem25 = QtGui.QSpacerItem(141, 28, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem25, 4, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 4, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 4, 3, 1, 1)
+ self.CancelButton = QtGui.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 4, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QObject.connect(self.ConneryUseFactoryDefaultsCheckBox, QtCore.SIGNAL("clicked(bool)"), self.groupBox_2.setDisabled)
+ QtCore.QObject.connect(self.ConneryUseFactoryDefaultsCheckBox, QtCore.SIGNAL("clicked(bool)"), self.groupBox_3.setDisabled)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Printer Color Calibration", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Printer Color Calibration", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Best Matched Image:", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(0, QtGui.QApplication.translate("Dialog", "1", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(1, QtGui.QApplication.translate("Dialog", "2", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(2, QtGui.QApplication.translate("Dialog", "3", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(3, QtGui.QApplication.translate("Dialog", "4", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(4, QtGui.QApplication.translate("Dialog", "5", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(5, QtGui.QApplication.translate("Dialog", "6", None, QtGui.QApplication.UnicodeUTF8))
+ self.Deskjet450ComboBox.setItemText(6, QtGui.QApplication.translate("Dialog", "7", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Number of <b>best</b> matching patch (1-81):", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_12.setText(QtGui.QApplication.translate("Dialog", "Choose the numbered colored box that the color <b>best </b>matches the background color of the bar.", None, QtGui.QApplication.UnicodeUTF8))
+ self.LBowLabel.setText(QtGui.QApplication.translate("Dialog", "Line %1:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "Gray Plot", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Color Plot", None, QtGui.QApplication.UnicodeUTF8))
+ self.ConneryUseFactoryDefaultsCheckBox.setText(QtGui.QApplication.translate("Dialog", "Use Factory Defaults", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_8.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from loadpapergroupbox import LoadPaperGroupBox
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/colorcaldialog_base.ui b/ui4/colorcaldialog_base.ui
new file mode 100644
index 0000000..1b3cf6d
--- /dev/null
+++ b/ui4/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/ui4/devicesetupdialog.py b/ui4/devicesetupdialog.py
new file mode 100644
index 0000000..3e46f1d
--- /dev/null
+++ b/ui4/devicesetupdialog.py
@@ -0,0 +1,297 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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, utils, pml
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ #self.connect(self.ApplyButton, SIGNAL("clicked()"), self.ApplyButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"),
+ 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"), QVariant(15))
+ self.DurationComboBox.addItem(self.__tr("30 minutes"), QVariant(30))
+ self.DurationComboBox.addItem(self.__tr("45 minutes"), QVariant(45))
+ self.DurationComboBox.addItem(self.__tr("1 hour"), QVariant(60))
+ self.DurationComboBox.addItem(self.__tr("2 hours"), QVariant(120))
+ self.DurationComboBox.addItem(self.__tr("3 hours"), QVariant(180))
+
+ self.connect(self.DurationComboBox, SIGNAL("activated(int)"), self.DurationComboBox_activated)
+
+ self.connect(self.OnRadioButton, SIGNAL("toggled(bool)"), self.OnRadioButton_toggled)
+
+
+ def OnRadioButton_toggled(self, b):
+ i = self.DurationComboBox.currentIndex()
+ if i == -1:
+ return
+ v, ok = self.DurationComboBox.itemData(i).toInt()
+ 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(QVariant(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(QVariant(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 = self.DurationComboBox.itemData(i).toInt()
+ 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/ui4/devicesetupdialog_base.py b/ui4/devicesetupdialog_base.py
new file mode 100644
index 0000000..05f5fda
--- /dev/null
+++ b/ui4/devicesetupdialog_base.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/devicesetupdialog_base.ui'
+#
+# Created: Mon May 4 14:30:32 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QTabWidget(Dialog)
+ self.TabWidget.setObjectName("TabWidget")
+ self.PowerSettingsTab = QtGui.QWidget()
+ self.PowerSettingsTab.setObjectName("PowerSettingsTab")
+ self.gridlayout1 = QtGui.QGridLayout(self.PowerSettingsTab)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.groupBox = QtGui.QGroupBox(self.PowerSettingsTab)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.OnRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.OnRadioButton.setObjectName("OnRadioButton")
+ self.gridlayout2.addWidget(self.OnRadioButton, 0, 0, 1, 2)
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.OffRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.OffRadioButton.setEnabled(True)
+ self.OffRadioButton.setObjectName("OffRadioButton")
+ self.hboxlayout.addWidget(self.OffRadioButton)
+ self.DurationComboBox = QtGui.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 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 1, 1, 1, 1)
+ self.gridlayout1.addWidget(self.groupBox, 0, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(282, 51, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QSpacerItem(510, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ self.gridlayout.addItem(spacerItem2, 4, 0, 1, 1)
+ spacerItem3 = QtGui.QSpacerItem(361, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 5, 0, 1, 1)
+ self.CancelButton = QtGui.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 5, 2, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.TabWidget.setCurrentIndex(0)
+ QtCore.QObject.connect(self.OffRadioButton, QtCore.SIGNAL("toggled(bool)"), self.DurationComboBox.setEnabled)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Device Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Device Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Automatic Power Off", None, QtGui.QApplication.UnicodeUTF8))
+ self.OnRadioButton.setText(QtGui.QApplication.translate("Dialog", "Always leave printer on", None, QtGui.QApplication.UnicodeUTF8))
+ self.OffRadioButton.setText(QtGui.QApplication.translate("Dialog", "Automatically turn printer off after:", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.PowerSettingsTab), QtGui.QApplication.translate("Dialog", "Power Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/devicesetupdialog_base.ui b/ui4/devicesetupdialog_base.ui
new file mode 100644
index 0000000..bc6e63a
--- /dev/null
+++ b/ui4/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/ui4/deviceuricombobox.py b/ui4/deviceuricombobox.py
new file mode 100644
index 0000000..5d08734
--- /dev/null
+++ b/ui4/deviceuricombobox.py
@@ -0,0 +1,163 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+
+DEVICEURICOMBOBOX_TYPE_PRINTER_ONLY = 0
+DEVICEURICOMBOBOX_TYPE_FAX_ONLY = 1
+DEVICEURICOMBOBOX_TYPE_PRINTER_AND_FAX = 2
+
+
+class DeviceUriComboBox(QWidget):
+ 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)
+
+
+ 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"))
+
+ else:
+ self.emit(SIGNAL("DeviceUriComboBox_noDevices"))
+
+
+ def ComboBox_currentIndexChanged(self, t):
+ if self.updating:
+ return
+
+ self.device_uri = 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)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DeviceUriComboBox",s,c)
diff --git a/ui4/devmgr5.py b/ui4/devmgr5.py
new file mode 100644
index 0000000..defbff8
--- /dev/null
+++ b/ui4/devmgr5.py
@@ -0,0 +1,2260 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+
+# Local
+from base.g import *
+from base import device, utils, pml, maint, models, pkit
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+import hpmudext
+from installer.core_install import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# dbus
+try:
+ import dbus
+ from dbus.mainloop.qt import DBusQtMainLoop
+ from dbus import lowlevel
+except ImportError:
+ log.error("Unable to load DBus libraries. Please check your installation and try again.")
+ 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
+
+# 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
+
+
+# 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)
+
+
+class DiagnoseQueue(QObject):
+ def __init__(self, parent):
+ self.parent = parent
+
+
+ def exec_(self):
+ ok, output = utils.run('hp-diagnose_queues -r')
+
+ def __tr(self,s,c = None):
+ return qApp.translate("DevMgr5",s,c)
+
+
+
+# ***********************************************************************************
+#
+# MAINWINDOW
+#
+# ***********************************************************************************
+
+class DevMgr5(QMainWindow, Ui_MainWindow):
+ def __init__(self, toolbox_version, initial_device_uri=None,
+ dbus_loop=None, parent=None, name=None, fl=0):
+
+ QMainWindow.__init__(self, parent)
+
+ log.debug("Initializing toolbox UI (Qt4)...")
+ 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.connect(self.ViewAsIconsAction, SIGNAL("triggered()"), lambda: self.setDeviceListViewMode(QListView.IconMode))
+ self.connect(self.ViewAsListAction, SIGNAL("triggered()"), lambda: self.setDeviceListViewMode(QListView.ListMode))
+
+ self.connect(self.DeviceList, SIGNAL("customContextMenuRequested(const QPoint &)"), self.DeviceList_customContextMenuRequested)
+
+ # Setup main menu
+ self.DeviceRefreshAction.setIcon(QIcon(load_pixmap("refresh1", "16x16")))
+ self.connect(self.DeviceRefreshAction, SIGNAL("triggered()"), self.DeviceRefreshAction_activated)
+
+ self.RefreshAllAction.setIcon(QIcon(load_pixmap("refresh", "16x16")))
+ self.connect(self.RefreshAllAction, SIGNAL("triggered()"), self.RefreshAllAction_activated)
+
+ self.SetupDeviceAction.setIcon(QIcon(load_pixmap('list_add', '16x16')))
+ self.connect(self.SetupDeviceAction, SIGNAL("triggered()"), self.SetupDeviceAction_activated)
+
+ self.RemoveDeviceAction.setIcon(QIcon(load_pixmap('list_remove', '16x16')))
+ self.connect(self.RemoveDeviceAction, SIGNAL("triggered()"), self.RemoveDeviceAction_activated)
+
+ self.PreferencesAction.setIcon(QIcon(load_pixmap('settings', '16x16')))
+ self.connect(self.PreferencesAction, SIGNAL("triggered()"), self.PreferencesAction_activated)
+
+ self.ContentsAction.setIcon(QIcon(load_pixmap("help", "16x16")))
+ self.connect(self.ContentsAction, SIGNAL("triggered()"), self.helpContents)
+
+ self.QuitAction.setIcon(QIcon(load_pixmap("quit", "16x16")))
+ self.connect(self.QuitAction, SIGNAL("triggered()"), self.quit)
+
+ self.connect(self.AboutAction, SIGNAL("triggered()"), self.helpAbout)
+
+ self.connect(self.PrintControlPrinterNameCombo, SIGNAL("activated(const QString &)"), self.PrintControlPrinterNameCombo_activated)
+ self.connect(self.PrintSettingsPrinterNameCombo, SIGNAL("activated(const QString &)"), self.PrintSettingsPrinterNameCombo_activated)
+
+
+ # Init tabs/controls
+ self.initActionsTab()
+ self.initStatusTab()
+ self.initSuppliesTab()
+ self.initPrintSettingsTab()
+ self.initPrintControlTab()
+
+
+ self.connect(self.Tabs,SIGNAL("currentChanged(int)"),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.connect(self.DeviceList, SIGNAL("currentItemChanged(QListWidgetItem * ,QListWidgetItem *)"),
+ 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, 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.error("HPLIP Status Service was closed. HPLIP Device Manager will now exit.")
+ 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, 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("%1 (Fax)").arg(dev.model_ui),
+ icon, d)
+ else:
+ if dev.fax_type:
+ DeviceViewItem(self.DeviceList, self.__tr("%1 (Printer)").arg(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))
+
+ for d in removals:
+ 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.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.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 - %1 (Fax)").arg(self.cur_device.model_ui))
+ else:
+ if self.cur_device.fax_type:
+ self.setWindowTitle(self.__tr("HP Device Manager - %1 (Printer)").arg(self.cur_device.model_ui))
+ else:
+ self.setWindowTitle(self.__tr("HP Device Manager - %1").arg(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)
+
+
+ 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" % item.cmd)
+ 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.decode("utf-8"))
+ self.PrintControlPrinterNameCombo.insertItem(0, c.decode("utf-8"))
+
+ self.cur_printer = unicode(self.PrintSettingsPrinterNameCombo.currentText())
+
+
+ def PrintSettingsPrinterNameCombo_activated(self, s):
+ self.cur_printer = unicode(s)
+ self.updateCurrentTab()
+
+
+ def PrintControlPrinterNameCombo_activated(self, s):
+ self.cur_printer = unicode(s)
+ self.updateCurrentTab()
+
+
+
+ # ***********************************************************************************
+ #
+ # FUNCTIONS/ACTION TAB
+ #
+ # ***********************************************************************************
+
+ def initActionsTab(self):
+ self.click_lock = None
+ self.ActionsList.setIconSize(QSize(32, 32))
+ self.connect(self.ActionsList, SIGNAL("itemClicked(QListWidgetItem *)"), self.ActionsList_clicked)
+ self.connect(self.ActionsList, SIGNAL("itemDoubleClicked(QListWidgetItem *)"), 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 Cartridges"),
+ "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)),
+
+ # Diagnose Queues
+ (lambda : True,
+ self.__tr("Diagnose Queues"),
+ "warning",
+ self.__tr("Diagnose Print/Fax Queues."),
+ lambda : DiagnoseQueue(self)),
+
+ # 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 filter, text, icon, tooltip, cmd in self.ICONS:
+ self.func_icons[icon] = load_pixmap(icon, '32x32')
+ self.func_icons_cached = True
+
+ for filter, text, icon, tooltip, cmd in self.ICONS:
+ if filter is not None:
+ if not filter():
+ 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 callable(item.cmd):
+ 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(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 = QString("%1 %2").arg(dt.toString()).arg(desc)
+
+ if e.job_id:
+ job_id = unicode(e.job_id)
+ else:
+ job_id = u''
+
+ 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 = 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(QString(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"
+ dark_grey = "#808080"
+ light_grey = "#c0c0c0"
+
+ self.TYPE_TO_PIX_MAP = {
+ AGENT_TYPE_UNSPECIFIED : [black],
+ AGENT_TYPE_BLACK: [black],
+ AGENT_TYPE_BLACK_B8800: [black],
+ AGENT_TYPE_CMY: [cyan, magenta, yellow],
+ AGENT_TYPE_KCM: [light_cyan, light_magenta, light_yellow],
+ AGENT_TYPE_GGK: [dark_grey],
+ 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_grey, dark_grey],
+ AGENT_TYPE_LG: [light_grey],
+ AGENT_TYPE_G: [dark_grey],
+ AGENT_TYPE_PG: [light_grey],
+ AGENT_TYPE_C_M: [cyan, magenta],
+ AGENT_TYPE_K_Y: [black, yellow],
+ }
+
+ 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:
+
+ try:
+ self.cur_device.sorted_supplies
+ except AttributeError:
+ self.cur_device.sorted_supplies = []
+
+ if not 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(lambda x, y: cmp(x[1], y[1]) or cmp(x[3], y[3]))
+
+ 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(QString(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.connect(self.StartStopButton, SIGNAL("clicked()"), self.StartStopButton_clicked)
+ self.connect(self.AcceptRejectButton, SIGNAL("clicked()"), self.AcceptRejectButton_clicked)
+ self.connect(self.SetDefaultButton, SIGNAL("clicked()"), self.SetDefaultButton_clicked)
+ self.connect(self.CancelJobButton, SIGNAL("clicked()"), self.CancelJobButton_clicked)
+ self.connect(self.RefreshButton, SIGNAL("clicked()"), 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.connect(self.InstallLatestButton, SIGNAL("clicked()"), 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'"
+ log.debug("cmd = %s " %cmd)
+ os.system(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 = item.data(Qt.UserRole).toInt()
+ 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:"))
+ else:
+ self.PrintControlPrinterNameLabel.setText(self.__tr("Fax Name:"))
+
+ 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.decode('utf-8') == unicode(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.decode('utf-8') == unicode(self.cur_printer):
+ i = QTableWidgetItem(self.JOB_STATE_ICONS[j.state], self.JOB_STATES[j.state])
+ i.setData(Qt.UserRole, QVariant(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(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.decode('utf-8') == 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 default_printer is not None:
+ default_printer = default_printer.decode('utf8')
+
+ if default_printer == self.cur_printer:
+ self.SetDefaultLabel.setText(self.__tr("Default Printer"))
+ self.SetDefaultIcon.setPixmap(load_pixmap("ok", "16x16"))
+ self.SetDefaultButton.setEnabled(False)
+
+ else:
+ self.SetDefaultLabel.setText(self.__tr("Not Default Printer"))
+ 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"))
+
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.StartStopButton.setText(self.__tr("Stop Printer"))
+
+ else:
+ self.StartStopButton.setText(self.__tr("Stop Fax"))
+
+ elif self.printer_state == cups.IPP_PRINTER_STATE_PROCESSING:
+ self.StartStopLabel.setText(self.__tr("Started/Processing"))
+ self.StartStopIcon.setPixmap(load_pixmap("busy", "16x16"))
+
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.StartStopButton.setText(self.__tr("Stop Printer"))
+
+ else:
+ self.StartStopButton.setText(self.__tr("Stop Fax"))
+ else:
+ self.StartStopLabel.setText(self.__tr("Stopped"))
+ self.StartStopIcon.setPixmap(load_pixmap("warning", "16x16"))
+
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ self.StartStopButton.setText(self.__tr("Start Printer"))
+
+ else:
+ self.StartStopButton.setText(self.__tr("Start Fax"))
+
+ # 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 = cups.stop(self.cur_printer)
+ if result:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_STOPPED
+ else:
+ e = EVENT_FAX_QUEUE_STOPPED
+
+ else:
+ result = cups.start(self.cur_printer)
+ if result:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_STARTED
+ else:
+ e = EVENT_FAX_QUEUE_STARTED
+
+ if result:
+ self.updatePrintController()
+ self.cur_device.sendEvent(e, self.cur_printer)
+ else:
+ if os.geteuid!=0 and utils.addgroup()!=[]:
+ FailureUI(self, self.__tr("<b>Start/Stop printer queue operation fails. Could not connect to CUPS Server</b><p>Is user added to %s group(s)" %utils.list_to_string(utils.addgroup())))
+
+ finally:
+ endWaitCursor()
+
+
+
+ def AcceptRejectButton_clicked(self):
+ beginWaitCursor()
+ try:
+ if self.printer_accepting:
+ result = cups.reject(self.cur_printer)
+ if result:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_REJECTING_JOBS
+ else:
+ e = EVENT_FAX_QUEUE_REJECTING_JOBS
+
+ else:
+ result = cups.accept(self.cur_printer)
+ if result:
+ if self.cur_device.device_type == DEVICE_TYPE_PRINTER:
+ e = EVENT_PRINTER_QUEUE_ACCEPTING_JOBS
+ else:
+ e = EVENT_FAX_QUEUE_ACCEPTING_JOBS
+
+ if result:
+ self.updatePrintController()
+ self.cur_device.sendEvent(e, self.cur_printer)
+ else:
+ if os.geteuid!=0 and utils.addgroup()!=[]:
+ FailureUI(self, self.__tr("<b>Accept/Reject printer queue operation fails. Could not connect to CUPS Server</b><p>Is user added to %s group(s)" %utils.list_to_string(utils.addgroup())))
+
+ finally:
+ endWaitCursor()
+
+
+
+ def SetDefaultButton_clicked(self):
+ beginWaitCursor()
+ try:
+ result = cups.setDefaultPrinter(self.cur_printer.encode('utf8'))
+ if not result:
+ if os.geteuid!=0 and utils.addgroup()!=[]:
+ FailureUI(self, self.__tr("<b>Set printer queue as default operation fails. Could not connect to CUPS Server</b><p>Is user added to %s group(s)" %utils.list_to_string(utils.addgroup())))
+ 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()
+ 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, log_output=True, password_func=None, timeout=1)
+ 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, log_output=True, password_func=None, timeout=1)
+ self.rescanDevices()
+ self.updatePrinterCombos()
+
+
+ # ***********************************************************************************
+ #
+ # MISC
+ #
+ # ***********************************************************************************
+
+ def runExternalCommand(self, cmd, macro_char='%'):
+ beginWaitCursor()
+
+ try:
+ if len(cmd) == 0:
+ FailureUI(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.connect(self.OkPushButton, SIGNAL("clicked()"), self.accept)
+ self.connect(self.PasswordLineEdit, SIGNAL("returnPressed()"), self.accept)
+
+
+ def getUsername(self):
+ return unicode(self.UsernameLineEdit.text())
+
+
+ def getPassword(self):
+ return 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/ui4/devmgr5_base.py b/ui4/devmgr5_base.py
new file mode 100644
index 0000000..3cdcfba
--- /dev/null
+++ b/ui4/devmgr5_base.py
@@ -0,0 +1,428 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/devmgr5_base.ui'
+#
+# Created: Thu Feb 2 15:07:11 2012
+# by: PyQt4 UI code generator 4.7.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow,latest_available_version,Is_autoInstaller_distro):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.setWindowModality(QtCore.Qt.ApplicationModal)
+ MainWindow.resize(700, 500)
+ self.latest_available_version = latest_available_version
+ self.Is_autoInstaller_distro = Is_autoInstaller_distro
+ self.centralwidget = QtGui.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridlayout = QtGui.QGridLayout(self.centralwidget)
+ self.gridlayout.setObjectName("gridlayout")
+ self.splitter = QtGui.QSplitter(self.centralwidget)
+ self.splitter.setOrientation(QtCore.Qt.Horizontal)
+ self.splitter.setObjectName("splitter")
+ self.DeviceList = QtGui.QListWidget(self.splitter)
+ self.DeviceList.setMovement(QtGui.QListView.Static)
+ self.DeviceList.setFlow(QtGui.QListView.TopToBottom)
+ self.DeviceList.setResizeMode(QtGui.QListView.Adjust)
+ self.DeviceList.setSpacing(10)
+ self.DeviceList.setViewMode(QtGui.QListView.IconMode)
+ self.DeviceList.setUniformItemSizes(True)
+ self.DeviceList.setWordWrap(True)
+ self.DeviceList.setSelectionRectVisible(False)
+ self.DeviceList.setObjectName("DeviceList")
+ self.Tabs = QtGui.QTabWidget(self.splitter)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Tabs.sizePolicy().hasHeightForWidth())
+ self.Tabs.setSizePolicy(sizePolicy)
+ self.Tabs.setObjectName("Tabs")
+ self.Actions = QtGui.QWidget()
+ self.Actions.setObjectName("Actions")
+ self.gridlayout1 = QtGui.QGridLayout(self.Actions)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.ActionsList = QtGui.QListWidget(self.Actions)
+ self.ActionsList.setSpacing(10)
+ self.ActionsList.setViewMode(QtGui.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 = QtGui.QWidget()
+ self.Status.setObjectName("Status")
+ self.gridlayout2 = QtGui.QGridLayout(self.Status)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ spacerItem = QtGui.QSpacerItem(21, 40, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem)
+ self.LCD = QtGui.QLabel(self.Status)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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.setObjectName("LCD")
+ self.hboxlayout.addWidget(self.LCD)
+ spacerItem1 = QtGui.QSpacerItem(21, 40, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem1)
+ self.gridlayout2.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.StatusTable = QtGui.QTableWidget(self.Status)
+ self.StatusTable.setAlternatingRowColors(True)
+ self.StatusTable.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.StatusTable.setSelectionBehavior(QtGui.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 = QtGui.QWidget()
+ self.Supplies.setObjectName("Supplies")
+ self.gridlayout3 = QtGui.QGridLayout(self.Supplies)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.SuppliesTable = QtGui.QTableWidget(self.Supplies)
+ self.SuppliesTable.setAlternatingRowColors(True)
+ self.SuppliesTable.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.SuppliesTable.setSelectionBehavior(QtGui.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 = QtGui.QWidget()
+ self.Settings.setObjectName("Settings")
+ self.gridlayout4 = QtGui.QGridLayout(self.Settings)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.PrintSettingsPrinterNameLabel = QtGui.QLabel(self.Settings)
+ self.PrintSettingsPrinterNameLabel.setObjectName("PrintSettingsPrinterNameLabel")
+ self.hboxlayout1.addWidget(self.PrintSettingsPrinterNameLabel)
+ self.PrintSettingsPrinterNameCombo = QtGui.QComboBox(self.Settings)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QWidget()
+ self.Control.setObjectName("Control")
+ self.gridlayout5 = QtGui.QGridLayout(self.Control)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.PrintControlPrinterNameLabel = QtGui.QLabel(self.Control)
+ self.PrintControlPrinterNameLabel.setObjectName("PrintControlPrinterNameLabel")
+ self.hboxlayout2.addWidget(self.PrintControlPrinterNameLabel)
+ self.PrintControlPrinterNameCombo = QtGui.QComboBox(self.Control)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QGroupBox(self.Control)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout6 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.vboxlayout = QtGui.QVBoxLayout()
+ self.vboxlayout.setObjectName("vboxlayout")
+ self.groupBox_3 = QtGui.QGroupBox(self.groupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.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 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout7.setMargin(1)
+ self.gridlayout7.setHorizontalSpacing(6)
+ self.gridlayout7.setVerticalSpacing(1)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.hboxlayout3 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.StartStopIcon = QtGui.QLabel(self.groupBox_3)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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 = QtGui.QLabel(self.groupBox_3)
+ self.StartStopLabel.setFrameShape(QtGui.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 = QtGui.QPushButton(self.groupBox)
+ self.StartStopButton.setObjectName("StartStopButton")
+ self.vboxlayout.addWidget(self.StartStopButton)
+ self.gridlayout6.addLayout(self.vboxlayout, 0, 0, 1, 1)
+ self.vboxlayout1 = QtGui.QVBoxLayout()
+ self.vboxlayout1.setObjectName("vboxlayout1")
+ self.groupBox_4 = QtGui.QGroupBox(self.groupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.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 = QtGui.QGridLayout(self.groupBox_4)
+ self.gridlayout8.setMargin(1)
+ self.gridlayout8.setHorizontalSpacing(6)
+ self.gridlayout8.setVerticalSpacing(1)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.hboxlayout4 = QtGui.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.AcceptRejectIcon = QtGui.QLabel(self.groupBox_4)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.AcceptRejectLabel.setFrameShape(QtGui.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 = QtGui.QPushButton(self.groupBox)
+ self.AcceptRejectButton.setObjectName("AcceptRejectButton")
+ self.vboxlayout1.addWidget(self.AcceptRejectButton)
+ self.gridlayout6.addLayout(self.vboxlayout1, 0, 1, 1, 1)
+ self.vboxlayout2 = QtGui.QVBoxLayout()
+ self.vboxlayout2.setObjectName("vboxlayout2")
+ self.groupBox_5 = QtGui.QGroupBox(self.groupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.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 = QtGui.QGridLayout(self.groupBox_5)
+ self.gridlayout9.setMargin(1)
+ self.gridlayout9.setHorizontalSpacing(6)
+ self.gridlayout9.setVerticalSpacing(1)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.hboxlayout5 = QtGui.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.SetDefaultIcon = QtGui.QLabel(self.groupBox_5)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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 = QtGui.QLabel(self.groupBox_5)
+ self.SetDefaultLabel.setFrameShape(QtGui.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 = QtGui.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 = QtGui.QGroupBox(self.Control)
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout10 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.JobTable = QtGui.QTableWidget(self.groupBox_2)
+ self.JobTable.setAlternatingRowColors(True)
+ self.JobTable.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.JobTable.setSelectionBehavior(QtGui.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 = QtGui.QPushButton(self.groupBox_2)
+ self.CancelJobButton.setObjectName("CancelJobButton")
+ self.gridlayout10.addWidget(self.CancelJobButton, 1, 0, 1, 1)
+ spacerItem2 = QtGui.QSpacerItem(131, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout10.addItem(spacerItem2, 1, 1, 1, 1)
+ self.RefreshButton = QtGui.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, "")
+ if self.latest_available_version is not "":
+ self.tab_3 = QtGui.QWidget()
+ self.tab_3.setObjectName("tab_3")
+ self.label = QtGui.QLabel(self.tab_3)
+ self.label.setGeometry(QtCore.QRect(30, 45, 300, 17))
+ self.label.setObjectName("label")
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton = QtGui.QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QtCore.QRect(351, 40, 96, 27))
+ self.InstallLatestButton.setObjectName("pushButton")
+ else:
+ self.ManualInstalllabel = QtGui.QLabel(self.tab_3)
+ self.ManualInstalllabel.setGeometry(QtCore.QRect(30, 70,300, 45))
+ self.ManualInstalllabel.setObjectName("label")
+ self.InstallLatestButton = QtGui.QPushButton(self.tab_3)
+ self.InstallLatestButton.setGeometry(QtCore.QRect(295, 80, 110, 25))
+ self.InstallLatestButton.setObjectName("pushButton")
+ self.Tabs.addTab(self.tab_3, "")
+
+ self.gridlayout.addWidget(self.splitter, 0, 0, 1, 1)
+ MainWindow.setCentralWidget(self.centralwidget)
+ self.Menubar = QtGui.QMenuBar(MainWindow)
+ self.Menubar.setGeometry(QtCore.QRect(0, 0, 700, 27))
+ self.Menubar.setObjectName("Menubar")
+ self.DeviceMenu = QtGui.QMenu(self.Menubar)
+ self.DeviceMenu.setObjectName("DeviceMenu")
+ self.ConfigureMenu = QtGui.QMenu(self.Menubar)
+ self.ConfigureMenu.setObjectName("ConfigureMenu")
+ self.HelpMenu = QtGui.QMenu(self.Menubar)
+ self.HelpMenu.setObjectName("HelpMenu")
+ self.ViewMenu = QtGui.QMenu(self.Menubar)
+ self.ViewMenu.setObjectName("ViewMenu")
+ MainWindow.setMenuBar(self.Menubar)
+ self.Statusbar = QtGui.QStatusBar(MainWindow)
+ self.Statusbar.setObjectName("Statusbar")
+ MainWindow.setStatusBar(self.Statusbar)
+ self.toolBar = QtGui.QToolBar(MainWindow)
+ self.toolBar.setObjectName("toolBar")
+ MainWindow.addToolBar(QtCore.Qt.ToolBarArea(QtCore.Qt.TopToolBarArea), self.toolBar)
+ self.QuitAction = QtGui.QAction(MainWindow)
+ self.QuitAction.setObjectName("QuitAction")
+ self.PreferencesAction = QtGui.QAction(MainWindow)
+ self.PreferencesAction.setObjectName("PreferencesAction")
+ self.AboutAction = QtGui.QAction(MainWindow)
+ self.AboutAction.setObjectName("AboutAction")
+ self.ContentsAction = QtGui.QAction(MainWindow)
+ self.ContentsAction.setObjectName("ContentsAction")
+ self.DeviceSettingsAction = QtGui.QAction(MainWindow)
+ self.DeviceSettingsAction.setEnabled(False)
+ self.DeviceSettingsAction.setObjectName("DeviceSettingsAction")
+ self.DeviceRefreshAction = QtGui.QAction(MainWindow)
+ self.DeviceRefreshAction.setObjectName("DeviceRefreshAction")
+ self.RefreshAllAction = QtGui.QAction(MainWindow)
+ self.RefreshAllAction.setObjectName("RefreshAllAction")
+ self.SetupDeviceAction = QtGui.QAction(MainWindow)
+ self.SetupDeviceAction.setObjectName("SetupDeviceAction")
+ self.RemoveDeviceAction = QtGui.QAction(MainWindow)
+ self.RemoveDeviceAction.setObjectName("RemoveDeviceAction")
+ self.ViewAsListAction = QtGui.QAction(MainWindow)
+ self.ViewAsListAction.setObjectName("ViewAsListAction")
+ self.ViewAsIconsAction = QtGui.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(0)
+ self.PrintSettingsToolbox.setCurrentIndex(-1)
+ QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+ def retranslateUi(self, MainWindow):
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "HP Device Manager", None, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Actions), QtGui.QApplication.translate("MainWindow", "Actions", None, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Status), QtGui.QApplication.translate("MainWindow", "Status", None, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Supplies), QtGui.QApplication.translate("MainWindow", "Supplies", None, QtGui.QApplication.UnicodeUTF8))
+ self.PrintSettingsPrinterNameLabel.setText(QtGui.QApplication.translate("MainWindow", "Printer Name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Settings), QtGui.QApplication.translate("MainWindow", "Print Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.PrintControlPrinterNameLabel.setText(QtGui.QApplication.translate("MainWindow", "Printer Name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Printer/Queue Control", None, QtGui.QApplication.UnicodeUTF8))
+ self.StartStopLabel.setText(QtGui.QApplication.translate("MainWindow", "Started", None, QtGui.QApplication.UnicodeUTF8))
+ self.StartStopButton.setText(QtGui.QApplication.translate("MainWindow", "Stop Printer", None, QtGui.QApplication.UnicodeUTF8))
+ self.AcceptRejectLabel.setText(QtGui.QApplication.translate("MainWindow", "Accepting", None, QtGui.QApplication.UnicodeUTF8))
+ self.AcceptRejectButton.setText(QtGui.QApplication.translate("MainWindow", "Reject Jobs", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetDefaultLabel.setText(QtGui.QApplication.translate("MainWindow", "Not default", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetDefaultButton.setText(QtGui.QApplication.translate("MainWindow", "Set as Default", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_2.setTitle(QtGui.QApplication.translate("MainWindow", "Job Queue", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelJobButton.setText(QtGui.QApplication.translate("MainWindow", "Cancel Job", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshButton.setText(QtGui.QApplication.translate("MainWindow", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.Control), QtGui.QApplication.translate("MainWindow", "Printer Control", None, QtGui.QApplication.UnicodeUTF8))
+ 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, QtGui.QApplication.UnicodeUTF8))
+ self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Upgrade", None, QtGui.QApplication.UnicodeUTF8))
+ if self.Is_autoInstaller_distro:
+ self.InstallLatestButton.setText(QtGui.QApplication.translate("MainWindow", "Install now", None, QtGui.QApplication.UnicodeUTF8))
+ else:
+ msg="Please install manually as mentioned in "
+ self.ManualInstalllabel.setText(QtGui.QApplication.translate("MainWindow", msg, None, QtGui.QApplication.UnicodeUTF8))
+ self.InstallLatestButton.setText(QtGui.QApplication.translate("MainWindow", "HPLIP website", None, QtGui.QApplication.UnicodeUTF8))
+
+ self.DeviceMenu.setTitle(QtGui.QApplication.translate("MainWindow", "&Device", None, QtGui.QApplication.UnicodeUTF8))
+ self.ConfigureMenu.setTitle(QtGui.QApplication.translate("MainWindow", "&Configure", None, QtGui.QApplication.UnicodeUTF8))
+ self.HelpMenu.setTitle(QtGui.QApplication.translate("MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8))
+ self.ViewMenu.setTitle(QtGui.QApplication.translate("MainWindow", "&View", None, QtGui.QApplication.UnicodeUTF8))
+ self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar_2", None, QtGui.QApplication.UnicodeUTF8))
+ self.QuitAction.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8))
+ self.PreferencesAction.setText(QtGui.QApplication.translate("MainWindow", "Preferences...", None, QtGui.QApplication.UnicodeUTF8))
+ self.AboutAction.setText(QtGui.QApplication.translate("MainWindow", "About...", None, QtGui.QApplication.UnicodeUTF8))
+ self.ContentsAction.setText(QtGui.QApplication.translate("MainWindow", "Contents...", None, QtGui.QApplication.UnicodeUTF8))
+ self.DeviceSettingsAction.setText(QtGui.QApplication.translate("MainWindow", "Settings...", None, QtGui.QApplication.UnicodeUTF8))
+ self.DeviceRefreshAction.setText(QtGui.QApplication.translate("MainWindow", "Refresh Device", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshAllAction.setText(QtGui.QApplication.translate("MainWindow", "Refresh All", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetupDeviceAction.setText(QtGui.QApplication.translate("MainWindow", "Setup Device...", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveDeviceAction.setText(QtGui.QApplication.translate("MainWindow", "Remove Device...", None, QtGui.QApplication.UnicodeUTF8))
+ self.ViewAsListAction.setText(QtGui.QApplication.translate("MainWindow", "View as List", None, QtGui.QApplication.UnicodeUTF8))
+ self.ViewAsListAction.setToolTip(QtGui.QApplication.translate("MainWindow", "View Devices as a list", None, QtGui.QApplication.UnicodeUTF8))
+ self.ViewAsIconsAction.setText(QtGui.QApplication.translate("MainWindow", "View as Icons", None, QtGui.QApplication.UnicodeUTF8))
+ self.ViewAsIconsAction.setToolTip(QtGui.QApplication.translate("MainWindow", "View device list as icons", None, QtGui.QApplication.UnicodeUTF8))
+
+from printsettingstoolbox import PrintSettingsToolbox
diff --git a/ui4/devmgr5_base.ui b/ui4/devmgr5_base.ui
new file mode 100644
index 0000000..7d0c7f5
--- /dev/null
+++ b/ui4/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/ui4/fabgrouptable.py b/ui4/fabgrouptable.py
new file mode 100644
index 0000000..c29f691
--- /dev/null
+++ b/ui4/fabgrouptable.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2007 Hewlett-Packard 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 *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+
+
+class FABGroupTable(QTableWidget):
+ 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 = unicode(item.text())
+
+ if group == u'All':
+ e.ignore()
+ return
+
+ names = unicode(e.mimeData().data(u'text/plain')).split(u'|')
+ 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 = unicode(data.data(u'text/plain')).split(u'|')
+ self.emit(SIGNAL("namesAddedToGroup"), row, items)
+ return False
+
+
+ def mimeTypes(self):
+ return QStringList([u'text/plain'])
+
+
diff --git a/ui4/fabnametable.py b/ui4/fabnametable.py
new file mode 100644
index 0000000..082e9fe
--- /dev/null
+++ b/ui4/fabnametable.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2007 Hewlett-Packard 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
+#
+
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+
+class FABNameTable(QTableWidget):
+ def __init__(self, parent):
+ QTableWidget.__init__(self, parent)
+
+
+ def mimeData(self, items):
+ data = QMimeData()
+ data.setText(u'|'.join([unicode(i.text()) for i in items]))
+ return data
+
diff --git a/ui4/fabwindow.py b/ui4/fabwindow.py
new file mode 100644
index 0000000..0d7cc36
--- /dev/null
+++ b/ui4/fabwindow.py
@@ -0,0 +1,607 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2009 Hewlett-Packard 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 *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.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):
+ def __init__(self, parent):
+ QMainWindow.__init__(self, parent)
+ self.setupUi(self)
+ self.group = u'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 u'All' not in data[d]['groups']:
+ data[d]['groups'].append(u'All')
+
+ if not data:
+ self.db.set('__' + utils.gen_random_uuid(), '', '', '', '', [u'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.connect(self.QuitAction, SIGNAL("triggered()"), self.close)
+ self.connect(self.NewGroupAction, SIGNAL("triggered()"), self.NewGroupAction_triggered)
+ self.connect(self.NewGroupFromSelectionAction, SIGNAL("triggered()"), self.NewGroupFromSelectionAction_triggered)
+ self.connect(self.RenameGroupAction, SIGNAL("triggered()"), self.RenameGroupAction_triggered)
+ self.connect(self.RemoveGroupAction, SIGNAL("triggered()"), self.RemoveGroupAction_triggered)
+ self.connect(self.NewNameAction, SIGNAL("triggered()"), self.NewNameAction_triggered)
+ self.connect(self.RemoveNameAction, SIGNAL("triggered()"), self.RemoveNameAction_triggered)
+ self.connect(self.ImportAction, SIGNAL("triggered()"), self.ImportAction_triggered)
+ self.connect(self.RemoveFromGroupAction, SIGNAL("triggered()"), self.RemoveFromGroupAction_triggered)
+ self.connect(self.AddToGroupAction, SIGNAL("triggered()"), self.AddToGroupAction_triggered)
+
+ self.GroupTableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+ self.NameTableWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
+
+ self.connect(self.Splitter, SIGNAL("splitterMoved(int, int)"), 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.connect(self.GroupTableWidget, SIGNAL("itemSelectionChanged()"),
+ self.GroupTableWidget_itemSelectionChanged)
+ self.connect(self.NameTableWidget, SIGNAL("itemSelectionChanged()"),
+ self.NameTableWidget_itemSelectionChanged)
+ self.connect(self.NameLineEdit, SIGNAL("editingFinished()"),
+ self.NameLineEdit_editingFinished)
+ self.connect(self.FaxNumberLineEdit, SIGNAL("editingFinished()"),
+ self.FaxNumberLineEdit_editingFinished)
+ self.connect(self.NotesTextEdit, SIGNAL("textChanged()"),
+ self.NotesTextEdit_textChanged)
+ self.connect(self.NotesTextEdit, SIGNAL("editingFinished()"),
+ self.NotesTextEdit_editingFinished)
+ self.connect(self.GroupTableWidget, SIGNAL("namesAddedToGroup"),
+ 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.NotesTextEdit.emit(SIGNAL("editingFinished()"))
+ 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 == u'All':
+ continue
+
+ i = QTableWidgetItem(QString(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 = unicode(selected_items[0].text())
+ self.RemoveGroupAction.setEnabled(self.group != u'All')
+ self.RenameGroupAction.setEnabled(self.group != u'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 = unicode(selected_items[0].text())
+ self.RemoveNameAction.setEnabled(True)
+ self.NewGroupFromSelectionAction.setEnabled(True)
+
+ self.RemoveFromGroupAction.setEnabled(self.group != u'All')
+ self.AddToGroupAction.setEnabled(True) #self.group != u'All')
+
+ else: # > 1
+ self.RemoveNameAction.setEnabled(True)
+ self.NewGroupFromSelectionAction.setEnabled(True)
+ self.RemoveFromGroupAction.setEnabled(self.group != u'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):
+ i = QTableWidgetItem(QString(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 == unicode(i.text()))
+
+
+ def updateDetailsFrame(self):
+ if self.name is None:
+ self.NameFrame.setEnabled(False)
+ self.NameLineEdit.setText(QString())
+ self.FaxNumberLineEdit.setText(QString())
+ self.NotesTextEdit.setText(QString())
+
+ 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 = unicode(self.NameLineEdit.text())
+ if new_name != self.name:
+ if QMessageBox.question(self, self.__tr("Rename?"), self.__tr("Rename '%1' to '%2'?").arg(self.name).arg(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.emit(SIGNAL("databaseChanged"), 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', unicode(self.FaxNumberLineEdit.text()))
+ self.emit(SIGNAL("databaseChanged"), FAB_NAME_DETAILS_CHANGED, self.name)
+
+
+ def NotesTextEdit_textChanged(self):
+ if self.name is not None:
+ self.db.set_key_value(self.name, 'notes', unicode(self.NotesTextEdit.document().toPlainText()))
+
+
+ def NotesTextEdit_editingFinished(self):
+ if self.name is not None:
+ self.emit(SIGNAL("databaseChanged"), 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 = unicode(g)
+
+ if g == u'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(), '', '', '', '', [u'All', g], '')
+ self.group = g
+ log.debug("New empty group %s" % self.group)
+ self.emit(SIGNAL("databaseChanged"), FAB_GROUP_ADD, self.group)
+ self.updateGroupList()
+
+
+ def NewGroupFromSelectionAction_triggered(self):
+ selected_names = [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 = 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.emit(SIGNAL("databaseChanged"), FAB_GROUP_ADD, self.group)
+ self.updateGroupList()
+
+
+ def RenameGroupAction_triggered(self):
+ selected_items = self.GroupTableWidget.selectedItems()
+ if selected_items:
+ old_group = unicode(selected_items[0].text())
+ ok = False
+ new_group, ok = QInputDialog.getText(self, self.__tr("Rename Group"), self.__tr("New Name for Group '%1':").arg(old_group))
+ new_group = 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.emit(SIGNAL("databaseChanged"), 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.emit(SIGNAL("databaseChanged"), 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 = unicode(t)
+ self.addName(t)
+
+
+ def addName(self, name, fax=''):
+ if self.group == u'All':
+ g = [u'All']
+ else:
+ g = [u'All', self.group]
+
+ self.db.set(name, '', '', '', fax, g, '')
+ self.name = name
+ log.debug("New name %s" % self.name)
+ self.emit(SIGNAL("databaseChanged"), FAB_NAME_ADD, self.name)
+ self.updateNameList()
+
+
+ def RemoveNameAction_triggered(self):
+ selected_names = [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.emit(SIGNAL("databaseChanged"), FAB_NAME_REMOVE, n)
+
+ self.name = None
+ self.updateNameList()
+
+
+ def RemoveFromGroupAction_triggered(self):
+ selected_names = [unicode(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.emit(SIGNAL("databaseChanged"), FAB_GROUP_MEMBERSHIP_CHANGED, self.group)
+ self.name = None
+ self.updateGroupList()
+
+
+ def GroupTableWidget_namesAddedToGroup(self, row, items): # drag n' drop handler
+ self.group = 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.emit(SIGNAL("databaseChanged"), FAB_GROUP_MEMBERSHIP_CHANGED, self.group)
+ self.updateGroupList()
+
+
+ def AddToGroupAction_triggered(self):
+ selected_names = [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 != u'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.emit(SIGNAL("databaseChanged"), 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 = unicode(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 = 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,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.connect(self.GroupJoinComboBox, SIGNAL("currentIndexChanged(int)"),
+ self.GroupJoinComboBox_currentIndexChanged)
+
+ for i, g in enumerate(groups):
+ if i == 0:
+ self.group = g
+ self.GroupJoinComboBox.insertItem(i, g)
+
+ self.connect(self.JoinButton, SIGNAL("clicked()"), self.accept)
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.reject)
+
+ self.retranslateUi()
+
+
+ def GroupJoinComboBox_currentIndexChanged(self, i):
+ self.group = 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/ui4/fabwindow_base.py b/ui4/fabwindow_base.py
new file mode 100644
index 0000000..43f2bbe
--- /dev/null
+++ b/ui4/fabwindow_base.py
@@ -0,0 +1,159 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/fabwindow_base.ui'
+#
+# Created: Mon May 4 14:30:32 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+ def setupUi(self, MainWindow):
+ MainWindow.setObjectName("MainWindow")
+ MainWindow.resize(700, 440)
+ self.centralwidget = QtGui.QWidget(MainWindow)
+ self.centralwidget.setObjectName("centralwidget")
+ self.gridlayout = QtGui.QGridLayout(self.centralwidget)
+ self.gridlayout.setObjectName("gridlayout")
+ self.Splitter = QtGui.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 = QtGui.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 = QtGui.QTableWidgetItem()
+ self.NameTableWidget.setHorizontalHeaderItem(0, item)
+ self.NameFrame = QtGui.QFrame(self.Splitter)
+ self.NameFrame.setEnabled(False)
+ self.NameFrame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.NameFrame.setFrameShadow(QtGui.QFrame.Raised)
+ self.NameFrame.setObjectName("NameFrame")
+ self.gridlayout1 = QtGui.QGridLayout(self.NameFrame)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.QLabel(self.NameFrame)
+ self.label.setObjectName("label")
+ self.gridlayout1.addWidget(self.label, 0, 0, 1, 1)
+ self.NameLineEdit = QtGui.QLineEdit(self.NameFrame)
+ self.NameLineEdit.setObjectName("NameLineEdit")
+ self.gridlayout1.addWidget(self.NameLineEdit, 0, 1, 1, 1)
+ self.label_2 = QtGui.QLabel(self.NameFrame)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 1, 0, 1, 1)
+ self.FaxNumberLineEdit = QtGui.QLineEdit(self.NameFrame)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout1.addWidget(self.FaxNumberLineEdit, 1, 1, 1, 1)
+ self.label_3 = QtGui.QLabel(self.NameFrame)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout1.addWidget(self.label_3, 2, 0, 1, 1)
+ self.NotesTextEdit = QtGui.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 = QtGui.QMenuBar(MainWindow)
+ self.menubar.setGeometry(QtCore.QRect(0, 0, 700, 27))
+ self.menubar.setObjectName("menubar")
+ self.menuGroup = QtGui.QMenu(self.menubar)
+ self.menuGroup.setObjectName("menuGroup")
+ self.menuName = QtGui.QMenu(self.menubar)
+ self.menuName.setObjectName("menuName")
+ self.menuFile = QtGui.QMenu(self.menubar)
+ self.menuFile.setObjectName("menuFile")
+ MainWindow.setMenuBar(self.menubar)
+ self.statusbar = QtGui.QStatusBar(MainWindow)
+ self.statusbar.setObjectName("statusbar")
+ MainWindow.setStatusBar(self.statusbar)
+ self.toolBar = QtGui.QToolBar(MainWindow)
+ self.toolBar.setObjectName("toolBar")
+ MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
+ self.NewGroupAction = QtGui.QAction(MainWindow)
+ self.NewGroupAction.setObjectName("NewGroupAction")
+ self.NewNameAction = QtGui.QAction(MainWindow)
+ self.NewNameAction.setObjectName("NewNameAction")
+ self.RemoveGroupAction = QtGui.QAction(MainWindow)
+ self.RemoveGroupAction.setEnabled(False)
+ self.RemoveGroupAction.setObjectName("RemoveGroupAction")
+ self.QuitAction = QtGui.QAction(MainWindow)
+ self.QuitAction.setObjectName("QuitAction")
+ self.RemoveNameAction = QtGui.QAction(MainWindow)
+ self.RemoveNameAction.setEnabled(False)
+ self.RemoveNameAction.setObjectName("RemoveNameAction")
+ self.NewGroupFromSelectionAction = QtGui.QAction(MainWindow)
+ self.NewGroupFromSelectionAction.setEnabled(False)
+ self.NewGroupFromSelectionAction.setObjectName("NewGroupFromSelectionAction")
+ self.ImportAction = QtGui.QAction(MainWindow)
+ self.ImportAction.setObjectName("ImportAction")
+ self.RenameGroupAction = QtGui.QAction(MainWindow)
+ self.RenameGroupAction.setEnabled(False)
+ self.RenameGroupAction.setObjectName("RenameGroupAction")
+ self.RemoveFromGroupAction = QtGui.QAction(MainWindow)
+ self.RemoveFromGroupAction.setEnabled(False)
+ self.RemoveFromGroupAction.setObjectName("RemoveFromGroupAction")
+ self.AddToGroupAction = QtGui.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):
+ MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "HP Device Manager - Fax Address Book", None, QtGui.QApplication.UnicodeUTF8))
+ self.GroupTableWidget.horizontalHeaderItem(0).setText(QtGui.QApplication.translate("MainWindow", "Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.NameTableWidget.horizontalHeaderItem(0).setText(QtGui.QApplication.translate("MainWindow", "Name", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("MainWindow", "Name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("MainWindow", "Fax Number:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("MainWindow", "Notes:", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuGroup.setTitle(QtGui.QApplication.translate("MainWindow", "Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuName.setTitle(QtGui.QApplication.translate("MainWindow", "Name", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
+ self.toolBar.setWindowTitle(QtGui.QApplication.translate("MainWindow", "toolBar", None, QtGui.QApplication.UnicodeUTF8))
+ self.NewGroupAction.setText(QtGui.QApplication.translate("MainWindow", "New Group...", None, QtGui.QApplication.UnicodeUTF8))
+ self.NewNameAction.setText(QtGui.QApplication.translate("MainWindow", "New Name...", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveGroupAction.setText(QtGui.QApplication.translate("MainWindow", "Delete Group...", None, QtGui.QApplication.UnicodeUTF8))
+ self.QuitAction.setText(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveNameAction.setText(QtGui.QApplication.translate("MainWindow", "Delete Name...", None, QtGui.QApplication.UnicodeUTF8))
+ self.NewGroupFromSelectionAction.setText(QtGui.QApplication.translate("MainWindow", "New Group From Selection...", None, QtGui.QApplication.UnicodeUTF8))
+ self.ImportAction.setText(QtGui.QApplication.translate("MainWindow", "Import...", None, QtGui.QApplication.UnicodeUTF8))
+ self.RenameGroupAction.setText(QtGui.QApplication.translate("MainWindow", "Rename Group...", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveFromGroupAction.setText(QtGui.QApplication.translate("MainWindow", "Leave Group", None, QtGui.QApplication.UnicodeUTF8))
+ self.AddToGroupAction.setText(QtGui.QApplication.translate("MainWindow", "Join Group...", None, QtGui.QApplication.UnicodeUTF8))
+
+from fabgrouptable import FABGroupTable
+from fabnametable import FABNameTable
diff --git a/ui4/fabwindow_base.ui b/ui4/fabwindow_base.ui
new file mode 100644
index 0000000..927ac9d
--- /dev/null
+++ b/ui4/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/ui4/faxsetupdialog.py b/ui4/faxsetupdialog.py
new file mode 100644
index 0000000..7963708
--- /dev/null
+++ b/ui4/faxsetupdialog.py
@@ -0,0 +1,307 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.FaxComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.FaxComboBox_noDevices)
+ self.connect(self.FaxComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.FaxComboBox_currentChanged)
+ self.FaxComboBox.setType(DEVICEURICOMBOBOX_TYPE_FAX_ONLY)
+
+ # 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.connect(self.NameCompanyLineEdit, SIGNAL("editingFinished()"),
+ self.NameCompanyLineEdit_editingFinished)
+
+ self.connect(self.NameCompanyLineEdit, SIGNAL("textChanged(const QString &)"),
+ self.NameCompanyLineEdit_textChanged)
+
+ self.connect(self.FaxNumberLineEdit, SIGNAL("editingFinished()"),
+ self.FaxNumberLineEdit_editingFinished)
+
+ self.connect(self.FaxNumberLineEdit, SIGNAL("textChanged(const QString &)"),
+ self.FaxNumberLineEdit_textChanged)
+
+ self.connect(self.VoiceNumberLineEdit, SIGNAL("editingFinished()"),
+ self.VoiceNumberLineEdit_editingFinished)
+
+ self.connect(self.VoiceNumberLineEdit, SIGNAL("textChanged(const QString &)"),
+ self.VoiceNumberLineEdit_textChanged)
+
+ self.connect(self.EmailLineEdit, SIGNAL("editingFinished()"),
+ self.EmailLineEdit_editingFinished)
+
+ self.connect(self.EmailLineEdit, SIGNAL("textChanged(const QString &)"),
+ self.EmailLineEdit_textChanged)
+
+ self.connect(self.tabWidget,SIGNAL("currentChanged(int)"),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(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()
+ finally:
+ endWaitCursor()
+
+ #
+ # Fax Number (for TTI header) (stored in device)
+ #
+
+ def FaxNumberLineEdit_editingFinished(self):
+ self.saveFaxNumber(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()
+ finally:
+ endWaitCursor()
+
+ #
+ # Voice Number (for coverpage) (stored in ~/.hplip/hplip.conf)
+ #
+
+ def VoiceNumberLineEdit_editingFinished(self):
+ self.saveVoiceNumber(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(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 = self.dev.getStationName()
+ log.debug("name_company = '%s'" % name_company)
+ self.NameCompanyLineEdit.setText(name_company)
+ fax_number = self.dev.getPhoneNum()
+ log.debug("fax_number = '%s'" % fax_number)
+ self.FaxNumberLineEdit.setText(fax_number)
+ except Error:
+ CheckDeviceUI()
+ 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.emit(SIGNAL("editingFinished()"))
+
+ if self.name_company_dirty:
+ self.NameCompanyLineEdit.emit(SIGNAL("editingFinished()"))
+
+ if self.email_dirty:
+ self.EmailLineEdit.emit(SIGNAL("editingFinished()"))
+
+ if self.fax_number_dirty:
+ self.FaxNumberLineEdit.emit(SIGNAL("editingFinished()"))
+
+ 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/ui4/faxsetupdialog_base.py b/ui4/faxsetupdialog_base.py
new file mode 100644
index 0000000..de4d7b0
--- /dev/null
+++ b/ui4/faxsetupdialog_base.py
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/faxsetupdialog_base.ui'
+#
+# Created: Mon May 4 14:30:33 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QTabWidget(Dialog)
+ self.tabWidget.setObjectName("tabWidget")
+ self.tab = QtGui.QWidget()
+ self.tab.setObjectName("tab")
+ self.gridlayout1 = QtGui.QGridLayout(self.tab)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_3 = QtGui.QLabel(self.tab)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout1.addWidget(self.label_3, 0, 0, 1, 2)
+ self.label_2 = QtGui.QLabel(self.tab)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout1.addWidget(self.label_2, 1, 0, 1, 1)
+ self.NameCompanyLineEdit = QtGui.QLineEdit(self.tab)
+ self.NameCompanyLineEdit.setObjectName("NameCompanyLineEdit")
+ self.gridlayout1.addWidget(self.NameCompanyLineEdit, 1, 1, 1, 1)
+ self.label_4 = QtGui.QLabel(self.tab)
+ self.label_4.setObjectName("label_4")
+ self.gridlayout1.addWidget(self.label_4, 2, 0, 1, 1)
+ self.FaxNumberLineEdit = QtGui.QLineEdit(self.tab)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout1.addWidget(self.FaxNumberLineEdit, 2, 1, 1, 1)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ self.tabWidget.addTab(self.tab, "")
+ self.tab_2 = QtGui.QWidget()
+ self.tab_2.setObjectName("tab_2")
+ self.gridlayout2 = QtGui.QGridLayout(self.tab_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_5 = QtGui.QLabel(self.tab_2)
+ self.label_5.setObjectName("label_5")
+ self.gridlayout2.addWidget(self.label_5, 0, 0, 1, 2)
+ self.label_6 = QtGui.QLabel(self.tab_2)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout2.addWidget(self.label_6, 1, 0, 1, 1)
+ self.VoiceNumberLineEdit = QtGui.QLineEdit(self.tab_2)
+ self.VoiceNumberLineEdit.setObjectName("VoiceNumberLineEdit")
+ self.gridlayout2.addWidget(self.VoiceNumberLineEdit, 1, 1, 1, 1)
+ self.label_7 = QtGui.QLabel(self.tab_2)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout2.addWidget(self.label_7, 2, 0, 1, 1)
+ self.EmailLineEdit = QtGui.QLineEdit(self.tab_2)
+ self.EmailLineEdit.setObjectName("EmailLineEdit")
+ self.gridlayout2.addWidget(self.EmailLineEdit, 2, 1, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(20, 131, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QSpacerItem(371, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem2, 4, 0, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Fax Device Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Fax Device Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("Dialog", "This information will appear at the top of each fax you send.", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("Dialog", "Name and/or Company:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Fax Number:", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "Fax Header", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "This information will appear on all coverpages.", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Voice Phone Number:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.translate("Dialog", "Email Address:", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Coverpage", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/faxsetupdialog_base.ui b/ui4/faxsetupdialog_base.ui
new file mode 100644
index 0000000..ab0f1a1
--- /dev/null
+++ b/ui4/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/ui4/filetable.py b/ui4/filetable.py
new file mode 100644
index 0000000..bdcffa9
--- /dev/null
+++ b/ui4/filetable.py
@@ -0,0 +1,405 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+
+# Local
+from base.g import *
+from base import utils, magic
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# Other UI
+from mimetypesdialog import MimeTypesDialog
+
+
+FILETABLE_TYPE_PRINT = 0
+FILETABLE_TYPE_FAX = 1
+
+
+
+class FileTable(QWidget):
+ 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.connect(self.AddFileButton, SIGNAL("clicked()"), self.AddFileButton_clicked)
+ self.RemoveFileButton.setIcon(QIcon(load_pixmap('list_remove', '16x16')))
+ self.RemoveFileButton.setText(self.__tr("Remove"))
+ self.connect(self.RemoveFileButton, SIGNAL("clicked()"), self.RemoveFileButton_clicked)
+ self.MoveFileUpButton.setText(self.__tr("Move Up"))
+ self.MoveFileUpButton.setIcon(QIcon(load_pixmap('up', '16x16')))
+ self.connect(self.MoveFileUpButton, SIGNAL("clicked()"), self.MoveFileUpButton_clicked)
+ self.MoveFileDownButton.setText(self.__tr("Move Down"))
+ self.MoveFileDownButton.setIcon(QIcon(load_pixmap('down', '16x16')))
+ self.connect(self.MoveFileDownButton, SIGNAL("clicked()"), self.MoveFileDownButton_clicked)
+ self.ShowTypesButton.setText(self.__tr("Show Valid Types..."))
+ self.ShowTypesButton.setIcon(QIcon(load_pixmap('mimetypes', '16x16')))
+ self.connect(self.ShowTypesButton, SIGNAL("clicked()"), self.ShowTypesButton_clicked)
+ self.FileTable.setContextMenuPolicy(Qt.CustomContextMenu)
+ self.connect(self.FileTable, SIGNAL("customContextMenuRequested(const QPoint &)"),
+ self.FileTable_customContextMenuRequested)
+ self.headers = [self.__tr("Name"), self.__tr("Type"), self.__tr("Folder/Path")]
+
+ self.FileTable.setSortingEnabled(False)
+ self.connect(self.FileTable, SIGNAL("itemSelectionChanged()"), 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"))
+ 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, QVariant(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(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.RemoveFileButton.setEnabled(False)
+ self.setUpDownButtons()
+
+ if show_add_file_if_empty:
+ self.AddFileButton.emit(SIGNAL("clicked()"))
+
+
+ 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:
+ s = self.__tr("Select File(s) to Send")
+
+ files = list(QFileDialog.getOpenFileNames(self, s,
+ self.working_dir, self.__tr("All files (*)")))
+
+ files = [unicode(f) for f in 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 '%1' 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.").arg(f),
+ self.__tr("HP Device Manager"))
+ else:
+ FailureUI(self, self.__tr("<b>You are trying to add a file '%1' 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.").arg(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 '%1' to file list (file not found or insufficient permissions).</b><p>Check the file name and try again.").arg(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"))
+
+
+ def currentFilename(self):
+ i = self.FileTable.item(self.FileTable.currentRow(), 0)
+ if i is None:
+ return None
+ return i.data(Qt.UserRole).toString()
+
+
+ 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 == filename:
+ del self.file_list[index]
+ self.emit(SIGNAL("fileListChanged"))
+ 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.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/ui4/firmwaredialog.py b/ui4/firmwaredialog.py
new file mode 100644
index 0000000..90a80fe
--- /dev/null
+++ b/ui4/firmwaredialog.py
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.DeviceUriComboBox_currentChanged)
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.close)
+ self.connect(self.DownloadFirmwareButton, SIGNAL("clicked()"), self.downloadFirmware)
+
+ # 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/ui4/firmwaredialog_base.py b/ui4/firmwaredialog_base.py
new file mode 100644
index 0000000..b52fb14
--- /dev/null
+++ b/ui4/firmwaredialog_base.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/firmwaredialog_base.ui'
+#
+# Created: Mon May 4 14:30:33 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QFrame(Dialog)
+ self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.frame.setFrameShadow(QtGui.QFrame.Raised)
+ self.frame.setObjectName("frame")
+ self.gridlayout1 = QtGui.QGridLayout(self.frame)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_2 = QtGui.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 = QtGui.QSpacerItem(20, 171, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 1, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(301, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.DownloadFirmwareButton = QtGui.QPushButton(Dialog)
+ self.DownloadFirmwareButton.setObjectName("DownloadFirmwareButton")
+ self.gridlayout.addWidget(self.DownloadFirmwareButton, 5, 1, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Download Firmware", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Download Firmware", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.DownloadFirmwareButton.setText(QtGui.QApplication.translate("Dialog", "Download Firmware", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/firmwaredialog_base.ui b/ui4/firmwaredialog_base.ui
new file mode 100644
index 0000000..d5b6734
--- /dev/null
+++ b/ui4/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/ui4/infodialog.py b/ui4/infodialog.py
new file mode 100644
index 0000000..2d93068
--- /dev/null
+++ b/ui4/infodialog.py
@@ -0,0 +1,310 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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, utils
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), 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 %1.</b>").arg(self.device_uri))
+ #self.close()
+ return
+
+ self.StaticTableWidget.clear()
+
+ self.StaticTableWidget.setColumnCount(len(self.headers))
+ self.StaticTableWidget.setHorizontalHeaderLabels(self.headers)
+
+ mq_keys = d.mq.keys()
+ mq_keys.sort()
+
+ self.StaticTableWidget.setRowCount(len(mq_keys))
+
+ for row, key in enumerate(mq_keys):
+ i = QTableWidgetItem(QString(key))
+ i.setFlags(flags)
+ self.StaticTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(QString(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, e:
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Unable to open device %1.</b>").arg(self.device_uri))
+ #self.close()
+ return
+
+ dq_keys = d.dq.keys()
+ dq_keys.sort()
+
+ self.DynamicTableWidget.setRowCount(len(dq_keys))
+
+ for row, key in enumerate(dq_keys):
+ i = QTableWidgetItem(QString(key))
+ i.setFlags(flags)
+ self.DynamicTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(QString(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 = dt.toString()
+
+ ess = device.queryString(h.event_code, 0)
+
+ for col, t in enumerate([dt, h.printer_name,
+ unicode(h.event_code), ess,
+ h.username, unicode(h.job_id),
+ h.title]):
+
+ i = QTableWidgetItem(QString(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(QString(p.name))
+
+ GridLayout = QGridLayout(Tab)
+ GridLayout.setObjectName(QString("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(QString("Table-%s" % p.name))
+ GridLayout.addWidget(Table, 0, 0, 1, 1)
+ self.TabWidget.addTab(Tab, QString(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 = file(os.path.expanduser('~/.cups/lpoptions'))
+ except IOError, e:
+ log.debug(str(e))
+ current_options['lpoptions_file_data'] = QString("(%1)").arg(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 = current_options.keys()
+ keys.sort()
+
+ Table.setRowCount(len(keys))
+
+ for row, key in enumerate(keys):
+ i = QTableWidgetItem(QString(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 (%1)").arg(state))
+ elif state == cups.IPP_PRINTER_STATE_PROCESSING:
+ i = QTableWidgetItem(self.__tr("busy/printing (%1)").arg(state))
+ elif state == cups.IPP_PRINTER_STATE_STOPPED:
+ i = QTableWidgetItem(self.__tr("stopped (%1)").arg(state))
+ else:
+ i = QTableWidgetItem(QString(str(state)))
+ else:
+ i = QTableWidgetItem(QString(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/ui4/infodialog_base.py b/ui4/infodialog_base.py
new file mode 100644
index 0000000..8ee40af
--- /dev/null
+++ b/ui4/infodialog_base.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/infodialog_base.ui'
+#
+# Created: Mon May 4 14:30:33 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QTabWidget(Dialog)
+ self.TabWidget.setObjectName("TabWidget")
+ self.tab_2 = QtGui.QWidget()
+ self.tab_2.setObjectName("tab_2")
+ self.gridlayout1 = QtGui.QGridLayout(self.tab_2)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.StaticTableWidget = QtGui.QTableWidget(self.tab_2)
+ self.StaticTableWidget.setAlternatingRowColors(True)
+ self.StaticTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.StaticTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.StaticTableWidget.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
+ self.StaticTableWidget.setHorizontalScrollMode(QtGui.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 = QtGui.QWidget()
+ self.tab.setObjectName("tab")
+ self.gridlayout2 = QtGui.QGridLayout(self.tab)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.DynamicTableWidget = QtGui.QTableWidget(self.tab)
+ self.DynamicTableWidget.setAlternatingRowColors(True)
+ self.DynamicTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.DynamicTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.DynamicTableWidget.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
+ self.DynamicTableWidget.setHorizontalScrollMode(QtGui.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 = QtGui.QWidget()
+ self.tab_3.setObjectName("tab_3")
+ self.gridlayout3 = QtGui.QGridLayout(self.tab_3)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.HistoryTableWidget = QtGui.QTableWidget(self.tab_3)
+ self.HistoryTableWidget.setAlternatingRowColors(True)
+ self.HistoryTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.HistoryTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.HistoryTableWidget.setVerticalScrollMode(QtGui.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 = QtGui.QSpacerItem(470, 31, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Maximum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(361, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Device Information", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Device Information", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("Dialog", "Model Data (Static)", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "Status Data (Dynamic)", None, QtGui.QApplication.UnicodeUTF8))
+ self.HistoryTableWidget.setSortingEnabled(False)
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.tab_3), QtGui.QApplication.translate("Dialog", "Status History", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/infodialog_base.ui b/ui4/infodialog_base.ui
new file mode 100644
index 0000000..f868431
--- /dev/null
+++ b/ui4/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/ui4/linefeedcaldialog.py b/ui4/linefeedcaldialog.py
new file mode 100644
index 0000000..539ab85
--- /dev/null
+++ b/ui4/linefeedcaldialog.py
@@ -0,0 +1,125 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.CalibrateButton, SIGNAL("clicked()"), self.CalibrateButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), 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/ui4/linefeedcaldialog_base.py b/ui4/linefeedcaldialog_base.py
new file mode 100644
index 0000000..75aacc7
--- /dev/null
+++ b/ui4/linefeedcaldialog_base.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/linefeedcaldialog_base.ui'
+#
+# Created: Mon May 4 14:30:33 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 3, 0, 1, 3)
+ spacerItem = QtGui.QSpacerItem(410, 81, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(361, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.CalibrateButton = QtGui.QPushButton(Dialog)
+ self.CalibrateButton.setObjectName("CalibrateButton")
+ self.gridlayout.addWidget(self.CalibrateButton, 5, 1, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Line Feed Calibration", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Line Feed Calibration", None, QtGui.QApplication.UnicodeUTF8))
+ self.CalibrateButton.setText(QtGui.QApplication.translate("Dialog", "Calibrate", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from loadpapergroupbox import LoadPaperGroupBox
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/linefeedcaldialog_base.ui b/ui4/linefeedcaldialog_base.ui
new file mode 100644
index 0000000..2d08020
--- /dev/null
+++ b/ui4/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/ui4/loadpapergroupbox.py b/ui4/loadpapergroupbox.py
new file mode 100644
index 0000000..11c96ae
--- /dev/null
+++ b/ui4/loadpapergroupbox.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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>%1</b> in the printer and then click <i>%2</i> to continue.").arg(paper_name).arg(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/ui4/makecopiesdialog.py b/ui4/makecopiesdialog.py
new file mode 100644
index 0000000..a8ca598
--- /dev/null
+++ b/ui4/makecopiesdialog.py
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.CopyButton, SIGNAL("clicked()"), self.CopyButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), 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/ui4/makecopiesdialog_base.py b/ui4/makecopiesdialog_base.py
new file mode 100644
index 0000000..0157c0c
--- /dev/null
+++ b/ui4/makecopiesdialog_base.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/makecopiesdialog_base.ui'
+#
+# Created: Mon May 4 14:30:34 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QSpacerItem(20, 341, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 3, 1, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(391, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 4, 0, 1, 2)
+ self.CopyButton = QtGui.QPushButton(Dialog)
+ self.CopyButton.setObjectName("CopyButton")
+ self.gridlayout.addWidget(self.CopyButton, 4, 2, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Make Copies", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Make Copies", None, QtGui.QApplication.UnicodeUTF8))
+ self.CopyButton.setText(QtGui.QApplication.translate("Dialog", "Make Copies", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/makecopiesdialog_base.ui b/ui4/makecopiesdialog_base.ui
new file mode 100644
index 0000000..15ccdd6
--- /dev/null
+++ b/ui4/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/ui4/mimetypesdialog.py b/ui4/mimetypesdialog.py
new file mode 100644
index 0000000..e7ce492
--- /dev/null
+++ b/ui4/mimetypesdialog.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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 = 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/ui4/mimetypesdialog_base.py b/ui4/mimetypesdialog_base.py
new file mode 100644
index 0000000..de1376c
--- /dev/null
+++ b/ui4/mimetypesdialog_base.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/mimetypesdialog_base.ui'
+#
+# Created: Mon May 4 14:30:34 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MimeTypesDialog_base(object):
+ def setupUi(self, MimeTypesDialog_base):
+ MimeTypesDialog_base.setObjectName("MimeTypesDialog_base")
+ MimeTypesDialog_base.resize(500, 540)
+ self.gridlayout = QtGui.QGridLayout(MimeTypesDialog_base)
+ self.gridlayout.setObjectName("gridlayout")
+ self.textLabel3_2 = QtGui.QLabel(MimeTypesDialog_base)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.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 = QtGui.QFrame(MimeTypesDialog_base)
+ self.line1_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line1_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line1_2.setObjectName("line1_2")
+ self.gridlayout.addWidget(self.line1_2, 1, 0, 1, 2)
+ self.TypesTableWidget = QtGui.QTableWidget(MimeTypesDialog_base)
+ self.TypesTableWidget.setAlternatingRowColors(True)
+ self.TypesTableWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
+ self.TypesTableWidget.setObjectName("TypesTableWidget")
+ self.TypesTableWidget.setColumnCount(3)
+ self.TypesTableWidget.setRowCount(0)
+ item = QtGui.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(0, item)
+ item = QtGui.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(1, item)
+ item = QtGui.QTableWidgetItem()
+ self.TypesTableWidget.setHorizontalHeaderItem(2, item)
+ self.gridlayout.addWidget(self.TypesTableWidget, 2, 0, 1, 2)
+ self.textLabel1 = QtGui.QLabel(MimeTypesDialog_base)
+ self.textLabel1.setWordWrap(True)
+ self.textLabel1.setObjectName("textLabel1")
+ self.gridlayout.addWidget(self.textLabel1, 3, 0, 1, 2)
+ spacerItem = QtGui.QSpacerItem(301, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ self.pushButton10 = QtGui.QPushButton(MimeTypesDialog_base)
+ self.pushButton10.setObjectName("pushButton10")
+ self.gridlayout.addWidget(self.pushButton10, 4, 1, 1, 1)
+
+ self.retranslateUi(MimeTypesDialog_base)
+ QtCore.QObject.connect(self.pushButton10, QtCore.SIGNAL("clicked()"), MimeTypesDialog_base.accept)
+ QtCore.QMetaObject.connectSlotsByName(MimeTypesDialog_base)
+
+ def retranslateUi(self, MimeTypesDialog_base):
+ MimeTypesDialog_base.setWindowTitle(QtGui.QApplication.translate("MimeTypesDialog_base", "HP Device Manager - MIME Types", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3_2.setText(QtGui.QApplication.translate("MimeTypesDialog_base", "<b>File/document types that can be added to the file list.</b>", None, QtGui.QApplication.UnicodeUTF8))
+ self.TypesTableWidget.horizontalHeaderItem(0).setText(QtGui.QApplication.translate("MimeTypesDialog_base", "MIME Type", None, QtGui.QApplication.UnicodeUTF8))
+ self.TypesTableWidget.horizontalHeaderItem(1).setText(QtGui.QApplication.translate("MimeTypesDialog_base", "Description", None, QtGui.QApplication.UnicodeUTF8))
+ self.TypesTableWidget.horizontalHeaderItem(2).setText(QtGui.QApplication.translate("MimeTypesDialog_base", "Usual File Extension(s)", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel1.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.pushButton10.setText(QtGui.QApplication.translate("MimeTypesDialog_base", "OK", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/mimetypesdialog_base.ui b/ui4/mimetypesdialog_base.ui
new file mode 100644
index 0000000..d1f4823
--- /dev/null
+++ b/ui4/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/ui4/nodevicesdialog.py b/ui4/nodevicesdialog.py
new file mode 100644
index 0000000..4114b9a
--- /dev/null
+++ b/ui4/nodevicesdialog.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.SetupButton, SIGNAL("clicked()"), self.SetupButton_clicked)
+ self.connect(self.CUPSButton, SIGNAL("clicked()"), self.CUPSButton_clicked)
+ self.connect(self.CloseButton, SIGNAL("clicked()"), 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, log_output=True, password_func=None, timeout=1)
+
+ 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/ui4/nodevicesdialog_base.py b/ui4/nodevicesdialog_base.py
new file mode 100644
index 0000000..2c3ff1f
--- /dev/null
+++ b/ui4/nodevicesdialog_base.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/nodevicesdialog_base.ui'
+#
+# Created: Mon May 4 14:30:34 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_NoDevicesDialog_base(object):
+ def setupUi(self, NoDevicesDialog_base):
+ NoDevicesDialog_base.setObjectName("NoDevicesDialog_base")
+ NoDevicesDialog_base.resize(539, 335)
+ self.gridlayout = QtGui.QGridLayout(NoDevicesDialog_base)
+ self.gridlayout.setObjectName("gridlayout")
+ self.Icon = QtGui.QLabel(NoDevicesDialog_base)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.Icon.sizePolicy().hasHeightForWidth())
+ self.Icon.setSizePolicy(sizePolicy)
+ self.Icon.setFrameShape(QtGui.QFrame.NoFrame)
+ self.Icon.setScaledContents(True)
+ self.Icon.setWordWrap(False)
+ self.Icon.setObjectName("Icon")
+ self.gridlayout.addWidget(self.Icon, 0, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(20, 280, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 1, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(20, 16, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem1, 2, 2, 1, 1)
+ self.textLabel7 = QtGui.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 = QtGui.QSpacerItem(400, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem2, 3, 0, 1, 2)
+ self.SetupButton = QtGui.QPushButton(NoDevicesDialog_base)
+ self.SetupButton.setObjectName("SetupButton")
+ self.gridlayout.addWidget(self.SetupButton, 3, 2, 1, 1)
+ self.CUPSButton = QtGui.QPushButton(NoDevicesDialog_base)
+ self.CUPSButton.setObjectName("CUPSButton")
+ self.gridlayout.addWidget(self.CUPSButton, 3, 3, 1, 1)
+ self.CloseButton = QtGui.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):
+ NoDevicesDialog_base.setWindowTitle(QtGui.QApplication.translate("NoDevicesDialog_base", "HP Device Manager - No Installed HP Devices Found", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel7.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetupButton.setText(QtGui.QApplication.translate("NoDevicesDialog_base", "Setup Device...", None, QtGui.QApplication.UnicodeUTF8))
+ self.CUPSButton.setText(QtGui.QApplication.translate("NoDevicesDialog_base", "CUPS Web Interface", None, QtGui.QApplication.UnicodeUTF8))
+ self.CloseButton.setText(QtGui.QApplication.translate("NoDevicesDialog_base", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/nodevicesdialog_base.ui b/ui4/nodevicesdialog_base.ui
new file mode 100644
index 0000000..b4d41e5
--- /dev/null
+++ b/ui4/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/ui4/plugindiagnose.py b/ui4/plugindiagnose.py
new file mode 100644
index 0000000..7dc2400
--- /dev/null
+++ b/ui4/plugindiagnose.py
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2011 Hewlett-Packard 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.core_install import CoreInstall
+from installer.core_install import PLUGIN_INSTALL_ERROR_NONE, \
+ PLUGIN_INSTALL_ERROR_PLUGIN_FILE_NOT_FOUND, \
+ PLUGIN_INSTALL_ERROR_DIGITAL_SIG_NOT_FOUND, \
+ PLUGIN_INSTALL_ERROR_DIGITAL_SIG_BAD, \
+ PLUGIN_INSTALL_ERROR_PLUGIN_FILE_CHECKSUM_ERROR, \
+ PLUGIN_INSTALL_ERROR_NO_NETWORK, \
+ PLUGIN_INSTALL_ERROR_DIRECTORY_ERROR, \
+ PLUGIN_INSTALL_ERROR_UNABLE_TO_RECV_KEYS
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# 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.core = CoreInstall()
+ self.core.set_plugin_version()
+ self.setupUi(self, upgrade)
+
+ self.user_settings = UserSettings()
+ self.user_settings.load()
+ self.user_settings.debug()
+
+ self.initUi()
+
+
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+
+ # Application icon
+ self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
+
+
+ def PathLineEdit_textChanged(self, t):
+ self.plugin_path = 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.core.check_for_plugin() != 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/ui4/plugindiagnose_base.py b/ui4/plugindiagnose_base.py
new file mode 100644
index 0000000..dc79780
--- /dev/null
+++ b/ui4/plugindiagnose_base.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/plugindialog_base.ui'
+#
+#** Created: Mon Nov 14 15:31:49 2011
+#** by: Qt User Interface Compiler version 4.7.0
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog, upgrade=False):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(500, 180)
+ self.upgradePlugin=upgrade
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtGui.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.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 = QtGui.QFrame(self.page)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QtGui.QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ spacerItem2 = QtGui.QSpacerItem(278, 51, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 4)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 2, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Plug-in Installer", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Driver Plug-in Required", None, QtGui.QApplication.UnicodeUTF8))
+ if self.upgradePlugin is False:
+ self.TitleLabel.setText(QtGui.QApplication.translate("Dialog", "HP Device proprietary plug-in is missing. Click 'Next' to continue plug-in installation.", None, QtGui.QApplication.UnicodeUTF8))
+ else:
+ self.TitleLabel.setText(QtGui.QApplication.translate("Dialog", "HP Device plug-in version mismatch or some files are corrupted.\nClick 'Next' to install required plug-in.", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/plugindiagnose_base.ui b/ui4/plugindiagnose_base.ui
new file mode 100644
index 0000000..b073c6a
--- /dev/null
+++ b/ui4/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/ui4/plugindialog.py b/ui4/plugindialog.py
new file mode 100644
index 0000000..d0f21ff
--- /dev/null
+++ b/ui4/plugindialog.py
@@ -0,0 +1,378 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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.core_install import CoreInstall
+from installer.core_install import PLUGIN_INSTALL_ERROR_NONE, \
+ PLUGIN_INSTALL_ERROR_PLUGIN_FILE_NOT_FOUND, \
+ PLUGIN_INSTALL_ERROR_DIGITAL_SIG_NOT_FOUND, \
+ PLUGIN_INSTALL_ERROR_DIGITAL_SIG_BAD, \
+ PLUGIN_INSTALL_ERROR_PLUGIN_FILE_CHECKSUM_ERROR, \
+ PLUGIN_INSTALL_ERROR_NO_NETWORK, \
+ PLUGIN_INSTALL_ERROR_DIRECTORY_ERROR, \
+ PLUGIN_INSTALL_ERROR_UNABLE_TO_RECV_KEYS
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# Ui
+from plugindialog_base import Ui_Dialog
+
+
+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 = None
+ self.result = False
+ self.core = CoreInstall()
+ self.core.set_plugin_version()
+ 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.core.check_for_plugin()
+
+
+ def initUi(self):
+ # connect signals/slots
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), 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 reason_text is not None:
+ if self.install_mode == PLUGIN_REQUIRED:
+ self.TitleLabel.setText(self.__tr("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). <br><br>%1").arg(reason_text))
+ self.SkipRadioButton.setEnabled(False)
+
+ elif self.install_mode == PLUGIN_OPTIONAL:
+ self.TitleLabel.setText(self.__tr("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).<br><br>%1").arg(reason_text))
+
+ self.connect(self.DownloadRadioButton, SIGNAL("toggled(bool)"), self.DownloadRadioButton_toggled)
+ self.connect(self.CopyRadioButton, SIGNAL("toggled(bool)"), self.CopyRadioButton_toggled)
+ self.connect(self.SkipRadioButton, SIGNAL("toggled(bool)"), self.SkipRadioButton_toggled)
+ self.connect(self.PathLineEdit, SIGNAL("textChanged(const QString &)"), self.PathLineEdit_textChanged)
+ self.connect(self.BrowseToolButton, SIGNAL("clicked()"), self.BrowseToolButton_clicked)
+
+ 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 = 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 = 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 '%1' file.").arg(self.core.plugin_name))
+ ok = False
+ elif os.path.basename(self.plugin_path) != self.core.plugin_name:
+ self.PathLineEdit.setToolTip(self.__tr("The plugin filename must be '%1'.").arg(self.core.plugin_name))
+ 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(QString(""))
+
+
+ def BrowseToolButton_clicked(self):
+ t = unicode(self.PathLineEdit.text())
+
+ if not os.path.exists(t):
+ path = unicode(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
+ 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 is None: # download
+ # read plugin.conf (local or on sf.net) to get plugin_path (http://)
+ plugin_conf_url = self.core.get_plugin_conf_url()
+
+ if plugin_conf_url.startswith('file://'):
+ pass
+ else:
+ log.info("Checking for network connection...")
+ ok = self.core.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 configuration file from: %s" % plugin_conf_url)
+ self.plugin_path, size, checksum, timestamp, ok = self.core.get_plugin_info(plugin_conf_url,
+ self.plugin_download_callback)
+
+ log.debug("path=%s, size=%d, checksum=%s, timestamp=%f, ok=%s" %
+ (self.plugin_path, size, checksum, timestamp, ok))
+
+ if not self.plugin_path.startswith('http://') and not self.plugin_path.startswith('file://'):
+ self.plugin_path = 'file://' + self.plugin_path
+
+ else: # path
+ if not self.plugin_path.startswith('http://'):
+ self.plugin_path = 'file://' + self.plugin_path
+
+ size, checksum, timestamp = 0, '', 0
+
+ if self.plugin_path.startswith('file://'):
+ pass
+ else:
+ log.info("Checking for network connection...")
+ ok = self.core.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, ret = self.core.download_plugin(self.plugin_path, size, checksum, timestamp,
+ self.plugin_download_callback)
+
+ if status in (PLUGIN_INSTALL_ERROR_UNABLE_TO_RECV_KEYS, PLUGIN_INSTALL_ERROR_DIGITAL_SIG_NOT_FOUND):
+ endWaitCursor()
+ if QMessageBox.question(self, self.__tr("Digital signature download failed"),
+ self.__tr("<b>The download of the digital signature file failed.</b><p>Without this file, it is not possible to authenticate and validate the plug-in prior to installation.</p>Do you still want to install the plug-in?"),
+ QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes:
+
+ self.core.delete_plugin()
+ self.close()
+ return
+
+ elif status != PLUGIN_INSTALL_ERROR_NONE:
+
+ if status == PLUGIN_INSTALL_ERROR_PLUGIN_FILE_NOT_FOUND:
+ desc = self.__tr("<b>ERROR: Plug-in file not found (server returned 404 or similar error).</b><p>Error code: %1</p>").arg(str(ret))
+
+ elif status == PLUGIN_INSTALL_ERROR_DIGITAL_SIG_BAD:
+ desc = self.__tr("<b>ERROR: Plug-in file does not match its digital signature.</b><p>File may have been corrupted or altered.</p><p>Error code: %1</p>").arg(str(ret))
+
+ elif status == PLUGIN_INSTALL_ERROR_PLUGIN_FILE_CHECKSUM_ERROR:
+ desc = self.__tr("<b>ERROR: Plug-in file does not match its checksum. File may have been corrupted or altered.")
+
+ elif status == PLUGIN_INSTALL_ERROR_NO_NETWORK:
+ desc = self.__tr("<b>ERROR: Unable to connect to network to download the plug-in.</b><p>Please check your network connection and try again.</p>")
+
+ elif status == PLUGIN_INSTALL_ERROR_DIRECTORY_ERROR:
+ desc = self.__tr("<b>ERROR: Unable to create the plug-in directory.</b><p>Please check your permissions and try again.</p>")
+
+ self.core.delete_plugin()
+ endWaitCursor()
+ FailureUI(self, desc)
+ self.close()
+ return
+
+ if not self.core.run_plugin(GUI_MODE, self.plugin_install_callback):
+ self.core.delete_plugin()
+ 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>%1</p>").arg(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>%1</p>").arg(dev))
+
+ finally:
+ if d is not None:
+ d.close()
+ finally:
+ endWaitCursor()
+
+ self.core.delete_plugin()
+ 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 %1 of %2").arg(p+1).arg(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/ui4/plugindialog_base.py b/ui4/plugindialog_base.py
new file mode 100644
index 0000000..b93061c
--- /dev/null
+++ b/ui4/plugindialog_base.py
@@ -0,0 +1,117 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/plugindialog_base.ui'
+#
+# Created: Mon May 4 14:30:34 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtGui.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.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 = QtGui.QFrame(self.page)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QtGui.QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem, 3, 0, 1, 1)
+ self.groupBox = QtGui.QGroupBox(self.page)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.DownloadRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.DownloadRadioButton.setChecked(True)
+ self.DownloadRadioButton.setObjectName("DownloadRadioButton")
+ self.gridlayout2.addWidget(self.DownloadRadioButton, 0, 0, 1, 2)
+ self.CopyRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.CopyRadioButton.setEnabled(True)
+ self.CopyRadioButton.setObjectName("CopyRadioButton")
+ self.gridlayout2.addWidget(self.CopyRadioButton, 1, 0, 1, 2)
+ spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem1, 2, 0, 1, 1)
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.PathLineEdit = QtGui.QLineEdit(self.groupBox)
+ self.PathLineEdit.setEnabled(False)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.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 = QtGui.QToolButton(self.groupBox)
+ self.BrowseToolButton.setEnabled(False)
+ self.BrowseToolButton.setObjectName("BrowseToolButton")
+ self.hboxlayout.addWidget(self.BrowseToolButton)
+ self.gridlayout2.addLayout(self.hboxlayout, 2, 1, 1, 1)
+ self.SkipRadioButton = QtGui.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 = QtGui.QSpacerItem(278, 51, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 5)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem3 = QtGui.QSpacerItem(161, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem3, 2, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setEnabled(False)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Plug-in Installer", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Driver Plug-in Installation", None, QtGui.QApplication.UnicodeUTF8))
+ self.TitleLabel.setText(QtGui.QApplication.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.", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Plug-in Installation Choice", None, QtGui.QApplication.UnicodeUTF8))
+ self.DownloadRadioButton.setText(QtGui.QApplication.translate("Dialog", "Download and install the plug-in from an HP authorized server (recommended)", None, QtGui.QApplication.UnicodeUTF8))
+ self.CopyRadioButton.setText(QtGui.QApplication.translate("Dialog", "Select and install an existing local copy of the plug-in file (advanced):", None, QtGui.QApplication.UnicodeUTF8))
+ self.BrowseToolButton.setToolTip(QtGui.QApplication.translate("Dialog", "Open a local copy of the plug-in file", None, QtGui.QApplication.UnicodeUTF8))
+ self.SkipRadioButton.setText(QtGui.QApplication.translate("Dialog", "Skip installation of the plug-in (not recommended)", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %d of %d", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/plugindialog_base.ui b/ui4/plugindialog_base.ui
new file mode 100644
index 0000000..a7cc8f1
--- /dev/null
+++ b/ui4/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/ui4/pluginlicensedialog.py b/ui4/pluginlicensedialog.py
new file mode 100644
index 0000000..8cb5dc0
--- /dev/null
+++ b/ui4/pluginlicensedialog.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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/ui4/pluginlicensedialog_base.py b/ui4/pluginlicensedialog_base.py
new file mode 100644
index 0000000..a7ffef6
--- /dev/null
+++ b/ui4/pluginlicensedialog_base.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/pluginlicensedialog_base.ui'
+#
+# Created: Mon May 4 14:30:35 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtGui.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.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 = QtGui.QFrame(self.page)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 1)
+ self.label_2 = QtGui.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 = QtGui.QTextEdit(self.page)
+ self.LicenseTextEdit.setAutoFormatting(QtGui.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 = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 5)
+ spacerItem = QtGui.QSpacerItem(161, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 2, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setEnabled(False)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setEnabled(False)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtGui.QPushButton(Dialog)
+ self.CancelButton.setObjectName("CancelButton")
+ self.gridlayout.addWidget(self.CancelButton, 2, 4, 1, 1)
+
+ self.retranslateUi(Dialog)
+ self.StackedWidget.setCurrentIndex(0)
+ QtCore.QObject.connect(self.AgreeCheckBox, QtCore.SIGNAL("toggled(bool)"), self.NextButton.setEnabled)
+ QtCore.QObject.connect(self.NextButton, QtCore.SIGNAL("clicked()"), Dialog.accept)
+ QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), Dialog.reject)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Plug-in Installer", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Driver Plug-in License Agreement", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.AgreeCheckBox.setText(QtGui.QApplication.translate("Dialog", "I agree to the terms of the driver plug-in license agreement", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/pluginlicensedialog_base.ui b/ui4/pluginlicensedialog_base.ui
new file mode 100644
index 0000000..0807b8d
--- /dev/null
+++ b/ui4/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/ui4/pqdiagdialog.py b/ui4/pqdiagdialog.py
new file mode 100644
index 0000000..69079ae
--- /dev/null
+++ b/ui4/pqdiagdialog.py
@@ -0,0 +1,124 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.RunButton, SIGNAL("clicked()"), self.RunButton_clicked)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
+ self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), 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/ui4/pqdiagdialog_base.py b/ui4/pqdiagdialog_base.py
new file mode 100644
index 0000000..425c7ee
--- /dev/null
+++ b/ui4/pqdiagdialog_base.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/pqdiagdialog_base.ui'
+#
+# Created: Mon May 4 14:30:35 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 3, 0, 1, 3)
+ spacerItem = QtGui.QSpacerItem(410, 81, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(361, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 5, 0, 1, 1)
+ self.RunButton = QtGui.QPushButton(Dialog)
+ self.RunButton.setObjectName("RunButton")
+ self.gridlayout.addWidget(self.RunButton, 5, 1, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Print Quality Diagnostics", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Print Quality Diagnostics", None, QtGui.QApplication.UnicodeUTF8))
+ self.RunButton.setText(QtGui.QApplication.translate("Dialog", "Run", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from loadpapergroupbox import LoadPaperGroupBox
+from deviceuricombobox import DeviceUriComboBox
diff --git a/ui4/pqdiagdialog_base.ui b/ui4/pqdiagdialog_base.ui
new file mode 100644
index 0000000..398189a
--- /dev/null
+++ b/ui4/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/ui4/printdialog.py b/ui4/printdialog.py
new file mode 100644
index 0000000..be5ad37
--- /dev/null
+++ b/ui4/printdialog.py
@@ -0,0 +1,352 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# Ui
+from printdialog_base import Ui_Dialog
+from filetable import FileTable, FILETABLE_TYPE_PRINT
+from printernamecombobox import PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY
+
+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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.BackButton, SIGNAL("clicked()"), self.BackButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+
+ 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.connect(self.Files, SIGNAL("isEmpty"), self.Files_isEmpty)
+ self.connect(self.Files, SIGNAL("isNotEmpty"), 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.connect(self.PrinterName, SIGNAL("PrinterNameComboBox_currentChanged"),
+ self.PrinterNameComboBox_currentChanged)
+
+ self.connect(self.PrinterName, SIGNAL("PrinterNameComboBox_noPrinters"),
+ 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 %1 Files").arg(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, log_output=True, password_func=None, timeout=1)
+ if status != 0:
+ FailureUI(self, self.__tr("<b>Print command failed with status code %1.</b><p>%2</p>").arg(status).arg(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 %1 of %2").arg(p+1).arg(PAGE_MAX+1))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrintDialog",s,c)
+
+
+
+"""
+ def printButton_clicked(self):
+ if self.invalid_page_range:
+ self.form.FailureUI(self.__tr("<b>Cannot print: Invalid page range: %1</b><p>A valid page range is a list of pages or ranges of pages separated by commas (e.g., 1-2,4,6-7)").arg(self.pageRangeEdit.text()))
+ return
+
+ try:
+ try:
+ self.cur_device.open()
+ except Error:
+ self.form.FailureUI(self.__tr("<b>Cannot print: Device is busy or not available.</b><p>Please check device and try again."))
+ return
+
+ if 1: # Go ahead and allow - print will be queued in CUPS if not rejecting
+ printers = cups.getPrinters()
+ for p in printers:
+ if p.name == self.cur_printer:
+ break
+
+ if p.state == cups.IPP_PRINTER_STATE_STOPPED:
+ self.form.FailureUI(self.__tr("<b>Cannot print: Printer is stopped.</b><p>Please START the printer to continue this print. Job will begin printing once printer is started."))
+
+ if not p.accepting:
+ self.form.FailureUI(self.__tr("<b>Cannot print: Printer is not accepting jobs.</b><p>Please set the printer to ACCEPTING JOBS to continue printing."))
+ return
+
+ copies = int(self.copiesSpinBox.value())
+ all_pages = self.pages_button_group == 0
+ page_range = unicode(self.pageRangeEdit.text())
+ page_set = int(self.pageSetComboBox.currentItem())
+
+ cups.resetOptions()
+ cups.openPPD(self.cur_printer)
+ current_options = dict(cups.getOptions())
+ cups.closePPD()
+
+ nup = int(current_options.get("number-up", 1))
+
+ for p, t, d in self.file_list:
+
+ alt_nup = (nup > 1 and t == 'application/postscript' and utils.which('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:
+ 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 len(page_range) > 0:
+ cmd = ' '.join([cmd, '-o page-ranges=%s' % page_range])
+
+ if page_set > 0:
+ if page_set == 1:
+ cmd = ' '.join([cmd, '-o page-set=even'])
+ else:
+ cmd = ' '.join([cmd, '-o page-set=odd'])
+
+
+ # 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_avail:
+ if self.job_storage_mode: # On
+
+ if self.job_storage_mode == 1: # Proof and Hold
+ cmd = ' '.join([cmd, '-o HOLD=PROOF'])
+
+ elif self.job_storage_mode == 2: # Private Job
+ 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 == 3: # Quick Copy
+ cmd = ' '.join([cmd, '-o HOLD=ON'])
+ cmd = ' '.join([cmd, '-o HOLDTYPE=PUBLIC'])
+
+ elif self.job_storage_mode == 4: # Store Job
+ 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, '"'])
+
+ log.debug("Printing: %s" % cmd)
+
+ code = os.system(cmd)
+ if code != 0:
+ log.error("Print command failed.")
+ self.form.FailureUI(self.__tr("Print command failed with error code %1").arg(code))
+
+ self.form.close()
+
+ finally:
+ self.cur_device.close()
+
+"""
diff --git a/ui4/printdialog_base.py b/ui4/printdialog_base.py
new file mode 100644
index 0000000..bb815b0
--- /dev/null
+++ b/ui4/printdialog_base.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/printdialog_base.ui'
+#
+# Created: Mon May 4 14:30:35 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtGui.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_2 = QtGui.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 = QtGui.QFrame(self.page)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 1)
+ self.Files = FileTable(self.page)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout2 = QtGui.QGridLayout(self.page_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_3 = QtGui.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 = QtGui.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.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 = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout.addWidget(self.line_3, 1, 0, 1, 5)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(251, 28, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 2, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Print", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("Dialog", "Select Files to Print", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("Dialog", "Select Printer and Options", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from printsettingstoolbox import PrintSettingsToolbox
+from printernamecombobox import PrinterNameComboBox
+from filetable import FileTable
diff --git a/ui4/printdialog_base.ui b/ui4/printdialog_base.ui
new file mode 100644
index 0000000..2d1aab6
--- /dev/null
+++ b/ui4/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/ui4/printernamecombobox.py b/ui4/printernamecombobox.py
new file mode 100644
index 0000000..f8478c4
--- /dev/null
+++ b/ui4/printernamecombobox.py
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+
+PRINTERNAMECOMBOBOX_TYPE_PRINTER_ONLY = 0
+PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY = 1
+PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX = 2
+
+
+class PrinterNameComboBox(QWidget):
+ 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)
+
+ 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 p.name == self.initial_printer:
+ self.initial_printer = None
+ k = i
+
+ self.ComboBox.setCurrentIndex(-1)
+
+ finally:
+ self.updating = False
+
+ self.ComboBox.setCurrentIndex(k)
+ else:
+ self.emit(SIGNAL("PrinterNameComboBox_noPrinters"))
+
+
+ def ComboBox_currentIndexChanged(self, t):
+ self.printer_name = 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)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PrinterNameComboBox",s,c)
diff --git a/ui4/printsettingsdialog.py b/ui4/printsettingsdialog.py
new file mode 100644
index 0000000..baaa013
--- /dev/null
+++ b/ui4/printsettingsdialog.py
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# Ui
+from printsettingsdialog_base import Ui_Dialog
+from printsettingstoolbox import PrintSettingsToolbox
+from printernamecombobox import PRINTERNAMECOMBOBOX_TYPE_PRINTER_AND_FAX, PRINTERNAMECOMBOBOX_TYPE_FAX_ONLY
+
+
+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.connect(self.CloseButton, SIGNAL("clicked()"), self.CloseButton_clicked)
+
+ self.connect(self.PrinterName, SIGNAL("PrinterNameComboBox_currentChanged"),
+ self.PrinterNameComboBox_currentChanged)
+
+ self.connect(self.PrinterName, SIGNAL("PrinterNameComboBox_noPrinters"),
+ self.PrinterNameComboBox_noPrinters)
+
+ # 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/ui4/printsettingsdialog_base.py b/ui4/printsettingsdialog_base.py
new file mode 100644
index 0000000..bad8f8e
--- /dev/null
+++ b/ui4/printsettingsdialog_base.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/printsettingsdialog_base.ui'
+#
+# Created: Mon May 4 14:30:36 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.TitleLabel = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.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 = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QSpacerItem(461, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem, 4, 0, 1, 1)
+ self.CloseButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Print Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.TitleLabel.setText(QtGui.QApplication.translate("Dialog", "Print Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.CloseButton.setText(QtGui.QApplication.translate("Dialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
+
+from printsettingstoolbox import PrintSettingsToolbox
+from printernamecombobox import PrinterNameComboBox
diff --git a/ui4/printsettingsdialog_base.ui b/ui4/printsettingsdialog_base.ui
new file mode 100644
index 0000000..2ea3e0e
--- /dev/null
+++ b/ui4/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/ui4/printsettingstoolbox.py b/ui4/printsettingstoolbox.py
new file mode 100644
index 0000000..075fb02
--- /dev/null
+++ b/ui4/printsettingstoolbox.py
@@ -0,0 +1,2013 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+
+
+class RangeValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in unicode(input)[pos-1:]:
+ if x not in u'0123456789,- ':
+ return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, pos
+
+
+
+class PinValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in unicode(input)[pos-1:]:
+ if x not in u'0123456789':
+ return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, pos
+
+
+
+class UsernameAndJobnameValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent) #, name)
+
+
+ def validate(self, input, pos):
+ for x in unicode(input)[pos-1:]:
+ if x in u' /=,.:;\'"[]{}-+!@#$%^&*()':
+ return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, 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.connect(self, SIGNAL("currentChanged(int)"), 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 (Print last page first)"),
+ 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)
+
+ 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()
+
+ try:
+ text = text.decode('utf-8')
+ except UnicodeDecodeError:
+ pass
+
+ if g.lower() == 'printoutmode':
+ text = self.__tr("Quality (also see 'Printout Mode' under 'General')")
+
+ self.beginControlGroup(g, QString(text))
+
+ log.debug(" Text: %s" % unicode(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
+
+ try:
+ option_text = option_text.decode('utf-8')
+ except UnicodeDecodeError:
+ pass
+
+ 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)
+
+ try:
+ choice_text = choice_text.decode('utf-8')
+ except UnicodeDecodeError:
+ pass
+
+ 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" % unicode (cur_outputmode_dpi))
+ self.beginControlGroup("sumry", self.__tr("Summary"))
+ self.addControlRow("colorinput", self.__tr('Color Input / Black Render'),
+ cups.UI_INFO, 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 = self.cur_device.mq.get('job-storage', JOB_STORAGE_DISABLE) == JOB_STORAGE_ENABLE
+
+
+ if self.job_storage_enable:
+ self.job_storage_pin = unicode(current_options.get('HOLDKEY', '0000')[:4])
+ self.job_storage_username = unicode(current_options.get('USERNAME', prop.username)[:16])
+ self.job_storage_jobname = unicode(current_options.get('JOBNAME', u'Untitled')[:16])
+ hold = unicode(current_options.get('HOLD', u'OFF'))
+ holdtype = unicode(current_options.get('HOLDTYPE', u'PUBLIC'))
+ self.job_storage_use_pin = False
+ duplicate = unicode(current_options.get('DUPLICATEJOB', u'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 == u'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 == u'PROOF':
+ if holdtype == u'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 == u'STORE':
+ self.job_storage_mode = JOB_STORAGE_TYPE_STORE
+ self.job_storage_use_pin = (holdtype == u'PRIVATE')
+
+ if duplicate == u'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")
+
+ if value == default:
+ DefaultButton.setEnabled(False)
+ self.connect(DefaultButton, SIGNAL("clicked()"), self.DefaultButton_clicked)
+
+ if value:
+ OnRadioButton.setChecked(True)
+ else:
+ OffRadioButton.setChecked(True)
+ self.connect(OnRadioButton, SIGNAL("toggled(bool)"), 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))
+#
+
+ self.connect(DefaultButton, SIGNAL("clicked()"), self.DefaultButton_clicked)
+ self.connect(ComboBox, SIGNAL("currentIndexChanged(const QString &)"), self.ComboBox_indexChanged)
+ self.connect(ComboBox, SIGNAL("highlighted(const QString &)"), 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")
+
+ self.connect(SpinBox, SIGNAL("valueChanged(int)"), self.SpinBox_valueChanged)
+ self.connect(DefaultButton, SIGNAL("clicked()"), 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)
+
+ self.connect(StartComboBox, SIGNAL("activated(const QString&)"), self.BannerComboBox_activated)
+ self.connect(EndComboBox, SIGNAL("activated(const QString&)"), self.BannerComboBox_activated)
+ self.connect(DefaultButton, SIGNAL("clicked()"), 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
+
+ self.connect(AllRadioButton, SIGNAL("toggled(bool)"), self.PageRangeAllRadio_toggled)
+ self.connect(RangeRadioButton, SIGNAL("toggled(bool)"), self.PageRangeRangeRadio_toggled)
+ self.connect(DefaultButton, SIGNAL("clicked()"), self.DefaultButton_clicked)
+ self.connect(PageRangeEdit, SIGNAL("textChanged(const QString &)"), self.PageRangeEdit_textChanged)
+ self.connect(PageRangeEdit, SIGNAL("editingFinished()"), 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"), QVariant(JOB_STORAGE_TYPE_OFF))
+ self.JobStorageModeComboBox.addItem(self.__tr("Proof and Hold"), QVariant(JOB_STORAGE_TYPE_PROOF_AND_HOLD))
+ self.JobStorageModeComboBox.addItem(self.__tr("Personal/Private Job"), QVariant(JOB_STORAGE_TYPE_PERSONAL))
+ self.JobStorageModeComboBox.addItem(self.__tr("Quick Copy"), QVariant(JOB_STORAGE_TYPE_QUICK_COPY))
+ self.JobStorageModeComboBox.addItem(self.__tr("Stored Job"), QVariant(JOB_STORAGE_TYPE_STORE))
+
+ self.connect(self.JobStorageModeComboBox, SIGNAL("activated(int)"),
+ self.JobStorageModeComboBox_activated)
+
+ self.connect(self.JobStorageModeDefaultButton, SIGNAL("clicked()"),
+ 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.connect(self.JobStoragePinOffRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStoragePinOffRadioButton_toggled)
+
+ self.connect(self.JobStoragePinPrivateRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStoragePinPrivateRadioButton_toggled)
+
+ self.connect(self.JobStoragePinDefaultButton, SIGNAL("clicked()"),
+ self.JobStoragePinDefaultButton_clicked)
+
+ self.connect(self.JobStoragePinEdit, SIGNAL("textEdited(const QString &)"),
+ 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.connect(self.JobStorageUsernameAutoRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStorageUsernameAutoRadioButton_toggled)
+
+ self.connect(self.JobStorageUsernameCustomRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStorageUsernameCustomRadioButton_toggled)
+
+ self.connect(self.JobStorageUsernameDefaultButton, SIGNAL("clicked()"),
+ self.JobStorageUsernameDefaultButton_clicked)
+
+ self.connect(self.JobStorageUsernameEdit, SIGNAL("textEdited(const QString &)"),
+ 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.connect(self.JobStorageIDAutoRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStorageIDAutoRadioButton_toggled)
+
+ self.connect(self.JobStorageIDCustomRadioButton, SIGNAL("toggled(bool)"),
+ self.JobStorageIDCustomRadioButton_toggled)
+
+ self.connect(self.JobStorageIDDefaultButton, SIGNAL("clicked()"),
+ self.JobStorageIDDefaultButton_clicked)
+
+ self.connect(self.JobStorageIDEdit, SIGNAL("textEdited(const QString &)"),
+ 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"),
+ QVariant(JOB_STORAGE_EXISTING_JOB_REPLACE))
+
+ self.JobStorageExistingComboBox.addItem(self.__tr("Use job name appended with 1-99"),
+ QVariant(JOB_STORAGE_EXISTING_JOB_APPEND_1_99))
+
+ self.JobStorageExistingDefaultButton.setText(self.__tr("Default"))
+
+ self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
+
+ self.connect(self.JobStorageExistingComboBox, SIGNAL("activated(int)"),
+ self.JobStorageExistingComboBox_activated)
+
+ self.connect(self.JobStorageExistingDefaultButton, SIGNAL("clicked()"),
+ 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 = 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 = 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 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 = 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:
+ 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'] = unicode(sender.edit_control.text())
+
+
+ def PageRangeEdit_editingFinished(self):
+ sender = self.sender()
+ t, ok, x = self.job_options['pagerange'], True, []
+
+ #[Sanjay]Start Range Validation here as the editing is finished
+ try:
+ x = utils.expand_range(t)
+ except ValueError:
+ ok = False
+
+ if t == '':
+ ok = False
+
+ if ok:
+ if 0 in x:
+ ok = False
+
+ if ok:
+ for y in x:
+ if 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'] = unicode(t) # Do range validation only in PageRangeEdit_editingFinished method
+
+ #
+ # Job Storage
+ #
+
+ def updateJobStorageControls(self):
+ beginWaitCursor()
+ try:
+ # Mode
+ self.JobStorageModeComboBox.setCurrentIndex(self.JobStorageModeComboBox.findData(QVariant(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(QVariant(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(QString())
+
+ # 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(QString(self.job_storage_pin))
+ else:
+ self.JobStoragePinGroupBox.setEnabled(False)
+ self.JobStoragePinEdit.setEnabled(False)
+ self.JobStoragePinDefaultButton.setEnabled(False)
+ self.JobStoragePinEdit.setText(QString())
+
+ # 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(QString(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(QString(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 = sender.itemData(i).toInt()
+ 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 = 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 = 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 = 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 = sender.itemData(i).toInt()
+ 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/ui4/printtestpagedialog.py b/ui4/printtestpagedialog.py
new file mode 100644
index 0000000..890115b
--- /dev/null
+++ b/ui4/printtestpagedialog.py
@@ -0,0 +1,157 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+# 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.PrintTestpageButton, SIGNAL("clicked()"), self.PrintTestpageButton_clicked)
+
+ self.connect(self.PrinterNameCombo, SIGNAL("PrinterNameComboBox_currentChanged"),
+ self.PrinterNameCombo_currentChanged)
+
+ self.connect(self.PrinterNameCombo, SIGNAL("PrinterNameComboBox_noPrinters"),
+ self.PrinterNameComboBox_noPrinters)
+
+ 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, 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 %1.</b><p>Please check the printer and try again.").arg(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, 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 %1.</b><p>Please check the printer and try again.").arg(self.printer_name))
+
+ d.close()
+
+
+ def __tr(self, s, c=None):
+ return qApp.translate("PrintTestPageDialog", s, c)
+
+
diff --git a/ui4/printtestpagedialog_base.py b/ui4/printtestpagedialog_base.py
new file mode 100644
index 0000000..04840bf
--- /dev/null
+++ b/ui4/printtestpagedialog_base.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/printtestpagedialog_base.ui'
+#
+# Created: Mon May 4 14:30:36 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.label = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout.addWidget(self.line, 1, 0, 1, 4)
+ self.PrinterNameCombo = PrinterNameComboBox(Dialog)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QGroupBox(Dialog)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout1 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.HPLIPTestPageRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.HPLIPTestPageRadioButton.setObjectName("HPLIPTestPageRadioButton")
+ self.gridlayout1.addWidget(self.HPLIPTestPageRadioButton, 0, 0, 1, 1)
+ self.PrinterDiagnosticRadioButto = QtGui.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.setObjectName("LoadPaper")
+ self.gridlayout.addWidget(self.LoadPaper, 4, 0, 1, 4)
+ spacerItem = QtGui.QSpacerItem(189, 61, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.MinimumExpanding)
+ self.gridlayout.addItem(spacerItem, 5, 1, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(400, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem1, 6, 0, 1, 2)
+ self.PrintTestpageButton = QtGui.QPushButton(Dialog)
+ self.PrintTestpageButton.setObjectName("PrintTestpageButton")
+ self.gridlayout.addWidget(self.PrintTestpageButton, 6, 2, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Print Test Page", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Print Test Page", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Type", None, QtGui.QApplication.UnicodeUTF8))
+ self.HPLIPTestPageRadioButton.setText(QtGui.QApplication.translate("Dialog", "HPLIP test page (tests print driver)", None, QtGui.QApplication.UnicodeUTF8))
+ self.PrinterDiagnosticRadioButto.setText(QtGui.QApplication.translate("Dialog", "Printer diagnostic page (does not test print driver)", None, QtGui.QApplication.UnicodeUTF8))
+ self.PrintTestpageButton.setText(QtGui.QApplication.translate("Dialog", "Print Test Page", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from printernamecombobox import PrinterNameComboBox
+from loadpapergroupbox import LoadPaperGroupBox
diff --git a/ui4/printtestpagedialog_base.ui b/ui4/printtestpagedialog_base.ui
new file mode 100644
index 0000000..d21cfe2
--- /dev/null
+++ b/ui4/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/ui4/queuesconf.py b/ui4/queuesconf.py
new file mode 100644
index 0000000..c527b67
--- /dev/null
+++ b/ui4/queuesconf.py
@@ -0,0 +1,181 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2011-2014 Hewlett-Packard 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 sys
+
+# Local
+from base.g import *
+from base import utils
+from prnt import cups
+from base.codes import *
+from ui_utils import *
+
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+from PyQt4 import QtCore, QtGui
+
+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 = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout1 = QtGui.QGridLayout(self.page)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.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 = QtGui.QFrame(self.page)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.TitleLabel = QtGui.QLabel(self.page)
+ self.TitleLabel.setWordWrap(True)
+ self.TitleLabel.setObjectName("TitleLabel")
+ self.gridlayout1.addWidget(self.TitleLabel, 2, 0, 1, 2)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ spacerItem2 = QtGui.QSpacerItem(200, 51, QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout.addWidget(self.line_2, 1, 0, 1, 4)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Queues diagnose", None, QtGui.QApplication.UnicodeUTF8))
+ if self.Error_msg == QUEUES_PAUSED:
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Print/Fax Queue is Paused", None, QtGui.QApplication.UnicodeUTF8))
+ else:
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Queue needs to be reconfigured", None, QtGui.QApplication.UnicodeUTF8))
+
+ if 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 'Next' to remove and reconfigure queue."
+
+ if self.Error_msg != QUEUES_MSG_SENDING:
+ self.TitleLabel.setText(QtGui.QApplication.translate("Dialog", text, None, QtGui.QApplication.UnicodeUTF8))
+ if self.Error_msg == QUEUES_PAUSED or self.Error_msg == QUEUES_INCORRECT_PPD:
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Yes", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "No", None, QtGui.QApplication.UnicodeUTF8))
+ else:
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+
+# Ui
+
+class QueuesDiagnose(QDialog, Ui_Dialog):
+ def __init__(self, parent, printerName, device_uri, Error_msg):
+ QDialog.__init__(self, parent)
+ self.result = False
+ 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+
+ # 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):
+ try:
+ if self.Error_msg != QUEUES_PAUSED:
+ cups.delPrinter(self.printerName)
+ 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')
+
+ else:
+ cups.enablePrinter(self.printerName)
+ msg ="'"+self.printerName+"' is enabled successfully"
+ SuccessUI(self, self.__tr(msg))
+
+ 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)
+
diff --git a/ui4/readonlyradiobutton.py b/ui4/readonlyradiobutton.py
new file mode 100644
index 0000000..66f058f
--- /dev/null
+++ b/ui4/readonlyradiobutton.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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/ui4/sendfaxdialog.py b/ui4/sendfaxdialog.py
new file mode 100644
index 0000000..948076f
--- /dev/null
+++ b/ui4/sendfaxdialog.py
@@ -0,0 +1,1050 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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
+import Queue
+
+# 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 PyQt4.QtCore import *
+from PyQt4.QtGui 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 = reportlab.Version
+ try:
+ ver_f = float(ver)
+ except ValueError:
+ ver_f = 0.0
+
+ if ver_f >= 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.BackButton, SIGNAL("clicked()"), self.BackButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+
+ 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.connect(self.CheckTimer, SIGNAL("timeout()"), 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.connect(self.FaxComboBox, SIGNAL("PrinterNameComboBox_currentChanged"), self.FaxComboBox_currentChanged)
+ self.connect(self.FaxComboBox, SIGNAL("PrinterNameComboBox_noPrinters"), self.FaxComboBox_noPrinters)
+ self.connect(self.FaxOptionsButton, SIGNAL("clicked()"), self.FaxOptionsButton_clicked)
+ self.connect(self.FaxSetupButton, SIGNAL("clicked()"), 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 = 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.connect(self.PrevCoverPageButton, SIGNAL("clicked()"), self.PrevCoverPageButton_clicked)
+ self.connect(self.NextCoverPageButton, SIGNAL("clicked()"), self.NextCoverPageButton_clicked)
+ self.connect(self.CoverPageGroupBox, SIGNAL("toggled(bool)"), self.CoverPageGroupBox_toggled)
+ self.connect(self.MessageEdit, SIGNAL("textChanged()"), self.MessageEdit_textChanged)
+ self.connect(self.RegardingEdit, SIGNAL("textChanged(const QString &)"), self.RegardingEdit_textChanged)
+ self.connect(self.PreserveFormattingCheckBox, SIGNAL("toggled(bool)"),
+ 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 = unicode(self.MessageEdit.toPlainText())
+
+
+ def RegardingEdit_textChanged(self, t):
+ self.cover_page_re = 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):
+ 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(QString('<i>"%1"</i>').arg(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: "%1"').arg(self.cover_page_name),
+ self.__tr("Cover Page"), 1)
+
+
+ def removeCoverPage(self):
+ self.FilesTable.removeFileByMIMEType(MIME_TYPE_COVERPAGE)
+
+
+ def toggleCoverPage(self, b):
+ self.disconnect(self.CoverPageGroupBox, SIGNAL("toggled(bool)"), self.CoverPageGroupBox_toggled)
+ self.CoverPageGroupBox.setChecked(b)
+ self.connect(self.CoverPageGroupBox, SIGNAL("toggled(bool)"), self.CoverPageGroupBox_toggled)
+
+
+ #
+ # Files Page
+ #
+
+ def initFilesPage(self):
+ self.FilesTable.setType(FILETABLE_TYPE_FAX)
+ self.FilesTable.setFaxCallback(self.FileTable_callback)
+ self.connect(self.FilesTable, SIGNAL("isEmpty"), self.FilesTable_isEmpty)
+ self.connect(self.FilesTable, SIGNAL("isNotEmpty"), self.FilesTable_isNotEmpty)
+ self.connect(self.FilesTable, SIGNAL("fileListChanged"), 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 '%1' fax printer.").arg(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.connect(self.fab, SIGNAL("databaseChanged"), self.FABWindow_databaseChanged)
+
+ # connect signals
+ self.connect(self.QuickAddFaxEdit, SIGNAL("textChanged(const QString &)"),
+ self.QuickAddFaxEdit_textChanged)
+ self.connect(self.QuickAddNameEdit, SIGNAL("textChanged(const QString &)"),
+ self.QuickAddNameEdit_textChanged)
+ self.connect(self.QuickAddButton, SIGNAL("clicked()"), self.QuickAddButton_clicked)
+ self.connect(self.FABButton, SIGNAL("clicked()"), self.FABButton_clicked)
+ self.connect(self.AddIndividualButton, SIGNAL("clicked()"), self.AddIndividualButton_clicked)
+ self.connect(self.AddGroupButton, SIGNAL("clicked()"), self.AddGroupButton_clicked)
+ self.connect(self.RemoveRecipientButton, SIGNAL("clicked()"), self.RemoveRecipientButton_clicked)
+ self.connect(self.MoveRecipientUpButton, SIGNAL("clicked()"), self.MoveRecipientUpButton_clicked)
+ self.connect(self.MoveRecipientDownButton, SIGNAL("clicked()"), self.MoveRecipientDownButton_clicked)
+ self.connect(self.RecipientsTable, SIGNAL("itemSelectionChanged()"),
+ self.RecipientsTable_itemSelectionChanged)
+ self.connect(self.RecipientsTable, SIGNAL("itemDoubleClicked(QTableWidgetItem *)"),
+ 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 = filter(lambda x: x in self.recipient_list, all_names)
+ 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(QString(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(QString(k['fax']))
+ i.setFlags(flags)
+ self.RecipientsTable.setItem(row, 1, i)
+
+ i = QTableWidgetItem(QString(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, unicode(fax))
+
+
+ def QuickAddNameEdit_textChanged(self, name):
+ self.enableQuickAddButton(unicode(name))
+
+
+ def enableQuickAddButton(self, name=None, fax=None):
+ if name is None:
+ name = unicode(self.QuickAddNameEdit.text())
+ if fax is None:
+ fax = 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 = unicode(self.QuickAddNameEdit.text())
+ fax = 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(unicode(self.AddIndividualComboBox.currentText()))
+
+
+ def AddGroupButton_clicked(self):
+ self.addGroup(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 unicode(item.text())
+ else:
+ return u''
+
+
+ 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(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 file(ppd_file, 'r').read().find('HP Fax') == -1:
+ FailureUI(self, self.__tr("<b>Fax configuration error.</b><p>The CUPS fax queue for '%1' is incorrectly configured.<p>Please make sure that the CUPS fax queue is configured with the 'HPLIP Fax' Model/Driver.").arg(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, e:
+ log.warn(e.msg)
+
+ try:
+ self.dev.queryDevice(quick=True)
+ except Error, 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=%1)</b><p>Please wait for the device to become idle or clear the error and try again.").arg(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 '%1' is in a stopped or busy state.</b><p>Please check the queue and try again.").arg(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.connect(self.SendFaxTimer, SIGNAL('timeout()'), 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 %1...").arg(page_num), self.busy_icon)
+
+ elif status == fax.STATUS_SENDING_TO_RECIPIENT:
+ self.addStatusMessage(self.__tr("Sending fax to %1...").arg(arg), self.busy_icon)
+
+ elif status == fax.STATUS_DIALING:
+ self.addStatusMessage(self.__tr("Dialing %1...").arg(arg), self.busy_icon)
+
+ elif status == fax.STATUS_CONNECTING:
+ self.addStatusMessage(self.__tr("Connecting to %1...").arg(arg), self.busy_icon)
+
+ elif status == fax.STATUS_SENDING:
+ self.addStatusMessage(self.__tr("Sending page %1 to %2...").arg(page_num).arg(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 (%1)").arg(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...")
+ 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)
+
+ 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 = file(fax_file, 'r')
+ 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 %1 of %2").arg(p+1).arg(PAGE_MAX+1))
+
+
+ def restoreNextButton(self):
+ self.NextButton.setText(self.__tr("Next >"))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SendFaxDialog",s,c)
+
+
diff --git a/ui4/sendfaxdialog_base.py b/ui4/sendfaxdialog_base.py
new file mode 100644
index 0000000..0a04c4b
--- /dev/null
+++ b/ui4/sendfaxdialog_base.py
@@ -0,0 +1,388 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/sendfaxdialog_base.ui'
+#
+# Created: Mon May 4 14:30:36 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(600, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtGui.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.SelectFax = QtGui.QWidget()
+ self.SelectFax.setObjectName("SelectFax")
+ self.gridlayout1 = QtGui.QGridLayout(self.SelectFax)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label_8 = QtGui.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 = QtGui.QFrame(self.SelectFax)
+ self.line_4.setFrameShape(QtGui.QFrame.HLine)
+ self.line_4.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout1.addWidget(self.line_4, 1, 0, 1, 1)
+ self.gridlayout2 = QtGui.QGridLayout()
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.FaxComboBox = PrinterNameComboBox(self.SelectFax)
+ self.FaxComboBox.setObjectName("FaxComboBox")
+ self.gridlayout2.addWidget(self.FaxComboBox, 0, 0, 1, 3)
+ spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 1, 0, 1, 1)
+ self.FaxOptionsButton = QtGui.QPushButton(self.SelectFax)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QPushButton(self.SelectFax)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.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 = QtGui.QSpacerItem(564, 221, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 3, 0, 1, 1)
+ self.label_12 = QtGui.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 = QtGui.QWidget()
+ self.CoverPage.setObjectName("CoverPage")
+ self.gridlayout3 = QtGui.QGridLayout(self.CoverPage)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.label_3 = QtGui.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 = QtGui.QFrame(self.CoverPage)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout3.addWidget(self.line_2, 1, 0, 1, 1)
+ self.CoverPageGroupBox = QtGui.QGroupBox(self.CoverPage)
+ self.CoverPageGroupBox.setEnabled(True)
+ self.CoverPageGroupBox.setCheckable(True)
+ self.CoverPageGroupBox.setChecked(False)
+ self.CoverPageGroupBox.setObjectName("CoverPageGroupBox")
+ self.gridlayout4 = QtGui.QGridLayout(self.CoverPageGroupBox)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.gridlayout5 = QtGui.QGridLayout()
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.CoverPageName = QtGui.QLabel(self.CoverPageGroupBox)
+ self.CoverPageName.setFrameShape(QtGui.QFrame.NoFrame)
+ self.CoverPageName.setAlignment(QtCore.Qt.AlignCenter)
+ self.CoverPageName.setObjectName("CoverPageName")
+ self.gridlayout5.addWidget(self.CoverPageName, 0, 0, 1, 4)
+ self.CoverPagePreview = QtGui.QLabel(self.CoverPageGroupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.CoverPagePreview.setScaledContents(True)
+ self.CoverPagePreview.setAlignment(QtCore.Qt.AlignCenter)
+ self.CoverPagePreview.setObjectName("CoverPagePreview")
+ self.gridlayout5.addWidget(self.CoverPagePreview, 1, 0, 1, 4)
+ spacerItem2 = QtGui.QSpacerItem(16, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem2, 2, 0, 1, 1)
+ self.PrevCoverPageButton = QtGui.QPushButton(self.CoverPageGroupBox)
+ self.PrevCoverPageButton.setObjectName("PrevCoverPageButton")
+ self.gridlayout5.addWidget(self.PrevCoverPageButton, 2, 1, 1, 1)
+ self.NextCoverPageButton = QtGui.QPushButton(self.CoverPageGroupBox)
+ self.NextCoverPageButton.setObjectName("NextCoverPageButton")
+ self.gridlayout5.addWidget(self.NextCoverPageButton, 2, 2, 1, 1)
+ spacerItem3 = QtGui.QSpacerItem(31, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem3, 2, 3, 1, 1)
+ spacerItem4 = QtGui.QSpacerItem(20, 21, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem4, 3, 1, 1, 1)
+ self.gridlayout4.addLayout(self.gridlayout5, 0, 0, 2, 1)
+ self.vboxlayout = QtGui.QVBoxLayout()
+ self.vboxlayout.setObjectName("vboxlayout")
+ self.label_16 = QtGui.QLabel(self.CoverPageGroupBox)
+ self.label_16.setObjectName("label_16")
+ self.vboxlayout.addWidget(self.label_16)
+ self.RegardingEdit = QtGui.QLineEdit(self.CoverPageGroupBox)
+ self.RegardingEdit.setObjectName("RegardingEdit")
+ self.vboxlayout.addWidget(self.RegardingEdit)
+ self.gridlayout4.addLayout(self.vboxlayout, 0, 1, 1, 1)
+ self.gridlayout6 = QtGui.QGridLayout()
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_17 = QtGui.QLabel(self.CoverPageGroupBox)
+ self.label_17.setObjectName("label_17")
+ self.gridlayout6.addWidget(self.label_17, 0, 0, 1, 1)
+ self.MessageEdit = QtGui.QTextEdit(self.CoverPageGroupBox)
+ self.MessageEdit.setObjectName("MessageEdit")
+ self.gridlayout6.addWidget(self.MessageEdit, 1, 0, 1, 1)
+ self.PreserveFormattingCheckBox = QtGui.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 = QtGui.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 = QtGui.QWidget()
+ self.SelectFiles.setObjectName("SelectFiles")
+ self.gridlayout7 = QtGui.QGridLayout(self.SelectFiles)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_2 = QtGui.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 = QtGui.QFrame(self.SelectFiles)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout7.addWidget(self.line, 1, 0, 1, 1)
+ self.FilesTable = FileTable(self.SelectFiles)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.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 = QtGui.QWidget()
+ self.SelectRecipients.setObjectName("SelectRecipients")
+ self.gridlayout8 = QtGui.QGridLayout(self.SelectRecipients)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_4 = QtGui.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 = QtGui.QFrame(self.SelectRecipients)
+ self.line_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout8.addWidget(self.line_3, 1, 0, 1, 1)
+ self.groupBox_4 = QtGui.QGroupBox(self.SelectRecipients)
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.gridlayout9 = QtGui.QGridLayout(self.groupBox_4)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.RecipientsTable = QtGui.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 = QtGui.QPushButton(self.groupBox_4)
+ self.RemoveRecipientButton.setEnabled(False)
+ self.RemoveRecipientButton.setObjectName("RemoveRecipientButton")
+ self.gridlayout9.addWidget(self.RemoveRecipientButton, 1, 0, 1, 1)
+ self.MoveRecipientUpButton = QtGui.QPushButton(self.groupBox_4)
+ self.MoveRecipientUpButton.setEnabled(False)
+ self.MoveRecipientUpButton.setObjectName("MoveRecipientUpButton")
+ self.gridlayout9.addWidget(self.MoveRecipientUpButton, 1, 1, 1, 1)
+ self.MoveRecipientDownButton = QtGui.QPushButton(self.groupBox_4)
+ self.MoveRecipientDownButton.setEnabled(False)
+ self.MoveRecipientDownButton.setObjectName("MoveRecipientDownButton")
+ self.gridlayout9.addWidget(self.MoveRecipientDownButton, 1, 2, 1, 1)
+ spacerItem5 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout9.addItem(spacerItem5, 1, 3, 1, 1)
+ self.FABButton = QtGui.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 = QtGui.QGroupBox(self.SelectRecipients)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout10 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label = QtGui.QLabel(self.groupBox)
+ self.label.setObjectName("label")
+ self.hboxlayout.addWidget(self.label)
+ spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout.addItem(spacerItem6)
+ self.AddIndividualComboBox = QtGui.QComboBox(self.groupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.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 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.label_5 = QtGui.QLabel(self.groupBox)
+ self.label_5.setObjectName("label_5")
+ self.hboxlayout1.addWidget(self.label_5)
+ spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.hboxlayout1.addItem(spacerItem7)
+ self.AddGroupComboBox = QtGui.QComboBox(self.groupBox)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.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 = QtGui.QGroupBox(self.SelectRecipients)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout11 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout11.setObjectName("gridlayout11")
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.label_6 = QtGui.QLabel(self.groupBox_3)
+ self.label_6.setObjectName("label_6")
+ self.hboxlayout2.addWidget(self.label_6)
+ self.QuickAddNameEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.QuickAddNameEdit.setObjectName("QuickAddNameEdit")
+ self.hboxlayout2.addWidget(self.QuickAddNameEdit)
+ self.label_7 = QtGui.QLabel(self.groupBox_3)
+ self.label_7.setObjectName("label_7")
+ self.hboxlayout2.addWidget(self.label_7)
+ self.QuickAddFaxEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.QuickAddFaxEdit.setObjectName("QuickAddFaxEdit")
+ self.hboxlayout2.addWidget(self.QuickAddFaxEdit)
+ self.QuickAddButton = QtGui.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 = QtGui.QWidget()
+ self.SendFax.setObjectName("SendFax")
+ self.gridlayout12 = QtGui.QGridLayout(self.SendFax)
+ self.gridlayout12.setObjectName("gridlayout12")
+ self.label_9 = QtGui.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 = QtGui.QFrame(self.SendFax)
+ self.line_5.setFrameShape(QtGui.QFrame.HLine)
+ self.line_5.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_5.setObjectName("line_5")
+ self.gridlayout12.addWidget(self.line_5, 1, 0, 1, 1)
+ self.label_10 = QtGui.QLabel(self.SendFax)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout12.addWidget(self.label_10, 2, 0, 1, 1)
+ self.StatusList = QtGui.QListWidget(self.SendFax)
+ self.StatusList.setObjectName("StatusList")
+ self.gridlayout12.addWidget(self.StatusList, 3, 0, 1, 1)
+ self.label_15 = QtGui.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 = QtGui.QFrame(Dialog)
+ self.line_6.setFrameShape(QtGui.QFrame.HLine)
+ self.line_6.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_6.setObjectName("line_6")
+ self.gridlayout.addWidget(self.line_6, 1, 0, 1, 5)
+ self.StepText = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 2, 0, 1, 1)
+ spacerItem8 = QtGui.QSpacerItem(231, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem8, 2, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 2, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 2, 3, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Send Fax", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_8.setText(QtGui.QApplication.translate("Dialog", "Select Fax", None, QtGui.QApplication.UnicodeUTF8))
+ self.FaxOptionsButton.setText(QtGui.QApplication.translate("Dialog", "Fax Settings...", None, QtGui.QApplication.UnicodeUTF8))
+ self.FaxSetupButton.setText(QtGui.QApplication.translate("Dialog", "Fax Device Setup...", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_12.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("Dialog", "Select and Edit Fax Coverpage (Optional)", None, QtGui.QApplication.UnicodeUTF8))
+ self.CoverPageGroupBox.setTitle(QtGui.QApplication.translate("Dialog", "Include Coverpage", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_16.setText(QtGui.QApplication.translate("Dialog", "Regarding:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_17.setText(QtGui.QApplication.translate("Dialog", "Optional Message: (max. 2000 characters or 32 preformatted lines)", None, QtGui.QApplication.UnicodeUTF8))
+ self.PreserveFormattingCheckBox.setText(QtGui.QApplication.translate("Dialog", "Preformatted (preserve formatting)", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_13.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("Dialog", "Select Files to Send", None, QtGui.QApplication.UnicodeUTF8))
+ self.FilesPageNote.setText(QtGui.QApplication.translate("Dialog", "Note: You may also add files to the fax by printing from any application to the \'%1\' fax printer.", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Select Fax Recipients", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_4.setTitle(QtGui.QApplication.translate("Dialog", "Recipients", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveRecipientButton.setText(QtGui.QApplication.translate("Dialog", "Remove", None, QtGui.QApplication.UnicodeUTF8))
+ self.MoveRecipientUpButton.setText(QtGui.QApplication.translate("Dialog", "Move Up", None, QtGui.QApplication.UnicodeUTF8))
+ self.MoveRecipientDownButton.setText(QtGui.QApplication.translate("Dialog", "Move Down", None, QtGui.QApplication.UnicodeUTF8))
+ self.FABButton.setText(QtGui.QApplication.translate("Dialog", "Fax Address Book...", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Add Recipients or Groups from the Fax Address Book", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Add an individual:", None, QtGui.QApplication.UnicodeUTF8))
+ self.AddIndividualButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "Add a group:", None, QtGui.QApplication.UnicodeUTF8))
+ self.AddGroupButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Quick Add an Individual Recipient (recipient will automatically be added to fax address book)", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.translate("Dialog", "Fax Number:", None, QtGui.QApplication.UnicodeUTF8))
+ self.QuickAddButton.setText(QtGui.QApplication.translate("Dialog", "Add", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_9.setText(QtGui.QApplication.translate("Dialog", "Send Fax", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_10.setText(QtGui.QApplication.translate("Dialog", "Status:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_15.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from printernamecombobox import PrinterNameComboBox
+from filetable import FileTable
diff --git a/ui4/sendfaxdialog_base.ui b/ui4/sendfaxdialog_base.ui
new file mode 100644
index 0000000..e873050
--- /dev/null
+++ b/ui4/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/ui4/settingsdialog.py b/ui4/settingsdialog.py
new file mode 100644
index 0000000..be4e4ec
--- /dev/null
+++ b/ui4/settingsdialog.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2008 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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.connect(self.SetDefaultsButton, SIGNAL("clicked()"), 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 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.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 = unicode(self.ScanCommandLineEdit.text())
+ self.user_settings.auto_refresh = bool(self.AutoRefreshCheckBox.isChecked())
+
+ 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/ui4/settingsdialog_base.py b/ui4/settingsdialog_base.py
new file mode 100644
index 0000000..82cc4f0
--- /dev/null
+++ b/ui4/settingsdialog_base.py
@@ -0,0 +1,237 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/settingsdialog_base.ui'
+#
+# Created: Mon May 4 14:30:36 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_SettingsDialog_base(object):
+ def setupUi(self, SettingsDialog_base):
+ SettingsDialog_base.setObjectName("SettingsDialog_base")
+ SettingsDialog_base.resize(500, 540)
+ self.gridlayout = QtGui.QGridLayout(SettingsDialog_base)
+ self.gridlayout.setObjectName("gridlayout")
+ self.TabWidget = QtGui.QTabWidget(SettingsDialog_base)
+ self.TabWidget.setObjectName("TabWidget")
+ self.AutoRefresh = QtGui.QWidget()
+ self.AutoRefresh.setObjectName("AutoRefresh")
+ self.gridlayout1 = QtGui.QGridLayout(self.AutoRefresh)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.textLabel3_2_2 = QtGui.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 = QtGui.QFrame(self.AutoRefresh)
+ self.line1_2_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line1_2_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line1_2_2.setObjectName("line1_2_2")
+ self.gridlayout1.addWidget(self.line1_2_2, 1, 0, 1, 1)
+ self.AutoRefreshCheckBox = QtGui.QCheckBox(self.AutoRefresh)
+ self.AutoRefreshCheckBox.setObjectName("AutoRefreshCheckBox")
+ self.gridlayout1.addWidget(self.AutoRefreshCheckBox, 2, 0, 1, 1)
+ self.RefreshRateGroupBox = QtGui.QGroupBox(self.AutoRefresh)
+ self.RefreshRateGroupBox.setEnabled(True)
+ self.RefreshRateGroupBox.setObjectName("RefreshRateGroupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.RefreshRateGroupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.textLabel1_4 = QtGui.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 = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.AutoRefreshRateSpinBox = QtGui.QSpinBox(self.RefreshRateGroupBox)
+ self.AutoRefreshRateSpinBox.setEnabled(False)
+ self.AutoRefreshRateSpinBox.setWrapping(True)
+ self.AutoRefreshRateSpinBox.setButtonSymbols(QtGui.QAbstractSpinBox.PlusMinus)
+ self.AutoRefreshRateSpinBox.setMinimum(10)
+ self.AutoRefreshRateSpinBox.setMaximum(300)
+ self.AutoRefreshRateSpinBox.setProperty("value", QtCore.QVariant(30))
+ self.AutoRefreshRateSpinBox.setObjectName("AutoRefreshRateSpinBox")
+ self.hboxlayout.addWidget(self.AutoRefreshRateSpinBox)
+ self.gridlayout2.addLayout(self.hboxlayout, 0, 1, 1, 1)
+ spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 0, 2, 1, 1)
+ self.gridlayout1.addWidget(self.RefreshRateGroupBox, 3, 0, 1, 1)
+ self.RefreshTypeGroupBox = QtGui.QGroupBox(self.AutoRefresh)
+ self.RefreshTypeGroupBox.setObjectName("RefreshTypeGroupBox")
+ self.gridlayout3 = QtGui.QGridLayout(self.RefreshTypeGroupBox)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.RefreshCurrentRadioButton = QtGui.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 = QtGui.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 = QtGui.QSpacerItem(446, 41, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 5, 0, 1, 1)
+ self.TabWidget.addTab(self.AutoRefresh, "")
+ self.SystemTray = QtGui.QWidget()
+ self.SystemTray.setObjectName("SystemTray")
+ self.gridlayout4 = QtGui.QGridLayout(self.SystemTray)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.textLabel3_2_3 = QtGui.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 = QtGui.QFrame(self.SystemTray)
+ self.line1_2_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line1_2_3.setFrameShadow(QtGui.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 = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.SystemTraySettings.sizePolicy().hasHeightForWidth())
+ self.SystemTraySettings.setSizePolicy(sizePolicy)
+ self.SystemTraySettings.setFrameShadow(QtGui.QFrame.Raised)
+ self.SystemTraySettings.setObjectName("SystemTraySettings")
+ self.gridlayout4.addWidget(self.SystemTraySettings, 2, 0, 1, 1)
+ self.TabWidget.addTab(self.SystemTray, "")
+ self.Commands = QtGui.QWidget()
+ self.Commands.setObjectName("Commands")
+ self.gridlayout5 = QtGui.QGridLayout(self.Commands)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.textLabel3_2_2_2 = QtGui.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 = QtGui.QFrame(self.Commands)
+ self.line1_2_2_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line1_2_2_3.setFrameShadow(QtGui.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 = QtGui.QGroupBox(self.Commands)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout6 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.textLabel1_2 = QtGui.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 = QtGui.QLineEdit(self.groupBox_3)
+ self.PrintCommandLineEdit.setEnabled(False)
+ self.PrintCommandLineEdit.setObjectName("PrintCommandLineEdit")
+ self.gridlayout6.addWidget(self.PrintCommandLineEdit, 1, 0, 1, 1)
+ self.textLabel2_2 = QtGui.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 = QtGui.QLineEdit(self.groupBox_3)
+ self.ScanCommandLineEdit.setObjectName("ScanCommandLineEdit")
+ self.gridlayout6.addWidget(self.ScanCommandLineEdit, 3, 0, 1, 1)
+ self.textLabel3_3 = QtGui.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 = QtGui.QLineEdit(self.groupBox_3)
+ self.SendFaxCommandLineEdit.setEnabled(False)
+ self.SendFaxCommandLineEdit.setObjectName("SendFaxCommandLineEdit")
+ self.gridlayout6.addWidget(self.SendFaxCommandLineEdit, 5, 0, 1, 1)
+ self.textLabel4 = QtGui.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 = QtGui.QLineEdit(self.groupBox_3)
+ self.AccessPCardCommandLineEdit.setEnabled(False)
+ self.AccessPCardCommandLineEdit.setObjectName("AccessPCardCommandLineEdit")
+ self.gridlayout6.addWidget(self.AccessPCardCommandLineEdit, 7, 0, 1, 1)
+ self.textLabel5 = QtGui.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 = QtGui.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 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout5.addItem(spacerItem2, 3, 1, 1, 1)
+ self.SetDefaultsButton = QtGui.QPushButton(self.Commands)
+ self.SetDefaultsButton.setEnabled(True)
+ self.SetDefaultsButton.setObjectName("SetDefaultsButton")
+ self.gridlayout5.addWidget(self.SetDefaultsButton, 4, 0, 1, 1)
+ spacerItem3 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QSpacerItem(301, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem4, 1, 0, 1, 1)
+ self.StdButtons = QtGui.QDialogButtonBox(SettingsDialog_base)
+ self.StdButtons.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.NoButton|QtGui.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)
+ QtCore.QObject.connect(self.AutoRefreshCheckBox, QtCore.SIGNAL("toggled(bool)"), self.AutoRefreshRateSpinBox.setEnabled)
+ QtCore.QObject.connect(self.AutoRefreshCheckBox, QtCore.SIGNAL("toggled(bool)"), self.RefreshAllRadioButton.setEnabled)
+ QtCore.QObject.connect(self.AutoRefreshCheckBox, QtCore.SIGNAL("toggled(bool)"), self.RefreshCurrentRadioButton.setEnabled)
+ QtCore.QObject.connect(self.StdButtons, QtCore.SIGNAL("accepted()"), SettingsDialog_base.accept)
+ QtCore.QObject.connect(self.StdButtons, QtCore.SIGNAL("rejected()"), 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):
+ SettingsDialog_base.setWindowTitle(QtGui.QApplication.translate("SettingsDialog_base", "HP Device Manager - Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3_2_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.AutoRefreshCheckBox.setText(QtGui.QApplication.translate("SettingsDialog_base", "&Enable device auto refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshRateGroupBox.setTitle(QtGui.QApplication.translate("SettingsDialog_base", "Refresh Interval", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel1_4.setText(QtGui.QApplication.translate("SettingsDialog_base", "&Refresh every:", None, QtGui.QApplication.UnicodeUTF8))
+ self.AutoRefreshRateSpinBox.setSuffix(QtGui.QApplication.translate("SettingsDialog_base", " sec", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshTypeGroupBox.setTitle(QtGui.QApplication.translate("SettingsDialog_base", "Devices to Refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshCurrentRadioButton.setText(QtGui.QApplication.translate("SettingsDialog_base", "Only &currently selected device", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshAllRadioButton.setText(QtGui.QApplication.translate("SettingsDialog_base", "&All devices", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.AutoRefresh), QtGui.QApplication.translate("SettingsDialog_base", "Auto Refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3_2_3.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.SystemTray), QtGui.QApplication.translate("SettingsDialog_base", "System Tray Icon", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3_2_2_2.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("SettingsDialog_base", "Commands", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel1_2.setText(QtGui.QApplication.translate("SettingsDialog_base", "&Print:", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel2_2.setText(QtGui.QApplication.translate("SettingsDialog_base", "&Scan:", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel3_3.setText(QtGui.QApplication.translate("SettingsDialog_base", "Send PC &Fax:", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel4.setText(QtGui.QApplication.translate("SettingsDialog_base", "&Unload Photo Cards:", None, QtGui.QApplication.UnicodeUTF8))
+ self.textLabel5.setText(QtGui.QApplication.translate("SettingsDialog_base", "Make &Copies:", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetDefaultsButton.setText(QtGui.QApplication.translate("SettingsDialog_base", "Set &Defaults", None, QtGui.QApplication.UnicodeUTF8))
+ self.TabWidget.setTabText(self.TabWidget.indexOf(self.Commands), QtGui.QApplication.translate("SettingsDialog_base", "Commands (Advanced)", None, QtGui.QApplication.UnicodeUTF8))
+
+from systrayframe import SystrayFrame
diff --git a/ui4/settingsdialog_base.ui b/ui4/settingsdialog_base.ui
new file mode 100644
index 0000000..8ec841f
--- /dev/null
+++ b/ui4/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/ui4/setupdialog.py b/ui4/setupdialog.py
new file mode 100644
index 0000000..5d3c8ea
--- /dev/null
+++ b/ui4/setupdialog.py
@@ -0,0 +1,1323 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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 commands
+
+# 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 core_install
+from installer.core_install import CoreInstall
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui 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.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.connect(self.OkPushButton, SIGNAL("clicked()"), self.accept)
+ self.connect(self.PasswordLineEdit, SIGNAL("returnPressed()"), 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 unicode(self.UsernameLineEdit.text())
+
+
+ def getPassword(self):
+ return 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 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:
+ 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.BackButton, SIGNAL("clicked()"), self.BackButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+ self.connect(self.ManualGroupBox, SIGNAL("clicked(bool)"), self.ManualGroupBox_clicked)
+
+ 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", QVariant(DEVICE_DESC_ALL))
+ self.DeviceTypeComboBox.addItem("Single function printers only", QVariant(DEVICE_DESC_SINGLE_FUNC))
+ self.DeviceTypeComboBox.addItem("All-in-one/MFP devices only", QVariant(DEVICE_DESC_MULTI_FUNC))
+ else:
+ self.DeviceTypeComboBox.setEnabled(False)
+
+ self.connect(self.AdvancedButton, SIGNAL("clicked()"), self.AdvancedButton_clicked)
+ self.connect(self.UsbRadioButton, SIGNAL("toggled(bool)"), self.UsbRadioButton_toggled)
+ self.connect(self.NetworkRadioButton, SIGNAL("toggled(bool)"), self.NetworkRadioButton_toggled)
+ self.connect(self.WirelessButton, SIGNAL("toggled(bool)"), self.WirelessButton_toggled)
+ self.connect(self.ParallelRadioButton, SIGNAL("toggled(bool)"), self.ParallelRadioButton_toggled)
+ self.connect(self.NetworkTTLSpinBox, SIGNAL("valueChanged(int)"), self.NetworkTTLSpinBox_valueChanged)
+ self.connect(self.NetworkTimeoutSpinBox, SIGNAL("valueChanged(int)"),
+ self.NetworkTimeoutSpinBox_valueChanged)
+ self.connect(self.ManualGroupBox, SIGNAL("toggled(bool)"), 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:
+ 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(1)
+
+
+ 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.connect(self.RefreshButton, SIGNAL("clicked()"), 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"
+ else:
+ net_search_type = "mdns"
+
+ 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 = {}
+
+ 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>%1 devices found.</b> Select the device to install and click <i>Next</i> to continue.").arg(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."))
+
+ 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(QString(model_ui), d)
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(QString(d))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, device_uri_col, i)
+
+ if self.bus == 'net':
+ i = QTableWidgetItem(QString(host))
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 1, i)
+
+ if self.discovery_method == 0:
+ i = QTableWidgetItem(QString(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.connect(self.PrinterNameLineEdit, SIGNAL("textEdited(const QString &)"),
+ self.PrinterNameLineEdit_textEdited)
+
+ self.connect(self.FaxNameLineEdit, SIGNAL("textEdited(const QString &)"),
+ self.FaxNameLineEdit_textEdited)
+
+ 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.connect(self.OtherPPDButton, SIGNAL("clicked(bool)"), 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
+
+
+ def showAddPrinterPage(self):
+ # Install the plugin if needed...
+ core = CoreInstall()
+ plugin = self.mq.get('plugin', PLUGIN_NONE)
+ plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE)
+ if plugin > PLUGIN_NONE:
+
+ if core.check_for_plugin() != 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 core.check_for_plugin() != PLUGIN_INSTALLED:
+ if plugin == PLUGIN_REQUIRED:
+ FailureUI(self, self.__tr("<b>The printer you are trying to setup requires a binary driver plug-in and it failed to install.</b><p>Please check your internet connection and try again.</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)
+
+ if not self.printer_name:
+ self.setDefaultPrinterName()
+
+ self.findPrinterPPD()
+
+ 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)
+
+ if not self.fax_name:
+ self.setDefaultFaxName()
+
+ self.findFaxPPD()
+
+ self.readwriteFaxInformation()
+
+ 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
+
+ self.updatePPD()
+ self.setAddPrinterButton()
+ self.displayPage(PAGE_ADD_PRINTER)
+
+
+
+
+ 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(QString(""))
+
+ 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 = 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()
+
+ #Check if common ppd name is already given in models.dat(This is needed because in case of devices having more than one derivatives
+ #will have diffrent model name strings in device ID, because of which we don't get the common ppd name for search)
+
+ ppd_name = self.mq.get('ppd-name',0)
+
+ if ppd_name == 0: #Means ppd-name is not provided So follow earlier path of getting name from device ID.
+ model = cups.stripModel2(self.model)
+ self.print_ppd = cups.getPPDFile2(model, self.ppds)
+ else:
+ self.print_ppd = cups.getPPDFile2(ppd_name, self.ppds)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def findFaxPPD(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ log.debug("Searching for fax PPD for model %s" % self.model)
+
+ if prop.hpcups_build:
+ if self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_MARVELL:
+ fax_ppd_name = "HP-Fax3-hpcups" # Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax3 hpcups"
+ elif self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_SOAP or self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_LEDMSOAP:
+ fax_ppd_name = "HP-Fax2-hpcups" # Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax2 hpcups"
+ elif self.mq.get('fax-type', FAX_TYPE_LEDM) == FAX_TYPE_LEDM:
+ fax_ppd_name = "HP-Fax4-hpcups"# Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax4 hpcups"
+ else:
+ fax_ppd_name = "HP-Fax-hpcups" # Standard
+ nick = "HP Fax hpcups"
+
+ else: # hpijs
+ if self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_MARVELL:
+ fax_ppd_name = "HP-Fax3-hpijs" # Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax3 hpijs"
+ if self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_SOAP or self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_LEDMSOAP:
+ fax_ppd_name = "HP-Fax2-hpijs" # Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax2 hpijs"
+ if self.mq.get('fax-type', FAX_TYPE_NONE) == FAX_TYPE_LEDM:
+ fax_ppd_name = "HP-Fax4-hpijs" # Fixed width (2528 pixels) and 300dpi rendering
+ nick = "HP Fax4 hpijs"
+ else:
+ fax_ppd_name = "HP-Fax-hpijs" # Standard
+ nick = "HP Fax hpijs"
+
+ ppds = []
+
+ for f in utils.walkFiles(sys_conf.get('dirs', 'ppd'), pattern="HP-Fax*.ppd*", abs_paths=True):
+ ppds.append(f)
+
+ for f in ppds:
+ if f.find(fax_ppd_name) >= 0 and cups.getPPDDescription(f) == nick:
+ self.fax_ppd = f
+ self.fax_setup_ok = True
+ log.debug("Found fax PPD: %s" % f)
+ break
+ else:
+ self.fax_ppd = None
+ self.fax_setup_ok = False
+ FailureUI(self, self.__tr("<b>Unable to locate the HPLIP Fax PPD file:</b><p>%1.ppd.gz</p><p>Fax setup has been disabled.").arg(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):
+ 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
+
+ self.printer_name_ok = True
+ self.PrinterNameLineEdit.setText(printer_name)
+ log.debug(printer_name)
+ self.printer_name = printer_name
+
+
+ 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):
+ 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
+
+ self.fax_name_ok = True
+ self.FaxNameLineEdit.setText(fax_name)
+ self.fax_name = fax_name
+
+
+ def PrinterNameLineEdit_textEdited(self, t):
+ self.printer_name = 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 = 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 setIndicators(self):
+ if self.printer_name_ok:
+ self.PrinterNameLineEdit.setToolTip(QString(""))
+ 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(QString(""))
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("")
+ except AttributeError:
+ pass
+ else:
+ try:
+ self.PrinterNameLineEdit.setStyleSheet("background-color: yellow")
+ except AttributeError:
+ pass
+
+
+ def setAddPrinterButton(self):
+ self.NextButton.setEnabled((self.printer_name_ok and self.print_ppd is not None) and
+ ((self.fax_setup and self.fax_name_ok) or not self.fax_setup))
+
+
+ #
+ # ADD PRINTER
+ #
+
+ def addPrinter(self):
+ self.setupPrinter()
+
+ if self.fax_setup:
+ self.setupFax()
+ self.readwriteFaxInformation(False)
+
+ if self.print_test_page:
+ self.printTestPage()
+
+ self.close()
+
+
+
+ #
+ # SETUP PRINTER/FAX
+ #
+
+ def setupPrinter(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ cups.setPasswordPrompt("You do not have permission to add a printer.")
+ if not os.path.exists(self.print_ppd[0]): # assume foomatic: or some such
+ status, status_str = cups.addPrinter(self.printer_name.encode('utf8'), self.device_uri,
+ self.print_location, '', self.print_ppd[0], self.print_desc)
+ else:
+ status, status_str = cups.addPrinter(self.printer_name.encode('utf8'), self.device_uri,
+ self.print_location, self.print_ppd[0], '', self.print_desc)
+
+ log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
+ self.installed_print_devices = device.getSupportedCUPSDevices(['hp'])
+
+ log.debug(self.installed_print_devices)
+
+ if self.device_uri not in self.installed_print_devices or \
+ self.printer_name not in self.installed_print_devices[self.device_uri]:
+
+ QApplication.restoreOverrideCursor()
+ if os.geteuid!=0 and utils.addgroup()!=[]:
+ FailureUI(self, self.__tr("<b>Printer queue setup failed. Could not connect to CUPS Server</b><p>Is user added to %s group(s)" %utils.list_to_string(utils.addgroup())))
+ else:
+ # TODO:
+ #service.sendEvent(self.hpssd_sock, EVENT_CUPS_QUEUES_CHANGED, device_uri=self.device_uri)
+ pass
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def setupFax(self):
+ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
+ try:
+ cups.setPasswordPrompt("You do not have permission to add a fax device.")
+ if not os.path.exists(self.fax_ppd):
+ status, status_str = cups.addPrinter(self.fax_name.encode('utf8'),
+ self.fax_uri, self.fax_location, '', self.fax_ppd, self.fax_desc)
+ else:
+ status, status_str = cups.addPrinter(self.fax_name.encode('utf8'),
+ self.fax_uri, self.fax_location, self.fax_ppd, '', self.fax_desc)
+
+ log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
+ self.installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
+
+ log.debug(self.installed_fax_devices)
+
+ if self.fax_uri not in self.installed_fax_devices or \
+ self.fax_name not in self.installed_fax_devices[self.fax_uri]:
+
+ QApplication.restoreOverrideCursor()
+ FailureUI(self, self.__tr("<b>Fax queue setup failed.</b><p>Please restart CUPS and try again."))
+ else:
+ pass
+ # TODO:
+ #service.sendEvent(self.hpssd_sock, EVENT_CUPS_QUEUES_CHANGED, device_uri=self.fax_uri)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ 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(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 = unicode(d.getPhoneNum())
+ self.fax_name_company = 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(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, 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, 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)
+ self.connect(widget, SIGNAL("stateChanged(int)"), 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(QString(p.name))
+ i.setFlags(flags)
+ i.setData(Qt.UserRole, QVariant(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(QString(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 xrange(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 = unicode(self.ManualParamLineEdit.text())
+ self.jd_port = self.JetDirectSpinBox.value()
+ self.search = unicode(self.SearchLineEdit.text())
+ self.device_desc = int(self.DeviceTypeComboBox.itemData(self.DeviceTypeComboBox.currentIndex()).toInt()[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_desc = unicode(self.PrinterDescriptionLineEdit.text()).encode('utf8')
+ self.print_location = unicode(self.PrinterLocationLineEdit.text()).encode('utf8')
+ self.fax_setup = self.SetupFaxGroupBox.isChecked()
+ self.fax_desc = unicode(self.FaxDescriptionLineEdit.text()).encode('utf8')
+ self.fax_location = unicode(self.FaxLocationLineEdit.text()).encode('utf8')
+ self.fax_name_company = unicode(self.NameCompanyLineEdit.text()).encode('utf8')
+ self.fax_number = unicode(self.FaxNumberLineEdit.text()).encode('utf8')
+ self.addPrinter()
+
+ elif p == PAGE_REMOVE:
+ for row in xrange(self.RemoveDevicesTableWidget.rowCount()):
+ widget = self.RemoveDevicesTableWidget.cellWidget(row, 0)
+ if widget.checkState() == Qt.Checked:
+ item = self.RemoveDevicesTableWidget.item(row, 1)
+ printer = unicode(item.data(Qt.UserRole).toString()).encode('utf-8')
+ log.debug("Removing printer: %s" % printer)
+ if cups.delPrinter(printer) == 0 and os.geteuid!=0 and utils.addgroup()!=[]:
+ FailureUI(self, self.__tr("<b>Unable to delete printer queue. Could not connect to CUPS Server</b><p>Is user added to %s group(s)" %utils.list_to_string(utils.addgroup())))
+ 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 %1 of %2").arg(p+1).arg(self.max_page+1))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("SetupDialog",s,c)
+
+
diff --git a/ui4/setupdialog_base.py b/ui4/setupdialog_base.py
new file mode 100644
index 0000000..46476e1
--- /dev/null
+++ b/ui4/setupdialog_base.py
@@ -0,0 +1,383 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/setupdialog_base.ui'
+#
+# Created: Mon May 4 14:30:37 2009
+# by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(700, 500)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setObjectName("StackedWidget")
+ self.DiscoveryPage = QtGui.QWidget()
+ self.DiscoveryPage.setObjectName("DiscoveryPage")
+ self.gridlayout1 = QtGui.QGridLayout(self.DiscoveryPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.label = QtGui.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 = QtGui.QFrame(self.DiscoveryPage)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line, 1, 0, 1, 2)
+ self.groupBox = QtGui.QGroupBox(self.DiscoveryPage)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.UsbRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.UsbRadioButton.setChecked(True)
+ self.UsbRadioButton.setObjectName("UsbRadioButton")
+ self.gridlayout2.addWidget(self.UsbRadioButton, 0, 0, 1, 1)
+ self.NetworkRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.NetworkRadioButton.setObjectName("NetworkRadioButton")
+ self.gridlayout2.addWidget(self.NetworkRadioButton, 1, 0, 1, 1)
+ self.ParallelRadioButton = QtGui.QRadioButton(self.groupBox)
+ self.ParallelRadioButton.setEnabled(True)
+ self.ParallelRadioButton.setObjectName("ParallelRadioButton")
+ self.gridlayout2.addWidget(self.ParallelRadioButton, 3, 0, 1, 1)
+ self.WirelessButton = QtGui.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 = QtGui.QPushButton(self.DiscoveryPage)
+ self.AdvancedButton.setObjectName("AdvancedButton")
+ self.gridlayout1.addWidget(self.AdvancedButton, 3, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(381, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem, 3, 1, 1, 1)
+ self.AdvancedStackedWidget = QtGui.QStackedWidget(self.DiscoveryPage)
+ self.AdvancedStackedWidget.setObjectName("AdvancedStackedWidget")
+ self.page = QtGui.QWidget()
+ self.page.setObjectName("page")
+ self.gridlayout3 = QtGui.QGridLayout(self.page)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.DiscoveryOptionsGroupBox = QtGui.QGroupBox(self.page)
+ self.DiscoveryOptionsGroupBox.setObjectName("DiscoveryOptionsGroupBox")
+ self.gridlayout4 = QtGui.QGridLayout(self.DiscoveryOptionsGroupBox)
+ self.gridlayout4.setObjectName("gridlayout4")
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+ self.label_2 = QtGui.QLabel(self.DiscoveryOptionsGroupBox)
+ self.label_2.setObjectName("label_2")
+ self.hboxlayout.addWidget(self.label_2)
+ self.SearchLineEdit = QtGui.QLineEdit(self.DiscoveryOptionsGroupBox)
+ self.SearchLineEdit.setObjectName("SearchLineEdit")
+ self.hboxlayout.addWidget(self.SearchLineEdit)
+ self.gridlayout4.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+ self.DeviceTypeLabel = QtGui.QLabel(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeLabel.setObjectName("DeviceTypeLabel")
+ self.hboxlayout1.addWidget(self.DeviceTypeLabel)
+ self.DeviceTypeComboBox = QtGui.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.DeviceTypeComboBox.setObjectName("DeviceTypeComboBox")
+ self.hboxlayout1.addWidget(self.DeviceTypeComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout1, 0, 1, 1, 2)
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+ self.NetworkDiscoveryMethodLabel = QtGui.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodLabel.setObjectName("NetworkDiscoveryMethodLabel")
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodLabel)
+ self.NetworkDiscoveryMethodComboBox = QtGui.QComboBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkDiscoveryMethodComboBox.setObjectName("NetworkDiscoveryMethodComboBox")
+ self.NetworkDiscoveryMethodComboBox.addItem(QtCore.QString())
+ self.NetworkDiscoveryMethodComboBox.addItem(QtCore.QString())
+ self.hboxlayout2.addWidget(self.NetworkDiscoveryMethodComboBox)
+ self.gridlayout4.addLayout(self.hboxlayout2, 1, 0, 1, 1)
+ self.hboxlayout3 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+ self.NetworkTimeoutLabel = QtGui.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutLabel.setObjectName("NetworkTimeoutLabel")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutLabel)
+ self.NetworkTimeoutSpinBox = QtGui.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTimeoutSpinBox.setMinimum(1)
+ self.NetworkTimeoutSpinBox.setMaximum(90)
+ self.NetworkTimeoutSpinBox.setProperty("value", QtCore.QVariant(5))
+ self.NetworkTimeoutSpinBox.setObjectName("NetworkTimeoutSpinBox")
+ self.hboxlayout3.addWidget(self.NetworkTimeoutSpinBox)
+ self.gridlayout4.addLayout(self.hboxlayout3, 1, 1, 1, 1)
+ self.hboxlayout4 = QtGui.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+ self.NetworkTTLLabel = QtGui.QLabel(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLLabel.setObjectName("NetworkTTLLabel")
+ self.hboxlayout4.addWidget(self.NetworkTTLLabel)
+ self.NetworkTTLSpinBox = QtGui.QSpinBox(self.DiscoveryOptionsGroupBox)
+ self.NetworkTTLSpinBox.setMinimum(1)
+ self.NetworkTTLSpinBox.setMaximum(8)
+ self.NetworkTTLSpinBox.setProperty("value", QtCore.QVariant(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 = QtGui.QGroupBox(self.page)
+ self.ManualGroupBox.setCheckable(True)
+ self.ManualGroupBox.setObjectName("ManualGroupBox")
+ self.gridlayout5 = QtGui.QGridLayout(self.ManualGroupBox)
+ self.gridlayout5.setObjectName("gridlayout5")
+ self.ManualParamLabel = QtGui.QLabel(self.ManualGroupBox)
+ self.ManualParamLabel.setObjectName("ManualParamLabel")
+ self.gridlayout5.addWidget(self.ManualParamLabel, 0, 0, 1, 1)
+ self.ManualParamLineEdit = QtGui.QLineEdit(self.ManualGroupBox)
+ self.ManualParamLineEdit.setObjectName("ManualParamLineEdit")
+ self.gridlayout5.addWidget(self.ManualParamLineEdit, 0, 1, 1, 1)
+ self.JetDirectLabel = QtGui.QLabel(self.ManualGroupBox)
+ self.JetDirectLabel.setObjectName("JetDirectLabel")
+ self.gridlayout5.addWidget(self.JetDirectLabel, 0, 2, 1, 1)
+ self.JetDirectSpinBox = QtGui.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 = QtGui.QWidget()
+ self.page_4.setObjectName("page_4")
+ self.AdvancedStackedWidget.addWidget(self.page_4)
+ self.gridlayout1.addWidget(self.AdvancedStackedWidget, 4, 0, 1, 2)
+ spacerItem1 = QtGui.QSpacerItem(478, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem1, 5, 0, 1, 2)
+ self.StackedWidget.addWidget(self.DiscoveryPage)
+ self.page_2 = QtGui.QWidget()
+ self.page_2.setObjectName("page_2")
+ self.gridlayout6 = QtGui.QGridLayout(self.page_2)
+ self.gridlayout6.setObjectName("gridlayout6")
+ self.label_4 = QtGui.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 = QtGui.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout6.addWidget(self.line_2, 1, 0, 1, 3)
+ self.DevicesTableWidget = QtGui.QTableWidget(self.page_2)
+ self.DevicesTableWidget.setAlternatingRowColors(True)
+ self.DevicesTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.DevicesTableWidget.setSelectionBehavior(QtGui.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 = QtGui.QHBoxLayout()
+ self.hboxlayout5.setObjectName("hboxlayout5")
+ self.DevicesFoundIcon = QtGui.QLabel(self.page_2)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.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(QtGui.QFrame.NoFrame)
+ self.DevicesFoundIcon.setObjectName("DevicesFoundIcon")
+ self.hboxlayout5.addWidget(self.DevicesFoundIcon)
+ self.DevicesFoundLabel = QtGui.QLabel(self.page_2)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.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 = QtGui.QSpacerItem(21, 28, QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum)
+ self.gridlayout6.addItem(spacerItem2, 3, 1, 1, 1)
+ self.RefreshButton = QtGui.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 = QtGui.QWidget()
+ self.page_3.setObjectName("page_3")
+ self.gridlayout7 = QtGui.QGridLayout(self.page_3)
+ self.gridlayout7.setObjectName("gridlayout7")
+ self.label_5 = QtGui.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 = QtGui.QFrame(self.page_3)
+ self.line_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout7.addWidget(self.line_3, 1, 0, 1, 1)
+ self.groupBox_3 = QtGui.QGroupBox(self.page_3)
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout8 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout8.setObjectName("gridlayout8")
+ self.label_6 = QtGui.QLabel(self.groupBox_3)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout8.addWidget(self.label_6, 0, 0, 1, 1)
+ self.PrinterNameLineEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.PrinterNameLineEdit.setObjectName("PrinterNameLineEdit")
+ self.gridlayout8.addWidget(self.PrinterNameLineEdit, 0, 1, 1, 2)
+ self.label_7 = QtGui.QLabel(self.groupBox_3)
+ self.label_7.setObjectName("label_7")
+ self.gridlayout8.addWidget(self.label_7, 1, 0, 1, 1)
+ self.PrinterDescriptionLineEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.PrinterDescriptionLineEdit.setObjectName("PrinterDescriptionLineEdit")
+ self.gridlayout8.addWidget(self.PrinterDescriptionLineEdit, 1, 1, 1, 2)
+ self.label_8 = QtGui.QLabel(self.groupBox_3)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout8.addWidget(self.label_8, 2, 0, 1, 1)
+ self.PrinterLocationLineEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.PrinterLocationLineEdit.setObjectName("PrinterLocationLineEdit")
+ self.gridlayout8.addWidget(self.PrinterLocationLineEdit, 2, 1, 1, 2)
+ self.label_3 = QtGui.QLabel(self.groupBox_3)
+ self.label_3.setObjectName("label_3")
+ self.gridlayout8.addWidget(self.label_3, 3, 0, 1, 1)
+ self.PPDFileLineEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.PPDFileLineEdit.setReadOnly(True)
+ self.PPDFileLineEdit.setObjectName("PPDFileLineEdit")
+ self.gridlayout8.addWidget(self.PPDFileLineEdit, 3, 1, 1, 1)
+ self.OtherPPDButton = QtGui.QToolButton(self.groupBox_3)
+ 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 = QtGui.QGroupBox(self.page_3)
+ self.SetupFaxGroupBox.setCheckable(True)
+ self.SetupFaxGroupBox.setObjectName("SetupFaxGroupBox")
+ self.gridlayout9 = QtGui.QGridLayout(self.SetupFaxGroupBox)
+ self.gridlayout9.setObjectName("gridlayout9")
+ self.label_9 = QtGui.QLabel(self.SetupFaxGroupBox)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout9.addWidget(self.label_9, 0, 0, 1, 1)
+ self.FaxNameLineEdit = QtGui.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNameLineEdit.setObjectName("FaxNameLineEdit")
+ self.gridlayout9.addWidget(self.FaxNameLineEdit, 0, 1, 1, 3)
+ self.label_10 = QtGui.QLabel(self.SetupFaxGroupBox)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout9.addWidget(self.label_10, 1, 0, 1, 1)
+ self.FaxNumberLineEdit = QtGui.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxNumberLineEdit.setObjectName("FaxNumberLineEdit")
+ self.gridlayout9.addWidget(self.FaxNumberLineEdit, 1, 1, 1, 1)
+ self.label_11 = QtGui.QLabel(self.SetupFaxGroupBox)
+ self.label_11.setObjectName("label_11")
+ self.gridlayout9.addWidget(self.label_11, 1, 2, 1, 1)
+ self.NameCompanyLineEdit = QtGui.QLineEdit(self.SetupFaxGroupBox)
+ self.NameCompanyLineEdit.setObjectName("NameCompanyLineEdit")
+ self.gridlayout9.addWidget(self.NameCompanyLineEdit, 1, 3, 1, 1)
+ self.label_12 = QtGui.QLabel(self.SetupFaxGroupBox)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout9.addWidget(self.label_12, 2, 0, 1, 1)
+ self.FaxDescriptionLineEdit = QtGui.QLineEdit(self.SetupFaxGroupBox)
+ self.FaxDescriptionLineEdit.setObjectName("FaxDescriptionLineEdit")
+ self.gridlayout9.addWidget(self.FaxDescriptionLineEdit, 2, 1, 1, 3)
+ self.label_13 = QtGui.QLabel(self.SetupFaxGroupBox)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout9.addWidget(self.label_13, 3, 0, 1, 1)
+ self.FaxLocationLineEdit = QtGui.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 = QtGui.QSpacerItem(341, 16, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout7.addItem(spacerItem3, 4, 0, 1, 1)
+ self.SendTestPageCheckBox = QtGui.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 = QtGui.QWidget()
+ self.page_5.setObjectName("page_5")
+ self.gridlayout10 = QtGui.QGridLayout(self.page_5)
+ self.gridlayout10.setObjectName("gridlayout10")
+ self.label_15 = QtGui.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 = QtGui.QFrame(self.page_5)
+ self.line_4.setFrameShape(QtGui.QFrame.HLine)
+ self.line_4.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout10.addWidget(self.line_4, 1, 0, 1, 1)
+ self.RemoveDevicesTableWidget = QtGui.QTableWidget(self.page_5)
+ self.RemoveDevicesTableWidget.setAlternatingRowColors(True)
+ self.RemoveDevicesTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.RemoveDevicesTableWidget.setSelectionBehavior(QtGui.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 = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText, 1, 0, 1, 1)
+ spacerItem4 = QtGui.QSpacerItem(181, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem4, 1, 1, 1, 1)
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton, 1, 2, 1, 1)
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton, 1, 3, 1, 1)
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Device Discovery", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Connection (I/O) Type", None, QtGui.QApplication.UnicodeUTF8))
+ self.UsbRadioButton.setText(QtGui.QApplication.translate("Dialog", "Universal Serial Bus (USB)", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkRadioButton.setText(QtGui.QApplication.translate("Dialog", "Network/Ethernet/Wireless network (direct connection or JetDirect)", None, QtGui.QApplication.UnicodeUTF8))
+ self.ParallelRadioButton.setText(QtGui.QApplication.translate("Dialog", "Parallel Port (LPT)", None, QtGui.QApplication.UnicodeUTF8))
+ self.WirelessButton.setText(QtGui.QApplication.translate("Dialog", "Wireless/802.11 (requires a temporary USB connection and is only available for select devices)", None, QtGui.QApplication.UnicodeUTF8))
+ self.DiscoveryOptionsGroupBox.setTitle(QtGui.QApplication.translate("Dialog", "Discovery Options", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("Dialog", "Search term:", None, QtGui.QApplication.UnicodeUTF8))
+ self.DeviceTypeLabel.setText(QtGui.QApplication.translate("Dialog", "Type:", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkDiscoveryMethodLabel.setText(QtGui.QApplication.translate("Dialog", "Network discovery method:", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkDiscoveryMethodComboBox.setItemText(0, QtGui.QApplication.translate("Dialog", "SLP", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkDiscoveryMethodComboBox.setItemText(1, QtGui.QApplication.translate("Dialog", "mDNS/Bonjour", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkTimeoutLabel.setText(QtGui.QApplication.translate("Dialog", "Timeout:", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkTimeoutSpinBox.setSuffix(QtGui.QApplication.translate("Dialog", "sec", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworkTTLLabel.setText(QtGui.QApplication.translate("Dialog", "TTL:", None, QtGui.QApplication.UnicodeUTF8))
+ self.ManualGroupBox.setTitle(QtGui.QApplication.translate("Dialog", "Manual Discovery", None, QtGui.QApplication.UnicodeUTF8))
+ self.ManualParamLabel.setText(QtGui.QApplication.translate("Dialog", "Parameter:", None, QtGui.QApplication.UnicodeUTF8))
+ self.JetDirectLabel.setText(QtGui.QApplication.translate("Dialog", "Jetdirect port:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Select From Discovered Devices", None, QtGui.QApplication.UnicodeUTF8))
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesFoundLabel.setText(QtGui.QApplication.translate("Dialog", "Found %1 devices on the %1 bus.", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshButton.setText(QtGui.QApplication.translate("Dialog", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "Setup Device", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Printer Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Printer name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.translate("Dialog", "Description:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_8.setText(QtGui.QApplication.translate("Dialog", "Location:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("Dialog", "PPD file:", None, QtGui.QApplication.UnicodeUTF8))
+ self.SetupFaxGroupBox.setTitle(QtGui.QApplication.translate("Dialog", "Fax Setup", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_9.setText(QtGui.QApplication.translate("Dialog", "Fax name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_10.setText(QtGui.QApplication.translate("Dialog", "Fax number:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_11.setText(QtGui.QApplication.translate("Dialog", "Name/company:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_12.setText(QtGui.QApplication.translate("Dialog", "Description:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_13.setText(QtGui.QApplication.translate("Dialog", "Location:", None, QtGui.QApplication.UnicodeUTF8))
+ self.SendTestPageCheckBox.setText(QtGui.QApplication.translate("Dialog", "Send test page to printer", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_15.setText(QtGui.QApplication.translate("Dialog", "Select Printer/Fax Queues to Remove", None, QtGui.QApplication.UnicodeUTF8))
+ self.RemoveDevicesTableWidget.setSortingEnabled(False)
+ self.StepText.setText(QtGui.QApplication.translate("Dialog", "Step %1 of %2", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/setupdialog_base.ui b/ui4/setupdialog_base.ui
new file mode 100644
index 0000000..f486d99
--- /dev/null
+++ b/ui4/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="groupBox_3" >
+ <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/ui4/systemtray.py b/ui4/systemtray.py
new file mode 100644
index 0000000..9572689
--- /dev/null
+++ b/ui4/systemtray.py
@@ -0,0 +1,810 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2009 Hewlett-Packard 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 PyQt4.QtCore import *
+ from PyQt4.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
+ #import dbus.service
+ from dbus import SessionBus, lowlevel
+ #from dbus.mainloop.qt import DBusQtMainLoop
+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 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
+
+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]),
+ QString("%1 %2").arg(ess).arg(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, QApplication.UnicodeUTF8))
+
+
+
+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("%1 Printer (%2)").arg(self.model).arg(self.id)
+
+ elif back_end == 'hpaio':
+ self.device_type = DEVICE_TYPE_SCANNER
+ self.menu_text = self.__tr("%1 Scanner (%2)").arg(self.model).arg(self.id)
+
+ elif back_end == 'hpfax':
+ self.device_type = DEVICE_TYPE_FAX
+ self.menu_text = self.__tr("%1 Fax (%2)").arg(self.model).arg(self.id)
+
+ else:
+ self.device_type = DEVICE_TYPE_UNKNOWN
+ self.menu_text = self.__tr("%1 (%2)").arg(self.model).arg(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, QApplication.UnicodeUTF8)
+
+
+
+
+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.connect(self.StdButtons, SIGNAL("accepted()"), self.acceptClicked)
+ QObject.connect(self.StdButtons, SIGNAL("rejected()"), 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, QApplication.UnicodeUTF8)
+
+
+
+
+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.connect(self.tray_icon, SIGNAL("messageClicked()"), self.messageClicked)
+ notifier = QSocketNotifier(self.read_pipe, QSocketNotifier.Read)
+ QObject.connect(notifier, SIGNAL("activated(int)"), self.notifierActivated)
+ QObject.connect(self.tray_icon, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.trayActivated)
+ 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
+
+ self.handle_hplip_updation()
+ QTimer.singleShot(SET_MENU_DELAY, self.initDone)
+
+ self.timer = QTimer()
+ self.timer.connect(self.timer,SIGNAL("timeout()"),self.handle_hplip_updation)
+ self.timer.start(UPGRADE_CHECK_DELAY)
+
+
+
+ def initDone(self):
+ self.tray_icon.setIcon(self.prop_icon)
+ self.active_icon = False
+
+ self.setMenu()
+
+
+ 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_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')
+ 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')
+
+ 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))
+
+
+
+
+
+
+ def setMenu(self):
+ self.menu = QMenu()
+
+ title = QWidgetAction(self.menu)
+ #title.setDisabled(True)
+
+ hbox = QFrame(self.menu)
+ layout = QHBoxLayout(hbox)
+ layout.setMargin(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 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)])
+ while len(m) >= self.fmt_size:
+ event = device.Event(*struct.unpack(self.fmt, m[:self.fmt_size]))
+
+ m = m[self.fmt_size:]
+
+ 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:
+ 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 = QString(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("%1 Printer (%2)").arg(model).arg(idd)
+
+ elif back_end == 'hpaio':
+ d = self.__tr("%1 Scanner (%2)").arg(model).arg(idd)
+
+ elif back_end == 'hpfax':
+ d = self.__tr("%1 Fax (%2)").arg(model).arg(idd)
+
+ else:
+ d = self.__tr("%1 (%2)").arg(model).arg(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)" % (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)" % (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)
+ 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"),
+ QString("%1\n%2: %3\n(%4/%5)").\
+ arg(d).\
+ arg(desc).arg(event.title).\
+ arg(event.username).arg(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"),
+ QString("%1\n%2 (%3)").arg(d).\
+ arg(desc).arg(event.event_code),
+ icon, TRAY_MESSAGE_DELAY)
+
+ else:
+ break
+
+
+ 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, QApplication.UnicodeUTF8)
+
+
+
+def run(read_pipe):
+ log.set_module("hp-systray(qt4)")
+ log.debug("PID=%d" % os.getpid())
+
+ app = SystemTrayApp(sys.argv, read_pipe)
+ 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.UnicodeUTF8),
+ QApplication.translate("SystemTray", "HPLIP Status Service",
+ None, QApplication.UnicodeUTF8))
+ else:
+ notifier = QSocketNotifier(read_pipe, QSocketNotifier.Read)
+ QObject.connect(notifier, SIGNAL("activated(int)"), app.notifierActivated)
+
+ app.exec_()
+
+
diff --git a/ui4/systrayframe.py b/ui4/systrayframe.py
new file mode 100644
index 0000000..5ef8446
--- /dev/null
+++ b/ui4/systrayframe.py
@@ -0,0 +1,216 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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 PyQt4.QtCore import *
+from PyQt4.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"), QVariant(SYSTRAY_MESSAGES_SHOW_ALL))
+ self.MessageShowComboBox.addItem(self.__tr("Errors and Warnings"), QVariant(SYSTRAY_MESSAGES_SHOW_ERRORS_AND_WARNINGS))
+ self.MessageShowComboBox.addItem(self.__tr("Errors Only"), QVariant(SYSTRAY_MESSAGES_SHOW_ERRORS_ONLY))
+ self.MessageShowComboBox.addItem(self.__tr("None"), QVariant(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, QApplication.UnicodeUTF8))
+ self.groupBox_2.setTitle(QApplication.translate("self", "System tray icon visibility", None, QApplication.UnicodeUTF8))
+ self.ShowAlwaysRadioButton.setText(QApplication.translate("self", "Always show", None, QApplication.UnicodeUTF8))
+ self.HideWhenInactiveRadioButton.setText(QApplication.translate("self", "Hide when inactive", None, QApplication.UnicodeUTF8))
+ self.HideAlwaysRadioButton.setText(QApplication.translate("self", "Always hide", None, QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QApplication.translate("self", "System tray icon messages", None, QApplication.UnicodeUTF8))
+ self.label_2.setText(QApplication.translate("self", "Messages to show:", None, QApplication.UnicodeUTF8))
+ self.MonitorGroupBox.setTitle(QApplication.translate("self", "Monitor button presses on devices", None, QApplication.UnicodeUTF8))
+ self.label.setText(QApplication.translate("self", "Devices to monitor:", None, QApplication.UnicodeUTF8))
+
+
+ self.groupBox_4.setTitle(QApplication.translate("Dialog", "Update Settings", None, QApplication.UnicodeUTF8))
+ self.UpdatecheckBox.setText(QApplication.translate("Dialog", "Check and notify HPLIP updates", None, QApplication.UnicodeUTF8))
+ self.label_5.setText(QApplication.translate("Dialog", "Status:", None, QApplication.UnicodeUTF8))
+ self.textEdit.setPlainText(self.upgrade_msg)
+
+
+ self.connect(self.ShowAlwaysRadioButton, SIGNAL("clicked(bool)"), self.ShowAlwaysRadioButton_clicked)
+ self.connect(self.HideWhenInactiveRadioButton, SIGNAL("clicked(bool)"), self.HideWhenInactiveRadioButton_clicked)
+ self.connect(self.HideAlwaysRadioButton, SIGNAL("clicked(bool)"), self.HideAlwaysRadioButton_clicked)
+ self.connect(self.MessageShowComboBox, SIGNAL("activated(int)"), self.MessageShowComboBox_activated)
+ self.connect(self.UpdatecheckBox, SIGNAL("clicked(bool)"), 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))
+ if i != -1:
+ self.MessageShowComboBox.setCurrentIndex(i)
+
+
+ def MessageShowComboBox_activated(self, i):
+ sender = self.sender()
+ mode, ok = sender.itemData(i).toInt()
+ 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, QApplication.UnicodeUTF8)
+
diff --git a/ui4/systrayframe_base.py b/ui4/systrayframe_base.py
new file mode 100644
index 0000000..bfb1926
--- /dev/null
+++ b/ui4/systrayframe_base.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/systrayframe_base.ui'
+#
+# Created: Fri Jan 27 17:32:25 2012
+# by: PyQt4 UI code generator 4.7.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(476, 653)
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+ self.frame = QtGui.QFrame(Dialog)
+ self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.frame.setFrameShadow(QtGui.QFrame.Raised)
+ self.frame.setObjectName("frame")
+ self.groupBox_2 = QtGui.QGroupBox(self.frame)
+ self.groupBox_2.setGeometry(QtCore.QRect(11, 11, 201, 114))
+ self.groupBox_2.setObjectName("groupBox_2")
+ self.gridlayout1 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout1.setObjectName("gridlayout1")
+ self.radioButton = QtGui.QRadioButton(self.groupBox_2)
+ self.radioButton.setObjectName("radioButton")
+ self.gridlayout1.addWidget(self.radioButton, 0, 0, 1, 1)
+ self.radioButton_2 = QtGui.QRadioButton(self.groupBox_2)
+ self.radioButton_2.setObjectName("radioButton_2")
+ self.gridlayout1.addWidget(self.radioButton_2, 1, 0, 1, 1)
+ self.radioButton_3 = QtGui.QRadioButton(self.groupBox_2)
+ self.radioButton_3.setObjectName("radioButton_3")
+ self.gridlayout1.addWidget(self.radioButton_3, 2, 0, 1, 1)
+ self.groupBox_3 = QtGui.QGroupBox(self.frame)
+ self.groupBox_3.setGeometry(QtCore.QRect(232, 11, 197, 136))
+ self.groupBox_3.setObjectName("groupBox_3")
+ self.gridlayout2 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout2.setObjectName("gridlayout2")
+ self.label_2 = QtGui.QLabel(self.groupBox_3)
+ self.label_2.setObjectName("label_2")
+ self.gridlayout2.addWidget(self.label_2, 0, 0, 1, 1)
+ self.MessageShowComboBox = QtGui.QComboBox(self.groupBox_3)
+ self.MessageShowComboBox.setObjectName("MessageShowComboBox")
+ self.gridlayout2.addWidget(self.MessageShowComboBox, 1, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem, 2, 0, 1, 1)
+ self.groupBox = QtGui.QGroupBox(self.frame)
+ self.groupBox.setGeometry(QtCore.QRect(10, 385, 411, 241))
+ self.groupBox.setCheckable(True)
+ self.groupBox.setObjectName("groupBox")
+ self.gridlayout3 = QtGui.QGridLayout(self.groupBox)
+ self.gridlayout3.setObjectName("gridlayout3")
+ self.listWidget = QtGui.QListWidget(self.groupBox)
+ self.listWidget.setObjectName("listWidget")
+ self.gridlayout3.addWidget(self.listWidget, 4, 0, 1, 1)
+ self.label = QtGui.QLabel(self.groupBox)
+ self.label.setObjectName("label")
+ self.gridlayout3.addWidget(self.label, 3, 0, 1, 1)
+ self.groupBox_4 = QtGui.QGroupBox(self.frame)
+ self.groupBox_4.setGeometry(QtCore.QRect(10, 130, 411, 231))
+ self.groupBox_4.setObjectName("groupBox_4")
+ self.checkBox = QtGui.QCheckBox(self.groupBox_4)
+ self.checkBox.setGeometry(QtCore.QRect(20, 20, 331, 22))
+ self.checkBox.setChecked(True)
+ self.checkBox.setObjectName("checkBox")
+ self.label_3 = QtGui.QLabel(self.groupBox_4)
+ self.label_3.setGeometry(QtCore.QRect(50, 44, 221, 17))
+ self.label_3.setObjectName("label_3")
+ self.spinBox = QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_4.setGeometry(QtCore.QRect(329, 45, 67, 17))
+ self.label_4.setObjectName("label_4")
+ self.checkBox_2 = QtGui.QCheckBox(self.groupBox_4)
+ self.checkBox_2.setGeometry(QtCore.QRect(49, 78, 301, 22))
+ self.checkBox_2.setObjectName("checkBox_2")
+ self.textEdit = QtGui.QTextEdit(self.groupBox_4)
+ self.textEdit.setGeometry(QtCore.QRect(50, 129, 331, 81))
+ self.textEdit.setObjectName("textEdit")
+ self.label_5 = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "System tray icon visibility", None, QtGui.QApplication.UnicodeUTF8))
+ self.radioButton.setText(QtGui.QApplication.translate("Dialog", "Always show", None, QtGui.QApplication.UnicodeUTF8))
+ self.radioButton_2.setText(QtGui.QApplication.translate("Dialog", "Hide when inactive", None, QtGui.QApplication.UnicodeUTF8))
+ self.radioButton_3.setText(QtGui.QApplication.translate("Dialog", "Always hide", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "System tray icon messages", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("Dialog", "Which messages to show:", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Monitor button presses on devices", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Devices to monitor:", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_4.setTitle(QtGui.QApplication.translate("Dialog", "Update Settings", None, QtGui.QApplication.UnicodeUTF8))
+ self.checkBox.setText(QtGui.QApplication.translate("Dialog", "Check for HPLIP Updates", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("Dialog", "Repeat Check for Updates every ", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Days", None, QtGui.QApplication.UnicodeUTF8))
+ self.checkBox_2.setText(QtGui.QApplication.translate("Dialog", "Check when ever new version available", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "Status:", None, QtGui.QApplication.UnicodeUTF8))
+
diff --git a/ui4/systrayframe_base.ui b/ui4/systrayframe_base.ui
new file mode 100644
index 0000000..68e2d0d
--- /dev/null
+++ b/ui4/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/ui4/ui_utils.py b/ui4/ui_utils.py
new file mode 100644
index 0000000..c6f4534
--- /dev/null
+++ b/ui4/ui_utils.py
@@ -0,0 +1,553 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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 os.path
+import re
+import os
+import time
+
+# Local
+from base.g import *
+from base.codes import *
+from base import utils
+from prnt import cups
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+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, QApplication.UnicodeUTF8)
+
+
+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:
+ dir = prop.image_dir
+ ldir = os.path.join(os.getcwd(), 'data', 'images')
+ else:
+ dir = os.path.join(prop.image_dir, subdir)
+ ldir = os.path.join(os.getcwd(), 'data', 'images', subdir)
+
+ for d in [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(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)
+
+
+
+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")
+ i, ok = self.value("systray_visible").toInt()
+ if ok:
+ self.systray_visible = i
+
+ i, ok = self.value("systray_messages").toInt()
+ if ok:
+ self.systray_messages = i
+
+ self.endGroup()
+
+ self.beginGroup("last_used")
+ self.last_used_device_uri = unicode(self.value("device_uri").toString()) or self.last_used_device_uri
+ self.last_used_printer = unicode(self.value("printer_name").toString()) or self.last_used_printer
+ self.working_dir = unicode(self.value("working_dir").toString()) or self.working_dir
+ self.endGroup()
+
+ self.beginGroup("commands")
+ self.cmd_scan = unicode(self.value("scan").toString()) or self.cmd_scan
+ self.endGroup()
+
+ self.beginGroup("refresh")
+ self.auto_refresh_rate = int(self.value("rate").toString() or self.auto_refresh_rate)
+ self.auto_refresh = bool(self.value("enable").toBool())
+ self.auto_refresh_type = int(self.value("type").toString() or self.auto_refresh_type)
+ self.endGroup()
+
+ self.beginGroup("installation")
+ self.version = unicode(self.value("version").toString())
+ self.date_time = unicode(self.value("date_time").toString())
+ self.endGroup()
+
+ self.beginGroup("polling")
+ self.polling = bool(self.value("enable").toBool())
+ self.polling_interval = int(self.value("interval").toString() or self.polling_interval)
+ self.polling_device_list = unicode(self.value("device_list").toString() or '').split(u',')
+ self.endGroup()
+
+ self.beginGroup("fax")
+ self.voice_phone = unicode(self.value("voice_phone").toString())
+ self.email_address = unicode(self.value("email_address").toString())
+ self.endGroup()
+
+ self.beginGroup("upgrade")
+ self.upgrade_notify= bool(self.value("notify_upgrade").toBool())
+ self.latest_available_version=str(self.value("latest_available_version").toString())
+
+ i, Ok = self.value("last_upgraded_time").toInt()
+ if Ok and i >0:
+ self.upgrade_last_update_time =i
+ else:
+ self.upgrade_last_update_time = 0
+
+ i, Ok = self.value("pending_upgrade_time").toInt()
+ if Ok and i >0 :
+ self.upgrade_pending_update_time = i
+ else:
+ self.upgrade_pending_update_time = 0
+
+ self.endGroup()
+
+
+ def save(self):
+ log.debug("Saving user settings...")
+
+ self.beginGroup("settings")
+ self.setValue("systray_visible", QVariant(self.systray_visible))
+ self.setValue("systray_messages", QVariant(self.systray_messages))
+ self.endGroup()
+
+ self.beginGroup("last_used")
+ self.setValue("device_uri", QVariant(self.last_used_device_uri))
+ self.setValue("printer_name", QVariant(self.last_used_printer))
+ self.setValue("working_dir", QVariant(self.working_dir))
+ self.endGroup()
+
+ self.beginGroup("commands")
+ self.setValue("scan", QVariant(self.cmd_scan))
+ self.endGroup()
+
+ self.beginGroup("refresh")
+ self.setValue("rate", QVariant(self.auto_refresh_rate))
+ self.setValue("enable", QVariant(self.auto_refresh))
+ self.setValue("type", QVariant(self.auto_refresh_type))
+ self.endGroup()
+
+ self.beginGroup("polling")
+ self.setValue("enable", QVariant(self.polling))
+ self.setValue("interval", QVariant(self.polling_interval))
+ self.setValue("device_list", QVariant(u','.join(self.polling_device_list)))
+ self.endGroup()
+
+ self.beginGroup("fax")
+ self.setValue("voice_phone", QVariant(self.voice_phone))
+ self.setValue("email_address", QVariant(self.email_address))
+ self.endGroup()
+
+ self.beginGroup("upgrade")
+ self.setValue("notify_upgrade", QVariant(self.upgrade_notify))
+ if self.upgrade_last_update_time <1:
+ self.upgrade_last_update_time = time.time() # <---Need to verify code once
+
+ self.setValue("last_upgraded_time", QVariant(self.upgrade_last_update_time))
+ self.setValue("pending_upgrade_time", QVariant(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(' ', 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(' ', 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(' ', 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, pos):
+ input = unicode(input)
+
+ if not input:
+ return QValidator.Acceptable, pos
+
+ if input[pos-1] in cups.INVALID_PRINTER_NAME_CHARS:
+ return QValidator.Invalid, pos
+
+ # TODO: How to determine if unicode char is "printable" and acceptable
+ # to CUPS?
+ #elif input != utils.printable(input):
+ # return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, pos
+
+
+
+class PhoneNumValidator(QValidator):
+ def __init__(self, parent=None):
+ QValidator.__init__(self, parent)
+
+ def validate(self, input, pos):
+ input = unicode(input)
+
+ if not input:
+ return QValidator.Acceptable, pos
+
+ if input[pos-1] not in u'0123456789-(+).,#* ':
+ return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, pos
+
+
+class AddressBookNameValidator(QValidator):
+ def __init__(self, db, parent=None):
+ QValidator.__init__(self, parent)
+ self.db = db
+
+ def validate(self, input, pos):
+ input = unicode(input)
+
+ if not input:
+ return QValidator.Acceptable, pos
+
+ if input in self.db.get_all_names():
+ return QValidator.Invalid, pos
+
+ if input[pos-1] in u'''|\\/"''': # | is the drag 'n drop separator
+ return QValidator.Invalid, pos
+
+ return QValidator.Acceptable, 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("(%1 ago)").arg(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 = unicode(amount)
+
+ if amount == 1:
+ i18n_unit = UNIT_NAMES[unit_name][0]
+ else:
+ i18n_unit = UNIT_NAMES[unit_name][1]
+
+ return QString("%1 %2").arg(i18n_amount).arg(i18n_unit)
+
+
diff --git a/ui4/upgradedialog.py b/ui4/upgradedialog.py
new file mode 100644
index 0000000..c747ff3
--- /dev/null
+++ b/ui4/upgradedialog.py
@@ -0,0 +1,127 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2011 Hewlett-Packard 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
+
+# Local
+from base.g import *
+from base import device, utils, pkit
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.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.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+ self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+# self.connect (self.comboBox, SIGNAL ("currentIndexChanged (const QString&)"), self.slotIndexChanged)
+ self.connect(self.installRadioBtton, SIGNAL("toggled(bool)"), self.installRadioBtton_toggled)
+ self.connect(self.remindRadioBtton, SIGNAL("toggled(bool)"), self.remindRadioBtton_toggled)
+ self.connect(self.dontRemindRadioBtton, SIGNAL("toggled(bool)"), self.dontRemindRadioBtton_toggled)
+
+ # 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'"
+ log.debug("cmd = %s " %cmd)
+ os.system(cmd)
+ self.result = True
+ else:
+ log.error("Failed to run hp-upgrade command from terminal =%s "%terminal_cmd)
+ ErrorUI(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/ui4/upgradedialog_base.py b/ui4/upgradedialog_base.py
new file mode 100644
index 0000000..2486f55
--- /dev/null
+++ b/ui4/upgradedialog_base.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'upgradedialog_base.ui'
+#
+# Created: Thu Feb 9 18:16:03 2012
+# by: PyQt4 UI code generator 4.7.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog, distro_tier,msg):
+ self.distro_tier = distro_tier
+ self.msg= msg
+ Dialog.setObjectName("Dialog")
+ Dialog.resize(369, 205)
+ self.centralwidget = QtGui.QWidget(Dialog)
+ self.centralwidget.setObjectName("centralwidget")
+ self.MainLabel = QtGui.QLabel(self.centralwidget)
+ self.MainLabel.setGeometry(QtCore.QRect(10, 10, 351, 51))
+ self.MainLabel.setObjectName("MainLabel")
+ self.installRadioBtton = QtGui.QRadioButton(self.centralwidget)
+ self.installRadioBtton.setGeometry(QtCore.QRect(10, 65, 350, 22))
+ self.installRadioBtton.setChecked(True)
+ self.installRadioBtton.setObjectName("installRadioBtton")
+ self.remindRadioBtton = QtGui.QRadioButton(self.centralwidget)
+ self.remindRadioBtton.setGeometry(QtCore.QRect(10, 96, 141, 22))
+ self.remindRadioBtton.setObjectName("remindRadioBtton")
+ self.dontRemindRadioBtton = QtGui.QRadioButton(self.centralwidget)
+ self.dontRemindRadioBtton.setGeometry(QtCore.QRect(10, 126, 161, 22))
+ self.dontRemindRadioBtton.setObjectName("dontRemindRadioBtton")
+ self.daysSpinBox = QtGui.QSpinBox(self.centralwidget)
+ self.daysSpinBox.setGeometry(QtCore.QRect(152, 94, 55, 27))
+ self.daysSpinBox.setMinimum(1)
+ self.daysSpinBox.setMaximum(365)
+ self.daysSpinBox.setEnabled(False)
+ self.daysSpinBox.setObjectName("daysSpinBox")
+ self.DaysLabel = QtGui.QLabel(self.centralwidget)
+ self.DaysLabel.setGeometry(QtCore.QRect(211, 98, 67, 21))
+ self.DaysLabel.setObjectName("DaysLabel")
+ self.CancelButton = QtGui.QPushButton(self.centralwidget)
+ self.CancelButton.setGeometry(QtCore.QRect(270, 160, 91, 31))
+ self.CancelButton.setObjectName("CancelButton")
+ self.NextButton = QtGui.QPushButton(self.centralwidget)
+ self.NextButton.setGeometry(QtCore.QRect(159, 160, 96, 31))
+ self.NextButton.setObjectName("NextButton")
+ self.retranslateUi(Dialog)
+ QtCore.QMetaObject.connectSlotsByName(Dialog)
+
+ def retranslateUi(self, Dialog):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Upgrade Manager", None, QtGui.QApplication.UnicodeUTF8))
+ self.MainLabel.setText(QtGui.QApplication.translate("Dialog", self.msg, None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Ok", None, QtGui.QApplication.UnicodeUTF8))
+ if self.distro_tier == 1:
+ self.installRadioBtton.setText(QtGui.QApplication.translate("Dialog", "Download and Install", None, QtGui.QApplication.UnicodeUTF8))
+ else:
+ self.installRadioBtton.setText(QtGui.QApplication.translate("Dialog", "Follow steps from www.hplip.net", None, QtGui.QApplication.UnicodeUTF8))
+ self.remindRadioBtton.setText(QtGui.QApplication.translate("Dialog", "Remind me after", None, QtGui.QApplication.UnicodeUTF8))
+ self.dontRemindRadioBtton.setText(QtGui.QApplication.translate("Dialog", "Don\'t remind again", None, QtGui.QApplication.UnicodeUTF8))
+ self.DaysLabel.setText(QtGui.QApplication.translate("Dialog", "days", None, QtGui.QApplication.UnicodeUTF8))
diff --git a/ui4/upgradedialog_base.ui b/ui4/upgradedialog_base.ui
new file mode 100644
index 0000000..1573752
--- /dev/null
+++ b/ui4/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/ui4/wifisetupdialog.py b/ui4/wifisetupdialog.py
new file mode 100644
index 0000000..95ea617
--- /dev/null
+++ b/ui4/wifisetupdialog.py
@@ -0,0 +1,839 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2009 Hewlett-Packard 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, models, wifi, LedmWifi
+from base.codes import *
+from ui_utils import *
+
+# Qt
+from PyQt4.QtCore import *
+from PyQt4.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):
+ 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.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
+ self.connect(self.BackButton, SIGNAL("clicked()"), self.BackButton_clicked)
+ self.connect(self.NextButton, SIGNAL("clicked()"), self.NextButton_clicked)
+
+ 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.connect(self.RefreshButton, SIGNAL("clicked()"), 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)}
+
+ 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>%1 wireless capable devices found.</b> Select the device to install and click <i>Next</i> to continue.").arg(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(QString(model_ui), d)
+ i.setFlags(flags)
+ self.DevicesTableWidget.setItem(row, 0, i)
+
+ i = QTableWidgetItem(QString(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.connect(self.ShowExtendedCheckBox, SIGNAL("clicked(bool)"), self.ShowExtendedCheckBox_clicked)
+ self.connect(self.SearchPushButton, SIGNAL("clicked()"), self.SearchPushButton_clicked)
+ self.connect(self.UndirectedRadioButton, SIGNAL("clicked(bool)"), self.UndirectedRadioButton_clicked)
+ self.connect(self.DirectedRadioButton, SIGNAL("clicked(bool)"), self.DirectedRadioButton_clicked)
+ self.connect(self.NetworksTableWidget, SIGNAL("itemSelectionChanged()"), self.NetworksTableWidget_itemSelectionChanged)
+
+
+ def showNetworkPage(self):
+ if self.dev is None:
+ try:
+ self.dev = device.Device(self.device_uri)
+ except Error, e:
+ FailureUI(self, self.__tr("<b>Error opening device:</b><p>%1</p><p>(%2)</p>").arg(self.device_uri).arg(QString(e[0])))
+
+ if self.dev is not None:
+ self.dev.close()
+
+ self.close()
+ return
+
+ self.networks.clear()
+ self.num_networks = 0
+
+ try:
+ self.adaptor_id, self.adapterName, state, presence = self.wifiObj.getWifiAdaptorID(self.dev)
+ except Error, e:
+ self.showIOError(e)
+ return
+
+ 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)
+
+ if self.adaptor_id == -1:
+ 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.wifiObj.setAdaptorPower(self.dev, self.adapterName, self.adaptor_id)
+ except Error, e:
+ self.showIOError(e)
+ return
+
+ self.performScan()
+ self.setNextButton(BUTTON_NEXT)
+ self.displayPage(PAGE_NETWORK)
+
+
+ def performScan(self):
+ beginWaitCursor()
+ error = False
+ try:
+ self.ssid = unicode(self.SSIDLineEdit.text())
+ if self.directed and self.ssid:
+ try:
+ self.networks = self.wifiObj.performScan(self.dev, self.adapterName, self.ssid)
+ except Error, e:
+ self.showIOError(e)
+ return
+ else:
+ try:
+ self.networks = self.wifiObj.performScan(self.dev, self.adapterName)
+ except Error, 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>%1 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.").arg(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, u''
+ if self.num_networks:
+ beginWaitCursor()
+ try:
+ if self.show_extended:
+ for n in xrange(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 xrange(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(QString(name))
+ if flags is not None: i.setFlags(flags)
+ i.setData(Qt.UserRole, QVariant(n))
+ self.NetworksTableWidget.setItem(n, 0, i)
+
+ pixmap = load_pixmap('signal%d' % ss, 'other')
+ if self.show_extended:
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr("%1/5 (%2 dBm)").arg(ss).arg(dbm))
+ else:
+ i = QTableWidgetItem(QIcon(pixmap), self.__tr("%1/5").arg(ss))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 1, i)
+
+ i = QTableWidgetItem(QString(sec))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 2, i)
+
+ i = QTableWidgetItem(QString(mode))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 3, i)
+
+ if self.show_extended:
+ i = QTableWidgetItem(QString(str(chn)))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 4, i)
+
+ i = QTableWidgetItem(QString(bssid))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 5, i)
+
+ i = QTableWidgetItem(QString(address))
+ if flags is not None: i.setFlags(flags)
+ self.NetworksTableWidget.setItem(n, 6, i)
+
+ i = QTableWidgetItem(QString("%1/%2").arg(lat).arg(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)
+ self.NetworksTableWidget.emit(SIGNAL("itemSelectionChanged()"))
+
+ 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 = item.data(Qt.UserRole).toInt()
+ 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.connect(self.ShowKeyCheckBox, SIGNAL("toggled(bool)"), 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(QString())
+ 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.connect(self.PageSpinBox, SIGNAL("valueChanged(int)"), self.PageSpinBox_valueChanged)
+ self.RefreshTimer = QTimer(self)
+ self.connect(self.RefreshTimer, SIGNAL('timeout()'), 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(QString(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, 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 %1 seconds.<p>If your printer fails to connect within a reasonable time, there may be a problem with your configuration.").arg(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.RefreshTimer.start(REFRESH_INTERVAL * 1000)
+
+ else: # SUCCESS_CONNECTED
+ if self.standalone:
+ 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.</pre>"), load_pixmap('info', '16x16')))
+ else:
+ self.pages.append((self.__tr("Your printer has been successfully configured on the wireless network. You may now unplug the USB cable."), 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(QString(addressmode))
+
+ if self.hn is None:
+ self.HostnameLabel.setText(self.__tr("Unknown"))
+ else:
+ self.HostnameLabel.setText(QString(self.hn))
+
+ self.IPAddressLabel.setText(QString(self.ip))
+ self.GatewayLabel.setText(QString(gateway))
+ self.DNSLabel.setText(QString(pridns))
+ self.NextButton.setEnabled(True)
+
+ self.SignalStrengthLabel.setText(QString("%1/%2 (%3 dBm)").arg(ss_val).arg(ss_max).arg(ss_dbm))
+ self.SignalStrengthIcon.setPixmap(load_pixmap('signal%d' % ss_val, 'other'))
+
+ for c, s in vsa_codes:
+ 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 %1").arg(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=u''):
+ beginWaitCursor()
+ try:
+ try:
+ alg, mode, secretid = self.wifiObj.getCryptoSuite(self.dev, self.adapterName)
+ except Error, e:
+ self.showIOError(e)
+ return
+
+ log.debug("Crypto algorithm: %s" % alg)
+ log.debug("Crypto mode: %s" % mode)
+ finally:
+ endWaitCursor()
+
+ beginWaitCursor()
+ try:
+ try:
+ ret = self.wifiObj.associate(self.dev, self.adapterName, self.network, self.mode, self.security, key)
+ except Error, 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 = unicode(i.text())
+ log.debug("Selected network SSID: %s" % self.network)
+ self.n, ok = i.data(Qt.UserRole).toInt()
+ 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 = 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 %1 of %2").arg(p+1).arg(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>(%1)").arg(QString(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/ui4/wifisetupdialog_base.py b/ui4/wifisetupdialog_base.py
new file mode 100644
index 0000000..868404c
--- /dev/null
+++ b/ui4/wifisetupdialog_base.py
@@ -0,0 +1,722 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui4/wifisetupdialog_base.ui'
+#
+# Created: Thu May 28 11:00:20 2009
+# by: PyQt4 UI code generator 4.3.3
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_Dialog(object):
+ def setupUi(self, Dialog):
+ Dialog.setObjectName("Dialog")
+ Dialog.setWindowModality(QtCore.Qt.ApplicationModal)
+ Dialog.resize(QtCore.QSize(QtCore.QRect(0,0,700,500).size()).expandedTo(Dialog.minimumSizeHint()))
+
+ self.gridlayout = QtGui.QGridLayout(Dialog)
+ self.gridlayout.setObjectName("gridlayout")
+
+ self.StackedWidget = QtGui.QStackedWidget(Dialog)
+ self.StackedWidget.setFrameShape(QtGui.QFrame.NoFrame)
+ self.StackedWidget.setObjectName("StackedWidget")
+
+ self.DiscoveryPage = QtGui.QWidget()
+ self.DiscoveryPage.setObjectName("DiscoveryPage")
+
+ self.gridlayout1 = QtGui.QGridLayout(self.DiscoveryPage)
+ self.gridlayout1.setObjectName("gridlayout1")
+
+ self.label = QtGui.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 = QtGui.QFrame(self.DiscoveryPage)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridlayout1.addWidget(self.line,1,0,1,3)
+
+ self.MainTitleLabel = QtGui.QLabel(self.DiscoveryPage)
+ self.MainTitleLabel.setTextFormat(QtCore.Qt.RichText)
+ self.MainTitleLabel.setWordWrap(True)
+ self.MainTitleLabel.setObjectName("MainTitleLabel")
+ self.gridlayout1.addWidget(self.MainTitleLabel,2,0,1,3)
+
+ spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem,3,1,1,1)
+
+ spacerItem1 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem1,4,0,1,1)
+
+ self.Picture = QtGui.QLabel(self.DiscoveryPage)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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.setObjectName("Picture")
+ self.gridlayout1.addWidget(self.Picture,4,1,1,1)
+
+ spacerItem2 = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout1.addItem(spacerItem2,4,2,1,1)
+
+ spacerItem3 = QtGui.QSpacerItem(664,61,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout1.addItem(spacerItem3,5,0,1,3)
+
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+
+ self.InfoIcon = QtGui.QLabel(self.DiscoveryPage)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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.setObjectName("InfoIcon")
+ self.hboxlayout.addWidget(self.InfoIcon)
+
+ self.label_14 = QtGui.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 = QtGui.QWidget()
+ self.page_2.setObjectName("page_2")
+
+ self.gridlayout2 = QtGui.QGridLayout(self.page_2)
+ self.gridlayout2.setObjectName("gridlayout2")
+
+ self.label_4 = QtGui.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 = QtGui.QFrame(self.page_2)
+ self.line_2.setFrameShape(QtGui.QFrame.HLine)
+ self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_2.setObjectName("line_2")
+ self.gridlayout2.addWidget(self.line_2,1,0,1,3)
+
+ self.DevicesTableWidget = QtGui.QTableWidget(self.page_2)
+ self.DevicesTableWidget.setAlternatingRowColors(True)
+ self.DevicesTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.DevicesTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.DevicesTableWidget.setSortingEnabled(False)
+ self.DevicesTableWidget.setObjectName("DevicesTableWidget")
+ self.gridlayout2.addWidget(self.DevicesTableWidget,2,0,1,3)
+
+ self.hboxlayout1 = QtGui.QHBoxLayout()
+ self.hboxlayout1.setObjectName("hboxlayout1")
+
+ self.DevicesFoundIcon = QtGui.QLabel(self.page_2)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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(QtGui.QFrame.NoFrame)
+ self.DevicesFoundIcon.setObjectName("DevicesFoundIcon")
+ self.hboxlayout1.addWidget(self.DevicesFoundIcon)
+
+ self.DevicesFoundLabel = QtGui.QLabel(self.page_2)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.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 = QtGui.QSpacerItem(21,28,QtGui.QSizePolicy.Preferred,QtGui.QSizePolicy.Minimum)
+ self.gridlayout2.addItem(spacerItem4,3,1,1,1)
+
+ self.RefreshButton = QtGui.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 = QtGui.QWidget()
+ self.page_3.setObjectName("page_3")
+
+ self.gridlayout3 = QtGui.QGridLayout(self.page_3)
+ self.gridlayout3.setObjectName("gridlayout3")
+
+ self.label_5 = QtGui.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 = QtGui.QFrame(self.page_3)
+ self.line_3.setFrameShape(QtGui.QFrame.HLine)
+ self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_3.setObjectName("line_3")
+ self.gridlayout3.addWidget(self.line_3,1,0,1,1)
+
+ self.groupBox_3 = QtGui.QGroupBox(self.page_3)
+ self.groupBox_3.setObjectName("groupBox_3")
+
+ self.gridlayout4 = QtGui.QGridLayout(self.groupBox_3)
+ self.gridlayout4.setObjectName("gridlayout4")
+
+ self.UndirectedRadioButton = QtGui.QRadioButton(self.groupBox_3)
+ self.UndirectedRadioButton.setChecked(True)
+ self.UndirectedRadioButton.setObjectName("UndirectedRadioButton")
+ self.gridlayout4.addWidget(self.UndirectedRadioButton,0,0,1,3)
+
+ self.DirectedRadioButton = QtGui.QRadioButton(self.groupBox_3)
+ self.DirectedRadioButton.setObjectName("DirectedRadioButton")
+ self.gridlayout4.addWidget(self.DirectedRadioButton,1,0,1,2)
+
+ self.SSIDLineEdit = QtGui.QLineEdit(self.groupBox_3)
+ self.SSIDLineEdit.setEnabled(False)
+ self.SSIDLineEdit.setObjectName("SSIDLineEdit")
+ self.gridlayout4.addWidget(self.SSIDLineEdit,1,2,1,1)
+
+ self.SearchPushButton = QtGui.QPushButton(self.groupBox_3)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum,QtGui.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 = QtGui.QSpacerItem(521,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout4.addItem(spacerItem5,2,1,1,2)
+ self.gridlayout3.addWidget(self.groupBox_3,2,0,1,1)
+
+ self.SelectSSIDGroupBox = QtGui.QGroupBox(self.page_3)
+ self.SelectSSIDGroupBox.setCheckable(False)
+ self.SelectSSIDGroupBox.setObjectName("SelectSSIDGroupBox")
+
+ self.gridlayout5 = QtGui.QGridLayout(self.SelectSSIDGroupBox)
+ self.gridlayout5.setObjectName("gridlayout5")
+
+ spacerItem6 = QtGui.QSpacerItem(421,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout5.addItem(spacerItem6,0,0,1,2)
+
+ self.ShowExtendedCheckBox = QtGui.QCheckBox(self.SelectSSIDGroupBox)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Maximum,QtGui.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 = QtGui.QTableWidget(self.SelectSSIDGroupBox)
+ self.NetworksTableWidget.setAlternatingRowColors(True)
+ self.NetworksTableWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
+ self.NetworksTableWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
+ self.NetworksTableWidget.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerItem)
+ self.NetworksTableWidget.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
+ self.NetworksTableWidget.setObjectName("NetworksTableWidget")
+ self.gridlayout5.addWidget(self.NetworksTableWidget,1,0,1,3)
+
+ self.NetworksFoundIcon = QtGui.QLabel(self.SelectSSIDGroupBox)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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(QtGui.QFrame.NoFrame)
+ self.NetworksFoundIcon.setObjectName("NetworksFoundIcon")
+ self.gridlayout5.addWidget(self.NetworksFoundIcon,2,0,1,1)
+
+ self.NetworksFoundLabel = QtGui.QLabel(self.SelectSSIDGroupBox)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.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 = QtGui.QWidget()
+ self.page_5.setObjectName("page_5")
+
+ self.gridlayout6 = QtGui.QGridLayout(self.page_5)
+ self.gridlayout6.setObjectName("gridlayout6")
+
+ self.label_15 = QtGui.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 = QtGui.QFrame(self.page_5)
+ self.line_4.setFrameShape(QtGui.QFrame.HLine)
+ self.line_4.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_4.setObjectName("line_4")
+ self.gridlayout6.addWidget(self.line_4,1,0,1,2)
+
+ self.hboxlayout2 = QtGui.QHBoxLayout()
+ self.hboxlayout2.setObjectName("hboxlayout2")
+
+ self.label_3 = QtGui.QLabel(self.page_5)
+ self.label_3.setObjectName("label_3")
+ self.hboxlayout2.addWidget(self.label_3)
+
+ self.SSIDLabel = QtGui.QLabel(self.page_5)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QLabel(self.page_5)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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.setObjectName("StrengthIcon")
+ self.hboxlayout2.addWidget(self.StrengthIcon)
+ self.gridlayout6.addLayout(self.hboxlayout2,2,0,1,2)
+
+ spacerItem7 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem7,3,1,1,1)
+
+ self.groupBox = QtGui.QGroupBox(self.page_5)
+ self.groupBox.setObjectName("groupBox")
+
+ self.gridlayout7 = QtGui.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 = QtGui.QGroupBox(self.page_5)
+ self.groupBox_2.setObjectName("groupBox_2")
+
+ self.gridlayout8 = QtGui.QGridLayout(self.groupBox_2)
+ self.gridlayout8.setObjectName("gridlayout8")
+
+ self.label_6 = QtGui.QLabel(self.groupBox_2)
+ self.label_6.setObjectName("label_6")
+ self.gridlayout8.addWidget(self.label_6,0,0,1,1)
+
+ self.KeyLineEdit = QtGui.QLineEdit(self.groupBox_2)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.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 = QtGui.QLabel(self.groupBox_2)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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(QtGui.QFrame.NoFrame)
+ self.KeysIcon.setObjectName("KeysIcon")
+ self.gridlayout8.addWidget(self.KeysIcon,0,2,1,1)
+
+ self.ShowKeyCheckBox = QtGui.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 = QtGui.QSpacerItem(638,81,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout6.addItem(spacerItem8,6,1,1,1)
+
+ self.ConfigureIcon = QtGui.QLabel(self.page_5)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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.setObjectName("ConfigureIcon")
+ self.gridlayout6.addWidget(self.ConfigureIcon,7,0,1,1)
+
+ self.label_7 = QtGui.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 = QtGui.QWidget()
+ self.page.setObjectName("page")
+
+ self.gridlayout9 = QtGui.QGridLayout(self.page)
+ self.gridlayout9.setObjectName("gridlayout9")
+
+ self.label_16 = QtGui.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 = QtGui.QFrame(self.page)
+ self.line_5.setFrameShape(QtGui.QFrame.HLine)
+ self.line_5.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line_5.setObjectName("line_5")
+ self.gridlayout9.addWidget(self.line_5,1,0,1,1)
+
+ self.groupBox_4 = QtGui.QGroupBox(self.page)
+ self.groupBox_4.setObjectName("groupBox_4")
+
+ self.gridlayout10 = QtGui.QGridLayout(self.groupBox_4)
+ self.gridlayout10.setObjectName("gridlayout10")
+
+ self.label_8 = QtGui.QLabel(self.groupBox_4)
+ self.label_8.setObjectName("label_8")
+ self.gridlayout10.addWidget(self.label_8,0,0,1,1)
+
+ self.SSIDLabel_2 = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QHBoxLayout()
+ self.hboxlayout3.setObjectName("hboxlayout3")
+
+ self.SignalStrengthIcon = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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 = QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_9.setObjectName("label_9")
+ self.gridlayout10.addWidget(self.label_9,1,0,1,1)
+
+ self.AddressModeLabel = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_12.setObjectName("label_12")
+ self.gridlayout10.addWidget(self.label_12,2,0,1,1)
+
+ self.HostnameLabel = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_10.setObjectName("label_10")
+ self.gridlayout10.addWidget(self.label_10,3,0,1,1)
+
+ self.IPAddressLabel = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_11.setObjectName("label_11")
+ self.gridlayout10.addWidget(self.label_11,4,0,1,1)
+
+ self.GatewayLabel = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QLabel(self.groupBox_4)
+ self.label_13.setObjectName("label_13")
+ self.gridlayout10.addWidget(self.label_13,5,0,1,1)
+
+ self.DNSLabel = QtGui.QLabel(self.groupBox_4)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QGroupBox(self.page)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,QtGui.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 = QtGui.QGridLayout(self.groupBox_5)
+ self.gridlayout11.setObjectName("gridlayout11")
+
+ self.ExitIcon = QtGui.QLabel(self.groupBox_5)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,QtGui.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(QtGui.QFrame.NoFrame)
+ self.ExitIcon.setObjectName("ExitIcon")
+ self.gridlayout11.addWidget(self.ExitIcon,0,0,1,1)
+
+ self.ExitLabel = QtGui.QLabel(self.groupBox_5)
+
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.ExitLabel.sizePolicy().hasHeightForWidth())
+ self.ExitLabel.setSizePolicy(sizePolicy)
+ self.ExitLabel.setFrameShape(QtGui.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 = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout11.addItem(spacerItem9,1,0,1,1)
+
+ spacerItem10 = QtGui.QSpacerItem(501,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout11.addItem(spacerItem10,2,0,1,2)
+
+ self.hboxlayout4 = QtGui.QHBoxLayout()
+ self.hboxlayout4.setObjectName("hboxlayout4")
+
+ self.PageLabel2 = QtGui.QLabel(self.groupBox_5)
+ self.PageLabel2.setObjectName("PageLabel2")
+ self.hboxlayout4.addWidget(self.PageLabel2)
+
+ self.PageSpinBox = QtGui.QSpinBox(self.groupBox_5)
+ self.PageSpinBox.setMinimum(1)
+ self.PageSpinBox.setObjectName("PageSpinBox")
+ self.hboxlayout4.addWidget(self.PageSpinBox)
+
+ self.PageLabel = QtGui.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 = QtGui.QSpacerItem(664,20,QtGui.QSizePolicy.Minimum,QtGui.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 = QtGui.QLabel(Dialog)
+ self.StepText.setObjectName("StepText")
+ self.gridlayout.addWidget(self.StepText,1,0,1,1)
+
+ spacerItem12 = QtGui.QSpacerItem(181,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum)
+ self.gridlayout.addItem(spacerItem12,1,1,1,1)
+
+ self.BackButton = QtGui.QPushButton(Dialog)
+ self.BackButton.setObjectName("BackButton")
+ self.gridlayout.addWidget(self.BackButton,1,2,1,1)
+
+ self.NextButton = QtGui.QPushButton(Dialog)
+ self.NextButton.setObjectName("NextButton")
+ self.gridlayout.addWidget(self.NextButton,1,3,1,1)
+
+ self.CancelButton = QtGui.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):
+ Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "HP Device Manager - Wifi Configuration", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("Dialog", "Wireless (Wifi/802.11) Configuration", None, QtGui.QApplication.UnicodeUTF8))
+ self.MainTitleLabel.setText(QtGui.QApplication.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=\"-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;\"><span style=\" font-style:italic;\">Note: This configuration utility does not setup (install) your printer on this computer. Use hp-setup to setup your printer once it has been configured on the network by this utility.</span></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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_14.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("Dialog", "Select From Discovered Wireless Capable Devices", None, QtGui.QApplication.UnicodeUTF8))
+ self.DevicesTableWidget.clear()
+ self.DevicesTableWidget.setColumnCount(0)
+ self.DevicesTableWidget.setRowCount(0)
+ self.DevicesFoundLabel.setText(QtGui.QApplication.translate("Dialog", "Found 0 wireless capable devices on the USB bus.", None, QtGui.QApplication.UnicodeUTF8))
+ self.RefreshButton.setText(QtGui.QApplication.translate("Dialog", "Refresh", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("Dialog", "Find and Select a Wireless Network", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Find Wireless Network", None, QtGui.QApplication.UnicodeUTF8))
+ self.UndirectedRadioButton.setText(QtGui.QApplication.translate("Dialog", "Search for wireless networks automatically", None, QtGui.QApplication.UnicodeUTF8))
+ self.DirectedRadioButton.setText(QtGui.QApplication.translate("Dialog", "Enter the name (SSID) of a known wireless network:", None, QtGui.QApplication.UnicodeUTF8))
+ self.SearchPushButton.setText(QtGui.QApplication.translate("Dialog", "Search", None, QtGui.QApplication.UnicodeUTF8))
+ self.SelectSSIDGroupBox.setTitle(QtGui.QApplication.translate("Dialog", "Wireless Networks", None, QtGui.QApplication.UnicodeUTF8))
+ self.ShowExtendedCheckBox.setText(QtGui.QApplication.translate("Dialog", "Show extended information", None, QtGui.QApplication.UnicodeUTF8))
+ self.NetworksTableWidget.clear()
+ self.NetworksTableWidget.setColumnCount(0)
+ self.NetworksTableWidget.setRowCount(0)
+ self.NetworksFoundLabel.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_15.setText(QtGui.QApplication.translate("Dialog", "Configure Wireless", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.SSIDLabel.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Wireless Security Type", None, QtGui.QApplication.UnicodeUTF8))
+ self.WEPRadioButton.setText(QtGui.QApplication.translate("Dialog", "WEP (Wired Equivalent Privacy)", None, QtGui.QApplication.UnicodeUTF8))
+ self.WPARadioButton.setText(QtGui.QApplication.translate("Dialog", "WPA (Wi-Fi Protected Access)", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "Wireless Security Key", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("Dialog", "Key:", None, QtGui.QApplication.UnicodeUTF8))
+ self.ShowKeyCheckBox.setText(QtGui.QApplication.translate("Dialog", "Show key", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_16.setText(QtGui.QApplication.translate("Dialog", "Wireless Configuration Results", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_4.setTitle(QtGui.QApplication.translate("Dialog", "Wireless Configuration", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_8.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.SSIDLabel_2.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.SignalStrengthIcon.setText(QtGui.QApplication.translate("Dialog", "(icon)", None, QtGui.QApplication.UnicodeUTF8))
+ self.SignalStrengthLabel.setText(QtGui.QApplication.translate("Dialog", "0/5 (0dBm)", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_9.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.AddressModeLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_12.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.HostnameLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_10.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.IPAddressLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_11.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.GatewayLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_13.setText(QtGui.QApplication.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>", None, QtGui.QApplication.UnicodeUTF8))
+ self.DNSLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.groupBox_5.setTitle(QtGui.QApplication.translate("Dialog", "Messages", None, QtGui.QApplication.UnicodeUTF8))
+ self.ExitLabel.setText(QtGui.QApplication.translate("Dialog", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
+ self.PageLabel2.setText(QtGui.QApplication.translate("Dialog", "Message:", None, QtGui.QApplication.UnicodeUTF8))
+ self.PageLabel.setText(QtGui.QApplication.translate("Dialog", "of XXX", None, QtGui.QApplication.UnicodeUTF8))
+ self.BackButton.setText(QtGui.QApplication.translate("Dialog", "< Back", None, QtGui.QApplication.UnicodeUTF8))
+ self.NextButton.setText(QtGui.QApplication.translate("Dialog", "Next >", None, QtGui.QApplication.UnicodeUTF8))
+ self.CancelButton.setText(QtGui.QApplication.translate("Dialog", "Cancel", None, QtGui.QApplication.UnicodeUTF8))
+
+from readonlyradiobutton import ReadOnlyRadioButton
diff --git a/ui4/wifisetupdialog_base.ui b/ui4/wifisetupdialog_base.ui
new file mode 100644
index 0000000..a85d14c
--- /dev/null
+++ b/ui4/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>