summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2016-01-04 16:43:51 +0100
committerDidier Raboud <odyx@debian.org>2016-01-04 16:43:51 +0100
commitd2347c83fe9fb2053998235b0e81e93dbc888598 (patch)
treeb0d64153826ed4bccdf888471261464cc0b65483 /ui
parentadcfeaed777a5a8ac231413ec9130705bb042e0a (diff)
Imported Upstream version 2.7.10
Diffstat (limited to 'ui')
-rw-r--r--ui/__init__.py2
-rw-r--r--ui/aboutdlg.py3
-rw-r--r--ui/aboutdlg_base.py98
-rw-r--r--ui/aboutdlg_base.ui264
-rw-r--r--ui/align10form.py19
-rw-r--r--ui/alignform.py14
-rw-r--r--ui/aligntype6form1.py11
-rw-r--r--ui/aligntype6form2.py4
-rw-r--r--ui/allowabletypesdlg.py (renamed from ui/faxallowabletypesdlg.py)15
-rw-r--r--ui/allowabletypesdlg_base.py (renamed from ui/faxallowabletypesdlg_base.py)34
-rw-r--r--ui/allowabletypesdlg_base.ui (renamed from ui/faxallowabletypesdlg_base.ui)16
-rw-r--r--ui/choosedevicedlg.py27
-rw-r--r--ui/chooseprinterdlg.py50
-rw-r--r--ui/cleaningform.py18
-rw-r--r--ui/cleaningform2.py2
-rw-r--r--ui/coloradjform.py6
-rw-r--r--ui/colorcal4form.py2
-rw-r--r--ui/colorcalform.py5
-rw-r--r--ui/colorcalform2.py2
-rw-r--r--ui/coverpageform.py22
-rw-r--r--ui/coverpageform_base.py63
-rw-r--r--ui/coverpageform_base.ui174
-rw-r--r--ui/devmgr4.py2144
-rw-r--r--ui/devmgr4_base.py168
-rw-r--r--ui/devmgr4_base.ui460
-rw-r--r--ui/faxaddrbookeditform_base.py159
-rw-r--r--ui/faxaddrbookeditform_base.ui344
-rw-r--r--ui/faxaddrbookform.py270
-rw-r--r--ui/faxsendjobform.py974
-rw-r--r--ui/faxsendjobform_base.py463
-rw-r--r--ui/faxsendjobform_base.ui1045
-rw-r--r--ui/faxsettingsform.py73
-rw-r--r--ui/imagepropertiesdlg.py4
-rw-r--r--ui/informationform.py23
-rw-r--r--ui/informationform_base.py61
-rw-r--r--ui/informationform_base.ui85
-rw-r--r--ui/loadpaperform.py3
-rw-r--r--ui/makecopiesform.py591
-rw-r--r--ui/makecopiesform_base.py303
-rw-r--r--ui/makecopiesform_base.ui751
-rw-r--r--ui/nodevicesform.py56
-rw-r--r--ui/paperedgealignform.py8
-rw-r--r--ui/pluginform.py247
-rw-r--r--ui/pluginform_base.py148
-rw-r--r--ui/pluginform_base.ui237
-rw-r--r--ui/printerform.py460
-rw-r--r--ui/printerform_base.py433
-rw-r--r--ui/printerform_base.ui907
-rw-r--r--ui/scrollcopy.py552
-rw-r--r--ui/scrollfax.py1293
-rw-r--r--ui/scrollfunc.py217
-rw-r--r--ui/scrollprint.py642
-rw-r--r--ui/scrollprintcontrol.py337
-rw-r--r--ui/scrollprintsettings.py950
-rw-r--r--ui/scrollstatus.py263
-rw-r--r--ui/scrollsupplies.py338
-rw-r--r--ui/scrolltool.py928
-rw-r--r--ui/scrollunload.py651
-rw-r--r--ui/scrollview.py455
-rw-r--r--ui/settingsdialog.py138
-rw-r--r--ui/settingsdialog_base.py195
-rw-r--r--ui/settingsdialog_base.ui308
-rw-r--r--ui/setupform.py570
-rw-r--r--ui/setupform_base.py32
-rw-r--r--ui/setupform_base.ui17
-rw-r--r--ui/setupmanualfind.py15
-rw-r--r--ui/setupsettings.py44
-rw-r--r--ui/unloadform.py507
-rw-r--r--ui/unloadform_base.py261
-rw-r--r--ui/unloadform_base.ui334
-rw-r--r--ui/waitform.py26
71 files changed, 10013 insertions, 10328 deletions
diff --git a/ui/__init__.py b/ui/__init__.py
index 851e0d991..5722dcbcb 100644
--- a/ui/__init__.py
+++ b/ui/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
diff --git a/ui/aboutdlg.py b/ui/aboutdlg.py
index 1f760ef7a..f9d639a3c 100644
--- a/ui/aboutdlg.py
+++ b/ui/aboutdlg.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -31,3 +31,4 @@ class AboutDlg(AboutDlg_base):
self.pyPixmap.setPixmap(QPixmap(os.path.join(prop.image_dir, 'powered_by_python.png')))
self.osiPixmap.setPixmap(QPixmap(os.path.join(prop.image_dir, 'opensource-75x65.png')))
+ self.logoPixmap.setPixmap(QPixmap(os.path.join(prop.image_dir, 'hp-tux-printer.png')))
diff --git a/ui/aboutdlg_base.py b/ui/aboutdlg_base.py
index 73a15efa6..57ef95de3 100644
--- a/ui/aboutdlg_base.py
+++ b/ui/aboutdlg_base.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'aboutdlg_base.ui'
+# Form implementation generated from reading ui file 'ui/aboutdlg_base.ui'
#
-# Created: Fri May 5 15:09:03 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
+# Created: Mon Oct 15 16:07:30 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.17
#
# WARNING! All changes made in this file will be lost!
@@ -23,55 +23,76 @@ class AboutDlg_base(QDialog):
self.textLabel1 = QLabel(self,"textLabel1")
- AboutDlg_baseLayout.addMultiCellWidget(self.textLabel1,0,0,0,3)
- spacer15 = QSpacerItem(340,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- AboutDlg_baseLayout.addMultiCell(spacer15,7,7,0,2)
+ AboutDlg_baseLayout.addWidget(self.textLabel1,0,0)
+
+ layout17 = QHBoxLayout(None,0,6,"layout17")
+ spacer27 = QSpacerItem(150,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout17.addItem(spacer27)
+
+ self.logoPixmap = QLabel(self,"logoPixmap")
+ self.logoPixmap.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.logoPixmap.sizePolicy().hasHeightForWidth()))
+ self.logoPixmap.setMinimumSize(QSize(100,110))
+ self.logoPixmap.setMaximumSize(QSize(100,110))
+ self.logoPixmap.setScaledContents(1)
+ layout17.addWidget(self.logoPixmap)
+ spacer28 = QSpacerItem(151,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout17.addItem(spacer28)
+
+ AboutDlg_baseLayout.addLayout(layout17,1,0)
self.pushButton15 = QPushButton(self,"pushButton15")
- AboutDlg_baseLayout.addWidget(self.pushButton15,7,3)
+ AboutDlg_baseLayout.addWidget(self.pushButton15,8,0)
- self.pyPixmap = QLabel(self,"pyPixmap")
- self.pyPixmap.setMinimumSize(QSize(200,62))
- self.pyPixmap.setMaximumSize(QSize(200,62))
- self.pyPixmap.setScaledContents(1)
+ layout1 = QHBoxLayout(None,0,6,"layout1")
+
+ self.textLabel4 = QLabel(self,"textLabel4")
+ layout1.addWidget(self.textLabel4)
- AboutDlg_baseLayout.addWidget(self.pyPixmap,6,0)
+ self.VersionText = QLabel(self,"VersionText")
+ layout1.addWidget(self.VersionText)
- self.osiPixmap = QLabel(self,"osiPixmap")
- self.osiPixmap.setMinimumSize(QSize(75,65))
- self.osiPixmap.setMaximumSize(QSize(75,65))
- self.osiPixmap.setScaledContents(1)
+ AboutDlg_baseLayout.addLayout(layout1,2,0)
+
+ layout1_2 = QHBoxLayout(None,0,6,"layout1_2")
- AboutDlg_baseLayout.addMultiCellWidget(self.osiPixmap,6,6,1,2)
- spacer5 = QSpacerItem(20,50,QSizePolicy.Minimum,QSizePolicy.Expanding)
- AboutDlg_baseLayout.addItem(spacer5,5,2)
- spacer4 = QSpacerItem(20,50,QSizePolicy.Minimum,QSizePolicy.Expanding)
- AboutDlg_baseLayout.addItem(spacer4,5,0)
+ self.textLabel4_2 = QLabel(self,"textLabel4_2")
+ layout1_2.addWidget(self.textLabel4_2)
+
+ self.ToolboxVersionText = QLabel(self,"ToolboxVersionText")
+ layout1_2.addWidget(self.ToolboxVersionText)
+
+ AboutDlg_baseLayout.addLayout(layout1_2,3,0)
self.textLabel2 = QLabel(self,"textLabel2")
- AboutDlg_baseLayout.addMultiCellWidget(self.textLabel2,4,4,0,3)
+ AboutDlg_baseLayout.addWidget(self.textLabel2,5,0)
self.textLabel3 = QLabel(self,"textLabel3")
- AboutDlg_baseLayout.addMultiCellWidget(self.textLabel3,3,3,0,3)
+ AboutDlg_baseLayout.addWidget(self.textLabel3,4,0)
- layout1 = QHBoxLayout(None,0,6,"layout1")
+ layout18 = QHBoxLayout(None,0,6,"layout18")
- self.textLabel4 = QLabel(self,"textLabel4")
- layout1.addWidget(self.textLabel4)
+ self.pyPixmap = QLabel(self,"pyPixmap")
+ self.pyPixmap.setMinimumSize(QSize(200,62))
+ self.pyPixmap.setMaximumSize(QSize(200,62))
+ self.pyPixmap.setScaledContents(1)
+ layout18.addWidget(self.pyPixmap)
- self.VersionText = QLabel(self,"VersionText")
- layout1.addWidget(self.VersionText)
+ self.osiPixmap = QLabel(self,"osiPixmap")
+ self.osiPixmap.setMinimumSize(QSize(75,65))
+ self.osiPixmap.setMaximumSize(QSize(75,65))
+ self.osiPixmap.setScaledContents(1)
+ layout18.addWidget(self.osiPixmap)
- AboutDlg_baseLayout.addMultiCellLayout(layout1,2,2,0,3)
- spacer6 = QSpacerItem(20,21,QSizePolicy.Minimum,QSizePolicy.Expanding)
- AboutDlg_baseLayout.addItem(spacer6,1,1)
+ AboutDlg_baseLayout.addLayout(layout18,6,0)
+ spacer29 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ AboutDlg_baseLayout.addItem(spacer29,7,0)
self.languageChange()
- self.resize(QSize(465,522).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(481,560).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.pushButton15,SIGNAL("clicked()"),self.close)
@@ -80,13 +101,16 @@ class AboutDlg_base(QDialog):
def languageChange(self):
self.setCaption(self.__tr("HP Device Manager - About"))
self.textLabel1.setText(self.__tr("<font size=\"+3\"><p align=\"center\">HP Linux Imaging and Printing (HPLIP)</p></font>"))
- self.pushButton15.setText(self.__tr("OK"))
+ self.pushButton15.setText(self.__tr("Close"))
+ self.textLabel4.setText(self.__tr("<b>HPLIP Software Version:</b>"))
+ self.VersionText.setText(self.__tr("0.0.0"))
+ self.textLabel4_2.setText(self.__tr("<b>Device Manager Software Version:</b>"))
+ self.ToolboxVersionText.setText(self.__tr("0.0.0"))
self.textLabel2.setText(self.__tr("<b>Authors and Contributors:</b>\n"
-"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"))
+"David Suffield, Don Welch, Shiyun Yie, Raghothama Cauligi, John Oleinik, Cory Meisch, Foster Nuffer, Pete Parks, Jacqueline Pitter, David Paschal, \n"
+"Steve DeRoos, Mark Overton, Aaron Albright, Smith Kennedy, John Hosszu, Chris Wiesner, Henrique M. Holschuh, Till Kamppeter, Linus Araque, Mark Crawford, Charlie Moore"))
self.textLabel3.setText(self.__tr("<b>License and Copyright:</b>\n"
-"(c) Copyright 2006 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."))
- self.textLabel4.setText(self.__tr("<b>Software Version:</b>"))
- self.VersionText.setText(self.__tr("0.0.0"))
+"(c) Copyright 2007 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."))
def __tr(self,s,c = None):
diff --git a/ui/aboutdlg_base.ui b/ui/aboutdlg_base.ui
index 220978445..ca8ae5c93 100644
--- a/ui/aboutdlg_base.ui
+++ b/ui/aboutdlg_base.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>465</width>
- <height>522</height>
+ <width>481</width>
+ <height>560</height>
</rect>
</property>
<property name="caption">
@@ -19,7 +19,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="4">
+ <widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@@ -27,126 +27,160 @@
<string>&lt;font size="+3"&gt;&lt;p align="center"&gt;HP Linux Imaging and Printing (HPLIP)&lt;/p&gt;&lt;/font&gt;</string>
</property>
</widget>
- <spacer row="7" column="0" rowspan="1" colspan="3">
+ <widget class="QLayoutWidget" row="1" column="0">
<property name="name">
- <cstring>spacer15</cstring>
+ <cstring>layout17</cstring>
</property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>340</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="7" column="3">
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer27</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>150</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>logoPixmap</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <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>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer28</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>151</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QPushButton" row="8" column="0">
<property name="name">
<cstring>pushButton15</cstring>
</property>
<property name="text">
- <string>OK</string>
+ <string>Close</string>
</property>
</widget>
- <widget class="QLabel" row="6" column="0">
+ <widget class="QLayoutWidget" row="2" column="0">
<property name="name">
- <cstring>pyPixmap</cstring>
- </property>
- <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>
+ <cstring>layout1</cstring>
</property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;HPLIP Software Version:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>VersionText</cstring>
+ </property>
+ <property name="text">
+ <string>0.0.0</string>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget class="QLabel" row="6" column="1" rowspan="1" colspan="2">
+ <widget class="QLayoutWidget" row="3" column="0">
<property name="name">
- <cstring>osiPixmap</cstring>
- </property>
- <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>
+ <cstring>layout1_2</cstring>
</property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Device Manager Software Version:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>ToolboxVersionText</cstring>
+ </property>
+ <property name="text">
+ <string>0.0.0</string>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <spacer row="5" column="2">
- <property name="name">
- <cstring>spacer5</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>50</height>
- </size>
- </property>
- </spacer>
- <spacer row="5" column="0">
- <property name="name">
- <cstring>spacer4</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>50</height>
- </size>
- </property>
- </spacer>
- <widget class="QLabel" row="4" column="0" rowspan="1" colspan="4">
+ <widget class="QLabel" row="5" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>&lt;b&gt;Authors and Contributors:&lt;/b&gt;
-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</string>
+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</string>
</property>
</widget>
- <widget class="QLabel" row="3" column="0" rowspan="1" colspan="4">
+ <widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>&lt;b&gt;License and Copyright:&lt;/b&gt;
-(c) Copyright 2006 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.</string>
+(c) Copyright 2007 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.</string>
</property>
</widget>
- <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="4">
+ <widget class="QLayoutWidget" row="6" column="0">
<property name="name">
- <cstring>layout1</cstring>
+ <cstring>layout18</cstring>
</property>
<hbox>
<property name="name">
@@ -154,25 +188,49 @@ David Suffield, Don Welch, Shiyun Yie, Raghothama Cauligi, John Oleinik, Cory Me
</property>
<widget class="QLabel">
<property name="name">
- <cstring>textLabel4</cstring>
+ <cstring>pyPixmap</cstring>
</property>
- <property name="text">
- <string>&lt;b&gt;Software Version:&lt;/b&gt;</string>
+ <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>
</widget>
<widget class="QLabel">
<property name="name">
- <cstring>VersionText</cstring>
+ <cstring>osiPixmap</cstring>
</property>
- <property name="text">
- <string>0.0.0</string>
+ <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>
</widget>
</hbox>
</widget>
- <spacer row="1" column="1">
+ <spacer row="7" column="0">
<property name="name">
- <cstring>spacer6</cstring>
+ <cstring>spacer29</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
@@ -183,7 +241,7 @@ David Suffield, Don Welch, Shiyun Yie, Raghothama Cauligi, John Oleinik, Cory Me
<property name="sizeHint">
<size>
<width>20</width>
- <height>21</height>
+ <height>20</height>
</size>
</property>
</spacer>
diff --git a/ui/align10form.py b/ui/align10form.py
index 6934171ca..d869087ad 100644
--- a/ui/align10form.py
+++ b/ui/align10form.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -30,28 +30,31 @@ class Align10Form(Align10Form_Base):
def __init__(self, pattern, align_type=ALIGN_TYPE_LBOW, parent = None, name = None, modal = 0, fl = 0):
Align10Form_Base.__init__(self,parent,name,modal,fl)
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, 'align10.png')))
-
+
self.controls = maint.align10and11Controls(pattern, align_type)
-
+
for line in self.controls:
if not self.controls[line][0]:
eval('self.comboBox%s.setEnabled(False)' % line)
else:
for x in range(self.controls[line][1]):
eval('self.comboBox%s.insertItem("%s%d")' % (line, line, x+1))
-
+
def getValues(self):
ret = []
- for line in self.controls:
+ controls = self.controls.keys()
+ controls.sort()
+
+ for line in controls:
if not self.controls[line][0]:
ret.append(0)
else:
- exec('selected = str(self.comboBox%s.currentText())' % line)
+ exec('selected = unicode(self.comboBox%s.currentText())' % line)
try:
selected = int(selected[1:])
except ValueError:
selected = 0
ret.append(selected)
-
+
return ret
-
+
diff --git a/ui/alignform.py b/ui/alignform.py
index a88f70873..b037f195d 100644
--- a/ui/alignform.py
+++ b/ui/alignform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -35,15 +35,15 @@ class AlignForm(QDialog):
# line_count: 2 or 3
# choice_count: 5, 7, 9, 11, etc. (odd)
mid_point = (choice_count+1)/2
-
+
if not name:
self.setProperty("name", QVariant("AlignForm"))
AlignFormLayout = QGridLayout(self,1,1,11,6,"AlignFormLayout")
- self.helpButton = QPushButton(self,"helpButton")
+ #self.helpButton = QPushButton(self,"helpButton")
- AlignFormLayout.addWidget(self.helpButton,1,0)
+ #AlignFormLayout.addWidget(self.helpButton,1,0)
self.CancelButton = QPushButton(self,"CancelButton")
@@ -59,7 +59,7 @@ class AlignForm(QDialog):
self.buttonGroup.setColumnLayout(0,Qt.Vertical)
self.buttonGroup.layout().setSpacing(6)
self.buttonGroup.layout().setMargin(11)
-
+
buttonGroupLayout = QGridLayout(self.buttonGroup.layout())
buttonGroupLayout.setAlignment(Qt.AlignTop)
@@ -99,7 +99,7 @@ class AlignForm(QDialog):
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, '%s-%s-%d.png' % (orientation, colors, line_count))))
self.buttonGroup.setTitle(line_id)
-
+
self.value = (choice_count + 1) / 2
def buttonGroup_clicked(self,a0):
@@ -108,7 +108,7 @@ class AlignForm(QDialog):
def languageChange(self):
self.setProperty("caption",QVariant(self.__tr("HP Device Manager - Alignment")))
- self.helpButton.setProperty("text",QVariant(self.__tr("Help")))
+ #self.helpButton.setProperty("text",QVariant(self.__tr("Help")))
self.CancelButton.setProperty("text",QVariant(self.__tr("Cancel")))
self.ContinueButton.setProperty("text",QVariant(self.__tr("Next >")))
self.buttonGroup.setProperty("title",QVariant(self.__tr("")))
diff --git a/ui/aligntype6form1.py b/ui/aligntype6form1.py
index 7760fa89b..8c258efac 100644
--- a/ui/aligntype6form1.py
+++ b/ui/aligntype6form1.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,8 +19,6 @@
# Author: Don Welch
#
-#from base.g import *
-#import os.path
from qt import *
from aligntype6form1_base import AlignType6Form1_base
@@ -28,9 +26,4 @@ class AlignType6Form1(AlignType6Form1_base):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
AlignType6Form1_base.__init__(self,parent,name,modal,fl)
- #self.print_page = False
-
- #def printPageButton_clicked(self):
- #print "AlignType6Form1_base.printPageButton_clicked(): Not implemented yet"
- # self.print_page = True
- # self.accept()
+
diff --git a/ui/aligntype6form2.py b/ui/aligntype6form2.py
index d9b7f5a75..b5cec27d3 100644
--- a/ui/aligntype6form2.py
+++ b/ui/aligntype6form2.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,8 +19,6 @@
# Author: Don Welch
#
-from base.g import *
-import os.path
from qt import *
from aligntype6form2_base import AlignType6Form2_base
diff --git a/ui/faxallowabletypesdlg.py b/ui/allowabletypesdlg.py
index a3de821c9..025307770 100644
--- a/ui/faxallowabletypesdlg.py
+++ b/ui/allowabletypesdlg.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
@@ -20,15 +20,14 @@
#
from qt import *
-from faxallowabletypesdlg_base import FaxAllowableTypesDlg_base
+from allowabletypesdlg_base import AllowableTypesDlg_base
-class FaxAllowableTypesDlg(FaxAllowableTypesDlg_base):
+class AllowableTypesDlg(AllowableTypesDlg_base):
def __init__(self, allowables, parent=None, name=None, modal=0, fl=0):
- FaxAllowableTypesDlg_base.__init__(self,parent,name,modal,fl)
- #self.allowables = allowables
-
+ AllowableTypesDlg_base.__init__(self,parent,name,modal,fl)
+
for x in allowables:
QListViewItem(self.allowableTypesListView, x, *allowables[x])
-
+
def __tr(self,s,c = None):
- return qApp.translate("FaxAllowableTypesDlg",s,c)
+ return qApp.translate("AllowableTypesDlg",s,c)
diff --git a/ui/faxallowabletypesdlg_base.py b/ui/allowabletypesdlg_base.py
index c85bca5e9..ffc1ea63b 100644
--- a/ui/faxallowabletypesdlg_base.py
+++ b/ui/allowabletypesdlg_base.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'faxallowabletypesdlg_base.ui'
+# Form implementation generated from reading ui file 'allowabletypesdlg_base.ui'
#
-# Created: Tue Apr 11 10:58:56 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
+# Created: Wed Mar 14 12:57:36 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.16
#
# WARNING! All changes made in this file will be lost!
@@ -11,33 +11,33 @@
from qt import *
-class FaxAllowableTypesDlg_base(QDialog):
+class AllowableTypesDlg_base(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
if not name:
- self.setName("FaxAllowableTypesDlg_base")
+ self.setName("AllowableTypesDlg_base")
- FaxAllowableTypesDlg_baseLayout = QGridLayout(self,1,1,11,6,"FaxAllowableTypesDlg_baseLayout")
+ AllowableTypesDlg_baseLayout = QGridLayout(self,1,1,11,6,"AllowableTypesDlg_baseLayout")
self.line1_2 = QFrame(self,"line1_2")
self.line1_2.setFrameShape(QFrame.HLine)
self.line1_2.setFrameShadow(QFrame.Sunken)
self.line1_2.setFrameShape(QFrame.HLine)
- FaxAllowableTypesDlg_baseLayout.addMultiCellWidget(self.line1_2,1,1,0,1)
+ AllowableTypesDlg_baseLayout.addMultiCellWidget(self.line1_2,1,1,0,1)
self.textLabel3_2 = QLabel(self,"textLabel3_2")
self.textLabel3_2.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.textLabel3_2.sizePolicy().hasHeightForWidth()))
- FaxAllowableTypesDlg_baseLayout.addMultiCellWidget(self.textLabel3_2,0,0,0,1)
+ AllowableTypesDlg_baseLayout.addMultiCellWidget(self.textLabel3_2,0,0,0,1)
self.pushButton10 = QPushButton(self,"pushButton10")
- FaxAllowableTypesDlg_baseLayout.addWidget(self.pushButton10,4,1)
+ AllowableTypesDlg_baseLayout.addWidget(self.pushButton10,4,1)
spacer7 = QSpacerItem(301,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- FaxAllowableTypesDlg_baseLayout.addItem(spacer7,4,0)
+ AllowableTypesDlg_baseLayout.addItem(spacer7,4,0)
self.allowableTypesListView = QListView(self,"allowableTypesListView")
self.allowableTypesListView.addColumn(self.__tr("MIME Type"))
@@ -46,29 +46,29 @@ class FaxAllowableTypesDlg_base(QDialog):
self.allowableTypesListView.setSelectionMode(QListView.NoSelection)
self.allowableTypesListView.setAllColumnsShowFocus(1)
- FaxAllowableTypesDlg_baseLayout.addMultiCellWidget(self.allowableTypesListView,2,2,0,1)
+ AllowableTypesDlg_baseLayout.addMultiCellWidget(self.allowableTypesListView,2,2,0,1)
self.textLabel1 = QLabel(self,"textLabel1")
- FaxAllowableTypesDlg_baseLayout.addMultiCellWidget(self.textLabel1,3,3,0,1)
+ AllowableTypesDlg_baseLayout.addMultiCellWidget(self.textLabel1,3,3,0,1)
self.languageChange()
- self.resize(QSize(451,442).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(495,576).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.pushButton10,SIGNAL("clicked()"),self.accept)
def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Direct Allowable Types"))
- self.textLabel3_2.setText(self.__tr("<b>File types that can be <i>directly</i> added to a fax job.</b>"))
+ self.setCaption(self.__tr("HP Device Manager - Allowable Types"))
+ self.textLabel3_2.setText(self.__tr("<b>File/document types that can be added to the file list.</b>"))
self.pushButton10.setText(self.__tr("OK"))
self.allowableTypesListView.header().setLabel(0,self.__tr("MIME Type"))
self.allowableTypesListView.header().setLabel(1,self.__tr("Description"))
self.allowableTypesListView.header().setLabel(2,self.__tr("Usual File Extension(s)"))
- self.textLabel1.setText(self.__tr("<i>Note: To add files types that do not appear on this list, print the document from the application that created it through the appropriate CUPS printer.</i>"))
+ self.textLabel1.setText(self.__tr("<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>"))
def __tr(self,s,c = None):
- return qApp.translate("FaxAllowableTypesDlg_base",s,c)
+ return qApp.translate("AllowableTypesDlg_base",s,c)
diff --git a/ui/faxallowabletypesdlg_base.ui b/ui/allowabletypesdlg_base.ui
index 942788a1f..9aa5b9ce4 100644
--- a/ui/faxallowabletypesdlg_base.ui
+++ b/ui/allowabletypesdlg_base.ui
@@ -1,19 +1,19 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>FaxAllowableTypesDlg_base</class>
+<class>AllowableTypesDlg_base</class>
<widget class="QDialog">
<property name="name">
- <cstring>FaxAllowableTypesDlg_base</cstring>
+ <cstring>AllowableTypesDlg_base</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>451</width>
- <height>442</height>
+ <width>495</width>
+ <height>576</height>
</rect>
</property>
<property name="caption">
- <string>HP Device Manager - Direct Allowable Types</string>
+ <string>HP Device Manager - Allowable Types</string>
</property>
<grid>
<property name="name">
@@ -46,7 +46,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>&lt;b&gt;File types that can be &lt;i&gt;directly&lt;/i&gt; added to a fax job.&lt;/b&gt;</string>
+ <string>&lt;b&gt;File/document types that can be added to the file list.&lt;/b&gt;</string>
</property>
</widget>
<widget class="QPushButton" row="4" column="1">
@@ -123,7 +123,7 @@
<cstring>textLabel1</cstring>
</property>
<property name="text">
- <string>&lt;i&gt;Note: To add files types that do not appear on this list, print the document from the application that created it through the appropriate CUPS printer.&lt;/i&gt;</string>
+ <string>&lt;i&gt;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&gt;</string>
</property>
</widget>
</grid>
@@ -132,7 +132,7 @@
<connection>
<sender>pushButton10</sender>
<signal>clicked()</signal>
- <receiver>FaxAllowableTypesDlg_base</receiver>
+ <receiver>AllowableTypesDlg_base</receiver>
<slot>accept()</slot>
</connection>
</connections>
diff --git a/ui/choosedevicedlg.py b/ui/choosedevicedlg.py
index 56014f5f0..f160c4c94 100644
--- a/ui/choosedevicedlg.py
+++ b/ui/choosedevicedlg.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -31,7 +31,7 @@ class ChooseDeviceDlg(QDialog):
self.setName("ChooseDeviceDlg")
self.device_uri = ''
-
+
ChooseDeviceDlg_Layout = QGridLayout(self,1,1,6,6,"ChooseDeviceDlg_Layout")
self.OKButton = QPushButton(self,"OKButton")
@@ -52,18 +52,28 @@ class ChooseDeviceDlg(QDialog):
self.DevicesButtonGroup.layout().setMargin(6)
DevicesButtonGroupLayout = QGridLayout(self.DevicesButtonGroup.layout())
DevicesButtonGroupLayout.setAlignment(Qt.AlignTop)
-
+
self.radio_buttons = {}
+
+ last_used_device_uri = user_cfg.last_used.device_uri
+ last_used_index = None
for y in range(len(devices)):
- if y == 0:
- self.device_uri = devices[y][0]
self.radio_buttons[y] = QRadioButton(self.DevicesButtonGroup,"radioButton%d" % y)
self.radio_buttons[y].setText(devices[y][0])
+
+ if devices[y][0] == last_used_device_uri:
+ last_used_index = y
+ self.device_uri = devices[y][0]
+
DevicesButtonGroupLayout.addWidget(self.radio_buttons[y], y, 0)
- self.radio_buttons[0].setChecked(1)
-
+ if last_used_index is not None:
+ self.radio_buttons[last_used_index].setChecked(1)
+ else:
+ self.radio_buttons[0].setChecked(1)
+ self.device_uri = devices[0][0]
+
ChooseDeviceDlg_Layout.addMultiCellWidget(self.DevicesButtonGroup,0,0,0,2)
self.languageChange()
@@ -86,8 +96,7 @@ class ChooseDeviceDlg(QDialog):
return qApp.translate("ChooseDeviceDlg",s,c)
def DevicesButtonGroup_clicked(self,a0):
- self.device_uri = str(self.radio_buttons[a0].text())
- #print self.device_uri
+ self.device_uri = unicode(self.radio_buttons[a0].text())
if __name__ == "__main__":
a = QApplication(sys.argv)
diff --git a/ui/chooseprinterdlg.py b/ui/chooseprinterdlg.py
index 80edff688..b31609fbe 100644
--- a/ui/chooseprinterdlg.py
+++ b/ui/chooseprinterdlg.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -27,13 +27,13 @@ from qt import *
class ChoosePrinterDlg(QDialog):
def __init__(self, printers, back_end_filter=['hp'], parent = None,name = None,modal = 0,fl = 0, show_uris=True):
QDialog.__init__(self,parent,name,modal,fl)
-
+
if not name:
self.setName("ChooseDeviceDlg")
self.device_uri = ''
self.back_end_filter = back_end_filter
-
+
ChooseDeviceDlg_Layout = QGridLayout(self,1,1,6,6,"ChooseDeviceDlg_Layout")
self.OKButton = QPushButton(self,"OKButton")
@@ -54,7 +54,7 @@ class ChoosePrinterDlg(QDialog):
self.DevicesButtonGroup.layout().setMargin(6)
DevicesButtonGroupLayout = QGridLayout(self.DevicesButtonGroup.layout())
DevicesButtonGroupLayout.setAlignment(Qt.AlignTop)
-
+
self.radio_buttons = {}
self.printer_index, x = {}, 0
@@ -62,30 +62,30 @@ class ChoosePrinterDlg(QDialog):
try:
back_end, is_hp, bus, model, serial, dev_file, host, port = \
device.parseDeviceURI(p.device_uri)
-
+
except Error:
continue
-
+
if back_end in back_end_filter:
self.printer_index[x] = (p.name, p.device_uri)
x += 1
-
-
+
+
for y in range(len(self.printer_index)):
if y == 0:
self.device_uri = self.printer_index[y][1]
-
+
self.radio_buttons[y] = QRadioButton(self.DevicesButtonGroup,"radioButton%d" % y)
-
+
if show_uris:
self.radio_buttons[y].setText("%s (%s)" % self.printer_index[y])
else:
self.radio_buttons[y].setText(self.printer_index[y])
-
+
DevicesButtonGroupLayout.addWidget(self.radio_buttons[y], y, 0)
self.radio_buttons[0].setChecked(1)
-
+
ChooseDeviceDlg_Layout.addMultiCellWidget(self.DevicesButtonGroup,0,0,0,2)
self.languageChange()
@@ -101,7 +101,7 @@ class ChoosePrinterDlg(QDialog):
self.setCaption(self.__tr("Choose Device"))
self.OKButton.setText(self.__tr("OK"))
self.CancelButton.setText(self.__tr("Cancel"))
-
+
if 'hp' in self.back_end_filter and 'hpfax' in self.back_end_filter:
self.DevicesButtonGroup.setTitle(self.__tr("Available Devices:"))
elif 'hp' in self.back_end_filter:
@@ -110,25 +110,25 @@ class ChoosePrinterDlg(QDialog):
self.DevicesButtonGroup.setTitle(self.__tr("Available Faxes:"))
else:
self.DevicesButtonGroup.setTitle(self.__tr("Available Devices:"))
-
+
def __tr(self,s,c = None):
return qApp.translate("ChooseDeviceDlg",s,c)
def DevicesButtonGroup_clicked(self,a0):
for p in self.printer_index:
pp = self.printer_index[p]
- if str(self.radio_buttons[a0].text()).startswith(pp[0]):
+ if unicode(self.radio_buttons[a0].text()).startswith(pp[0]):
self.device_uri = pp[1]
break
-
-
+
+
class ChoosePrinterDlg2(QDialog):
def __init__(self, printers, parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)
-
+
self.printers = printers
-
+
if not name:
self.setName("ChooseDeviceDlg2")
@@ -152,19 +152,19 @@ class ChoosePrinterDlg2(QDialog):
self.DevicesButtonGroup.layout().setMargin(6)
DevicesButtonGroupLayout = QGridLayout(self.DevicesButtonGroup.layout())
DevicesButtonGroupLayout.setAlignment(Qt.AlignTop)
-
+
self.radio_buttons = {}
for y in range(len(self.printers)):
if y == 0:
self.printer_name = self.printers[0]
-
+
self.radio_buttons[y] = QRadioButton(self.DevicesButtonGroup,"radioButton%d" % y)
self.radio_buttons[y].setText(self.printers[y])
DevicesButtonGroupLayout.addWidget(self.radio_buttons[y], y, 0)
self.radio_buttons[0].setChecked(1)
-
+
ChooseDeviceDlg_Layout.addMultiCellWidget(self.DevicesButtonGroup,0,0,0,2)
self.languageChange()
@@ -180,11 +180,11 @@ class ChoosePrinterDlg2(QDialog):
self.setCaption(self.__tr("Choose Printer"))
self.OKButton.setText(self.__tr("OK"))
self.CancelButton.setText(self.__tr("Cancel"))
-
+
self.DevicesButtonGroup.setTitle(self.__tr("Printers:"))
-
+
def __tr(self,s,c = None):
return qApp.translate("ChooseDeviceDlg2",s,c)
def DevicesButtonGroup_clicked(self,a0):
- self.printer_name = str(a0)
+ self.printer_name = self.printers[a0]
diff --git a/ui/cleaningform.py b/ui/cleaningform.py
index 35df3349b..2bb5c33c1 100644
--- a/ui/cleaningform.py
+++ b/ui/cleaningform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -30,24 +30,24 @@ class CleaningForm(CleaningForm_base):
CleaningForm_base.__init__(self,parent,name,modal,fl)
self.dev = dev
- text = str(self.CleaningText.text())
+ text = unicode(self.CleaningText.text())
self.CleaningText.setText(text % str(cleaning_level + 1))
-
- text = str(self.Continue.text())
+
+ text = unicode(self.Continue.text())
self.Continue.setText(text % str(cleaning_level + 1))
-
- text = str(self.CleaningTitle.text())
+
+ text = unicode(self.CleaningTitle.text())
self.CleaningTitle.setText(text % str(cleaning_level))
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, 'clean.png')))
-
+
self.check_timer = QTimer(self, "CheckTimer")
self.connect(self.check_timer, SIGNAL('timeout()'), self.CheckTimerTimeout)
self.check_timer.start(3000)
-
+
def CheckTimerTimeout(self):
if self.dev.isIdleAndNoError():
self.Continue.setEnabled(True)
self.check_timer.stop()
-
+
diff --git a/ui/cleaningform2.py b/ui/cleaningform2.py
index 4699cc802..1d9e0e1d3 100644
--- a/ui/cleaningform2.py
+++ b/ui/cleaningform2.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
diff --git a/ui/coloradjform.py b/ui/coloradjform.py
index 83e0e354f..6e693e8a8 100644
--- a/ui/coloradjform.py
+++ b/ui/coloradjform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -30,7 +30,7 @@ class ColorAdjForm(ColorAdjForm_base):
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, 'color-adj.png')))
self.LineLabel.setText("""<b><font size="+1">%s</font></b>""" % line)
self.value = 11
-
+
def buttonGroup_clicked(self,a0):
self.value = a0
-
+
diff --git a/ui/colorcal4form.py b/ui/colorcal4form.py
index 5ce15d18f..3d9a4304b 100644
--- a/ui/colorcal4form.py
+++ b/ui/colorcal4form.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
diff --git a/ui/colorcalform.py b/ui/colorcalform.py
index 3dc1f22d1..a0935cf9a 100644
--- a/ui/colorcalform.py
+++ b/ui/colorcalform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,7 +19,6 @@
# Author: Don Welch
#
-
from qt import *
from colorcalform_base import ColorCalForm_base
@@ -28,7 +27,7 @@ class ColorCalForm(ColorCalForm_base):
ColorCalForm_base.__init__(self,parent,name,modal,fl)
self.value = 4
-
+
def ColorCalGroup_clicked(self,a0):
self.value = a0 + 1
diff --git a/ui/colorcalform2.py b/ui/colorcalform2.py
index 0a41f57a8..b33f892f2 100644
--- a/ui/colorcalform2.py
+++ b/ui/colorcalform2.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
diff --git a/ui/coverpageform.py b/ui/coverpageform.py
index 39ffaecf4..2bc05170d 100644
--- a/ui/coverpageform.py
+++ b/ui/coverpageform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
@@ -25,30 +25,35 @@ from fax import coverpages
from coverpageform_base import CoverpageForm_base
class CoverpageForm(CoverpageForm_base):
- def __init__(self, cover_page_name='', parent=None,name=None,modal=0,fl=0):
+ def __init__(self, cover_page_name='', preserve_formatting=False, parent=None,name=None,modal=0,fl=0):
CoverpageForm_base.__init__(self,parent,name,modal,fl)
+
+ self.preserve_formatting = preserve_formatting
+ self.preserveFormattingCheckBox.setChecked(preserve_formatting)
+
pix = QPixmap(os.path.join(prop.image_dir, 'prev.png'))
self.prevCoverpageButton.setPixmap(pix)
pix = QPixmap(os.path.join(prop.image_dir, 'next.png'))
self.nextCoverpageButton.setPixmap(pix)
self.coverpage_list = coverpages.COVERPAGES.keys()
-
+
if cover_page_name:
self.coverpage_index = self.coverpage_list.index(cover_page_name)
else:
self.coverpage_index = 0
-
+
self.setCoverpage()
+
def setCoverpage(self, inc=0):
self.coverpage_index += inc
-
+
if self.coverpage_index > len(self.coverpage_list) - 1:
self.coverpage_index = 0
-
+
elif self.coverpage_index < 0:
self.coverpage_index = len(self.coverpage_list) - 1
-
+
self.coverpage_name = self.coverpage_list[self.coverpage_index]
self.data = coverpages.COVERPAGES[self.coverpage_name]
pix = QPixmap(os.path.join(prop.image_dir, self.data[1]))
@@ -59,6 +64,9 @@ class CoverpageForm(CoverpageForm_base):
def nextCoverpageButton_clicked(self):
self.setCoverpage(1)
+
+ def preserveFormattingCheckBox_toggled(self,a0):
+ self.preserve_formatting = bool(a0)
def __tr(self,s,c = None):
return qApp.translate("CoverpageForm_base",s,c)
diff --git a/ui/coverpageform_base.py b/ui/coverpageform_base.py
index e02032a29..7c65ec10b 100644
--- a/ui/coverpageform_base.py
+++ b/ui/coverpageform_base.py
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'coverpageform_base.ui'
#
-# Created: Mon Apr 10 14:09:01 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
+# Created: Fri Apr 13 10:15:44 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.16
#
# WARNING! All changes made in this file will be lost!
@@ -20,6 +20,16 @@ class CoverpageForm_base(QDialog):
CoverpageForm_baseLayout = QGridLayout(self,1,1,11,6,"CoverpageForm_baseLayout")
+ spacer7 = QSpacerItem(590,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ CoverpageForm_baseLayout.addMultiCell(spacer7,5,5,0,1)
+
+ self.pushButton10 = QPushButton(self,"pushButton10")
+
+ CoverpageForm_baseLayout.addWidget(self.pushButton10,5,2)
+
+ self.pushButton9 = QPushButton(self,"pushButton9")
+
+ CoverpageForm_baseLayout.addWidget(self.pushButton9,5,3)
self.groupBox2 = QGroupBox(self,"groupBox2")
self.groupBox2.setColumnLayout(0,Qt.Vertical)
@@ -52,19 +62,7 @@ class CoverpageForm_base(QDialog):
groupBox2Layout.addWidget(self.prevCoverpageButton,0,0)
- CoverpageForm_baseLayout.addWidget(self.groupBox2,2,0)
- spacer4 = QSpacerItem(20,50,QSizePolicy.Minimum,QSizePolicy.Expanding)
- CoverpageForm_baseLayout.addItem(spacer4,3,0)
- spacer7 = QSpacerItem(590,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- CoverpageForm_baseLayout.addMultiCell(spacer7,4,4,0,1)
-
- self.pushButton10 = QPushButton(self,"pushButton10")
-
- CoverpageForm_baseLayout.addWidget(self.pushButton10,4,2)
-
- self.pushButton9 = QPushButton(self,"pushButton9")
-
- CoverpageForm_baseLayout.addWidget(self.pushButton9,4,3)
+ CoverpageForm_baseLayout.addMultiCellWidget(self.groupBox2,2,3,0,0)
self.textLabel5 = QLabel(self,"textLabel5")
self.textLabel5.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Maximum,0,0,self.textLabel5.sizePolicy().hasHeightForWidth()))
@@ -78,8 +76,6 @@ class CoverpageForm_base(QDialog):
CoverpageForm_baseLayout.addMultiCellWidget(self.line1_2,1,1,0,3)
- layout7 = QVBoxLayout(None,0,6,"layout7")
-
layout6 = QHBoxLayout(None,0,6,"layout6")
self.textLabel6 = QLabel(self,"textLabel6")
@@ -87,27 +83,36 @@ class CoverpageForm_base(QDialog):
self.regardingTextEdit = QLineEdit(self,"regardingTextEdit")
layout6.addWidget(self.regardingTextEdit)
- layout7.addLayout(layout6)
+
+ CoverpageForm_baseLayout.addMultiCellLayout(layout6,2,2,1,3)
+ spacer5 = QSpacerItem(20,141,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ CoverpageForm_baseLayout.addItem(spacer5,4,0)
+
+ layout5 = QVBoxLayout(None,0,6,"layout5")
self.textLabel3 = QLabel(self,"textLabel3")
self.textLabel3.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Maximum,0,0,self.textLabel3.sizePolicy().hasHeightForWidth()))
- layout7.addWidget(self.textLabel3)
+ layout5.addWidget(self.textLabel3)
self.messageTextEdit = QTextEdit(self,"messageTextEdit")
self.messageTextEdit.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Expanding,0,0,self.messageTextEdit.sizePolicy().hasHeightForWidth()))
- layout7.addWidget(self.messageTextEdit)
+ layout5.addWidget(self.messageTextEdit)
+
+ self.preserveFormattingCheckBox = QCheckBox(self,"preserveFormattingCheckBox")
+ layout5.addWidget(self.preserveFormattingCheckBox)
- CoverpageForm_baseLayout.addMultiCellLayout(layout7,2,3,1,3)
+ CoverpageForm_baseLayout.addMultiCellLayout(layout5,3,4,1,3)
self.languageChange()
- self.resize(QSize(592,359).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(675,558).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.pushButton10,SIGNAL("clicked()"),self.reject)
self.connect(self.pushButton9,SIGNAL("clicked()"),self.accept)
self.connect(self.prevCoverpageButton,SIGNAL("clicked()"),self.prevCoverpageButton_clicked)
self.connect(self.nextCoverpageButton,SIGNAL("clicked()"),self.nextCoverpageButton_clicked)
+ self.connect(self.preserveFormattingCheckBox,SIGNAL("toggled(bool)"),self.preserveFormattingCheckBox_toggled)
self.setTabOrder(self.regardingTextEdit,self.messageTextEdit)
self.setTabOrder(self.messageTextEdit,self.pushButton10)
@@ -116,15 +121,16 @@ class CoverpageForm_base(QDialog):
def languageChange(self):
self.setCaption(self.__tr("HP Device Manager - Coverpages"))
- self.groupBox2.setTitle(self.__tr("Choose Coverpage"))
- self.nextCoverpageButton.setText(QString.null)
- self.prevCoverpageButton.setText(QString.null)
- self.prevCoverpageButton.setAccel(QString.null)
self.pushButton10.setText(self.__tr("Cancel"))
self.pushButton9.setText(self.__tr("OK"))
+ self.groupBox2.setTitle(self.__tr("Coverpage Design"))
+ self.nextCoverpageButton.setText(QString.null)
+ self.prevCoverpageButton.setText(QString.null)
+ self.prevCoverpageButton.setAccel(QKeySequence(QString.null))
self.textLabel5.setText(self.__tr("<b>Choose coverpage and enter optional message.<b>"))
self.textLabel6.setText(self.__tr("Regarding:"))
- self.textLabel3.setText(self.__tr("Optional Message <i>(Maximum 2000 characters)</i>:"))
+ self.textLabel3.setText(self.__tr("Optional Message <i>(Maximum 2048 characters or 32 lines preformatted)</i>:"))
+ self.preserveFormattingCheckBox.setText(self.__tr("Preformatted (preserve formatting)"))
def coverpageListBox_currentChanged(self,a0):
@@ -136,5 +142,8 @@ class CoverpageForm_base(QDialog):
def nextCoverpageButton_clicked(self):
print "CoverpageForm_base.nextCoverpageButton_clicked(): Not implemented yet"
+ def preserveFormattingCheckBox_toggled(self,a0):
+ print "CoverpageForm_base.preserveFormattingCheckBox_toggled(bool): Not implemented yet"
+
def __tr(self,s,c = None):
return qApp.translate("CoverpageForm_base",s,c)
diff --git a/ui/coverpageform_base.ui b/ui/coverpageform_base.ui
index 18fa993b9..888b32d51 100644
--- a/ui/coverpageform_base.ui
+++ b/ui/coverpageform_base.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>592</width>
- <height>359</height>
+ <width>675</width>
+ <height>558</height>
</rect>
</property>
<property name="caption">
@@ -19,12 +19,45 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QGroupBox" row="2" column="0">
+ <spacer row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>590</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="5" column="2">
+ <property name="name">
+ <cstring>pushButton10</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="5" column="3">
+ <property name="name">
+ <cstring>pushButton9</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0" rowspan="2" colspan="1">
<property name="name">
<cstring>groupBox2</cstring>
</property>
<property name="title">
- <string>Choose Coverpage</string>
+ <string>Coverpage Design</string>
</property>
<grid>
<property name="name">
@@ -125,56 +158,6 @@
</widget>
</grid>
</widget>
- <spacer row="3" column="0">
- <property name="name">
- <cstring>spacer4</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>50</height>
- </size>
- </property>
- </spacer>
- <spacer row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>spacer7</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>590</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="4" column="2">
- <property name="name">
- <cstring>pushButton10</cstring>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
- </widget>
- <widget class="QPushButton" row="4" column="3">
- <property name="name">
- <cstring>pushButton9</cstring>
- </property>
- <property name="text">
- <string>OK</string>
- </property>
- </widget>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>textLabel5</cstring>
@@ -205,37 +188,54 @@
<enum>Horizontal</enum>
</property>
</widget>
- <widget class="QLayoutWidget" row="2" column="1" rowspan="2" colspan="3">
+ <widget class="QLayoutWidget" row="2" column="1" rowspan="1" colspan="3">
<property name="name">
- <cstring>layout7</cstring>
+ <cstring>layout6</cstring>
</property>
- <vbox>
+ <hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLayoutWidget">
+ <widget class="QLabel">
<property name="name">
- <cstring>layout6</cstring>
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Regarding:</string>
</property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel6</cstring>
- </property>
- <property name="text">
- <string>Regarding:</string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>regardingTextEdit</cstring>
- </property>
- </widget>
- </hbox>
</widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>regardingTextEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>141</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="3" column="1" rowspan="2" colspan="3">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel3</cstring>
@@ -249,7 +249,7 @@
</sizepolicy>
</property>
<property name="text">
- <string>Optional Message &lt;i&gt;(Maximum 2000 characters)&lt;/i&gt;:</string>
+ <string>Optional Message &lt;i&gt;(Maximum 2048 characters or 32 lines preformatted)&lt;/i&gt;:</string>
</property>
</widget>
<widget class="QTextEdit">
@@ -265,6 +265,14 @@
</sizepolicy>
</property>
</widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>preserveFormattingCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Preformatted (preserve formatting)</string>
+ </property>
+ </widget>
</vbox>
</widget>
</grid>
@@ -294,6 +302,12 @@
<receiver>CoverpageForm_base</receiver>
<slot>nextCoverpageButton_clicked()</slot>
</connection>
+ <connection>
+ <sender>preserveFormattingCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>CoverpageForm_base</receiver>
+ <slot>preserveFormattingCheckBox_toggled(bool)</slot>
+ </connection>
</connections>
<tabstops>
<tabstop>regardingTextEdit</tabstop>
@@ -301,10 +315,14 @@
<tabstop>pushButton10</tabstop>
<tabstop>pushButton9</tabstop>
</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">coverpageform_base.ui.h</include>
+</includes>
<slots>
<slot>coverpageListBox_currentChanged( QListBoxItem * )</slot>
<slot>prevCoverpageButton_clicked()</slot>
<slot>nextCoverpageButton_clicked()</slot>
+ <slot>preserveFormattingCheckBox_toggled( bool )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/ui/devmgr4.py b/ui/devmgr4.py
index a8135fe5a..9061b5a4f 100644
--- a/ui/devmgr4.py
+++ b/ui/devmgr4.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -22,11 +22,11 @@
from __future__ import generators
# Std Lib
-import sys, time, os
+import sys, time, os, gzip
# Local
from base.g import *
-from base import device, status, msg, maint, utils, service, pml
+from base import device, utils, service
from prnt import cups
from base.codes import *
@@ -36,451 +36,98 @@ from qt import *
# Main form
from devmgr4_base import DevMgr4_base
-# Alignment and ColorCal forms
-from alignform import AlignForm
-from aligntype6form1 import AlignType6Form1
-from aligntype6form2 import AlignType6Form2
-from paperedgealignform import PaperEdgeAlignForm
-from colorcalform import ColorCalForm # Type 1 color cal
-from coloradjform import ColorAdjForm # Type 5 and 6 color adj
-from colorcalform2 import ColorCalForm2 # Type 2 color cal
-from colorcal4form import ColorCal4Form # Type 4 color cal
-from align10form import Align10Form # Type 10 and 11 alignment
+# Scrollviews
+from scrollview import ScrollView
+from scrollfunc import ScrollFunctionsView
+from scrollstatus import ScrollStatusView
+from scrollprintsettings import ScrollPrintSettingsView
+from scrollprintcontrol import ScrollPrintJobView
+from scrolltool import ScrollToolView, ScrollDeviceInfoView, ScrollTestpageView, ScrollPrinterInfoView
+from scrollsupplies import ScrollSuppliesView
+from scrollprint import ScrollPrintView
+from scrollfax import ScrollFaxView
+from scrollunload import ScrollUnloadView
+from scrollcopy import ScrollCopyView
# Misc forms
-from loadpaperform import LoadPaperForm
-from settingsdialog import SettingsDialog
from nodevicesform import NoDevicesForm
+from settingsdialog import SettingsDialog
from aboutdlg import AboutDlg
-from cleaningform import CleaningForm
-from cleaningform2 import CleaningForm2
-from waitform import WaitForm
-from faxsettingsform import FaxSettingsForm
-from informationform import InformationForm
-
-# all in minutes
-MIN_AUTO_REFRESH_RATE = 1
+
+# all in seconds
+MIN_AUTO_REFRESH_RATE = 5
MAX_AUTO_REFRESH_RATE = 60
-DEF_AUTO_REFRESH_RATE = 1
+DEF_AUTO_REFRESH_RATE = 30
-class JobListViewItem(QListViewItem):
- def __init__(self, parent, printer, job_id, state, user, title):
- QListViewItem.__init__(self, parent, printer, str(job_id), state, user, title)
- self.job_id = job_id
- self.printer = printer
+class IconViewItem(QIconViewItem):
+ def __init__(self, parent, text, pixmap, device_uri, is_avail=True):
+ QIconViewItem.__init__(self, parent, text, pixmap)
+ self.device_uri = device_uri
+ self.is_avail = is_avail
-class QPixmapLabelButton(QPushButton):
- def __init__(self, parent=None, pixmap=None, disabled_pixmap=None, name=''):
- QPushButton.__init__(self, parent, name)
- self.pixmap = pixmap
- self.disabled_pixmap = disabled_pixmap
-
- self.pixmap_width, self.pixmap_height = self.pixmap.width(), self.pixmap.height()
-
-
-## pp = QPainter(self.disabled_pixmap)
-## pp.setBackgroundMode(Qt.OpaqueMode)
-## pp.eraseRect(0, 0, self.pixmap_width, self.pixmap_height)
-## #mask = self.pixmap.mask()
-## #pp.drawPixmap(0, 0, mask)
-## pp.end()
-
- #self.setFixedHeight(self.pixmap_height)
-
- def drawButtonLabel(self, painter):
- button_width, button_height = self.width(), self.height()
-
- adj = 0
- if self.isDown():
- adj = 1
-
-
- if self.isEnabled():
- painter.setPen(Qt.black)
- weight = QFont.Bold
- else:
- painter.setPen(Qt.gray)
- weight = QFont.Normal
-
- f = QFont() #"helvetica", 12, weight)
- f.setWeight(weight)
- painter.setFont(f)
- text_rect = painter.boundingRect(0, 0, 1000, 1000, Qt.AlignLeft, self.text())
- text_width, text_height = text_rect.right() - text_rect.left(), text_rect.bottom() - text_rect.top()
-
- button_width_center = button_width/2
- button_height_center = button_height/2
- combined_width_center = (self.pixmap_width + text_width + 10)/2
-
-
- if self.isEnabled():
- painter.drawPixmap(button_width_center - combined_width_center + adj, button_height_center - self.pixmap_height/2 + adj, self.pixmap)
- else:
- painter.drawPixmap(button_width_center - combined_width_center + adj, button_height_center - self.pixmap_height/2 + adj, self.disabled_pixmap)
-
-
- painter.drawText(button_width_center - combined_width_center + self.pixmap_width + 10 + adj,
- button_height_center - text_height/2 + adj, 1000, 1000, Qt.AlignLeft, self.text())
-
-
-
+class PasswordDialog(QDialog):
+ def __init__(self,prompt, parent = None,name = None,modal = 0,fl = 0):
+ QDialog.__init__(self,parent,name,modal,fl)
-class ScrollToolView(QScrollView):
- def __init__(self,parent = None,name = None,fl = 0):
- QScrollView.__init__(self,parent,name,fl)
- self.items = {}
- self.setStaticBackground(True)
- self.enableClipper(True)
- self.viewport().setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
- self.row_height = 120
-
- def viewportResizeEvent(self, e):
- for x in self.items:
- self.items[x].resize(e.size().width(), self.row_height)
-
- def addItem(self, name, title, pix, text, button_text, button_func):
- num_items = len(self.items)
- LayoutWidget = QWidget(self.viewport(),"layoutwidget")
- LayoutWidget.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum))
- LayoutWidget.setGeometry(QRect(0, 0, self.width(), self.row_height))
- LayoutWidget.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
- self.addChild(LayoutWidget)
-
- if num_items:
- self.moveChild(LayoutWidget, 0, self.row_height*num_items)
-
- layout = QGridLayout(LayoutWidget,1,1,10,10,"layout")
-
- pushButton = QPushButton(LayoutWidget,"pushButton")
- pushButton.setSizePolicy(QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Fixed,0,0,
- pushButton.sizePolicy().hasHeightForWidth()))
-
- self.connect(pushButton,SIGNAL("clicked()"), button_func)
-
- layout.addWidget(pushButton,2,2)
- textLabel = QLabel(LayoutWidget,"textLabel")
- layout.addWidget(textLabel,1,1)
-
- pixmap = QLabel(LayoutWidget,"pixmapLabel2")
- pixmap.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,
- pixmap.sizePolicy().hasHeightForWidth()))
- pixmap.setMinimumSize(QSize(32,32))
- pixmap.setMaximumSize(QSize(32,32))
- pixmap.setPixmap(pix)
- pixmap.setScaledContents(1)
- layout.addWidget(pixmap,1,0)
-
- textLabel2 = QLabel(LayoutWidget,"textLabel2")
- textLabel2.setAlignment(QLabel.WordBreak | QLabel.AlignTop)
- textLabel2.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding))
- layout.addWidget(textLabel2,2,1)
-
- if num_items:
- line = QFrame(LayoutWidget,"line")
- line.setFrameShadow(QFrame.Sunken)
- line.setFrameShape(QFrame.HLine)
- line.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Foreground))
- layout.addMultiCellWidget(line,0,0,0,2)
-
- textLabel.setText(title)
- textLabel2.setText(text)
- pushButton.setText(button_text)
- self.resizeContents(self.width(), num_items*self.row_height*2)
-
- LayoutWidget.show()
+ if not name:
+ self.setName("PasswordDialog")
- try:
- self.items[name]
- except KeyError:
- self.items[name] = LayoutWidget
- else:
- print "ERROR: Duplicate button name:", name
-
- def clear(self):
- if len(self.items):
- for x in self.items:
- self.removeChild(self.items[x])
- self.items[x].hide()
-
- self.items.clear()
- self.resizeContents(self.width(), 0)
-
-
-class ScrollSuppliesView(QScrollView):
- def __init__(self,parent = None,name = None,fl = 0):
- QScrollView.__init__(self,parent,name,fl)
- self.items = {}
- self.setStaticBackground(True)
- self.enableClipper(True)
- self.viewport().setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
-
- self.pix_black = QPixmap(os.path.join(prop.image_dir, 'icon_black.png'))
- self.pix_blue = QPixmap(os.path.join(prop.image_dir, 'icon_blue.png'))
- self.pix_cyan = QPixmap(os.path.join(prop.image_dir, 'icon_cyan.png'))
- self.pix_grey = QPixmap(os.path.join(prop.image_dir, 'icon_grey.png'))
- self.pix_magenta = QPixmap(os.path.join(prop.image_dir, 'icon_magenta.png'))
- self.pix_photo = QPixmap(os.path.join(prop.image_dir, 'icon_photo.png'))
- self.pix_photo_cyan = QPixmap(os.path.join(prop.image_dir, 'icon_photo_cyan.png'))
- self.pix_photo_magenta = QPixmap(os.path.join(prop.image_dir, 'icon_photo_magenta.png'))
- self.pix_photo_yellow = QPixmap(os.path.join(prop.image_dir, 'icon_photo_yellow.png'))
- self.pix_tricolor = QPixmap(os.path.join(prop.image_dir, 'icon_tricolor.png'))
- self.pix_yellow = QPixmap(os.path.join(prop.image_dir, 'icon_yellow.png'))
- self.pix_battery = QPixmap(os.path.join(prop.image_dir, 'icon_battery.png'))
- self.pix_photo_cyan_and_photo_magenta = QPixmap(os.path.join(prop.image_dir, 'icon_photo_magenta_and_photo_cyan.png'))
- self.pix_magenta_and_yellow = QPixmap(os.path.join(prop.image_dir, 'icon_magenta_and_yellow.png'))
- self.pix_black_and_cyan = QPixmap(os.path.join(prop.image_dir, 'icon_black_and_cyan.png'))
- self.pix_light_gray_and_photo_black = QPixmap(os.path.join(prop.image_dir, 'icon_light_grey_and_photo_black.png'))
- self.pix_light_gray = QPixmap(os.path.join(prop.image_dir, 'icon_light_grey.png'))
- self.pix_photo_gray = QPixmap(os.path.join(prop.image_dir, 'icon_photo_black.png'))
-
- self.TYPE_TO_PIX_MAP = {AGENT_TYPE_BLACK: self.pix_black,
- AGENT_TYPE_CMY: self.pix_tricolor,
- AGENT_TYPE_KCM: self.pix_photo,
- AGENT_TYPE_GGK: self.pix_grey,
- AGENT_TYPE_YELLOW: self.pix_yellow,
- AGENT_TYPE_MAGENTA: self.pix_magenta,
- AGENT_TYPE_CYAN: self.pix_cyan,
- AGENT_TYPE_CYAN_LOW: self.pix_photo_cyan,
- AGENT_TYPE_YELLOW_LOW: self.pix_photo_yellow,
- AGENT_TYPE_MAGENTA_LOW: self.pix_photo_magenta,
- AGENT_TYPE_BLUE: self.pix_blue,
- AGENT_TYPE_KCMY_CM: self.pix_grey,
- AGENT_TYPE_LC_LM: self.pix_photo_cyan_and_photo_magenta,
- AGENT_TYPE_Y_M: self.pix_magenta_and_yellow,
- AGENT_TYPE_C_K: self.pix_black_and_cyan,
- AGENT_TYPE_LG_PK: self.pix_light_gray_and_photo_black,
- AGENT_TYPE_LG: self.pix_light_gray,
- AGENT_TYPE_G: self.pix_grey,
- AGENT_TYPE_PG: self.pix_photo_gray,
- }
-
- self.row_height = 100
-
- def viewportResizeEvent(self, e):
- for x in self.items:
- self.items[x].resize(e.size().width(), self.row_height)
-
- def getIcon(self, agent_kind, agent_type):
- if agent_kind in (AGENT_KIND_SUPPLY,
- AGENT_KIND_HEAD,
- AGENT_KIND_HEAD_AND_SUPPLY,
- AGENT_KIND_TONER_CARTRIDGE):
-
- return self.TYPE_TO_PIX_MAP[agent_type]
-
- elif agent_kind == AGENT_KIND_INT_BATTERY:
- return self.pix_battery
-
-
- def createBarGraph(self, percent, agent_type, w=100, h=18):
- fw = w/100*percent
- px = QPixmap(w, h)
- pp = QPainter(px)
- pp.setBackgroundMode(Qt.OpaqueMode)
- pp.setPen(Qt.black)
-
- pp.setBackgroundColor(Qt.white)
-
- # erase the background
- b = QBrush(QColor(Qt.white))
- pp.fillRect(0, 0, w, h, b)
-
- # fill in the bar
- if agent_type in (AGENT_TYPE_BLACK, AGENT_TYPE_UNSPECIFIED):
- b = QBrush(QColor(Qt.black))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_CMY:
- h3 = h/3
- b = QBrush(QColor(Qt.cyan))
- pp.fillRect(0, 0, fw, h3, b)
- b = QBrush(QColor(Qt.magenta))
- pp.fillRect(0, h3, fw, 2*h3, b)
- b = QBrush(QColor(Qt.yellow))
- pp.fillRect(0, 2*h3, fw, h, b)
- elif agent_type == AGENT_TYPE_KCM:
- h3 = h/3
- b = QBrush(QColor(Qt.cyan).light())
- pp.fillRect(0, 0, fw, h3, b)
- b = QBrush(QColor(Qt.magenta).light())
- pp.fillRect(0, h3, fw, 2*h3, b)
- b = QBrush(QColor(Qt.yellow).light())
- pp.fillRect(0, 2*h3, fw, h, b)
- elif agent_type == AGENT_TYPE_GGK:
- b = QBrush(QColor(Qt.gray))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_YELLOW:
- b = QBrush(QColor(Qt.yellow))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_MAGENTA:
- b = QBrush(QColor(Qt.magenta))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_CYAN:
- b = QBrush(QColor(Qt.cyan))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_CYAN_LOW:
- b = QBrush(QColor(225, 246, 255))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_YELLOW_LOW:
- b = QBrush(QColor(255, 253, 225))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_MAGENTA_LOW:
- b = QBrush(QColor(255, 225, 240))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_BLUE:
- b = QBrush(QColor(0, 0, 255))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_LG:
- b = QBrush(QColor(192, 192, 192))
- pp.fillRect(0, 0, fw, h, b)
- elif agent_type == AGENT_TYPE_PG:
- b = QBrush(QColor(128, 128, 128))
- pp.fillRect(0, 0, fw, h, b)
-
-
-
- # 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)
-
- return px
-
-
- def addItem(self, name, title_text, part_num_text, status_text,
- agent_kind, agent_type, percent):
-
- num_items = len(self.items)
- LayoutWidget = QWidget(self.viewport(), name)
- LayoutWidget.setGeometry(QRect(0, 0, self.width(), self.row_height))
- LayoutWidget.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum))
- LayoutWidget.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
- self.addChild(LayoutWidget)
-
- if num_items:
- self.moveChild(LayoutWidget, 0, self.row_height*num_items)
-
- layout = QGridLayout(LayoutWidget,1,1,10,10,"layout")
- textStatus = QLabel(LayoutWidget,"textStatus")
- layout.addWidget(textStatus,1,2)
- pixmapLevel = QLabel(LayoutWidget,"pixmapLevel")
- pixmapLevel.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,
- pixmapLevel.sizePolicy().hasHeightForWidth()))
-
- pixmapLevel.setMinimumSize(QSize(100,20))
- pixmapLevel.setMaximumSize(QSize(100,20))
- layout.addWidget(pixmapLevel,2,2)
- textTitle = QLabel(LayoutWidget,"textTitle")
- layout.addWidget(textTitle,1,1)
- textPartNo = QLabel(LayoutWidget,"textPartNo")
- layout.addWidget(textPartNo,2,1)
- pixmapIcon = QLabel(LayoutWidget,"pixmapIcon")
- pixmapIcon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,
- pixmapIcon.sizePolicy().hasHeightForWidth()))
-
- pixmapIcon.setMinimumSize(QSize(32,32))
- pixmapIcon.setMaximumSize(QSize(32,32))
- layout.addWidget(pixmapIcon,1,0)
-
- if num_items:
- line = QFrame(LayoutWidget,"line")
- line.setFrameShadow(QFrame.Sunken)
- line.setFrameShape(QFrame.HLine)
- line.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Foreground))
- layout.addMultiCellWidget(line,0,0,0,2)
-
- textTitle.setText(title_text)
- textPartNo.setText(part_num_text)
- textStatus.setText(status_text)
-
- # Bar graph level
- 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,
- ):
-
- pixmapLevel.setPixmap(self.createBarGraph(percent, agent_type))
-
- # Color icon
- 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,
- ):
-
- pix = self.getIcon(agent_kind, agent_type)
-
- if pix is not None:
- pixmapIcon.setPixmap(pix)
-
- self.resizeContents(self.width(), num_items*self.row_height*2)
- LayoutWidget.show()
+ passwordDlg_baseLayout = QGridLayout(self,1,1,11,6,"passwordDlg_baseLayout")
- try:
- self.items[name]
- except KeyError:
- self.items[name] = LayoutWidget
+ self.passwordLineEdit = QLineEdit(self,"passwordLineEdit")
+ self.passwordLineEdit.setEchoMode(QLineEdit.Password)
+ passwordDlg_baseLayout.addMultiCellWidget(self.passwordLineEdit,1,1,0,1)
- def clear(self):
- if len(self.items):
- for x in self.items:
- self.removeChild(self.items[x])
- self.items[x].hide()
+ self.promptTextLabel = QLabel(self,"promptTextLabel")
- self.items.clear()
- self.resizeContents(self.width(), 0)
+ passwordDlg_baseLayout.addMultiCellWidget(self.promptTextLabel,0,0,0,1)
+ spacer1 = QSpacerItem(20,61,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ passwordDlg_baseLayout.addItem(spacer1,2,0)
+ spacer2 = QSpacerItem(321,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ passwordDlg_baseLayout.addItem(spacer2,3,0)
+ self.okPushButton = QPushButton(self,"okPushButton")
+ passwordDlg_baseLayout.addWidget(self.okPushButton,3,1)
-class IconViewItem(QIconViewItem):
- def __init__(self, parent, text, pixmap, device_uri, is_avail=True):
- QIconViewItem.__init__(self, parent, text, pixmap)
- self.device_uri = device_uri
- self.is_avail = is_avail
+ self.languageChange()
+
+ self.resize(QSize(420,163).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+
+ self.connect(self.okPushButton,SIGNAL("clicked()"),self.accept)
+ self.connect(self.passwordLineEdit,SIGNAL("returnPressed()"),self.accept)
+ self.promptTextLabel.setText(prompt)
+
+ def getPassword(self):
+ return unicode(self.passwordLineEdit.text())
+
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Enter Password"))
+ self.okPushButton.setText(self.__tr("OK"))
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PasswordDialog",s,c)
+def PasswordUI(prompt):
+ QApplication.restoreOverrideCursor()
-class devmgr4(DevMgr4_base):
- def __init__(self, hpiod_sock, hpssd_sock,
- cleanup=None, initial_device_uri=None,
+ dlg = PasswordDialog(prompt, None)
+
+ if dlg.exec_loop() == QDialog.Accepted:
+ return dlg.getPassword()
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ return ""
+
+
+class DevMgr4(DevMgr4_base):
+ def __init__(self, hpssd_sock,
+ cleanup=None, toolbox_version='0.0',
parent=None, name=None, fl = 0):
DevMgr4_base.__init__(self, parent, name, fl)
@@ -488,111 +135,133 @@ class devmgr4(DevMgr4_base):
icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
self.setIcon(icon)
- log.debug("Initializing toolbox UI")
+ log.debug("Initializing toolbox UI...")
+ log.debug("HPLIP Version: %s" % sys_cfg.hplip.version)
+
self.cleanup = cleanup
- self.hpiod_sock = hpiod_sock
self.hpssd_sock = hpssd_sock
-
- TabPageLayout = QGridLayout(self.TabPage,1,1,11,6) #,"TabPageLayout")
-
- self.ConfigureFeaturesButton = QPushButton(self.TabPage) #,"ConfigureFeaturesButton")
- TabPageLayout.addWidget(self.ConfigureFeaturesButton,7,1)
-
- spacer1 = QSpacerItem(321,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- TabPageLayout.addItem(spacer1,7,0)
-
- spacer2 = QSpacerItem(20,80,QSizePolicy.Minimum,QSizePolicy.Expanding)
- TabPageLayout.addItem(spacer2,6,1)
+ self.toolbox_version = toolbox_version
+ self.cur_device_uri = user_cfg.last_used.device_uri # Device URI
+ self.devices = {} # { Device_URI : device.Device(), ... }
+ self.device_vars = {}
+ self.num_devices = 0
+ self.cur_device = None
+ self.rescanning = False
- self.ScanButton = QPixmapLabelButton(self.TabPage, QPixmap(os.path.join(prop.image_dir, "scan_icon.png")),
- QPixmap(os.path.join(prop.image_dir, "scan_icon_disabled.png")))
-
- self.ScanButton.setMinimumSize(QSize(0,42))
- self.ScanButton.setEnabled(0)
+ self.user_settings = utils.UserSettings()
- TabPageLayout.addMultiCellWidget(self.ScanButton,2,2,0,1)
+ if not self.user_settings.auto_refresh:
+ self.autoRefresh.toggle()
- self.PCardButton = QPixmapLabelButton(self.TabPage, QPixmap(os.path.join(prop.image_dir, "pcard_icon.png")),
- QPixmap(os.path.join(prop.image_dir, "pcard_icon_disabled.png")))
-
- self.PCardButton.setMinimumSize(QSize(0,42))
- self.PCardButton.setEnabled(0)
+ self.InitDeviceList()
- TabPageLayout.addMultiCellWidget(self.PCardButton,3,3,0,1)
+ self.InitFunctionsTab()
+ self.InitStatusTab()
+ self.InitMaintTab()
+ self.InitSuppliesTab()
+ self.InitPrintSettingsTab()
+ self.InitPrintJobsTab()
- self.SendFaxButton = QPixmapLabelButton(self.TabPage, QPixmap(os.path.join(prop.image_dir, "fax_icon.png")),
- QPixmap(os.path.join(prop.image_dir, "fax_icon_disabled.png")))
-
- self.SendFaxButton.setMinimumSize(QSize(0,42))
- self.SendFaxButton.setEnabled(0)
+ self.TabIndex = { self.FunctionsTab: self.FuncList,
+ self.StatusTab: self.StatusList,
+ self.MaintTab: self.ToolList,
+ self.SuppliesTab: self.SuppliesList,
+ self.PrintSettingsTab: self.PrintSettingsList,
+ self.PrintJobsTab: self.PrintJobsList,
+ self.MaintTab: self.ToolList
+ }
- TabPageLayout.addMultiCellWidget(self.SendFaxButton,4,4,0,1)
+ self.funcs_page = 'funcs'
+ self.maint_page = 'tools'
- self.MakeCopiesButton = QPixmapLabelButton(self.TabPage, QPixmap(os.path.join(prop.image_dir, "makecopies_icon.png")),
- QPixmap(os.path.join(prop.image_dir, "makecopies_icon_disabled.png")) )
+ cups.setPasswordCallback(PasswordUI)
- self.MakeCopiesButton.setMinimumSize(QSize(0,42))
- self.MakeCopiesButton.setEnabled(0)
+ #if not prop.doc_build:
+ # self.helpContentsAction.setEnabled(False)
+
+ self.allow_auto_refresh = True
- TabPageLayout.addMultiCellWidget(self.MakeCopiesButton,5,5,0,1)
- spacer3 = QSpacerItem(20,90,QSizePolicy.Minimum,QSizePolicy.Expanding)
- TabPageLayout.addItem(spacer3, 0, 0)
+ QTimer.singleShot(0, self.InitialUpdate)
- self.PrintButton = QPixmapLabelButton(self.TabPage, QPixmap(os.path.join(prop.image_dir, "print_icon.png")),
- QPixmap(os.path.join(prop.image_dir, "print_icon_disabled.png")))
-
- self.PrintButton.setMinimumSize(QSize(0,42))
- self.PrintButton.setEnabled(0)
- TabPageLayout.addMultiCellWidget(self.PrintButton,1,1,0,1)
+ def InitialUpdate(self):
+ self.RescanDevices(init=True)
+
+ self.refresh_timer = QTimer(self, "RefreshTimer")
+ self.connect(self.refresh_timer, SIGNAL('timeout()'), self.TimedRefresh)
+ if MIN_AUTO_REFRESH_RATE <= self.user_settings.auto_refresh_rate <= MAX_AUTO_REFRESH_RATE:
+ self.refresh_timer.start(self.user_settings.auto_refresh_rate * 1000)
- self.connect(self.PrintButton,SIGNAL("clicked()"),self.PrintButton_clicked)
- self.connect(self.ScanButton,SIGNAL("clicked()"),self.ScanButton_clicked)
- self.connect(self.PCardButton,SIGNAL("clicked()"),self.PCardButton_clicked)
- self.connect(self.SendFaxButton,SIGNAL("clicked()"),self.SendFaxButton_clicked)
- self.connect(self.MakeCopiesButton,SIGNAL("clicked()"),self.MakeCopiesButton_clicked)
- self.connect(self.ConfigureFeaturesButton,SIGNAL("clicked()"),self.ConfigureFeaturesButton_clicked)
-
- self.ConfigureFeaturesButton.setText(self.__tr("Configure..."))
- self.ScanButton.setText(self.__tr("Scan"))
- self.PCardButton.setText(self.__tr("Photo Card"))
- self.SendFaxButton.setText(self.__tr("Send Fax"))
- self.MakeCopiesButton.setText(self.__tr("Make Copies"))
- self.PrintButton.setText(self.__tr("Print"))
-
- self.StatusHistoryList.setSorting(-1)
- self.PrintJobList.setSorting(1) # Sort on job ID column
+ def InitDeviceList(self):
self.DeviceList.setAutoArrange(False)
- self.StatusHistoryList.setColumnWidth(0, 16)
- self.StatusHistoryList.setColumnText(0, ' ')
- self.StatusHistoryList.setColumnWidthMode(1, QListView.Maximum)
- self.StatusHistoryList.setColumnWidthMode(2, QListView.Maximum)
- self.StatusHistoryList.setColumnWidthMode(3, QListView.Maximum)
- self.StatusHistoryList.setColumnWidthMode(4, QListView.Maximum)
- self.StatusHistoryList.setColumnWidthMode(5, QListView.Maximum)
- self.StatusHistoryList.setColumnWidthMode(6, QListView.Maximum)
-
- self.PrintJobList.setColumnWidth(0, 150)
- self.PrintJobList.setColumnWidthMode(0, QListView.Maximum)
- self.PrintJobList.setColumnWidth(1, 60)
- self.PrintJobList.setColumnWidthMode(1, QListView.Maximum)
- self.PrintJobList.setColumnWidth(2, 80)
- self.PrintJobList.setColumnWidthMode(2, QListView.Maximum)
- self.PrintJobList.setColumnWidth(3, 100)
- self.PrintJobList.setColumnWidthMode(3, QListView.Maximum)
- self.PrintJobList.setColumnWidth(4, 200)
- self.PrintJobList.setColumnWidthMode(4, QListView.Maximum)
-
- self.initial_device_uri = initial_device_uri
-
- self.warning_pix = QPixmap(os.path.join(prop.image_dir, "warning.png"))
- self.error_pix = QPixmap(os.path.join(prop.image_dir, "error.png"))
- self.ok_pix = QPixmap(os.path.join(prop.image_dir, "ok.png"))
- self.lowink_pix = QPixmap(os.path.join(prop.image_dir, 'inkdrop.png'))
- self.lowtoner_pix = QPixmap(os.path.join(prop.image_dir, 'toner.png'))
- self.busy_pix = QPixmap(os.path.join(prop.image_dir, 'busy.png'))
- self.lowpaper_pix = QPixmap(os.path.join(prop.image_dir, 'paper.png'))
+ # Resize the splitter so that the device list starts as a single column
+ self.splitter2.setSizes([120, 700])
+
+
+ def InitFunctionsTab(self):
+ self.FuncList = ScrollFunctionsView(self.FunctionsTab, self, "FuncView")
+
+ self.FuncTabLayout = QGridLayout(self.FunctionsTab,1,1,11,6,"FuncTabLayout")
+ self.FuncTabLayout.addWidget(self.FuncList,0,0)
+
+ def SwitchFunctionsTab(self, page='funcs'):
+ self.FuncTabLayout.remove(self.FuncList)
+ self.FuncList.hide()
+
+ if page == 'funcs':
+ self.allow_auto_refresh = True
+ self.Tabs.changeTab(self.FunctionsTab,self.__tr("Functions"))
+ self.FuncList = ScrollFunctionsView(self.FunctionsTab, self, "FuncView")
+
+ elif page == 'print':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.FunctionsTab,self.__tr("Functions > Print"))
+ self.FuncList = ScrollPrintView(True, self.FunctionsTab, self, "PrintView")
+
+ elif page == 'scan':
+ self.allow_auto_refresh = False
+ pass
+
+ elif page == 'copy':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.FunctionsTab,self.__tr("Functions > Make Copies"))
+ self.FuncList = ScrollCopyView(self.hpssd_sock, True, parent=self.FunctionsTab, form=self, name="CopyView")
+
+ elif page == 'fax':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.FunctionsTab, self.__tr("Functions > Fax"))
+ self.FuncList = ScrollFaxView(self.hpssd_sock, True, self.FunctionsTab, self, "FaxView")
+
+ elif page == 'pcard':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.FunctionsTab, self.__tr("Functions > Unload Photo Card"))
+ self.FuncList = ScrollUnloadView(True, self.FunctionsTab, self, "UnloadView")
+
+ self.funcs_page = page
+ self.FuncTabLayout.addWidget(self.FuncList, 0, 0)
+ self.FuncList.show()
+ self.TabIndex[self.FunctionsTab] = self.FuncList
+ self.FuncList.onDeviceChange(self.cur_device)
+
+
+ def InitStatusTab(self):
+ StatusTabLayout = QGridLayout(self.StatusTab,1,1,11,6,"StatusTabLayout")
+
+ self.Panel_2 = QLabel(self.StatusTab,"Panel_2")
+ self.Panel_2.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.Panel_2.sizePolicy().hasHeightForWidth()))
+ self.Panel_2.setMinimumSize(QSize(254,40))
+ self.Panel_2.setMaximumSize(QSize(254,40))
+ self.Panel_2.setScaledContents(1)
+
+ StatusTabLayout.addWidget(self.Panel_2,0,1)
+ spacer21 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ StatusTabLayout.addItem(spacer21,0,2)
+ spacer22 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ StatusTabLayout.addItem(spacer22,0,0)
+
+ self.StatusList = ScrollStatusView(self.StatusTab, "statuslist")
+ StatusTabLayout.addMultiCellWidget(self.StatusList,1,1,0,2)
self.warning_pix_small = QPixmap(os.path.join(prop.image_dir, "warning_small.png"))
self.error_pix_small = QPixmap(os.path.join(prop.image_dir, "error_small.png"))
@@ -602,136 +271,161 @@ class devmgr4(DevMgr4_base):
self.busy_pix_small = QPixmap(os.path.join(prop.image_dir, 'busy_small.png'))
self.lowpaper_pix_small = QPixmap(os.path.join(prop.image_dir, 'paper_small.png'))
- self.blank_lcd = os.path.join(prop.image_dir, "panel_lcd.xpm")
- self.Panel.setPixmap(QPixmap(self.blank_lcd))
-
# pixmaps: (inkjet, laserjet)
- self.STATUS_HISTORY_ICONS = { ERROR_STATE_CLEAR : (None, None),
- ERROR_STATE_BUSY : (self.busy_pix_small, self.busy_pix_small),
- ERROR_STATE_ERROR : (self.error_pix_small, self.error_pix_small),
- ERROR_STATE_LOW_SUPPLIES : (self.lowink_pix_small, self.lowtoner_pix_small),
- ERROR_STATE_OK : (self.ok_pix_small, self.ok_pix_small),
- ERROR_STATE_WARNING : (self.warning_pix_small, self.warning_pix_small),
- ERROR_STATE_LOW_PAPER: (self.lowpaper_pix_small, self.lowpaper_pix_small),
- }
-
- self.STATUS_ICONS = { ERROR_STATE_CLEAR : (None, None),
- ERROR_STATE_BUSY : (self.busy_pix, self.busy_pix),
- ERROR_STATE_ERROR : (self.error_pix, self.error_pix),
- ERROR_STATE_LOW_SUPPLIES : (self.lowink_pix, self.lowtoner_pix),
- ERROR_STATE_OK : (self.ok_pix, self.ok_pix),
- ERROR_STATE_WARNING : (self.warning_pix, self.warning_pix),
- ERROR_STATE_LOW_PAPER: (self.lowpaper_pix, self.lowpaper_pix),
+ self.SMALL_ICONS = { ERROR_STATE_CLEAR : (None, None),
+ ERROR_STATE_BUSY : (self.busy_pix_small, self.busy_pix_small),
+ ERROR_STATE_ERROR : (self.error_pix_small, self.error_pix_small),
+ ERROR_STATE_LOW_SUPPLIES : (self.lowink_pix_small, self.lowtoner_pix_small),
+ ERROR_STATE_OK : (self.ok_pix_small, self.ok_pix_small),
+ ERROR_STATE_WARNING : (self.warning_pix_small, self.warning_pix_small),
+ ERROR_STATE_LOW_PAPER: (self.lowpaper_pix_small, self.lowpaper_pix_small),
+ ERROR_STATE_PRINTING : (self.busy_pix_small, self.busy_pix_small),
+ ERROR_STATE_SCANNING : (self.busy_pix_small, self.busy_pix_small),
+ ERROR_STATE_PHOTOCARD : (self.busy_pix_small, self.busy_pix_small),
+ ERROR_STATE_FAXING : (self.busy_pix_small, self.busy_pix_small),
+ ERROR_STATE_COPYING : (self.busy_pix_small, self.busy_pix_small),
}
- self.JOB_STATES = { 3 : self.__tr("Pending"),
- 4 : self.__tr("On hold"),
- 5 : self.__tr("Printing"),
- 6 : self.__tr("Stopped"),
- 7 : self.__tr("Canceled"),
- 8 : self.__tr("Aborted"),
- 9 : self.__tr("Completed"),
- }
+ self.blank_lcd = os.path.join(prop.image_dir, "panel_lcd.xpm")
+ self.Panel_2.setPixmap(QPixmap(self.blank_lcd))
- self.email_alerts = utils.to_bool(user_cfg.alerts.email_alerts) or False
- self.email_to_addresses = user_cfg.alerts.email_to_addresses
- self.email_from_address = user_cfg.alerts.email_from_address
- self.auto_refresh = utils.to_bool(user_cfg.refresh.enable) or False
+ def InitMaintTab(self): # Add Scrolling Maintenance (Tools)
+ self.ToolList = ScrollToolView(True, self.MaintTab, self, "ToolView")
+ self.MaintTabLayout = QGridLayout(self.MaintTab,1,1,11,6,"MaintTabLayout")
+ self.MaintTabLayout.addWidget(self.ToolList,0,0)
- try:
- self.auto_refresh_rate = int(user_cfg.refresh.rate)
- except ValueError:
- self.auto_refresh_rate = DEF_AUTO_REFRESH_RATE
+ def SwitchMaintTab(self, page='tools'):
+ self.MaintTabLayout.remove(self.ToolList)
+ self.ToolList.hide()
- try:
- self.auto_refresh_type = int(user_cfg.refresh.type)
- except ValueError:
- self.auto_refresh_type = 0 # refresh 1 (1=refresh all)
+ if page == 'tools':
+ self.allow_auto_refresh = True
+ self.Tabs.changeTab(self.MaintTab,self.__tr("Tools"))
+ self.ToolList = ScrollToolView(True, self.MaintTab, self, "ToolView")
- cmd_print, cmd_scan, cmd_pcard, \
- cmd_copy, cmd_fax, cmd_fab = utils.deviceDefaultFunctions()
+ elif page == 'device_info':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.MaintTab,self.__tr("Tools > Device Information"))
+ self.ToolList = ScrollDeviceInfoView(True, self.MaintTab, self, "DeviceInfoView")
- self.cmd_print = user_cfg.commands.prnt or cmd_print
- self.cmd_scan = user_cfg.commands.scan or cmd_scan
- self.cmd_pcard = user_cfg.commands.pcard or cmd_pcard
- self.cmd_copy = user_cfg.commands.cpy or cmd_copy
- self.cmd_fax = user_cfg.commands.fax or cmd_fax
- self.cmd_fab = user_cfg.commands.fab or cmd_fab
+ elif page == 'printer_info':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.MaintTab,self.__tr("Tools > Printer Information"))
+ self.ToolList = ScrollPrinterInfoView(True, self.MaintTab, self, "PrinterInfoView")
- log.debug("HPLIP Version: %s" % sys_cfg.hplip.version)
- log.debug("Print command: %s" % self.cmd_print)
- log.debug("PCard command: %s" % self.cmd_pcard)
- log.debug("Fax command: %s" % self.cmd_fax)
- log.debug("FAB command: %s" % self.cmd_fab)
- log.debug("Copy command: %s " % self.cmd_copy)
- log.debug("Scan command: %s" % self.cmd_scan)
- log.debug("Email alerts: %s" % self.email_alerts)
- log.debug("Email to address(es): %s" % self.email_to_addresses)
- log.debug("Email from address: %s" % self.email_from_address)
- 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)
-
- if not self.auto_refresh:
- self.autoRefresh.toggle()
+ elif page == 'testpage':
+ self.allow_auto_refresh = False
+ self.Tabs.changeTab(self.MaintTab,self.__tr("Tools > Print Test Page"))
- self.cur_device_uri = '' # Device URI
- self.devices = {} # { Device_URI : device.Device(), ... }
- self.device_vars = {}
- self.num_devices = 0
- self.cur_device = None
- self.rescanning = False
+ self.ToolList = ScrollTestpageView(True, self.MaintTab, self, "ScrollTestpageView")
+
+ self.maint_page = page
+ self.MaintTabLayout.addWidget(self.ToolList, 0, 0)
+ self.ToolList.show()
+ self.TabIndex[self.MaintTab] = self.ToolList
+ self.ToolList.onDeviceChange(self.cur_device)
- # Add Scrolling Maintenance (Tools)
- self.ToolList = ScrollToolView(self.MaintTab, "ToolView")
- MaintTabLayout = QGridLayout(self.MaintTab,1,1,11,6,"MaintTabLayout")
- MaintTabLayout.addWidget(self.ToolList,0,0)
- # Add Scrolling Supplies
+ def InitSuppliesTab(self): # Add Scrolling Supplies
self.SuppliesList = ScrollSuppliesView(self.SuppliesTab, "SuppliesView")
SuppliesTabLayout = QGridLayout(self.SuppliesTab,1,1,11,6,"SuppliesTabLayout")
self.SuppliesList.setHScrollBarMode(QScrollView.AlwaysOff)
- SuppliesTabLayout.addWidget(self.SuppliesList,0,0)
+ SuppliesTabLayout.addWidget(self.SuppliesList,0,0)
- QTimer.singleShot(0, self.InitialUpdate)
+ def InitPrintSettingsTab(self): # Add Scrolling Print Settings
+ PrintJobsTabLayout = QGridLayout(self.PrintSettingsTab,1,1,11,6,"PrintJobsTabLayout")
+ self.PrintSettingsList = ScrollPrintSettingsView(self.PrintSettingsTab, "PrintSettingsView")
+ PrintJobsTabLayout.addMultiCellWidget(self.PrintSettingsList,1,1,0,5)
- def InitialUpdate(self):
- self.RescanDevices()
+ self.PrintSettingsPrinterCombo = QComboBox(0,self.PrintSettingsTab,"comboBox5")
+ self.PrintSettingsPrinterCombo.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,
+ self.PrintSettingsPrinterCombo.sizePolicy().hasHeightForWidth()))
- self.refresh_timer = QTimer(self, "RefreshTimer")
- self.connect(self.refresh_timer, SIGNAL('timeout()'), self.TimedRefresh)
+ PrintJobsTabLayout.addMultiCellWidget(self.PrintSettingsPrinterCombo,0,0,2,3)
+
+ textLabel12 = QLabel(self.PrintSettingsTab,"textLabel12")
+ PrintJobsTabLayout.addWidget(textLabel12,0,1)
+
+ textLabel12.setText(self.__tr("Printer Name:"))
+
+ spacer34 = QSpacerItem(20,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ PrintJobsTabLayout.addMultiCell(spacer34,0,0,4,5)
+
+ spacer35 = QSpacerItem(20,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ PrintJobsTabLayout.addItem(spacer35,0,0)
+
+ self.connect(self.PrintSettingsPrinterCombo, SIGNAL("activated(const QString&)"), self.SettingsPrinterCombo_activated)
+
+ def InitPrintJobsTab(self):
+ # Add Scrolling Print Jobs
+ PrintJobsTabLayout = QGridLayout(self.PrintJobsTab,1,1,11,6,"PrintJobsTabLayout")
+
+ self.PrintJobsList = ScrollPrintJobView(self.PrintJobsTab, "PrintJobsView")
+ PrintJobsTabLayout.addMultiCellWidget(self.PrintJobsList,1,1,0,5)
- if MIN_AUTO_REFRESH_RATE <= self.auto_refresh_rate <= MAX_AUTO_REFRESH_RATE:
- self.refresh_timer.start(self.auto_refresh_rate * 60000)
+ self.PrintJobPrinterCombo = QComboBox(0,self.PrintJobsTab,"comboBox5")
+ self.PrintJobPrinterCombo.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,
+ self.PrintJobPrinterCombo.sizePolicy().hasHeightForWidth()))
+ PrintJobsTabLayout.addMultiCellWidget(self.PrintJobPrinterCombo,0,0,2,3)
+
+ textLabel12 = QLabel(self.PrintJobsTab,"textLabel12")
+ PrintJobsTabLayout.addWidget(textLabel12,0,1)
+
+ textLabel12.setText(self.__tr("Printer Name:"))
+
+ spacer34 = QSpacerItem(171,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ PrintJobsTabLayout.addMultiCell(spacer34,0,0,4,5)
+
+ spacer35 = QSpacerItem(71,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ PrintJobsTabLayout.addItem(spacer35,0,0)
+
+ self.connect(self.PrintJobPrinterCombo, SIGNAL("activated(const QString&)"), self.JobsPrinterCombo_activated)
def TimedRefresh(self):
- if self.auto_refresh:
+ if self.user_settings.auto_refresh and self.allow_auto_refresh:
log.debug("Refresh timer...")
self.CleanupChildren()
- if self.auto_refresh_type == 0:
+ if self.user_settings.auto_refresh_type == 0:
self.UpdateDevice()
else:
self.RescanDevices()
def autoRefresh_toggled(self,a0):
- self.auto_refresh = bool(a0)
- self.SaveConfig()
-
+ self.user_settings.auto_refresh = bool(a0)
+ #self.user_settings.save()
def closeEvent(self, event):
self.Cleanup()
event.accept()
-
- def RescanDevices(self):
+ def RescanDevices(self, init=False):
if not self.rescanning:
self.deviceRefreshAll.setEnabled(False)
self.DeviceListRefresh()
self.deviceRefreshAll.setEnabled(True)
+ if not init:
+ self.UpdateDevice()
+
+ def ActivateDevice(self, device_uri):
+ log.debug(log.bold("Activate: %s %s %s" % ("*"*20, device_uri, "*"*20)))
+ d = self.DeviceList.firstItem()
+ found = False
+
+ while d is not None:
+
+ if d.device_uri == device_uri:
+ found = True
+ self.DeviceList.setSelected(d, True)
+ break
+
+ d = d.nextItem()
+
+ return found
+
def Cleanup(self):
self.CleanupChildren()
@@ -747,11 +441,15 @@ class devmgr4(DevMgr4_base):
pass
- def DeviceList_currentChanged(self,a0):
- if self.cur_device is not None:
- self.cur_device_uri = self.DeviceList.currentItem().device_uri
- self.cur_device = self.devices[self.cur_device_uri]
- #self.cur_device.sorted_supplies = []
+ def DeviceList_currentChanged(self, a0):
+ if not self.rescanning:
+ try:
+ self.cur_device_uri = self.DeviceList.currentItem().device_uri
+ self.cur_device = self.devices[self.cur_device_uri]
+ user_cfg.last_used.device_uri = self.cur_device_uri
+ except AttributeError:
+ pass
+
self.UpdateDevice()
@@ -759,20 +457,35 @@ class devmgr4(DevMgr4_base):
popup = QPopupMenu(self)
if item is not None:
- if self.cur_device.error_state not in (ERROR_STATE_BUSY, ERROR_STATE_ERROR):
- popup.insertItem(self.__tr("Print..."), self.PrintButton_clicked)
+ if self.cur_device.error_state != ERROR_STATE_ERROR:
+ if self.user_settings.cmd_print_int:
+ popup.insertItem(self.__tr("Print >>"), self.PrintButton_clicked)
+ else:
+ popup.insertItem(self.__tr("Print..."), self.PrintButton_clicked)
if self.cur_device.scan_type:
- popup.insertItem(self.__tr("Scan..."), self.ScanButton_clicked)
+ if self.user_settings.cmd_scan_int:
+ popup.insertItem(self.__tr("Scan >>"), self.ScanButton_clicked)
+ else:
+ popup.insertItem(self.__tr("Scan..."), self.ScanButton_clicked)
if self.cur_device.pcard_type:
- popup.insertItem(self.__tr("Access Photo Cards..."), self.PCardButton_clicked)
+ if self.user_settings.cmd_pcard_int:
+ popup.insertItem(self.__tr("Access Photo Cards >>"), self.PCardButton_clicked)
+ else:
+ popup.insertItem(self.__tr("Access Photo Cards..."), self.PCardButton_clicked)
if self.cur_device.fax_type:
- popup.insertItem(self.__tr("Send Fax..."), self.SendFaxButton_clicked)
+ if self.user_settings.cmd_fax_int:
+ popup.insertItem(self.__tr("Send Fax >>"), self.SendFaxButton_clicked)
+ else:
+ popup.insertItem(self.__tr("Send Fax..."), self.SendFaxButton_clicked)
- if self.cur_device.copy_type == COPY_TYPE_DEVICE:
- popup.insertItem(self.__tr("Make Copies..."), self.MakeCopiesButton_clicked)
+ if self.cur_device.copy_type:
+ if self.user_settings.cmd_copy_int:
+ popup.insertItem(self.__tr("Make Copies >>"), self.MakeCopiesButton_clicked)
+ else:
+ popup.insertItem(self.__tr("Make Copies..."), self.MakeCopiesButton_clicked)
popup.insertSeparator()
@@ -786,47 +499,131 @@ class devmgr4(DevMgr4_base):
popup.popup(pos)
- def UpdateDevice(self, check_state=True, reread_cups_printers=False):
+ def UpdateDevice(self, check_state=True):
if self.cur_device is not None:
- log.debug(utils.bold("Update: %s %s %s" % ("*"*20, self.cur_device_uri, "*"*20)))
- self.setCaption(self.__tr("%1 - HP Device Manager").arg(self.cur_device.model_ui))
-
+ log.debug(log.bold("Update: %s %s %s" % ("*"*20, self.cur_device_uri, "*"*20)))
+ self.setCaption(self.__tr("HP Device Manager - %1").arg(self.cur_device.model_ui))
+
+ self.updatePrinterList()
+
if not self.rescanning:
- self.statusBar().message(self.cur_device_uri)
-
+ self.statusBar().message(QString("%1 (%2)").arg(self.cur_device_uri).arg(', '.join(self.cur_device.cups_printers)))
+
if self.cur_device.supported and check_state and not self.rescanning:
QApplication.setOverrideCursor(QApplication.waitCursor)
-
+
try:
try:
self.cur_device.open()
except Error, e:
log.warn(e.msg)
-
+
if self.cur_device.device_state == DEVICE_STATE_NOT_FOUND:
self.cur_device.error_state = ERROR_STATE_ERROR
else:
try:
- self.cur_device.queryDevice(quick=False, no_fwd=False, reread_cups_printers=reread_cups_printers)
+ self.cur_device.queryDevice(quick=False, no_fwd=False,
+ reread_cups_printers=False)
+
except Error, e:
log.error("Query device error (%s)." % e.msg)
self.cur_device.error_state = ERROR_STATE_ERROR
-
+
finally:
self.cur_device.close()
QApplication.restoreOverrideCursor()
-
+
log.debug("Device state = %d" % self.cur_device.device_state)
log.debug("Status code = %d" % self.cur_device.status_code)
log.debug("Error state = %d" % self.cur_device.error_state)
-
+
icon = self.CreatePixmap()
self.DeviceList.currentItem().setPixmap(icon)
-
+
+ self.cur_device.hist = []
+
if not self.rescanning:
self.UpdateHistory()
- self.UpdateTabs()
+
+ if self.allow_auto_refresh:
+ self.Tabs_deviceChanged(self.Tabs.currentPage())
+
+ self.UpdatePrinterCombos()
+ self.UpdatePanel()
+ self.setupDevice.setEnabled(self.cur_device.device_settings_ui is not None)
+
+ def updatePrinterList(self):
+ if self.cur_device is not None and \
+ self.cur_device.supported:
+
+ printers = cups.getPrinters()
+ self.cur_device.cups_printers = []
+ cur_device_uri_tail = self.cur_device_uri.split(':')[1]
+
+ for p in printers:
+ try:
+ p_tail = p.device_uri.split(':')[1]
+ except IndexError:
+ continue
+
+ if p_tail == cur_device_uri_tail:
+ self.cur_device.cups_printers.append(p.name)
+
+ def UpdatePrinterCombos(self):
+ self.PrintSettingsPrinterCombo.clear()
+ self.PrintJobPrinterCombo.clear()
+
+ if self.cur_device is not None and \
+ self.cur_device.supported:
+
+ for c in self.cur_device.cups_printers:
+ self.PrintSettingsPrinterCombo.insertItem(c)
+ self.PrintJobPrinterCombo.insertItem(c)
+ self.current_printer = str(self.PrintSettingsPrinterCombo.currentText())
+
+ def SettingsPrinterCombo_activated(self, s):
+ self.current_printer = str(s)
+ self.PrintJobPrinterCombo.setCurrentText(self.current_printer)
+ return self.PrinterCombo_activated(self.current_printer)
+
+ def JobsPrinterCombo_activated(self, s):
+ self.current_printer = str(s)
+ self.PrintSettingsPrinterCombo.setCurrentText(s)
+ return self.PrinterCombo_activated(self.current_printer)
+
+ def PrinterCombo_activated(self, printer):
+ self.PrintJobsList.onPrinterChange(printer)
+ self.PrintSettingsList.onPrinterChange(printer)
+ self.FuncList.onPrinterChange(printer)
+
+ def Tabs_currentChanged(self, tab):
+ """ Called when the active tab changes. """
+ log.debug("Tabs_currentChanged()")
+ try:
+ self.TabIndex[tab].onUpdate(self.cur_device)
+ except AttributeError:
+ pass
+
+ def Tabs_deviceChanged(self, tab):
+ """ Called when the device changes. """
+ log.debug("Tabs_deviceChanged()")
+
+ if tab is self.FunctionsTab and self.funcs_page != 'funcs':
+ self.SwitchFunctionsTab('funcs')
+
+ elif tab is self.MaintTab and self.maint_page != 'tools':
+ self.SwitchMaintTab('tools')
+
+ else:
+ try:
+ self.TabIndex[tab].onDeviceChange(self.cur_device)
+ except AttributeError:
+ self.TabIndex[tab]()
+
+
+ def DeviceList_onItem(self, a0):
+ pass
def CreatePixmap(self, dev=None):
if dev is None:
@@ -850,9 +647,9 @@ class devmgr4(DevMgr4_base):
if error_state != ERROR_STATE_CLEAR:
if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
- status_icon = self.STATUS_HISTORY_ICONS[error_state][0] # ink
+ status_icon = self.SMALL_ICONS[error_state][0] # ink
else:
- status_icon = self.STATUS_HISTORY_ICONS[error_state][1] # laser
+ status_icon = self.SMALL_ICONS[error_state][1] # laser
if status_icon is not None:
p.drawPixmap(0, 0, status_icon)
@@ -868,17 +665,17 @@ class devmgr4(DevMgr4_base):
if not self.rescanning:
self.setCaption(self.__tr("Refreshing Device List - HP Device Manager"))
self.statusBar().message(self.__tr("Refreshing device list..."))
-
+
self.rescanning = True
total_changes = 0
total_steps = 0
-
+
self.cups_devices = device.getSupportedCUPSDevices()
QApplication.setOverrideCursor(QApplication.waitCursor)
-
+
# TODO: Use Set() when 2.3+ is ubiquitous
-
+
for d in self.cups_devices: # adds
if d not in self.devices:
total_steps += 1
@@ -894,14 +691,12 @@ class devmgr4(DevMgr4_base):
if self.cur_device is not None and self.cur_device_uri != d:
updates.append(d) # updates
total_steps += 1
-
- #print updates
log.debug("total changes = %d" % total_changes)
step_num = 0
pb = None
-
+
if total_steps:
pb = QProgressBar(self.statusBar(), 'ProgressBar')
pb.setTotalSteps(total_changes + total_steps)
@@ -909,8 +704,6 @@ class devmgr4(DevMgr4_base):
pb.show()
if total_changes:
- #self.DeviceList.setUpdatesEnabled(False)
-
# Item addition (device added to CUPS)
for d in self.cups_devices:
if d not in self.devices:
@@ -921,13 +714,11 @@ class devmgr4(DevMgr4_base):
step_num += 1
qApp.processEvents()
- log.debug(utils.bold("Refresh: %s %s %s" % \
+ log.debug(log.bold("Refresh: %s %s %s" % \
("*"*20, d, "*"*20)))
try:
- dev = device.Device(d,
- hpiod_sock=self.hpiod_sock,
- hpssd_sock=self.hpssd_sock,
+ dev = device.Device(d, hpssd_sock=self.hpssd_sock,
callback=self.callback)
except Error:
log.error("Unexpected error in Device class.")
@@ -944,27 +735,26 @@ class devmgr4(DevMgr4_base):
dev.error_state = ERROR_STATE_ERROR
else:
dev.queryDevice(quick=True) #, no_fwd=True)
-
+
finally:
dev.close()
self.CheckForDeviceSettingsUI(dev)
icon = self.CreatePixmap(dev)
-
+
IconViewItem(self.DeviceList, dev.model_ui,
icon, d)
self.devices[d] = dev
-
# Item removal (device removed from CUPS)
for d in self.devices.keys():
if d not in self.cups_devices:
qApp.processEvents()
item = self.DeviceList.firstItem()
log.debug("removing: %s" % d)
-
+
pb.setProgress(step_num)
step_num += 1
qApp.processEvents()
@@ -977,8 +767,6 @@ class devmgr4(DevMgr4_base):
item = item.nextItem()
-
-
# Item updates
for d in updates:
log.debug("updating: %s" % d)
@@ -990,7 +778,7 @@ class devmgr4(DevMgr4_base):
qApp.processEvents()
prev_error_state = dev.error_state
-
+
try:
try:
dev.open()
@@ -1001,7 +789,7 @@ class devmgr4(DevMgr4_base):
dev.error_state = ERROR_STATE_ERROR
else:
dev.queryDevice(quick=True) #, no_fwd=True)
-
+
finally:
dev.close()
@@ -1019,28 +807,34 @@ class devmgr4(DevMgr4_base):
pb.hide()
self.statusBar().removeWidget(pb)
pb = None
-
+
if not len(self.cups_devices):
QApplication.restoreOverrideCursor()
self.cur_device = None
self.deviceRescanAction.setEnabled(False)
self.deviceRemoveAction.setEnabled(False)
self.rescanning = False
- self.UpdateTabs()
self.statusBar().message(self.__tr("Press F6 to refresh."))
+ self.UpdatePrinterCombos()
+ self.UpdatePanel()
+ #self.Tabs_deviceChanged(self.Tabs.currentPage())
+ self.TabIndex[self.Tabs.currentPage()].onDeviceChange(None)
+ #self.onDeviceChange()
dlg = NoDevicesForm(self, "", True)
dlg.show()
return
-
+
# Select current item
- if self.cur_device is not None:
+ self.rescanning = False
+
+ if self.cur_device_uri:
item = self.DeviceList.firstItem()
-
+
while item is not None:
qApp.processEvents()
if item.device_uri == self.cur_device_uri:
self.DeviceList.setCurrentItem(item)
- #self.DeviceList.setSelected(item, True)
+ self.DeviceList.setSelected(item, True)
break
item = item.nextItem()
@@ -1049,21 +843,15 @@ class devmgr4(DevMgr4_base):
self.cur_device = None
self.cur_device_uri = ''
- if self.cur_device is None:
+ if not self.cur_device_uri:
self.cur_device_uri = self.DeviceList.firstItem().device_uri
self.cur_device = self.devices[self.cur_device_uri]
self.DeviceList.setCurrentItem(self.DeviceList.firstItem())
- #self.DeviceList.setSelected(self.DeviceList.firstItem(), True)
- #self.DeviceList.setUpdatesEnabled(True)
+ user_cfg.last_used.device_uri = self.cur_device_uri
self.DeviceList.adjustItems()
self.DeviceList.updateGeometry()
-
- # Update current device
- self.rescanning = False
-
- self.UpdateDevice()
self.deviceRescanAction.setEnabled(True)
self.deviceRemoveAction.setEnabled(True)
@@ -1089,123 +877,9 @@ class devmgr4(DevMgr4_base):
log.debug("Loaded: %s" % repr(mod))
dev.device_settings_ui = mod.settingsUI
-
- def ActivateDevice(self, device_uri):
- log.debug(utils.bold("Activate: %s %s %s" % ("*"*20, device_uri, "*"*20)))
- d = self.DeviceList.firstItem()
- found = False
-
- while d is not None:
-
- if d.device_uri == device_uri:
- found = True
- self.DeviceList.setSelected(d, True)
- #self.Tabs.setCurrentPage(0)
- break
-
- d = d.nextItem()
-
- return found
-
-
- def UpdateTabs(self):
- self.UpdateFunctionsTab()
- self.UpdateStatusTab()
- self.UpdateSuppliesTab()
- self.UpdateMaintTab()
- self.UpdatePrintJobsTab()
- self.UpdatePanelTab()
-
-
- def UpdatePrintJobsTab(self):
- self.PrintJobList.clear()
- num_jobs = 0
-
- if self.cur_device is not None and \
- self.cur_device.supported:
-
- jobs = cups.getJobs()
-
- for j in jobs:
- if j.dest in self.cur_device.cups_printers:
-
- JobListViewItem(self.PrintJobList, j.dest, j.id,
- self.JOB_STATES[j.state], j.user, j.title)
-
- num_jobs += 1
-
- self.CancelPrintJobButton.setEnabled(num_jobs > 0)
-
-
- def PrintJobList_currentChanged(self, item):
- pass
-
-
- def PrintJobList_selectionChanged(self, a0):
- pass
-
-
- def CancelPrintJobButton_clicked(self):
- item = self.PrintJobList.currentItem()
- if item is not None:
- self.cur_device.cancelJob(item.job_id)
-
- def UpdatePanelTab(self):
- if self.cur_device is not None:
- dq = self.cur_device.dq
-
- if dq.get('panel', 0) == 1:
- line1 = dq.get('panel-line1', '')
- line2 = dq.get('panel-line2', '')
- else:
- line1 = self.__tr("Front panel display")
- line2 = self.__tr("not available.")
-
- pm = QPixmap(self.blank_lcd)
-
- 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
- p.drawText(x, y_line1, line1)
- p.drawText(x, y_line2, line2)
- p.end()
-
- self.Panel.setPixmap(pm)
-
- else:
- self.Panel.setPixmap(QPixmap(self.blank_lcd))
-
-
- def UpdateFunctionsTab(self):
- self.ToggleFunctionButtons(self.cur_device is not None and \
- self.cur_device.device_state in (DEVICE_STATE_FOUND, DEVICE_STATE_JUST_FOUND))
-
-
- def ToggleFunctionButtons(self, toggle):
- if toggle:
- self.PrintButton.setEnabled(True)
- self.ScanButton.setEnabled(self.cur_device.scan_type)
- self.PCardButton.setEnabled(self.cur_device.pcard_type)
- self.SendFaxButton.setEnabled(self.cur_device.fax_type)
- self.MakeCopiesButton.setEnabled(self.cur_device.copy_type == COPY_TYPE_DEVICE)
- #self.MakeCopiesButton.setEnabled(False)
- else:
- self.PrintButton.setEnabled(False)
- self.ScanButton.setEnabled(False)
- self.PCardButton.setEnabled(False)
- self.SendFaxButton.setEnabled(False)
- self.MakeCopiesButton.setEnabled(False)
-
-
def UpdateHistory(self):
try:
- self.cur_device.hist = self.cur_device.queryHistory()
- self.cur_device.hist.reverse()
+ self.cur_device.queryHistory()
except Error:
log.error("History query failed.")
self.cur_device.last_event = None
@@ -1220,757 +894,149 @@ class devmgr4(DevMgr4_base):
self.cur_device.status_code = STATUS_UNKNOWN
- def UpdateStatusTab(self):
- self.StatusHistoryList.clear()
- d = self.cur_device
-
- if d is not None:
- for x in d.hist:
- job_id, code = x[9], x[11]
-
- if job_id == 0:
- i = QListViewItem(self.StatusHistoryList, '',
- time.strftime("%x", x[:9]),
- time.strftime("%H:%M:%S", x[:9]),
- '', '', str(code), x[12])
-
- else:
- i = QListViewItem(self.StatusHistoryList, '',
- time.strftime("%x", x[:9]),
- time.strftime("%H:%M:%S", x[:9]),
- x[10], str(job_id), str(code), x[12])
-
- error_state = STATUS_TO_ERROR_STATE_MAP.get(code, ERROR_STATE_CLEAR)
-
- try:
- tech_type = d.tech_type
- except AttributeError:
- tech_type = TECH_TYPE_NONE
-
- if error_state != ERROR_STATE_CLEAR:
- if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
- status_pix = self.STATUS_HISTORY_ICONS[error_state][0] # ink
- else:
- status_pix = self.STATUS_HISTORY_ICONS[error_state][1] # laser
-
- if status_pix is not None:
- i.setPixmap(0, status_pix)
-
- if d.last_event is not None:
- self.StatusText.setText(d.last_event[12])
- self.StatusText2.setText(d.last_event[13])
-
- error_state = STATUS_TO_ERROR_STATE_MAP.get(d.last_event[11], ERROR_STATE_CLEAR)
-
- if error_state != ERROR_STATE_CLEAR:
- if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
- status_icon = self.STATUS_ICONS[error_state][0] # ink
- else:
- status_icon = self.STATUS_ICONS[error_state][1] # laser
-
- if status_icon is not None:
- self.StatusIcon.setPixmap(status_icon)
- else:
- self.StatusIcon.clear()
- else:
- self.StatusIcon.clear()
- else:
- self.StatusIcon.clear()
- self.StatusText.setText('')
- self.StatusText2.setText('')
-
-
- def UpdateSuppliesTab(self):
- self.SuppliesList.clear()
-
- if self.cur_device is not None and \
- self.cur_device.supported and \
- self.cur_device.status_type != STATUS_TYPE_NONE:
-
- 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])
- except KeyError:
- break
- else:
- self.cur_device.sorted_supplies.append((a, agent_kind, agent_type))
-
- a += 1
-
- self.cur_device.sorted_supplies.sort(lambda x, y: cmp(x[2], y[2]) or cmp(x[1], y[1]))
-
- for x in self.cur_device.sorted_supplies:
- a, agent_kind, agent_type = x
- agent_level = int(self.cur_device.dq['agent%d-level' % a])
- agent_sku = str(self.cur_device.dq['agent%d-sku' % a])
- agent_desc = self.cur_device.dq['agent%d-desc' % a]
- agent_health_desc = self.cur_device.dq['agent%d-health-desc' % a]
-
- self.SuppliesList.addItem("agent %d" % a, "<b>"+agent_desc+"</b>",
- agent_sku, agent_health_desc,
- agent_kind, agent_type, agent_level)
-
-
- def UpdateMaintTab(self):
- self.ToolList.clear()
-
+ def UpdatePanel(self):
if self.cur_device is not None and \
- self.cur_device.supported and \
- self.cur_device.device_state in (DEVICE_STATE_FOUND, DEVICE_STATE_JUST_FOUND):
-
- self.ToolList.addItem( "cups", self.__tr("<b>Configure Print Settings</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_cups.png')),
- self.__tr("Use this interface to configure printer settings such as print quality, print mode, paper size, etc. (Note: This may not work on all operating systems)"),
- self.__tr("Configure..."),
- self.ConfigurePrintSettings_clicked)
-
- if self.cur_device.device_settings_ui is not None:
- self.ToolList.addItem( "device_settings", self.__tr("<b>Device Settings</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_settings.png')),
- self.__tr("Your device has special device settings. You may alter these settings here."),
- self.__tr("Device Settings..."),
- self.deviceSettingsButton_clicked)
- self.setupDevice.setEnabled(True)
- else:
- self.setupDevice.setEnabled(False)
-
- if self.cur_device.fax_type:
- self.ToolList.addItem( "fax_settings", self.__tr("<b>Fax Setup</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_fax.png')),
- self.__tr("Fax support must be setup before you can send faxes."),
- self.__tr("Setup Fax..."),
- self.faxSettingsButton_clicked)
-
- self.ToolList.addItem( "testpage", self.__tr("<b>Print Test Page</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_testpage.png')),
- self.__tr("Print a test page to test the setup of your printer."),
- self.__tr("Print Test Page..."),
- self.PrintTestPageButton_clicked)
-
-
- self.ToolList.addItem( "info", self.__tr("<b>View Device Information</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_info.png')),
- self.__tr("This information is primarily useful for debugging and troubleshooting."),
- self.__tr("View Information..."),
- self.viewInformation)
-
- if self.cur_device.pq_diag_type:
- self.ToolList.addItem( "pqdiag", self.__tr("<b>Print Quality Diagnostics</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_pq_diag.png')),
- self.__tr("Your printer can print a test page to help diagnose print quality problems."),
- self.__tr("Print Diagnostic Page..."),
- self.pqDiag)
-
- if self.cur_device.clean_type:
- self.ToolList.addItem( "clean", self.__tr("<b>Clean Cartridges</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_clean.png')),
- self.__tr("You only need to perform this action if you are having problems with poor printout quality due to clogged ink nozzles."),
- self.__tr("Clean Cartridges..."),
- self.CleanPensButton_clicked)
-
- if self.cur_device.align_type:
- self.ToolList.addItem( "align", self.__tr("<b>Align Cartridges</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_align.png')),
- self.__tr("This will improve the quality of output when a new cartridge is installed."),
- self.__tr("Align Cartridges..."),
- self.AlignPensButton_clicked)
-
- if self.cur_device.color_cal_type:
- self.ToolList.addItem( "colorcal", self.__tr("<b>Perform Color Calibration</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_colorcal.png')),
- self.__tr("Use this procedure to optimimize your printer's color output."),
- self.__tr("Color Calibration..."),
- self.ColorCalibrationButton_clicked)
-
- if self.cur_device.linefeed_cal_type:
- self.ToolList.addItem( "linefeed", self.__tr("<b>Perform Line Feed Calibration</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_linefeed_cal.png')),
- self.__tr("Use line feed calibration to optimize print quality (to remove gaps in the printed output)."),
- self.__tr("Line Feed Calibration..."),
- self.linefeedCalibration)
-
- if self.cur_device.embedded_server_type and self.cur_device.bus == 'net':
- self.ToolList.addItem( "ews", self.__tr("<b>Access Embedded Web Page</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_ews.png')),
- self.__tr("You can use your printer's embedded web server to configure, maintain, and monitor the device from a web browser. <i>This feature is only available if the device is connected via the network.</i>"),
- self.__tr("Open in Browser..."),
- self.OpenEmbeddedBrowserButton_clicked)
-
- self.ToolList.addItem("support", self.__tr("<b>View Documentation</b>"),
- QPixmap(os.path.join(prop.image_dir, 'icon_support2.png')),
- self.__tr("View documentation installed on your system."),
- self.__tr("View Documentation..."),
- self.viewSupport)
-
-
- def viewSupportAction_activated(self):
- self.viewSupport()
-
- def ConfigurePrintSettings_clicked(self):
- utils.openURL("http://localhost:631/printers")
-
- def viewInformation(self):
- InformationForm(self.cur_device, self).exec_loop()
-
- def viewSupport(self):
- f = "file://%s" % os.path.join(sys_cfg.dirs.doc, 'index.html')
- log.debug(f)
- utils.openURL(f)
-
-
- def pqDiag(self):
- d = self.cur_device
- ok = False;
- pq_diag = d.pq_diag_type
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if pq_diag == 1:
- maint.printQualityDiagType1(d, self.LoadPaperUI)
-
- else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
-
-
- def linefeedCalibration(self):
- d = self.cur_device
- ok = False;
- linefeed_type = d.linefeed_cal_type
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if linefeed_type == 1:
- maint.linefeedCalType1(d, self.LoadPaperUI)
-
- else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
-
- def ConfigurePrintSettings_clicked(self):
- utils.openURL("http://localhost:631/printers")
-
- def viewInformation(self):
- InformationForm(self.cur_device, self).exec_loop()
-
- def pqDiag(self):
- d = self.cur_device
- pq_diag = d.pq_diag_type
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
+ self.cur_device.supported:
- if pq_diag == 1:
- maint.printQualityDiagType1(d, self.LoadPaperUI)
+ dq = self.cur_device.dq
+ if dq.get('panel', 0) == 1:
+ line1 = dq.get('panel-line1', '')
+ line2 = dq.get('panel-line2', '')
else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
-
-
- def linefeedCalibration(self):
- d = self.cur_device
- linefeed_type = d.linefeed_cal_type
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if linefeed_type == 1:
- maint.linefeedCalType1(d, self.LoadPaperUI)
+ try:
+ line1 = self.cur_device.hist[0][12]
+ except IndexError:
+ line1 = ''
- else:
- self.CheckDeviceUI()
+ line2 = ''
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
+ pm = QPixmap(self.blank_lcd)
+ p = QPainter()
+ p.begin(pm)
+ p.setPen(QColor(0, 0, 0))
+ p.setFont(self.font())
- def EventUI(self, event_code, event_type,
- error_string_short, error_string_long,
- retry_timeout, job_id, device_uri):
+ x, y_line1, y_line2 = 10, 17, 33
- log.debug("Event: code=%d type=%s string=%s timeout=%d id=%d uri=%s" %
- (event_code, event_type, error_string_short, retry_timeout, job_id, device_uri))
+ # TODO: Scroll long lines
+ p.drawText(x, y_line1, line1)
+ p.drawText(x, y_line2, line2)
+ p.end()
- if not self.rescanning:
- if event_code == EVENT_CUPS_QUEUES_CHANGED:
- self.RescanDevices()
- device_uri = device_uri.replace('hpfax:', 'hp:').replace('hpaio:', 'hp:')
+ self.Panel_2.setPixmap(pm)
- if self.ActivateDevice(device_uri):
- self.UpdateDevice(True, True)
-
- elif self.ActivateDevice(device_uri):
- self.cur_device.status_code = event_code
- self.UpdateDevice(False)
- self.Tabs.setCurrentPage(1)
+ else:
+ self.Panel_2.setPixmap(QPixmap(self.blank_lcd))
def settingsConfigure_activated(self, tab_to_show=0):
dlg = SettingsDialog(self.hpssd_sock, self)
-
- dlg.autoRefreshCheckBox.setChecked(self.auto_refresh)
- dlg.AutoRefreshRate.setValue(self.auto_refresh_rate) # min
- dlg.refreshScopeButtonGroup.setButton(self.auto_refresh_type)
- dlg.auto_refresh_type = self.auto_refresh_type
-
- dlg.EmailCheckBox.setChecked(self.email_alerts)
- dlg.EmailAddress.setText(self.email_to_addresses)
- dlg.senderLineEdit.setText(self.email_from_address)
-
- dlg.PrintCommand.setText(self.cmd_print)
- dlg.ScanCommand.setText(self.cmd_scan)
- dlg.AccessPCardCommand.setText(self.cmd_pcard)
- dlg.SendFaxCommand.setText(self.cmd_fax)
- dlg.MakeCopiesCommand.setText(self.cmd_copy)
-
-
dlg.TabWidget.setCurrentPage(tab_to_show)
if dlg.exec_loop() == QDialog.Accepted:
+ old_auto_refresh = self.user_settings.auto_refresh_rate
+ self.user_settings.load()
- self.cmd_print = str(dlg.PrintCommand.text())
- self.cmd_scan = str(dlg.ScanCommand.text())
- self.cmd_pcard = str(dlg.AccessPCardCommand.text())
- self.cmd_fax = str(dlg.SendFaxCommand.text())
- self.cmd_copy = str(dlg.MakeCopiesCommand.text())
-
-
- self.email_alerts = bool(dlg.EmailCheckBox.isChecked())
- self.email_to_addresses = str(dlg.EmailAddress.text())
- self.email_from_address = str(dlg.senderLineEdit.text())
-
- old_auto_refresh = self.auto_refresh
- self.auto_refresh = bool(dlg.autoRefreshCheckBox.isChecked())
- new_refresh_value = int(dlg.AutoRefreshRate.value())
- self.auto_refresh_type = dlg.auto_refresh_type
+ if self.user_settings.auto_refresh and old_auto_refresh != self.user_settings.auto_refresh_rate:
+ self.refresh_timer.changeInterval(self.user_settings.auto_refresh_rate * 1000)
- if self.auto_refresh and new_refresh_value != self.auto_refresh_rate:
- self.auto_refresh_rate = new_refresh_value
- self.refresh_timer.changeInterval(self.auto_refresh_rate * 60000)
-
- if old_auto_refresh != self.auto_refresh:
+ if old_auto_refresh != self.user_settings.auto_refresh:
self.autoRefresh.toggle()
self.SetAlerts()
- self.SaveConfig()
def SetAlerts(self):
service.setAlerts(self.hpssd_sock,
- self.email_alerts,
- self.email_to_addresses,
- self.email_from_address)
-
-
- def SaveConfig(self):
- user_cfg.commands.prnt = self.cmd_print
- user_cfg.commands.pcard = self.cmd_pcard
- user_cfg.commands.fax = self.cmd_fax
- user_cfg.commands.scan = self.cmd_scan
- user_cfg.commands.cpy = self.cmd_copy
- user_cfg.alerts.email_to_addresses = self.email_to_addresses
- user_cfg.alerts.email_from_address = self.email_from_address
- user_cfg.alerts.email_alerts = self.email_alerts
- user_cfg.refresh.enable = self.auto_refresh
- user_cfg.refresh.rate = self.auto_refresh_rate
- user_cfg.refresh.type = self.auto_refresh_type
-
-
- def SuccessUI(self):
- QMessageBox.information(self,
- self.caption(),
- self.__tr("<p><b>The operation completed successfully.</b>"),
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- def FailureUI(self, error_text):
- QMessageBox.critical(self,
- self.caption(),
- error_text,
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- def WarningUI(self, msg):
- QMessageBox.warning(self,
- self.caption(),
- msg,
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- def CheckDeviceUI(self):
- self.FailureUI(self.__tr("<b>Device is busy or in an error state.</b><p>Please check device and try again."))
-
- def LoadPaperUI(self):
- if LoadPaperForm(self).exec_loop() == QDialog.Accepted:
- return True
- return False
-
- def AlignmentNumberUI(self, letter, hortvert, colors, line_count, choice_count):
- dlg = AlignForm(self, letter, hortvert, colors, line_count, choice_count)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.value
- else:
- return False, 0
-
- def PaperEdgeUI(self, maximum):
- dlg = PaperEdgeAlignForm(self)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.value
- else:
- return False, 0
-
- def BothPensRequiredUI(self):
- self.WarningUI(self.__tr("<p><b>Both cartridges are required for alignment.</b><p>Please install both cartridges and try again."))
-
- def InvalidPenUI(self):
- self.WarningUI(self.__tr("<p><b>One or more cartiridges are missing from the printer.</b><p>Please install cartridge(s) and try again."))
-
- def PhotoPenRequiredUI(self):
- self.WarningUI(self.__tr("<p><b>Both the photo and color cartridges must be inserted into the printer to perform color calibration.</b><p>If you are planning on printing with the photo cartridge, please insert it and try again."))
-
- def PhotoPenRequiredUI2(self):
- self.WarningUI(self.__tr("<p><b>Both the photo (regular photo or photo blue) and color cartridges must be inserted into the printer to perform color calibration.</b><p>If you are planning on printing with the photo or photo blue cartridge, please insert it and try again."))
-
- def NotPhotoOnlyRequired(self): # Type 11
- self.WarningUI(self.__tr("<p><b>Cannot align with only the photo cartridge installed.</b><p>Please install other cartridges and try again."))
-
- def AioUI1(self):
- dlg = AlignType6Form1(self)
- return dlg.exec_loop() == QDialog.Accepted
-
-
- def AioUI2(self):
- AlignType6Form2(self).exec_loop()
-
- def Align10and11UI(self, pattern, align_type):
- dlg = Align10Form(pattern, align_type, self)
- dlg.exec_loop()
- return dlg.getValues()
-
- def AlignPensButton_clicked(self):
- d = self.cur_device
- align_type = d.align_type
-
- log.debug(utils.bold("Align: %s %s (type=%d) %s" % ("*"*20, self.cur_device_uri, align_type, "*"*20)))
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if align_type == ALIGN_TYPE_AUTO:
- maint.AlignType1(d, self.LoadPaperUI)
-
- elif align_type == ALIGN_TYPE_8XX:
- maint.AlignType2(d, self.LoadPaperUI, self.AlignmentNumberUI,
- self.BothPensRequiredUI)
-
- elif align_type in (ALIGN_TYPE_9XX,ALIGN_TYPE_9XX_NO_EDGE_ALIGN):
- maint.AlignType3(d, self.LoadPaperUI, self.AlignmentNumberUI,
- self.PaperEdgeUI, align_type)
-
- elif align_type in (ALIGN_TYPE_LIDIL_0_3_8, ALIGN_TYPE_LIDIL_0_4_3, ALIGN_TYPE_LIDIL_VIP):
- maint.AlignxBow(d, align_type, self.LoadPaperUI, self.AlignmentNumberUI,
- self.PaperEdgeUI, self.InvalidPenUI, self.ColorAdjUI)
-
- elif align_type == ALIGN_TYPE_LIDIL_AIO:
- maint.AlignType6(d, self.AioUI1, self.AioUI2, self.LoadPaperUI)
-
- elif align_type == ALIGN_TYPE_DESKJET_450:
- maint.AlignType8(d, self.LoadPaperUI, self.AlignmentNumberUI)
-
- elif align_type == ALIGN_TYPE_LBOW:
- maint.AlignType10(d, self.LoadPaperUI, self.Align10and11UI)
-
- elif align_type == ALIGN_TYPE_LIDIL_0_5_4:
- maint.AlignType11(d, self.LoadPaperUI, self.Align10and11UI, self.NotPhotoOnlyRequired)
-
- else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
-
-
- def ColorAdjUI(self, line, maximum=0):
- dlg = ColorAdjForm(self, line)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.value
- else:
- return False, 0
-
- def ColorCalUI(self):
- dlg = ColorCalForm(self)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.value
- else:
- return False, 0
-
- def ColorCalUI2(self):
- dlg = ColorCalForm2(self)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.value
- else:
- return False, 0
-
- def ColorCalUI4(self):
- dlg = ColorCal4Form(self)
- if dlg.exec_loop() == QDialog.Accepted:
- return True, dlg.values
- else:
- return False, None
-
- def ColorCalibrationButton_clicked(self):
- d = self.cur_device
- color_cal_type = d.color_cal_type
- log.debug(utils.bold("Color-cal: %s %s (type=%d) %s" % ("*"*20, self.cur_device_uri, color_cal_type, "*"*20)))
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if color_cal_type == COLOR_CAL_TYPE_DESKJET_450:
- maint.colorCalType1(d, self.LoadPaperUI, self.ColorCalUI,
- self.PhotoPenRequiredUI)
-
- elif color_cal_type == COLOR_CAL_TYPE_MALIBU_CRICK:
- maint.colorCalType2(d, self.LoadPaperUI, self.ColorCalUI2,
- self.InvalidPenUI)
-
- elif color_cal_type == COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADO:
- maint.colorCalType3(d, self.LoadPaperUI, self.ColorAdjUI,
- self.PhotoPenRequiredUI2)
-
- elif color_cal_type == COLOR_CAL_TYPE_CONNERY:
- maint.colorCalType4(d, self.LoadPaperUI, self.ColorCalUI4,
- self.WaitUI)
-
- elif color_cal_type == COLOR_CAL_TYPE_COUSTEAU:
- maint.colorCalType5(d, self.LoadPaperUI)
-
- else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
-
- def PrintTestPageButton_clicked(self):
- d = self.cur_device
-
- printer_name = d.cups_printers[0]
-
- if len(d.cups_printers) > 1:
- from chooseprinterdlg import ChoosePrinterDlg2
- dlg = ChoosePrinterDlg2(d.cups_printers)
-
- if dlg.exec_loop() == QDialog.Accepted:
- printer_name = dlg.printer_name
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
- d.close()
-
- if self.LoadPaperUI():
- d.printTestPage(printer_name)
-
- QMessageBox.information(self,
- self.caption(),
- self.__tr("<p><b>A test page should be printing on your printer.</b><p>If the page fails to print, please visit http://hplip.sourceforge.net for troubleshooting and support."),
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- else:
- d.close()
- self.CheckDeviceUI()
-
- finally:
- QApplication.restoreOverrideCursor()
-
-
- def CleanUI1(self):
- return CleaningForm(self, self.cur_device, 1).exec_loop() == QDialog.Accepted
-
-
- def CleanUI2(self):
- return CleaningForm(self, self.cur_device, 2).exec_loop() == QDialog.Accepted
-
-
- def CleanUI3(self):
- CleaningForm2(self).exec_loop()
- return True
-
-
- def WaitUI(self, seconds):
- WaitForm(seconds, None, self).exec_loop()
-
-
- def CleanPensButton_clicked(self):
- d = self.cur_device
- clean_type = d.clean_type
- log.debug(utils.bold("Clean: %s %s (type=%d) %s" % ("*"*20, self.cur_device_uri, clean_type, "*"*20)))
-
- try:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- d.open()
-
- if d.isIdleAndNoError():
- QApplication.restoreOverrideCursor()
-
- if clean_type == CLEAN_TYPE_PCL:
- maint.cleaning(d, clean_type, maint.cleanType1, maint.primeType1,
- maint.wipeAndSpitType1, self.LoadPaperUI,
- self.CleanUI1, self.CleanUI2, self.CleanUI3,
- self.WaitUI)
-
- elif clean_type == CLEAN_TYPE_LIDIL:
- maint.cleaning(d, clean_type, maint.cleanType2, maint.primeType2,
- maint.wipeAndSpitType2, self.LoadPaperUI,
- self.CleanUI1, self.CleanUI2, self.CleanUI3,
- self.WaitUI)
-
- elif clean_type == CLEAN_TYPE_PCL_WITH_PRINTOUT:
- maint.cleaning(d, clean_type, maint.cleanType1, maint.primeType1,
- maint.wipeAndSpitType1, self.LoadPaperUI,
- self.CleanUI1, self.CleanUI2, self.CleanUI3,
- self.WaitUI)
- else:
- self.CheckDeviceUI()
-
- finally:
- d.close()
- QApplication.restoreOverrideCursor()
-
+ self.user_settings.email_alerts,
+ self.user_settings.email_to_addresses,
+ self.user_settings.email_from_address)
def deviceRescanAction_activated(self):
self.deviceRescanAction.setEnabled(False)
self.UpdateDevice()
self.deviceRescanAction.setEnabled(True)
-
def deviceRefreshAll_activated(self):
self.RescanDevices()
-
def DeviceList_clicked(self,a0):
pass
-
- def OpenEmbeddedBrowserButton_clicked(self):
- utils.openURL("http://%s" % self.cur_device.host)
-
def PrintButton_clicked(self):
- self.RunCommand(self.cmd_print)
-
+ if self.user_settings.cmd_print_int:
+ self.Tabs.setCurrentPage(0)
+ self.SwitchFunctionsTab("print")
+ else:
+ self.RunCommand(self.user_settings.cmd_print)
def ScanButton_clicked(self):
- self.RunCommand(self.cmd_scan)
-
+ if self.user_settings.cmd_scan_int:
+ self.Tabs.setCurrentPage(0)
+ self.SwitchFunctionsTab("scan")
+ else:
+ self.RunCommand(self.user_settings.cmd_scan)
def PCardButton_clicked(self):
if self.cur_device.pcard_type == PCARD_TYPE_MLC:
- self.RunCommand(self.cmd_pcard)
+ if self.user_settings.cmd_pcard_int:
+ self.Tabs.setCurrentPage(0)
+ self.SwitchFunctionsTab("pcard")
+ else:
+ self.RunCommand(self.user_settings.cmd_pcard)
+
elif self.cur_device.pcard_type == PCARD_TYPE_USB_MASS_STORAGE:
- self.FailureUI(self.__tr("<p><b>The photocard on your printer are only available by mounting them as drives using USB mass storage.</b>Please refer to your distribution's documentation for setup and usage instructions."))
+ self.FailureUI(self.__tr("<p><b>Photocards on your printer are only available by mounting them as drives using USB mass storage.</b><p>Please refer to your distribution's documentation for setup and usage instructions."))
def SendFaxButton_clicked(self):
- self.RunCommand(self.cmd_fax)
+ if self.user_settings.cmd_fax_int:
+ self.Tabs.setCurrentPage(0)
+ self.SwitchFunctionsTab("fax")
+ else:
+ self.RunCommand(self.user_settings.cmd_fax)
def MakeCopiesButton_clicked(self):
- if self.cur_device.copy_type == COPY_TYPE_DEVICE:
- self.RunCommand(self.cmd_copy)
+ if self.user_settings.cmd_copy_int:
+ self.Tabs.setCurrentPage(0)
+ self.SwitchFunctionsTab("copy")
else:
- self.FailureUI(self.__tr("<p><b>Sorry, the make copies feature is currently not implemented for this device type.</b>"))
-
+ self.RunCommand(self.user_settings.cmd_copy)
def ConfigureFeaturesButton_clicked(self):
self.settingsConfigure_activated(2)
-
def RunCommand(self, cmd, macro_char='%'):
- self.ToggleFunctionButtons(False)
- if len(cmd) == 0:
- self.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(utils.bold("Run: %s %s (%s) %s" % ("*"*20, cmd, self.cur_device_uri, "*"*20)))
- log.debug(cmd)
- cmd = ''.join([self.cur_device.device_vars.get(x, x) \
- for x in cmd.split(macro_char)])
- log.debug(cmd)
+ QApplication.setOverrideCursor(QApplication.waitCursor)
- path = cmd.split()[0]
- args = cmd.split()
-
- log.debug(path)
- log.debug(args)
+ try:
+ if len(cmd) == 0:
+ self.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)
+ cmd = ''.join([self.cur_device.device_vars.get(x, x) \
+ for x in cmd.split(macro_char)])
+ log.debug(cmd)
- self.CleanupChildren()
- os.spawnvp(os.P_NOWAIT, path, args)
+ path = cmd.split()[0]
+ args = cmd.split()
+ log.debug(path)
+ log.debug(args)
- self.ToggleFunctionButtons(True)
+ self.CleanupChildren()
+ os.spawnvp(os.P_NOWAIT, path, args)
+ finally:
+ QApplication.restoreOverrideCursor()
def helpAbout(self):
dlg = AboutDlg(self)
dlg.VersionText.setText(prop.version)
+ dlg.ToolboxVersionText.setText(self.toolbox_version)
dlg.exec_loop()
def deviceSettingsButton_clicked(self):
@@ -1981,82 +1047,102 @@ class devmgr4(DevMgr4_base):
self.cur_device.close()
def setupDevice_activated(self):
- self.cur_device.device_settings_ui(self.cur_device, self)
-
- def faxSettingsButton_clicked(self):
try:
self.cur_device.open()
-
- try:
- result_code, fax_num = self.cur_device.getPML(pml.OID_FAX_LOCAL_PHONE_NUM)
- except Error:
- log.error("PML failure.")
- self.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
- return
-
- fax_num = str(fax_num)
-
- try:
- result_code, name = self.cur_device.getPML(pml.OID_FAX_STATION_NAME)
- except Error:
- log.error("PML failure.")
- self.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
- return
-
- name = str(name)
-
- dlg = FaxSettingsForm(self.cur_device, fax_num, name, self)
- dlg.exec_loop()
+ self.cur_device.device_settings_ui(self.cur_device, self)
finally:
self.cur_device.close()
-
- def addressBookButton_clicked(self):
- self.RunCommand(self.cmd_fab)
+ #self.cur_device.device_settings_ui(self.cur_device, self)
def helpContents(self):
- f = "file://%s" % os.path.join(sys_cfg.dirs.doc, 'index.html')
+ f = "http://hplip.sf.net"
+
+ if prop.doc_build:
+ g = os.path.join(sys_cfg.dirs.doc, 'index.html')
+ if os.path.exists(g):
+ f = "file://%s" % g
+
log.debug(f)
utils.openURL(f)
-
+
def deviceInstallAction_activated(self):
+ su_sudo = None
if utils.which('kdesu'):
- su_sudo = 'kdesu -- %s'
-
+ su_sudo = 'kdesu -- "%s"'
+
elif utils.which('gksu'):
su_sudo = 'gksu "%s"'
-
- if utils.which('hp-setup'):
- cmd = su_sudo % 'hp-setup -u'
+
+ if su_sudo is None:
+ QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-setup.</b>"),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
else:
- cmd = su_sudo % 'python ./setup.py -u'
-
- log.debug(cmd)
- os.system(cmd)
-
+ if utils.which('hp-setup'):
+ c = 'hp-setup -u --username=%s' % prop.username
+ cmd = su_sudo % c
+ else:
+ c = 'python ./setup.py -u --username=%s' % prop.username
+ cmd = su_sudo % c
+
+ log.debug(cmd)
+ os.system(cmd)
+ self.RescanDevices()
+
+
def deviceRemoveAction_activated(self):
if self.cur_device is not None:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- print_uri = self.cur_device.device_uri
- fax_uri = print_uri.replace('hp:', 'hpfax:')
-
- log.debug(print_uri)
- log.debug(fax_uri)
-
- self.cups_devices = device.getSupportedCUPSDevices(['hp', 'hpfax'])
-
- for d in self.cups_devices:
- if d in (print_uri, fax_uri):
- for p in self.cups_devices[d]:
- log.debug("Removing %s" % p)
- cups.delPrinter(p)
-
- self.cur_device = None
-
- QApplication.restoreOverrideCursor()
-
- self.RescanDevices()
-
+ x = QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to remove this device?</b>"),
+ QMessageBox.Yes,
+ QMessageBox.No | QMessageBox.Default,
+ QMessageBox.NoButton)
+ if x == QMessageBox.Yes:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ print_uri = self.cur_device.device_uri
+ fax_uri = print_uri.replace('hp:', 'hpfax:')
+
+ log.debug(print_uri)
+ log.debug(fax_uri)
+
+ self.cups_devices = device.getSupportedCUPSDevices(['hp', 'hpfax'])
+
+ for d in self.cups_devices:
+ if d in (print_uri, fax_uri):
+ for p in self.cups_devices[d]:
+ log.debug("Removing %s" % p)
+ cups.delPrinter(p)
+
+ self.cur_device = None
+ self.cur_device_uri = ''
+ user_cfg.last_used.device_uri = ''
+
+ QApplication.restoreOverrideCursor()
+
+ self.RescanDevices()
+
+
+ def FailureUI(self, error_text):
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", ""))
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+ def WarningUI(self, msg):
+ QMessageBox.warning(self,
+ self.caption(),
+ msg,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
def __tr(self,s,c = None):
return qApp.translate("DevMgr4",s,c)
diff --git a/ui/devmgr4_base.py b/ui/devmgr4_base.py
index c8752f448..ac2e9a659 100644
--- a/ui/devmgr4_base.py
+++ b/ui/devmgr4_base.py
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'ui/devmgr4_base.ui'
#
-# Created: Tue Oct 3 10:42:44 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.15.1
+# Created: Mon May 21 16:06:42 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.17
#
# WARNING! All changes made in this file will be lost!
@@ -25,9 +25,10 @@ class DevMgr4_base(QMainWindow):
self.splitter2 = QSplitter(self.centralWidget(),"splitter2")
self.splitter2.setOrientation(QSplitter.Horizontal)
+ self.splitter2.setOpaqueResize(1)
self.DeviceList = QIconView(self.splitter2,"DeviceList")
- self.DeviceList.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.DeviceList.sizePolicy().hasHeightForWidth()))
+ self.DeviceList.setSizePolicy(QSizePolicy(QSizePolicy.Maximum,QSizePolicy.Preferred,0,0,self.DeviceList.sizePolicy().hasHeightForWidth()))
self.DeviceList.setMaximumSize(QSize(32767,32767))
self.DeviceList.setResizePolicy(QIconView.Manual)
self.DeviceList.setArrangement(QIconView.TopToBottom)
@@ -35,126 +36,23 @@ class DevMgr4_base(QMainWindow):
self.Tabs = QTabWidget(self.splitter2,"Tabs")
- self.TabPage = QWidget(self.Tabs,"TabPage")
- self.Tabs.insertTab(self.TabPage,QString.fromLatin1(""))
+ self.FunctionsTab = QWidget(self.Tabs,"FunctionsTab")
+ self.Tabs.insertTab(self.FunctionsTab,QString.fromLatin1(""))
self.StatusTab = QWidget(self.Tabs,"StatusTab")
- StatusTabLayout = QGridLayout(self.StatusTab,1,1,11,6,"StatusTabLayout")
-
- self.StatusGroupBox = QGroupBox(self.StatusTab,"StatusGroupBox")
- self.StatusGroupBox.setColumnLayout(0,Qt.Vertical)
- self.StatusGroupBox.layout().setSpacing(6)
- self.StatusGroupBox.layout().setMargin(11)
- StatusGroupBoxLayout = QGridLayout(self.StatusGroupBox.layout())
- StatusGroupBoxLayout.setAlignment(Qt.AlignTop)
-
- self.StatusText = QLabel(self.StatusGroupBox,"StatusText")
- StatusText_font = QFont(self.StatusText.font())
- StatusText_font.setBold(1)
- self.StatusText.setFont(StatusText_font)
- self.StatusText.setFrameShape(QLabel.NoFrame)
-
- StatusGroupBoxLayout.addWidget(self.StatusText,0,0)
-
- self.StatusIcon = QLabel(self.StatusGroupBox,"StatusIcon")
- self.StatusIcon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.StatusIcon.sizePolicy().hasHeightForWidth()))
- self.StatusIcon.setMinimumSize(QSize(32,32))
- self.StatusIcon.setMaximumSize(QSize(32,32))
- self.StatusIcon.setScaledContents(1)
-
- StatusGroupBoxLayout.addWidget(self.StatusIcon,0,1)
-
- self.StatusText2 = QLabel(self.StatusGroupBox,"StatusText2")
- StatusText2_font = QFont(self.StatusText2.font())
- StatusText2_font.setItalic(1)
- self.StatusText2.setFont(StatusText2_font)
- self.StatusText2.setFrameShape(QLabel.NoFrame)
-
- StatusGroupBoxLayout.addMultiCellWidget(self.StatusText2,1,1,0,1)
-
- StatusTabLayout.addWidget(self.StatusGroupBox,0,0)
-
- self.groupBox3 = QGroupBox(self.StatusTab,"groupBox3")
- self.groupBox3.setColumnLayout(0,Qt.Vertical)
- self.groupBox3.layout().setSpacing(6)
- self.groupBox3.layout().setMargin(11)
- groupBox3Layout = QGridLayout(self.groupBox3.layout())
- groupBox3Layout.setAlignment(Qt.AlignTop)
-
- self.StatusHistoryList = QListView(self.groupBox3,"StatusHistoryList")
- self.StatusHistoryList.addColumn(QString.null)
- self.StatusHistoryList.header().setResizeEnabled(0,self.StatusHistoryList.header().count() - 1)
- self.StatusHistoryList.addColumn(self.__tr("Date"))
- self.StatusHistoryList.addColumn(self.__tr("Time"))
- self.StatusHistoryList.addColumn(self.__tr("User"))
- self.StatusHistoryList.addColumn(self.__tr("Job ID"))
- self.StatusHistoryList.addColumn(self.__tr("Code"))
- self.StatusHistoryList.addColumn(self.__tr("Description"))
- self.StatusHistoryList.setEnabled(1)
- self.StatusHistoryList.setSelectionMode(QListView.Single)
- self.StatusHistoryList.setAllColumnsShowFocus(1)
-
- groupBox3Layout.addWidget(self.StatusHistoryList,0,0)
-
- StatusTabLayout.addWidget(self.groupBox3,1,0)
self.Tabs.insertTab(self.StatusTab,QString.fromLatin1(""))
+ self.SuppliesTab = QWidget(self.Tabs,"SuppliesTab")
+ self.Tabs.insertTab(self.SuppliesTab,QString.fromLatin1(""))
+
self.MaintTab = QWidget(self.Tabs,"MaintTab")
self.Tabs.insertTab(self.MaintTab,QString.fromLatin1(""))
- self.SuppliesTab = QWidget(self.Tabs,"SuppliesTab")
- self.Tabs.insertTab(self.SuppliesTab,QString.fromLatin1(""))
+ self.PrintSettingsTab = QWidget(self.Tabs,"PrintSettingsTab")
+ self.Tabs.insertTab(self.PrintSettingsTab,QString.fromLatin1(""))
- self.TabPage_2 = QWidget(self.Tabs,"TabPage_2")
- TabPageLayout = QGridLayout(self.TabPage_2,1,1,11,6,"TabPageLayout")
-
- self.PrintJobList = QListView(self.TabPage_2,"PrintJobList")
- self.PrintJobList.addColumn(self.__tr("Queue"))
- self.PrintJobList.addColumn(self.__tr("Job ID"))
- self.PrintJobList.addColumn(self.__tr("Status"))
- self.PrintJobList.addColumn(self.__tr("User"))
- self.PrintJobList.addColumn(self.__tr("Title"))
- self.PrintJobList.setAllColumnsShowFocus(1)
-
- TabPageLayout.addMultiCellWidget(self.PrintJobList,0,0,0,1)
-
- self.CancelPrintJobButton = QPushButton(self.TabPage_2,"CancelPrintJobButton")
- self.CancelPrintJobButton.setEnabled(0)
-
- TabPageLayout.addWidget(self.CancelPrintJobButton,1,1)
- spacer12_3 = QSpacerItem(471,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- TabPageLayout.addItem(spacer12_3,1,0)
- self.Tabs.insertTab(self.TabPage_2,QString.fromLatin1(""))
-
- self.TabPage_3 = QWidget(self.Tabs,"TabPage_3")
- TabPageLayout_2 = QGridLayout(self.TabPage_3,1,1,11,6,"TabPageLayout_2")
-
- self.groupBox9_2 = QGroupBox(self.TabPage_3,"groupBox9_2")
- self.groupBox9_2.setColumnLayout(0,Qt.Vertical)
- self.groupBox9_2.layout().setSpacing(6)
- self.groupBox9_2.layout().setMargin(11)
- groupBox9_2Layout = QGridLayout(self.groupBox9_2.layout())
- groupBox9_2Layout.setAlignment(Qt.AlignTop)
-
- self.Panel = QLabel(self.groupBox9_2,"Panel")
- self.Panel.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.Panel.sizePolicy().hasHeightForWidth()))
- self.Panel.setMinimumSize(QSize(254,40))
- self.Panel.setMaximumSize(QSize(254,40))
- self.Panel.setFrameShape(QLabel.NoFrame)
- self.Panel.setScaledContents(1)
-
- groupBox9_2Layout.addWidget(self.Panel,1,1)
- spacer11_3 = QSpacerItem(20,101,QSizePolicy.Minimum,QSizePolicy.Expanding)
- groupBox9_2Layout.addItem(spacer11_3,0,1)
- spacer12_4 = QSpacerItem(20,181,QSizePolicy.Minimum,QSizePolicy.Expanding)
- groupBox9_2Layout.addItem(spacer12_4,2,1)
- spacer13_3 = QSpacerItem(121,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox9_2Layout.addItem(spacer13_3,1,2)
- spacer14_2 = QSpacerItem(151,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox9_2Layout.addItem(spacer14_2,1,0)
-
- TabPageLayout_2.addWidget(self.groupBox9_2,0,0)
- self.Tabs.insertTab(self.TabPage_3,QString.fromLatin1(""))
+ self.PrintJobsTab = QWidget(self.Tabs,"PrintJobsTab")
+ self.Tabs.insertTab(self.PrintJobsTab,QString.fromLatin1(""))
DevMgr4_baseLayout.addWidget(self.splitter2,0,0)
@@ -211,7 +109,7 @@ class DevMgr4_base(QMainWindow):
self.languageChange()
- self.resize(QSize(838,493).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(812,518).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.helpIndexAction,SIGNAL("activated()"),self.helpIndex)
@@ -225,45 +123,27 @@ class DevMgr4_base(QMainWindow):
self.connect(self.deviceRefreshAll,SIGNAL("activated()"),self.deviceRefreshAll_activated)
self.connect(self.DeviceList,SIGNAL("clicked(QIconViewItem*)"),self.DeviceList_clicked)
self.connect(self.autoRefresh,SIGNAL("toggled(bool)"),self.autoRefresh_toggled)
- self.connect(self.PrintJobList,SIGNAL("currentChanged(QListViewItem*)"),self.PrintJobList_currentChanged)
- self.connect(self.CancelPrintJobButton,SIGNAL("clicked()"),self.CancelPrintJobButton_clicked)
- self.connect(self.PrintJobList,SIGNAL("selectionChanged(QListViewItem*)"),self.PrintJobList_selectionChanged)
self.connect(self.DeviceList,SIGNAL("rightButtonClicked(QIconViewItem*,const QPoint&)"),self.DeviceList_rightButtonClicked)
self.connect(self.setupDevice,SIGNAL("activated()"),self.setupDevice_activated)
self.connect(self.viewSupportAction,SIGNAL("activated()"),self.viewSupportAction_activated)
self.connect(self.deviceInstallAction,SIGNAL("activated()"),self.deviceInstallAction_activated)
self.connect(self.deviceRemoveAction,SIGNAL("activated()"),self.deviceRemoveAction_activated)
+ self.connect(self.Tabs,SIGNAL("currentChanged(QWidget*)"),self.Tabs_currentChanged)
+ self.connect(self.DeviceList,SIGNAL("onItem(QIconViewItem*)"),self.DeviceList_onItem)
def languageChange(self):
self.setCaption(self.__tr("HP Device Manager"))
- self.Tabs.changeTab(self.TabPage,self.__tr("Functions"))
- self.StatusGroupBox.setTitle(self.__tr("Last"))
- self.StatusText.setText(QString.null)
- self.StatusText2.setText(QString.null)
- self.groupBox3.setTitle(self.__tr("History"))
- self.StatusHistoryList.header().setLabel(0,QString.null)
- self.StatusHistoryList.header().setLabel(1,self.__tr("Date"))
- self.StatusHistoryList.header().setLabel(2,self.__tr("Time"))
- self.StatusHistoryList.header().setLabel(3,self.__tr("User"))
- self.StatusHistoryList.header().setLabel(4,self.__tr("Job ID"))
- self.StatusHistoryList.header().setLabel(5,self.__tr("Code"))
- self.StatusHistoryList.header().setLabel(6,self.__tr("Description"))
+ self.Tabs.changeTab(self.FunctionsTab,self.__tr("Functions"))
self.Tabs.changeTab(self.StatusTab,self.__tr("Status"))
- self.Tabs.changeTab(self.MaintTab,self.__tr("Tools && Settings"))
self.Tabs.changeTab(self.SuppliesTab,self.__tr("Supplies"))
- self.PrintJobList.header().setLabel(0,self.__tr("Queue"))
- self.PrintJobList.header().setLabel(1,self.__tr("Job ID"))
- self.PrintJobList.header().setLabel(2,self.__tr("Status"))
- self.PrintJobList.header().setLabel(3,self.__tr("User"))
- self.PrintJobList.header().setLabel(4,self.__tr("Title"))
- self.CancelPrintJobButton.setText(self.__tr("Cancel Job"))
- self.Tabs.changeTab(self.TabPage_2,self.__tr("Print Jobs"))
- self.groupBox9_2.setTitle(self.__tr("Front Panel Display"))
- self.Tabs.changeTab(self.TabPage_3,self.__tr("Panel"))
+ self.Tabs.changeTab(self.MaintTab,self.__tr("Tools"))
+ self.Tabs.changeTab(self.PrintSettingsTab,self.__tr("Print Settings"))
+ self.Tabs.changeTab(self.PrintJobsTab,self.__tr("Print Control"))
self.helpContentsAction.setText(self.__tr("Contents"))
self.helpContentsAction.setMenuText(self.__tr("&Contents..."))
self.helpContentsAction.setToolTip(self.__tr("Help Contents (F1)"))
+ self.helpContentsAction.setAccel(self.__tr("F1"))
self.helpIndexAction.setText(self.__tr("Index"))
self.helpIndexAction.setMenuText(self.__tr("&Index..."))
self.helpIndexAction.setAccel(QString.null)
@@ -451,5 +331,11 @@ class DevMgr4_base(QMainWindow):
def deviceRemoveAction_activated(self):
print "DevMgr4_base.deviceRemoveAction_activated(): Not implemented yet"
+ def Tabs_currentChanged(self,a0):
+ print "DevMgr4_base.Tabs_currentChanged(QWidget*): Not implemented yet"
+
+ def DeviceList_onItem(self,a0):
+ print "DevMgr4_base.DeviceList_onItem(QIconViewItem*): Not implemented yet"
+
def __tr(self,s,c = None):
return qApp.translate("DevMgr4_base",s,c)
diff --git a/ui/devmgr4_base.ui b/ui/devmgr4_base.ui
index 665de4d5c..d39b7c0ad 100644
--- a/ui/devmgr4_base.ui
+++ b/ui/devmgr4_base.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>838</width>
- <height>493</height>
+ <width>812</width>
+ <height>518</height>
</rect>
</property>
<property name="caption">
@@ -26,13 +26,16 @@
<property name="orientation">
<enum>Horizontal</enum>
</property>
+ <property name="opaqueResize">
+ <bool>true</bool>
+ </property>
<widget class="QIconView">
<property name="name">
<cstring>DeviceList</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
- <hsizetype>5</hsizetype>
+ <hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
@@ -60,7 +63,7 @@
</property>
<widget class="QWidget">
<property name="name">
- <cstring>TabPage</cstring>
+ <cstring>FunctionsTab</cstring>
</property>
<attribute name="title">
<string>Functions</string>
@@ -73,433 +76,38 @@
<attribute name="title">
<string>Status</string>
</attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QGroupBox" row="0" column="0">
- <property name="name">
- <cstring>StatusGroupBox</cstring>
- </property>
- <property name="title">
- <string>Last</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>StatusText</cstring>
- </property>
- <property name="font">
- <font>
- <bold>1</bold>
- </font>
- </property>
- <property name="frameShape">
- <enum>NoFrame</enum>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="1">
- <property name="name">
- <cstring>StatusIcon</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="scaledContents">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>StatusText2</cstring>
- </property>
- <property name="font">
- <font>
- <italic>1</italic>
- </font>
- </property>
- <property name="frameShape">
- <enum>NoFrame</enum>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="1" column="0">
- <property name="name">
- <cstring>groupBox3</cstring>
- </property>
- <property name="title">
- <string>History</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView" row="0" column="0">
- <column>
- <property name="text">
- <string></string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>false</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Date</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Time</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>User</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Job ID</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Code</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Description</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>StatusHistoryList</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="selectionMode">
- <enum>Single</enum>
- </property>
- <property name="allColumnsShowFocus">
- <bool>true</bool>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
</widget>
<widget class="QWidget">
<property name="name">
- <cstring>MaintTab</cstring>
+ <cstring>SuppliesTab</cstring>
</property>
<attribute name="title">
- <string>Tools &amp;&amp; Settings</string>
+ <string>Supplies</string>
</attribute>
</widget>
<widget class="QWidget">
<property name="name">
- <cstring>SuppliesTab</cstring>
+ <cstring>MaintTab</cstring>
</property>
<attribute name="title">
- <string>Supplies</string>
+ <string>Tools</string>
</attribute>
</widget>
<widget class="QWidget">
<property name="name">
- <cstring>TabPage</cstring>
+ <cstring>PrintSettingsTab</cstring>
</property>
<attribute name="title">
- <string>Print Jobs</string>
+ <string>Print Settings</string>
</attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView" row="0" column="0" rowspan="1" colspan="2">
- <column>
- <property name="text">
- <string>Queue</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Job ID</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Status</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>User</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Title</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>PrintJobList</cstring>
- </property>
- <property name="allColumnsShowFocus">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>CancelPrintJobButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Cancel Job</string>
- </property>
- </widget>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer12_3</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>471</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
</widget>
<widget class="QWidget">
<property name="name">
- <cstring>TabPage</cstring>
+ <cstring>PrintJobsTab</cstring>
</property>
<attribute name="title">
- <string>Panel</string>
+ <string>Print Control</string>
</attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QGroupBox" row="0" column="0">
- <property name="name">
- <cstring>groupBox9_2</cstring>
- </property>
- <property name="title">
- <string>Front Panel Display</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="1" column="1">
- <property name="name">
- <cstring>Panel</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="frameShape">
- <enum>NoFrame</enum>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- </widget>
- <spacer row="0" column="1">
- <property name="name">
- <cstring>spacer11_3</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>101</height>
- </size>
- </property>
- </spacer>
- <spacer row="2" column="1">
- <property name="name">
- <cstring>spacer12_4</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>181</height>
- </size>
- </property>
- </spacer>
- <spacer row="1" column="2">
- <property name="name">
- <cstring>spacer13_3</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>121</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer14_2</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>151</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- </grid>
</widget>
</widget>
</widget>
@@ -549,6 +157,9 @@
<property name="toolTip">
<string>Help Contents (F1)</string>
</property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
</action>
<action>
<property name="name">
@@ -810,24 +421,6 @@
<slot>autoRefresh_toggled(bool)</slot>
</connection>
<connection>
- <sender>PrintJobList</sender>
- <signal>currentChanged(QListViewItem*)</signal>
- <receiver>DevMgr4_base</receiver>
- <slot>PrintJobList_currentChanged(QListViewItem*)</slot>
- </connection>
- <connection>
- <sender>CancelPrintJobButton</sender>
- <signal>clicked()</signal>
- <receiver>DevMgr4_base</receiver>
- <slot>CancelPrintJobButton_clicked()</slot>
- </connection>
- <connection>
- <sender>PrintJobList</sender>
- <signal>selectionChanged(QListViewItem*)</signal>
- <receiver>DevMgr4_base</receiver>
- <slot>PrintJobList_selectionChanged(QListViewItem*)</slot>
- </connection>
- <connection>
<sender>DeviceList</sender>
<signal>rightButtonClicked(QIconViewItem*,const QPoint&amp;)</signal>
<receiver>DevMgr4_base</receiver>
@@ -857,7 +450,22 @@
<receiver>DevMgr4_base</receiver>
<slot>deviceRemoveAction_activated()</slot>
</connection>
+ <connection>
+ <sender>Tabs</sender>
+ <signal>currentChanged(QWidget*)</signal>
+ <receiver>DevMgr4_base</receiver>
+ <slot>Tabs_currentChanged(QWidget*)</slot>
+ </connection>
+ <connection>
+ <sender>DeviceList</sender>
+ <signal>onItem(QIconViewItem*)</signal>
+ <receiver>DevMgr4_base</receiver>
+ <slot>DeviceList_onItem(QIconViewItem*)</slot>
+ </connection>
</connections>
+<includes>
+ <include location="local" impldecl="in implementation">devmgr4_base.ui.h</include>
+</includes>
<slots>
<slot>fileNew()</slot>
<slot>fileOpen()</slot>
@@ -906,6 +514,8 @@
<slot>installDevice_activated()</slot>
<slot>deviceInstallAction_activated()</slot>
<slot>deviceRemoveAction_activated()</slot>
+ <slot>Tabs_currentChanged( QWidget * )</slot>
+ <slot>DeviceList_onItem( QIconViewItem * )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/ui/faxaddrbookeditform_base.py b/ui/faxaddrbookeditform_base.py
index c3521923d..556452c8d 100644
--- a/ui/faxaddrbookeditform_base.py
+++ b/ui/faxaddrbookeditform_base.py
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file '/home/dwelch/linux-imaging-and-printing/src/ui/faxaddrbookeditform_base.ui'
+# Form implementation generated from reading ui file 'ui/faxaddrbookeditform_base.ui'
#
-# Created: Mon May 9 13:35:55 2005
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
+# Created: Wed Jul 18 16:05:44 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.17
#
# WARNING! All changes made in this file will be lost!
-import sys
from qt import *
@@ -22,123 +21,130 @@ class FaxAddrBookEditForm_base(QDialog):
FaxAddrBookEditForm_baseLayout = QGridLayout(self,1,1,11,6,"FaxAddrBookEditForm_baseLayout")
- self.groupListView = QListView(self,"groupListView")
- self.groupListView.addColumn(self.__tr("Group Name"))
- self.groupListView.setSelectionMode(QListView.NoSelection)
-
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.groupListView,5,6,2,2)
-
- self.notesEdit = QTextEdit(self,"notesEdit")
-
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.notesEdit,11,11,0,4)
-
- self.lastnameEdit = QLineEdit(self,"lastnameEdit")
-
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.lastnameEdit,4,4,2,4)
-
self.pushButton34 = QPushButton(self,"pushButton34")
- FaxAddrBookEditForm_baseLayout.addWidget(self.pushButton34,12,3)
-
- self.firstnameEdit = QLineEdit(self,"firstnameEdit")
-
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.firstnameEdit,3,3,2,4)
+ FaxAddrBookEditForm_baseLayout.addWidget(self.pushButton34,8,1)
self.line5 = QFrame(self,"line5")
self.line5.setFrameShape(QFrame.HLine)
self.line5.setFrameShadow(QFrame.Sunken)
self.line5.setFrameShape(QFrame.HLine)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5,9,9,0,4)
+ FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5,6,6,0,2)
self.OKButton = QPushButton(self,"OKButton")
self.OKButton.setEnabled(0)
- FaxAddrBookEditForm_baseLayout.addWidget(self.OKButton,12,4)
+ FaxAddrBookEditForm_baseLayout.addWidget(self.OKButton,8,2)
+ spacer31 = QSpacerItem(401,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ FaxAddrBookEditForm_baseLayout.addItem(spacer31,8,0)
- self.textLabel1 = QLabel(self,"textLabel1")
+ self.line5_2_2 = QFrame(self,"line5_2_2")
+ self.line5_2_2.setFrameShape(QFrame.HLine)
+ self.line5_2_2.setFrameShadow(QFrame.Sunken)
+ self.line5_2_2.setFrameShape(QFrame.HLine)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel1,3,3,0,1)
- spacer34 = QSpacerItem(20,61,QSizePolicy.Minimum,QSizePolicy.Expanding)
- FaxAddrBookEditForm_baseLayout.addItem(spacer34,5,3)
+ FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5_2_2,9,9,0,2)
- self.titleEdit = QLineEdit(self,"titleEdit")
+ self.line5_2 = QFrame(self,"line5_2")
+ self.line5_2.setFrameShape(QFrame.HLine)
+ self.line5_2.setFrameShadow(QFrame.Sunken)
+ self.line5_2.setFrameShape(QFrame.HLine)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.titleEdit,2,2,2,4)
+ FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5_2,4,4,0,2)
- self.groupsButton2 = QPushButton(self,"groupsButton2")
+ layout1 = QHBoxLayout(None,0,6,"layout1")
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.groupsButton2,6,6,3,4)
+ self.textLabel7 = QLabel(self,"textLabel7")
+ layout1.addWidget(self.textLabel7)
- self.textLabel4 = QLabel(self,"textLabel4")
+ self.faxEdit = QLineEdit(self,"faxEdit")
+ layout1.addWidget(self.faxEdit)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel4,5,6,0,1)
+ FaxAddrBookEditForm_baseLayout.addMultiCellLayout(layout1,5,5,0,2)
- self.textLabel2 = QLabel(self,"textLabel2")
+ layout2 = QHBoxLayout(None,0,6,"layout2")
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel2,4,4,0,1)
+ self.textLabel3 = QLabel(self,"textLabel3")
+ layout2.addWidget(self.textLabel3)
- self.textLabel7 = QLabel(self,"textLabel7")
+ self.nicknameEdit = QLineEdit(self,"nicknameEdit")
+ layout2.addWidget(self.nicknameEdit)
- FaxAddrBookEditForm_baseLayout.addWidget(self.textLabel7,8,0)
+ FaxAddrBookEditForm_baseLayout.addMultiCellLayout(layout2,0,0,0,2)
- self.textLabel6 = QLabel(self,"textLabel6")
+ layout6 = QHBoxLayout(None,0,6,"layout6")
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel6,10,10,0,4)
+ self.textLabel4 = QLabel(self,"textLabel4")
+ layout6.addWidget(self.textLabel4)
- self.textLabel5 = QLabel(self,"textLabel5")
+ self.groupListView = QListView(self,"groupListView")
+ self.groupListView.addColumn(self.__tr("Group Name"))
+ self.groupListView.setSelectionMode(QListView.NoSelection)
+ layout6.addWidget(self.groupListView)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel5,2,2,0,1)
- spacer31 = QSpacerItem(401,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- FaxAddrBookEditForm_baseLayout.addMultiCell(spacer31,12,12,0,2)
+ FaxAddrBookEditForm_baseLayout.addMultiCellLayout(layout6,3,3,0,2)
- self.textLabel3 = QLabel(self,"textLabel3")
+ layout7 = QVBoxLayout(None,0,6,"layout7")
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel3,0,0,0,1)
+ self.textLabel6 = QLabel(self,"textLabel6")
+ layout7.addWidget(self.textLabel6)
- self.nicknameEdit = QLineEdit(self,"nicknameEdit")
+ self.notesEdit = QTextEdit(self,"notesEdit")
+ layout7.addWidget(self.notesEdit)
+
+ FaxAddrBookEditForm_baseLayout.addMultiCellLayout(layout7,7,7,0,2)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.nicknameEdit,0,0,2,4)
+ self.textLabel12 = QLabel(self,"textLabel12")
+
+ FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel12,10,10,0,2)
self.line12 = QFrame(self,"line12")
self.line12.setFrameShape(QFrame.HLine)
self.line12.setFrameShadow(QFrame.Sunken)
self.line12.setFrameShape(QFrame.HLine)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line12,1,1,0,4)
+ FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line12,1,1,0,2)
- self.faxEdit = QLineEdit(self,"faxEdit")
+ layout11 = QGridLayout(None,1,1,0,6,"layout11")
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.faxEdit,8,8,1,4)
+ layout9 = QVBoxLayout(None,0,6,"layout9")
- self.line5_2 = QFrame(self,"line5_2")
- self.line5_2.setFrameShape(QFrame.HLine)
- self.line5_2.setFrameShadow(QFrame.Sunken)
- self.line5_2.setFrameShape(QFrame.HLine)
+ self.textLabel5 = QLabel(self,"textLabel5")
+ layout9.addWidget(self.textLabel5)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5_2,7,7,0,4)
+ self.textLabel1 = QLabel(self,"textLabel1")
+ layout9.addWidget(self.textLabel1)
- self.line5_2_2 = QFrame(self,"line5_2_2")
- self.line5_2_2.setFrameShape(QFrame.HLine)
- self.line5_2_2.setFrameShadow(QFrame.Sunken)
- self.line5_2_2.setFrameShape(QFrame.HLine)
+ self.textLabel2 = QLabel(self,"textLabel2")
+ layout9.addWidget(self.textLabel2)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.line5_2_2,13,13,0,4)
+ layout11.addLayout(layout9,0,0)
- self.textLabel12 = QLabel(self,"textLabel12")
+ layout10 = QVBoxLayout(None,0,6,"layout10")
+
+ self.titleEdit = QLineEdit(self,"titleEdit")
+ layout10.addWidget(self.titleEdit)
+
+ self.firstnameEdit = QLineEdit(self,"firstnameEdit")
+ layout10.addWidget(self.firstnameEdit)
- FaxAddrBookEditForm_baseLayout.addMultiCellWidget(self.textLabel12,14,14,0,4)
+ self.lastnameEdit = QLineEdit(self,"lastnameEdit")
+ layout10.addWidget(self.lastnameEdit)
+
+ layout11.addLayout(layout10,0,1)
+
+ FaxAddrBookEditForm_baseLayout.addMultiCellLayout(layout11,2,2,0,2)
self.languageChange()
- self.resize(QSize(479,551).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(532,555).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.pushButton34,SIGNAL("clicked()"),self.reject)
self.connect(self.OKButton,SIGNAL("clicked()"),self.accept)
self.connect(self.firstnameEdit,SIGNAL("textChanged(const QString&)"),self.firstnameEdit_textChanged)
self.connect(self.lastnameEdit,SIGNAL("textChanged(const QString&)"),self.lastnameEdit_textChanged)
- self.connect(self.groupsButton2,SIGNAL("clicked()"),self.groupsButton2_clicked)
self.connect(self.nicknameEdit,SIGNAL("textChanged(const QString&)"),self.nicknameEdit_textChanged)
self.connect(self.faxEdit,SIGNAL("textChanged(const QString&)"),self.faxEdit_textChanged)
@@ -153,18 +159,17 @@ class FaxAddrBookEditForm_base(QDialog):
def languageChange(self):
self.setCaption(self.__tr("HP Device Manager - Fax Address Book Entry"))
- self.groupListView.header().setLabel(0,self.__tr("Group Name"))
self.pushButton34.setText(self.__tr("Cancel"))
self.OKButton.setText(self.__tr("OK"))
- self.textLabel1.setText(self.__tr("First Name:"))
- self.groupsButton2.setText(self.__tr("New Group..."))
- self.textLabel4.setText(self.__tr("Member of Group(s):"))
- self.textLabel2.setText(self.__tr("Last Name:"))
self.textLabel7.setText(self.__tr("<b>Fax Number:</b>"))
+ self.textLabel3.setText(self.__tr("<b>Name/Nickname:</b>"))
+ self.textLabel4.setText(self.__tr("Member of Group(s):"))
+ self.groupListView.header().setLabel(0,self.__tr("Group Name"))
self.textLabel6.setText(self.__tr("Notes/Other Information:"))
- self.textLabel5.setText(self.__tr("Title:"))
- self.textLabel3.setText(self.__tr("<b>Nickname:</b>"))
self.textLabel12.setText(self.__tr("Note: Items in <b>bold</b> are required fields."))
+ self.textLabel5.setText(self.__tr("Title:"))
+ self.textLabel1.setText(self.__tr("First Name:"))
+ self.textLabel2.setText(self.__tr("Last Name:"))
def firstnameEdit_textChanged(self,a0):
@@ -190,11 +195,3 @@ class FaxAddrBookEditForm_base(QDialog):
def __tr(self,s,c = None):
return qApp.translate("FaxAddrBookEditForm_base",s,c)
-
-if __name__ == "__main__":
- a = QApplication(sys.argv)
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
- w = FaxAddrBookEditForm_base()
- a.setMainWidget(w)
- w.show()
- a.exec_loop()
diff --git a/ui/faxaddrbookeditform_base.ui b/ui/faxaddrbookeditform_base.ui
index c20baad30..840c039db 100644
--- a/ui/faxaddrbookeditform_base.ui
+++ b/ui/faxaddrbookeditform_base.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>479</width>
- <height>551</height>
+ <width>532</width>
+ <height>555</height>
</rect>
</property>
<property name="caption">
@@ -19,36 +19,7 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QListView" row="5" column="2" rowspan="2" colspan="1">
- <column>
- <property name="text">
- <string>Group Name</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>groupListView</cstring>
- </property>
- <property name="selectionMode">
- <enum>NoSelection</enum>
- </property>
- </widget>
- <widget class="QTextEdit" row="11" column="0" rowspan="1" colspan="5">
- <property name="name">
- <cstring>notesEdit</cstring>
- </property>
- </widget>
- <widget class="QLineEdit" row="4" column="2" rowspan="1" colspan="3">
- <property name="name">
- <cstring>lastnameEdit</cstring>
- </property>
- </widget>
- <widget class="QPushButton" row="12" column="3">
+ <widget class="QPushButton" row="8" column="1">
<property name="name">
<cstring>pushButton34</cstring>
</property>
@@ -56,12 +27,7 @@
<string>Cancel</string>
</property>
</widget>
- <widget class="QLineEdit" row="3" column="2" rowspan="1" colspan="3">
- <property name="name">
- <cstring>firstnameEdit</cstring>
- </property>
- </widget>
- <widget class="Line" row="9" column="0" rowspan="1" colspan="5">
+ <widget class="Line" row="6" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>line5</cstring>
</property>
@@ -75,7 +41,7 @@
<enum>Horizontal</enum>
</property>
</widget>
- <widget class="QPushButton" row="12" column="4">
+ <widget class="QPushButton" row="8" column="2">
<property name="name">
<cstring>OKButton</cstring>
</property>
@@ -86,85 +52,7 @@
<string>OK</string>
</property>
</widget>
- <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>First Name:</string>
- </property>
- </widget>
- <spacer row="5" column="3">
- <property name="name">
- <cstring>spacer34</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>61</height>
- </size>
- </property>
- </spacer>
- <widget class="QLineEdit" row="2" column="2" rowspan="1" colspan="3">
- <property name="name">
- <cstring>titleEdit</cstring>
- </property>
- </widget>
- <widget class="QPushButton" row="6" column="3" rowspan="1" colspan="2">
- <property name="name">
- <cstring>groupsButton2</cstring>
- </property>
- <property name="text">
- <string>New Group...</string>
- </property>
- </widget>
- <widget class="QLabel" row="5" column="0" rowspan="2" colspan="2">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>Member of Group(s):</string>
- </property>
- </widget>
- <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Last Name:</string>
- </property>
- </widget>
- <widget class="QLabel" row="8" column="0">
- <property name="name">
- <cstring>textLabel7</cstring>
- </property>
- <property name="text">
- <string>&lt;b&gt;Fax Number:&lt;/b&gt;</string>
- </property>
- </widget>
- <widget class="QLabel" row="10" column="0" rowspan="1" colspan="5">
- <property name="name">
- <cstring>textLabel6</cstring>
- </property>
- <property name="text">
- <string>Notes/Other Information:</string>
- </property>
- </widget>
- <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>Title:</string>
- </property>
- </widget>
- <spacer row="12" column="0" rowspan="1" colspan="3">
+ <spacer row="8" column="0">
<property name="name">
<cstring>spacer31</cstring>
</property>
@@ -181,22 +69,23 @@
</size>
</property>
</spacer>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <widget class="Line" row="9" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>textLabel3</cstring>
+ <cstring>line5_2_2</cstring>
</property>
- <property name="text">
- <string>&lt;b&gt;Nickname:&lt;/b&gt;</string>
+ <property name="frameShape">
+ <enum>HLine</enum>
</property>
- </widget>
- <widget class="QLineEdit" row="0" column="2" rowspan="1" colspan="3">
- <property name="name">
- <cstring>nicknameEdit</cstring>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
</property>
</widget>
- <widget class="Line" row="1" column="0" rowspan="1" colspan="5">
+ <widget class="Line" row="4" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>line12</cstring>
+ <cstring>line5_2</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
@@ -208,28 +97,123 @@
<enum>Horizontal</enum>
</property>
</widget>
- <widget class="QLineEdit" row="8" column="1" rowspan="1" colspan="4">
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>faxEdit</cstring>
+ <cstring>layout1</cstring>
</property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel7</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Fax Number:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>faxEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget class="Line" row="7" column="0" rowspan="1" colspan="5">
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>line5_2</cstring>
+ <cstring>layout2</cstring>
</property>
- <property name="frameShape">
- <enum>HLine</enum>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Name/Nickname:&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>nicknameEdit</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout6</cstring>
</property>
- <property name="frameShadow">
- <enum>Sunken</enum>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Member of Group(s):</string>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Group Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>groupListView</cstring>
+ </property>
+ <property name="selectionMode">
+ <enum>NoSelection</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout7</cstring>
</property>
- <property name="orientation">
- <enum>Horizontal</enum>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Notes/Other Information:</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>notesEdit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLabel" row="10" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel12</cstring>
+ </property>
+ <property name="text">
+ <string>Note: Items in &lt;b&gt;bold&lt;/b&gt; are required fields.</string>
</property>
</widget>
- <widget class="Line" row="13" column="0" rowspan="1" colspan="5">
+ <widget class="Line" row="1" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>line5_2_2</cstring>
+ <cstring>line12</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
@@ -241,13 +225,74 @@
<enum>Horizontal</enum>
</property>
</widget>
- <widget class="QLabel" row="14" column="0" rowspan="1" colspan="5">
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="3">
<property name="name">
- <cstring>textLabel12</cstring>
- </property>
- <property name="text">
- <string>Note: Items in &lt;b&gt;bold&lt;/b&gt; are required fields.</string>
+ <cstring>layout11</cstring>
</property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout9</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Title:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>First Name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Last Name:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout10</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>titleEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>firstnameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>lastnameEdit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
</widget>
</grid>
</widget>
@@ -277,12 +322,6 @@
<slot>lastnameEdit_textChanged(const QString&amp;)</slot>
</connection>
<connection>
- <sender>groupsButton2</sender>
- <signal>clicked()</signal>
- <receiver>FaxAddrBookEditForm_base</receiver>
- <slot>groupsButton2_clicked()</slot>
- </connection>
- <connection>
<sender>nicknameEdit</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>FaxAddrBookEditForm_base</receiver>
@@ -305,9 +344,6 @@
<tabstop>pushButton34</tabstop>
<tabstop>OKButton</tabstop>
</tabstops>
-<includes>
- <include location="local" impldecl="in implementation">faxaddrbookeditform_base.ui.h</include>
-</includes>
<slots>
<slot>firstnameEdit_textChanged( const QString &amp; )</slot>
<slot>lastnameEdit_textChanged( const QString &amp; )</slot>
diff --git a/ui/faxaddrbookform.py b/ui/faxaddrbookform.py
index 5cc7daab1..5fc27125e 100644
--- a/ui/faxaddrbookform.py
+++ b/ui/faxaddrbookform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
@@ -41,30 +41,28 @@ from faxaddrbookgroupeditform_base import FaxAddrBookGroupEditForm_base
# globals
db = None # kirbybase instance
-# **************************************************************************** #
+# ****************************************************************************
-class AddressBookItem(QListViewItem):
+class AddressBookItem2(QListViewItem):
- def __init__(self, parent, abe):
+ def __init__(self, parent, entry):
QListViewItem.__init__(self, parent)
- self.abe = abe
- self.recno = abe.recno
- self.setText(0, abe.name)
- self.setText(1, abe.title)
- self.setText(2, abe.firstname)
- self.setText(3, abe.lastname)
- self.setText(4, abe.fax)
- self.setText(5, ', '.join(abe.group_list))
- self.setText(6, abe.notes)
-
+ self.entry = entry
+ self.setText(0, entry['name'])
+ self.setText(1, entry['title'])
+ self.setText(2, entry['firstname'])
+ self.setText(3, entry['lastname'])
+ self.setText(4, entry['fax'])
+ self.setText(5, ', '.join(entry['groups']))
+ self.setText(6, entry['notes'])
class GroupValidator(QValidator):
def __init__(self, parent=None, name=None):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
- if input.find(',') > 0:
+ input = unicode(input)
+ if input.find(u',') > 0:
return QValidator.Invalid, pos
elif len(input) > 50:
return QValidator.Invalid, pos
@@ -77,26 +75,28 @@ class PhoneNumValidator(QValidator):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
+ input = unicode(input)
if not input:
return QValidator.Acceptable, pos
- elif input[pos-1] not in '0123456789-(+) ':
+ elif input[pos-1] not in u'0123456789-(+) *#':
return QValidator.Invalid, pos
elif len(input) > 50:
return QValidator.Invalid, pos
else:
return QValidator.Acceptable, pos
-
+
# **************************************************************************** #
class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
-
+ """
+ Called when clicking New... or Edit... from the Group Dialog
+ """
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
FaxAddrBookGroupEditForm_base.__init__(self,parent,name,modal,fl)
self.edit_mode = False
self.okButton.setEnabled(True)
- self.all_groups = db.AllGroups()
+ self.all_groups = db.get_all_groups()
self.groupnameEdit.setValidator(GroupValidator(self.groupnameEdit))
def setDlgData(self, group_name):
@@ -107,43 +107,39 @@ class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
def setEntries(self, group_name=''):
self.entriesListView.clear()
+ all_entries = db.get_all_records()
- all_entries = db.AllRecordEntries()
+ for e, v in all_entries.items():
+ i = QCheckListItem(self.entriesListView, e, QCheckListItem.CheckBox)
- for e in all_entries:
- i = QCheckListItem(self.entriesListView, e.name, QCheckListItem.CheckBox)
-
- if group_name and group_name in e.group_list:
+ if group_name and group_name in v['groups']:
i.setState(QCheckListItem.On)
self.CheckOKButton()
def getDlgData(self):
- group_name = str(self.groupnameEdit.text())
+ group_name = unicode(self.groupnameEdit.text())
entries = []
i = self.entriesListView.firstChild()
while i is not None:
if i.isOn():
- entries.append(str(i.text()))
+ entries.append(unicode(i.text()))
i = i.itemBelow()
return group_name, entries
-
def groupnameEdit_textChanged(self,a0):
self.CheckOKButton()
-
def entriesListView_clicked(self,a0):
self.CheckOKButton()
-
def CheckOKButton(self):
- group_name = str(self.groupnameEdit.text())
+ group_name = unicode(self.groupnameEdit.text())
if not group_name or \
(not self.edit_mode and group_name in self.all_groups):
@@ -171,25 +167,21 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
FaxAddrBookGroupsForm_base.__init__(self,parent,name,modal,fl)
-
self.current = None
QTimer.singleShot(0, self.InitialUpdate)
-
def InitialUpdate(self):
self.UpdateList()
-
def UpdateList(self):
self.groupListView.clear()
first_rec = None
- all_groups = db.AllGroups()
-
- if len(all_groups):
+ all_groups = db.get_all_groups()
+ if all_groups:
for group in all_groups:
i = QListViewItem(self.groupListView, group,
- ', '.join(db.GroupEntries(group)))
+ u', '.join(db.group_members(group)))
if first_rec is None:
first_rec = i
@@ -204,45 +196,44 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
self.editButton.setEnabled(False)
self.deleteButton.setEnabled(False)
-
def newButton_clicked(self):
dlg = FaxAddrBookGroupEditForm(self)
dlg.setEntries()
if dlg.exec_loop() == QDialog.Accepted:
group_name, entries = dlg.getDlgData()
- db.UpdateGroupEntries(group_name, entries)
+ db.update_groups(group_name, entries)
+ db.save()
self.UpdateList()
def editButton_clicked(self):
dlg = FaxAddrBookGroupEditForm(self)
- group_name = str(self.current.text(0))
+ group_name = unicode(self.current.text(0))
dlg.setDlgData(group_name)
if dlg.exec_loop() == QDialog.Accepted:
group_name, entries = dlg.getDlgData()
- db.UpdateGroupEntries(group_name, entries)
+ db.update_groups(group_name, entries)
+ db.save()
self.UpdateList()
def deleteButton_clicked(self):
x = QMessageBox.critical(self,
self.caption(),
- "<b>Annoying Confirmation: Are you sure you want to delete this group?</b>" ,
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to delete this group?</b>"),
QMessageBox.Yes,
QMessageBox.No | QMessageBox.Default,
QMessageBox.NoButton)
if x == QMessageBox.Yes:
- db.DeleteGroup(str(self.current.text(0)))
+ db.delete_group(unicode(self.current.text(0)))
+ db.save()
self.UpdateList()
-
def groupListView_currentChanged(self, a0):
self.current = a0
-
def groupListView_doubleClicked(self, a0):
self.editButton_clicked()
-
def groupListView_rightButtonClicked(self, item, pos, a2):
popup = QPopupMenu(self)
@@ -264,28 +255,27 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
-
def __init__(self, editing=True, parent = None,name = None,modal = 0,fl = 0):
FaxAddrBookEditForm_base.__init__(self,parent,name,modal,fl)
- self.recno = -1
self.editing = editing
self.faxEdit.setValidator(PhoneNumValidator(self.faxEdit))
-
- def setDlgData(self, abe):
- self.recno = abe.recno
- self.titleEdit.setText(abe.title)
- self.firstnameEdit.setText(abe.firstname)
- self.lastnameEdit.setText(abe.lastname)
- self.faxEdit.setText(abe.fax)
- self.notesEdit.setText(abe.notes)
- self.nicknameEdit.setText(abe.name)
-
- self.setGroups(abe.group_list)
+ self.initial_nickname = ''
+ self.OKButton.setEnabled(self.editing)
+
+ def setDlgData(self, name, title, firstname, lastname, fax, group_list, notes):
+ self.initial_nickname = name
+ self.name = name
+ self.titleEdit.setText(title)
+ self.firstnameEdit.setText(firstname)
+ self.lastnameEdit.setText(lastname)
+ self.faxEdit.setText(fax)
+ self.notesEdit.setText(notes)
+ self.nicknameEdit.setText(name)
+ self.setGroups(group_list)
def setGroups(self, entry_groups=[]):
self.groupListView.clear()
-
- for g in db.AllGroups():
+ for g in db.get_all_groups():
i = QCheckListItem(self.groupListView, g, QCheckListItem.CheckBox)
if g in entry_groups:
@@ -297,75 +287,52 @@ class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
while i is not None:
if i.isOn():
- in_groups.append(str(i.text()))
+ in_groups.append(unicode(i.text()))
i = i.itemBelow()
- return fax.AddressBookEntry((
- self.recno,
- str(self.nicknameEdit.text()),
- str(self.titleEdit.text()),
- str(self.firstnameEdit.text()),
- str(self.lastnameEdit.text()),
- str(self.faxEdit.text()),
- ', '.join(in_groups),
- str(self.notesEdit.text())))
-
+ return {'name': unicode(self.nicknameEdit.text()),
+ 'title': unicode(self.titleEdit.text()),
+ 'firstname': unicode(self.firstnameEdit.text()),
+ 'lastname': unicode(self.lastnameEdit.text()),
+ 'fax': unicode(self.faxEdit.text()),
+ 'groups': in_groups,
+ 'notes': unicode(self.notesEdit.text())}
def firstnameEdit_textChanged(self,a0):
pass
-
def lastnameEdit_textChanged(self,a0):
pass
-
- def groupsButton2_clicked(self): # New Group...
- new_group_name, ok = QInputDialog.getText(self.__tr("New Fax Group"),
- self.__tr("New Group Name:"))
-
- if ok and len(new_group_name):
- new_group_name = str(new_group_name)
- abe = db.GetEntryByRecno(self.recno)
-
- if new_group_name not in abe.group_list:
- abe.group_list.append(new_group_name)
- db.update(['recno'], [self.recno], [','.join(abe.group_list)], ['groups'])
- self.setGroups(abe.group_list)
-
-
-
def nicknameEdit_textChanged(self, nickname):
self.CheckOKButton(nickname, None)
-
def faxEdit_textChanged(self, fax):
self.CheckOKButton(None, fax)
-
def CheckOKButton(self, nickname=None, fax=None):
if nickname is None:
- nickname = str(self.nicknameEdit.text())
-
+ nickname = unicode(self.nicknameEdit.text())
+
if fax is None:
- fax = str(self.faxEdit.text())
-
- ok = len(nickname) and len(fax)
-
- if nickname and not self.editing:
- for x in db.AllRecordEntries():
- if nickname == x.name:
+ fax = unicode(self.faxEdit.text())
+
+ ok = bool(len(nickname) and len(fax))
+
+ if nickname:
+ all_entries = db.get_all_records()
+ for e, v in all_entries.items():
+ if nickname == e and nickname != self.initial_nickname:
ok = False
self.OKButton.setEnabled(ok)
-
def __tr(self,s,c = None):
return qApp.translate("FAB",s,c)
# **************************************************************************** #
class FaxAddrBookForm(FaxAddrBookForm_base):
-
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
FaxAddrBookForm_base.__init__(self,parent,name,modal,fl)
@@ -373,36 +340,15 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
self.setIcon(icon)
global db
- db = fax.FaxAddressBook()
+ db = fax.FaxAddressBook2()
self.init_problem = False
- self.current = None
try:
- invalids = db.validate()
- except:
- invalids = True
-
- if invalids:
- log.error("Fax address book file is invalid")
-
- if type(invalids) == type([]):
- log.error(invalids)
-
- self.FailureUI(self.__tr("<b>Fax address book file %s is invalid.</b><p>Please check the file for problems." % db.filename()))
+ self.hpssd_sock = service.startup()
+ except Error:
+ log.error("Unable to connect to HPLIP I/O (hpssd).")
self.init_problem = True
- db.pack()
-
- self.all_groups = []
-
- self.hpssd_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- try:
- self.hpssd_sock.connect((prop.hpssd_host, prop.hpssd_port))
- except socket.error:
- log.error("Unable to contact HPLIP I/O (hpssd).")
- self.hpssd_sock.close()
- self.hpssd_sock = None
-
QTimer.singleShot(0, self.InitialUpdate)
@@ -413,17 +359,15 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
self.UpdateList()
-
def UpdateList(self):
self.addressListView.clear()
first_rec = None
- all_entries = db.AllRecordEntries()
+ all_entries = db.get_all_records()
log.debug("Number of records is: %d" % len(all_entries))
- if len(all_entries) > 0:
-
- for abe in all_entries:
- i = AddressBookItem(self.addressListView, abe)
+ if all_entries:
+ for e, v in all_entries.items():
+ i = AddressBookItem2(self.addressListView, v)
if first_rec is None:
first_rec = i
@@ -438,7 +382,6 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
self.editButton.setEnabled(False)
self.deleteButton.setEnabled(False)
-
def groupButton_clicked(self):
FaxAddrBookGroupsForm(self).exec_loop()
self.sendUpdateEvent()
@@ -447,42 +390,47 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
def newButton_clicked(self):
dlg = FaxAddrBookEditForm(False, self)
dlg.setGroups()
- dlg.groupsButton2.setEnabled(False)
if dlg.exec_loop() == QDialog.Accepted:
- db.insert(dlg.getDlgData())
+ d = dlg.getDlgData()
+ db.set(**d)
+ db.save()
self.sendUpdateEvent()
self.UpdateList()
- def CurrentRecordEntry(self):
- return fax.AddressBookEntry(db.select(['recno'], [self.current.recno])[0])
-
def editButton_clicked(self):
dlg = FaxAddrBookEditForm(True, self)
- dlg.setDlgData(self.CurrentRecordEntry())
+ c = self.current.entry
+ dlg.setDlgData(c['name'], c['title'], c['firstname'],
+ c['lastname'], c['fax'], c['groups'], c['notes'])
+ prev_name = c['name']
if dlg.exec_loop() == QDialog.Accepted:
- db.update(['recno'], [self.current.recno], dlg.getDlgData())
+ d = dlg.getDlgData()
+
+ if prev_name != d['name']:
+ db.delete(prev_name)
+
+ db.set(**d)
+ db.save()
self.sendUpdateEvent()
self.UpdateList()
def deleteButton_clicked(self):
- x = QMessageBox.critical(self,
- self.caption(),
- "<b>Annoying Confirmation: Are you sure you want to delete this address book entry?</b>" ,
- QMessageBox.Yes,
- QMessageBox.No | QMessageBox.Default,
- QMessageBox.NoButton)
- if x == QMessageBox.Yes:
- db.delete(['recno'], [self.current.recno])
+ if QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to delete this address book entry?</b>"),
+ QMessageBox.Yes,
+ QMessageBox.No | QMessageBox.Default,
+ QMessageBox.NoButton) == QMessageBox.Yes:
+ db.delete(self.current.entry['name'])
+ db.save()
self.UpdateList()
self.sendUpdateEvent()
def addressListView_rightButtonClicked(self, item, pos, a2):
popup = QPopupMenu(self)
-
popup.insertItem(self.__tr("New..."), self.newButton_clicked)
-
if item is not None:
popup.insertItem(self.__tr("Edit..."), self.editButton_clicked)
popup.insertItem(self.__tr("Delete..."), self.deleteButton_clicked)
@@ -491,16 +439,14 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
popup.insertItem(self.__tr("Refresh List"), self.UpdateList)
popup.popup(pos)
-
def addressListView_doubleClicked(self,a0):
self.editButton_clicked()
-
def addressListView_currentChanged(self,item):
self.current = item
-
def FailureUI(self, error_text):
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", ""))
QMessageBox.critical(self,
self.caption(),
error_text,
@@ -508,16 +454,6 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
QMessageBox.NoButton,
QMessageBox.NoButton)
-
- def WarningUI(self, msg):
- QMessageBox.warning(self,
- self.caption(),
- msg,
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
-
def __tr(self,s,c = None):
return qApp.translate("FAB",s,c)
@@ -525,7 +461,7 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
self.sendUpdateEvent()
if self.hpssd_sock is not None:
self.hpssd_sock.close()
-
+
FaxAddrBookForm_base.accept(self)
def sendUpdateEvent(self):
diff --git a/ui/faxsendjobform.py b/ui/faxsendjobform.py
index fcc17f3eb..203f20f1f 100644
--- a/ui/faxsendjobform.py
+++ b/ui/faxsendjobform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
@@ -20,11 +20,12 @@
#
# Std Lib
-import glob, Queue, socket, struct
+import operator
# Local
from base.g import *
-from base import utils, device, pml, service, msg, magic
+from base import utils, device
+from prnt import cups
try:
from fax import fax
@@ -33,125 +34,37 @@ except ImportError:
log.error("Fax send disabled - Python 2.3+ required.")
sys.exit(1)
-from prnt import cups
# Qt/UI
from qt import *
-from faxsendjobform_base import FaxSendJobForm_base
-from waitform import WaitForm
-from faxsettingsform import FaxSettingsForm
-from faxallowabletypesdlg import FaxAllowableTypesDlg
-
-try:
- import reportlab
-except ImportError:
- coverpages_enabled = False
-else:
- from fax import coverpages
- from coverpageform import CoverpageForm
- coverpages_enabled = True
+from scrollfax import ScrollFaxView
-# Used to store MIME types for files
-# added directly in interface.
-job_types = {} # { job_id : "mime_type", ...}
-
-class FileListViewItem(QListViewItem):
- def __init__(self, parent, title, mime_type_desc, path, str_pages):
- QListViewItem.__init__(self, parent, title, mime_type_desc, str_pages)
- self.path = path
-
-
-class FaxSendJobForm(FaxSendJobForm_base):
+class FaxSendJobForm(QMainWindow):
def __init__(self, sock, device_uri, printer_name, args,
parent=None, name=None,
modal=0, fl=0):
- FaxSendJobForm_base.__init__(self, parent, name, modal, fl)
+ QMainWindow.__init__(self,parent,name,fl)
+
icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
self.setIcon(icon)
+
self.sock = sock
self.init_failed = False
self.device_uri = device_uri
self.dev = None
self.printer_name = printer_name
bus = 'cups'
- self.document_num = 1
self.filename = ''
- self.waitdlg = None
- self.recipient_list = []
self.username = prop.username
self.args = args
-
- self.update_queue = Queue.Queue() # UI updates from send thread
- self.event_queue = Queue.Queue() # UI events (from hpssd) to send thread
-
- pix = QPixmap(os.path.join(prop.image_dir, 'folder_remove.png'))
- self.delFileButton.setPixmap(pix)
-
- pix = QPixmap(os.path.join(prop.image_dir, 'status_refresh.png'))
- self.refreshToolButton.setPixmap(pix)
-
- pix = QPixmap(os.path.join(prop.image_dir, 'up.png'))
- self.upFileButton.setPixmap(pix)
-
- pix = QPixmap(os.path.join(prop.image_dir, 'down.png'))
- self.downFileButton.setPixmap(pix)
-
- self.fileListView.setSorting(-1)
-
- # TODO: Hook these up. Need to read current settings
- # from PDD file for the current device queue
- #self.paperSizeButtonGroup.setEnabled(False)
- #self.qualityButtonGroup.setEnabled(False)
-
- self.addCoverpagePushButton.setEnabled(coverpages_enabled)
- self.cover_page_func, cover_page_png = None, None
- self.cover_page_message = ''
- self.cover_page_re = ''
- self.cover_page_name = ''
-
- self.event_handler = self.addFileFromJob
-
- self.file_list = []
-
- self.db = fax.FaxAddressBook() # kirbybase instance
-
- self.allowable_mime_types = cups.getAllowableMIMETypes()
- self.allowable_mime_types.append("application/hplip-fax")
- self.allowable_mime_types.append("application/x-python")
-
- log.debug(self.allowable_mime_types)
-
- self.MIME_TYPES_DESC = \
- {
- "application/pdf" : (self.__tr("PDF Document"), '.pdf'),
- "application/postscript" : (self.__tr("Postscript Document"), '.ps'),
- "application/vnd.hp-HPGL" : (self.__tr("HP Graphics Language File"), '.hgl, .hpg, .plt, .prn'),
- "application/x-cshell" : (self.__tr("C Shell Script"), '.csh'),
- "application/x-perl" : (self.__tr("Perl Script"), '.pl'),
- "application/x-python" : (self.__tr("Python Program"), '.py'),
- "application/x-shell" : (self.__tr("Shell Script"), '.sh'),
- "text/plain" : (self.__tr("Plain Text"), '.txt, .log, etc'),
- "text/html" : (self.__tr("HTML Dcoument"), '.htm, .html'),
- "image/gif" : (self.__tr("GIF Image"), '.gif'),
- "image/png" : (self.__tr("PNG Image"), '.png'),
- "image/jpeg" : (self.__tr("JPEG Image"), '.jpg, .jpeg'),
- "image/tiff" : (self.__tr("TIFF Image"), '.tif, .tiff'),
- "image/x-bitmap" : (self.__tr("Bitmap (BMP) Image"), '.bmp'),
- "image/x-photocd" : (self.__tr("Photo CD Image"), '.pcd'),
- "image/x-portable-anymap" : (self.__tr("Portable Image (PNM)"), '.pnm'),
- "image/x-portable-bitmap" : (self.__tr("Portable B&W Image (PBM)"), '.pbm'),
- "image/x-portable-graymap" : (self.__tr("Portable Grayscale Image (PGM)"), '.pgm'),
- "image/x-portable-pixmap" : (self.__tr("Portable Color Image (PPM)"), '.ppm'),
- "image/x-sgi-rgb" : (self.__tr("SGI RGB"), '.rgb'),
- "image/x-xbitmap" : (self.__tr("X11 Bitmap (XBM)"), '.xbm'),
- "image/x-xpixmap" : (self.__tr("X11 Pixmap (XPM)"), '.xpm'),
- "image/x-sun-raster" : (self.__tr("Sucoverpages_enabledn Raster Format"), '.ras'),
- "application/hplip-fax" : (self.__tr("HP Fax"), '.g3'),
- "application/hplip-fax-coverpage" : (self.__tr("HP Fax Coverpage"), 'n/a'),
- }
+ self.setCentralWidget(QWidget(self,"qt_central_widget"))
+ self.FormLayout = QGridLayout(self.centralWidget(),1,1,11,6,"FormLayout")
+ self.resize(QSize(600,480).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+ self.languageChange()
if self.device_uri and self.printer_name:
log.error("You may not specify both a printer (-p) and a device (-d).")
@@ -162,8 +75,23 @@ class FaxSendJobForm(FaxSendJobForm_base):
self.cups_printers = cups.getPrinters()
log.debug(self.cups_printers)
+ if self.printer_name:
+ found = False
+ for p in self.cups_printers:
+ if p.name == printer_name:
+ self.device_uri = p.device_uri
+ found = True
+ break
+
+ if not found:
+ self.FailureUI(self.__tr("<b>Unknown printer name: %1</b><p>Please check the printer name and try again.").arg(self.printer_name))
+
+ if found and not p.device_uri.startswith('hpfax:/'):
+ self.FailureUI(self.__tr("You must specify a printer that has a device URI in the form 'hpfax:/...'"))
+ self.init_failed = True
+
if not self.device_uri and not self.printer_name:
- t = device.probeDevices(self.sock, bus=bus, filter='fax')
+ t = device.probeDevices(bus=bus, filter={'fax-type':(operator.gt, 0)})
probed_devices = []
for d in t:
@@ -189,7 +117,7 @@ class FaxSendJobForm(FaxSendJobForm_base):
self.init_failed = True
elif x == 1:
- log.info(utils.bold("Using device: %s" % devices[0][0]))
+ log.info(log.bold("Using device: %s" % devices[0][0]))
self.device_uri = devices[0][0]
else:
@@ -200,824 +128,47 @@ class FaxSendJobForm(FaxSendJobForm_base):
else:
self.init_failed = True
- cmd_print, cmd_scan, cmd_pcard, \
- cmd_copy, cmd_fax, cmd_fab = utils.deviceDefaultFunctions()
-
- self.cmd_fab = user_cfg.commands.fab or cmd_fab
- log.debug("FAB command: %s" % self.cmd_fab)
-
- if not coverpages_enabled:
- log.warn("Coverpages disabled. Reportlab not installed.")
-
+ self.FaxView = ScrollFaxView(self.sock, False, self.centralWidget(), self)
+ self.FormLayout.addWidget(self.FaxView,0,0)
+
+ if not self.init_failed:
+ try:
+ self.cur_device = device.Device(device_uri=self.device_uri,
+ printer_name=self.printer_name,
+ hpssd_sock=self.sock)
+ except Error, e:
+ log.error("Invalid device URI or printer name.")
+ self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-print and try again.")
+ self.init_failed = True
+
+ else:
+ self.device_uri = self.cur_device.device_uri
+ user_cfg.last_used.device_uri = self.device_uri
+
+ log.debug(self.device_uri)
+
+ self.statusBar().message(self.device_uri)
+
QTimer.singleShot(0, self.InitialUpdate)
- # ************************************** Device status
def InitialUpdate(self):
if self.init_failed:
self.close()
return
- self.printer_list = []
-
- try:
- self.dev = fax.FaxDevice(device_uri=self.device_uri,
- printer_name=self.printer_name)
- except Error, e:
- log.error("Invalid device URI or printer name.")
- self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-sendfax and try again.")
- self.close()
- return
-
- self.device_uri = self.dev.device_uri
-
- log.debug("Device URI=%s" %self.device_uri)
- self.DeviceURIText.setText(self.device_uri)
+ self.FaxView.onDeviceChange(self.cur_device)
- log.debug("Setting date and time on device.")
- self.dev.setDateAndTime()
-
- for p in self.cups_printers:
- if p.device_uri == self.device_uri:
- self.printer_list.append(p.name)
-
- if not self.printer_list:
- self.FailureUI(self.__tr("<b>No appropriate CUPS fax queue is setup.</b><p>Please install a CUPS queue for device '%1' using the HPLIP Fax PPD file. (You could use 'hp-setup' to do this.)").arg(self.device_uri))
- self.close()
- return
-
- for p in self.printer_list:
- self.printerNameComboBox.insertItem(p)
-
- self.UpdatePrinterStatus()
-
- if self.printer_name is None:
- self.printerNameComboBox.setCurrentItem(0)
- elif self.printer_name in self.printer_list:
- self.printerNameComboBox.setCurrentText(self.printer_name)
-
- self.current_printer = str(self.printerNameComboBox.currentText())
-
- self.UpdatePrinterInfo()
-
- self.UpdateIndividualList()
- self.UpdateGroupList()
- self.CheckSendButtons()
- self.selection = []
-
- if len(self.args):
- for a in self.args:
- if os.path.exists(a):
- self.processFile(a, a)
- else:
- self.FailureUI(self.__tr("<b>File not found:</b><p>%1").arg(a))
-
-
- def UpdatePrinterStatus(self):
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- 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()
- QApplication.restoreOverrideCursor()
-
-
- if self.dev.device_state == DEVICE_STATE_NOT_FOUND:
- self.FailureUI(self.__tr("<b>Unable to communicate with device:</b><p>%1").arg(self.device_uri))
-
-
- def UpdatePrinterInfo(self):
- for p in self.cups_printers:
- if p.name == self.current_printer:
-
- try:
- self.LocationText.setText(p.location)
- except AttributeError:
- self.LocationText.setText('')
-
- try:
- self.CommentText.setText(p.info)
- except AttributeError:
- self.CommentText.setText('')
-
- self.appPrintNoteLabel.setText(self.__tr("<i>You can also add items by printing documents from an application using the CUPS printer '%1'.</i>").arg(self.current_printer))
-
- break
- else: # No CUPS queue for this device
- log.error("No CUPS queue found!")
-
-
- def refreshToolButton_clicked(self):
- self.UpdatePrinterStatus()
-
- def printerNameComboBox_highlighted(self, a0):
- self.current_printer = str(a0)
- self.UpdatePrinterInfo()
-
- # ************************************** Recepient handling
- def UpdateIndividualList(self):
- already_checked = []
-
- i = self.individualSendListView.firstChild()
- while i is not None:
- if i.isOn():
- already_checked.append(str(i.text(1)))
-
- i = i.itemBelow()
-
- self.individualSendListView.clear()
-
- all_entries = self.db.AllRecordEntries()
-
- if len(all_entries) > 0:
-
- for i in all_entries:
- j = QCheckListItem(self.individualSendListView, '',
- QCheckListItem.CheckBox)
-
- j.setText(1, i.name)
- j.setText(2, i.fax)
- j.setText(3, i.notes)
-
- if i.name in already_checked:
- j.setOn(True)
-
-
- def UpdateGroupList(self):
- already_checked = []
-
- i = self.groupSendListView.firstChild()
- while i is not None:
- if i.isOn():
- already_checked.append(str(i.text(1)))
- i = i.itemBelow()
-
- self.groupSendListView.clear()
- all_groups = self.db.AllGroups()
-
- for g in all_groups:
- j = QCheckListItem(self.groupSendListView, '',
- QCheckListItem.CheckBox)
-
- j.setText(1, g)
- j.setText(2, ', '.join(self.db.GroupEntries(g)))
-
- if g in already_checked:
- j.setOn(True)
-
-
- def CheckSendButtons(self):
- self.sendNowButton.setEnabled(bool(self.recipient_list and self.file_list))
-
-
- def addressBookButton_clicked(self):
- log.debug(self.cmd_fab)
- cmd = ''.join([self.dev.device_vars.get(x, x) \
- for x in self.cmd_fab.split('%')])
- log.debug(cmd)
-
- path = cmd.split()[0]
- args = cmd.split()
-
- self.CleanupChildren()
- os.spawnvp(os.P_NOWAIT, path, args)
-
-
- def CleanupChildren(self):
- log.debug("Cleaning up child processes.")
- try:
- os.waitpid(-1, os.WNOHANG)
- except OSError:
- pass
-
-
- def sendLaterButton_clicked(self):
- print "FaxSendJobForm.sendLaterButton_clicked(): Not implemented yet"
-
-
- def individualSendListView_clicked(self,a0):
- self.UpdateSelectionEdit()
-
- def groupSendListView_clicked(self,a0):
- self.UpdateSelectionEdit()
-
-
- def UpdateSelectionEdit(self):
- self.recipient_list = []
- i = self.groupSendListView.firstChild()
- while i is not None:
- if i.isOn():
- group = str(i.text(1))
- self.recipient_list.extend(self.db.GroupEntries(group))
- i = i.itemBelow()
-
- i = self.individualSendListView.firstChild()
- while i is not None:
- if i.isOn():
- self.recipient_list.append(str(i.text(1)))
- i = i.itemBelow()
-
- log.debug("List=%s" % self.recipient_list)
- self.recipient_list = utils.uniqueList(self.recipient_list)
- log.debug("Unique list=%s" % self.recipient_list)
-
- self.selectionEdit.setText(', '.join(self.recipient_list))
- self.CheckSendButtons()
-
-
- # ************************************** Send fax handling
- def sendNowButton_clicked(self):
- phone_num_list = []
-
- log.debug("Current printer=%s" % self.current_printer)
- ppd_file = cups.getPPD(self.current_printer)
-
- if ppd_file is not None and os.path.exists(ppd_file):
- if file(ppd_file, 'r').read().find('HP Fax') == -1:
- self.FailureUI(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.current_printer))
- return
-
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- 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()
- QApplication.restoreOverrideCursor()
-
-
- if self.dev.error_state in (ERROR_STATE_WARNING, ERROR_STATE_ERROR, ERROR_STATE_BUSY):
- self.FailureUI(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))
- 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.current_printer:
- if p.state == cups.IPP_PRINTER_STATE_STOPPED:
- self.FailureUI(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.current_printer))
- return
- break
-
- log.debug("Recipient list:")
-
- for p in self.recipient_list:
- a = fax.AddressBookEntry(self.db.select(['name'], [p])[0])
- phone_num_list.append(a)
- log.debug("Name=%s Number=%s" % (a.name, a.fax))
-
- log.debug("File list:")
-
-
- for f in self.file_list:
- log.debug(str(f))
-
- self.event_handler = self.sendFaxEvent # Switch to send event handler
-
- service.sendEvent(self.sock, EVENT_START_FAX_JOB, device_uri=self.device_uri)
-
- if not self.dev.sendFaxes(phone_num_list, self.file_list, self.cover_page_message,
- self.cover_page_re, self.cover_page_func, self.current_printer,
- self.update_queue, self.event_queue):
-
- self.FailureUI(self.__tr("<b>Send fax is active.</b><p>Please wait for operation to complete."))
- service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=self.device_uri)
- return
-
-
- self.waitdlg = WaitForm(0, self.__tr("Initializing..."), self.send_fax_canceled, self, modal=1)
- self.waitdlg.show()
-
- self.send_fax_timer = QTimer(self, "SendFaxTimer")
- self.connect(self.send_fax_timer, SIGNAL('timeout()'), self.send_fax_timer_timeout)
- self.send_fax_timer.start(1000) # 1 sec UI updates
-
-
- def send_fax_canceled(self):
- self.event_queue.put((fax.EVENT_FAX_SEND_CANCELED, '', '', ''))
- service.sendEvent(self.sock, EVENT_FAX_JOB_CANCELED, device_uri=self.device_uri)
-
-
- def send_fax_timer_timeout(self):
- while self.update_queue.qsize():
- try:
- status, page_num, phone_num = self.update_queue.get(0)
- except Queue.Empty:
- break
-
- if status == fax.STATUS_IDLE:
- self.send_fax_timer.stop()
+ if self.args is not None:
+ for f in self.args:
+ self.FaxView.processFile(f)
+
+ if self.printer_name is not None:
+ self.FaxView.onPrinterChange(self.printer_name)
- if self.waitdlg is not None:
- self.waitdlg.hide()
- self.waitdlg.close()
- self.waitdlg = None
-
- self.event_handler = self.addFileFromJob # Reset handler
-
- elif status == fax.STATUS_PROCESSING_FILES:
- self.waitdlg.setMessage(self.__tr("Processing page %1...").arg(page_num))
-
- elif status == fax.STATUS_DIALING:
- self.waitdlg.setMessage(self.__tr("Dialing %1...").arg(phone_num))
-
- elif status == fax.STATUS_CONNECTING:
- self.waitdlg.setMessage(self.__tr("Connecting to %1...").arg(phone_num))
-
- elif status == fax.STATUS_SENDING:
- self.waitdlg.setMessage(self.__tr("Sending page %1 to %2...").arg(page_num).arg(phone_num))
-
- elif status == fax.STATUS_CLEANUP:
- self.waitdlg.setMessage(self.__tr("Cleaning up..."))
-
- elif status in (fax.STATUS_ERROR, fax.STATUS_BUSY, fax.STATUS_COMPLETED):
- self.send_fax_timer.stop()
-
- if self.waitdlg is not None:
- self.waitdlg.hide()
- self.waitdlg.close()
- self.waitdlg = None
-
- self.event_handler = self.addFileFromJob # Reset handler
-
- if status == fax.STATUS_ERROR:
- self.FailureUI(self.__tr("<b>Fax send error.</b><p>"))
- service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=self.device_uri)
-
- elif status == fax.STATUS_BUSY:
- self.FailureUI(self.__tr("<b>Fax device is busy.</b><p>Please try again later."))
- service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=self.device_uri)
-
- elif status == fax.STATUS_COMPLETED:
- self.SuccessUI()
- service.sendEvent(self.sock, EVENT_END_FAX_JOB, device_uri=self.device_uri)
-
- self.fileListView.clear()
- del self.file_list[:]
- self.UpdateFileList()
- self.CheckSendButtons()
-
- self.addCoverpagePushButton.setEnabled(coverpages_enabled)
- self.editCoverpagePushButton.setEnabled(False)
-
-
-
- # ************************************** File and event handling
- def delFileButton_clicked(self):
- try:
- path = self.fileListView.currentItem().path
- except AttributeError:
- return
- else:
- temp = self.file_list[:]
- index = 0
- for p, t, d, x, g in temp:
- if p == path:
- del self.file_list[index]
-
- if t == 'application/hplip-fax-coverpage':
- self.addCoverpagePushButton.setEnabled(coverpages_enabled)
- self.editCoverpagePushButton.setEnabled(False)
-
- self.UpdateFileList()
- break
-
- index += 1
-
- self.CheckSendButtons()
-
-
- def addFilePushButton_clicked(self):
- self.processFile(self.filename, self.filename)
- self.CheckSendButtons()
-
- def upFileButton_clicked(self):
- try:
- path = self.fileListView.currentItem().path
- except AttributeError:
- return
- else:
- temp = self.file_list[:]
- index = 0
- for p, t, d, x, c in temp:
- if p == path:
- self.file_list_move_up(p)
- self.UpdateFileList(index-1)
- break
-
- index += 1
-
-
- def downFileButton_clicked(self):
- try:
- path = self.fileListView.currentItem().path
- except AttributeError:
- return
- else:
- temp = self.file_list[:]
- index = 0
- for p, t, d, x, c in temp:
- if p == path:
- self.file_list_move_down(p)
- self.UpdateFileList(index+1)
- break
-
- index += 1
-
- def file_list_move_up(self, p):
- for i in range(1, len(self.file_list)):
- if self.file_list[i][0] == p:
- self.file_list[i-1], self.file_list[i] = \
- self.file_list[i], self.file_list[i-1]
-
- def file_list_move_down(self, p):
- for i in range(len(self.file_list)-2, -1, -1):
- if self.file_list[i][0] == p:
- self.file_list[i], self.file_list[i+1] = \
- self.file_list[i+1], self.file_list[i]
-
- def fileEdit_textChanged(self,a0):
- self.filename = str(self.fileEdit.text())
- self.enableAddFileButton()
-
- def browsePushButton_clicked(self):
- self.filename = str(self.fileEdit.text())
-
- if self.filename and os.path.isdir(self.filename):
- d = self.filename
- else:
- d = os.path.expanduser("~")
-
- s = str(QFileDialog.getOpenFileName(d, self.__tr("All files (*)"), self,
- "openfile", self.caption()))
-
- if s and os.path.exists(s):
- self.fileEdit.setText(s)
- self.enableAddFileButton()
-
-
- def enableAddFileButton(self):
- self.addFilePushButton.setEnabled(bool(self.filename and
- os.path.exists(self.filename) and
- os.path.isfile(self.filename)))
-
-
- def EventUI(self, event_code, event_type, error_string_short,
- error_string_long, retry_timeout, job_id,
- device_uri, printer_name, title, job_size):
-
- log.debug("Event: device_uri=%s code=%d type=%s string=%s timeout=%d id=%d uri=%s printer=%s title=%s" %
- (device_uri, event_code, event_type,
- error_string_short, retry_timeout,
- job_id, device_uri, printer_name, title))
-
- if event_code == EVENT_FAX_RENDER_COMPLETE:
-
- if device_uri == self.dev.device_uri:
- log.debug("Render completed message received for %s." % device_uri)
-
- if self.isMinimized():
- self.showNormal()
-
- self.event_handler(event_code, title, self.username, job_id, job_size)
-
- elif event_code == EVENT_FAX_RENDER_DISTANT_EARLY_WARNING:
- if device_uri == self.dev.device_uri:
- QApplication.setOverrideCursor(QApplication.waitCursor)
- log.debug("Distant early warning received.")
-
- elif event_code == EVENT_FAX_ADDRESS_BOOK_UPDATED:
- log.debug("Address book updated event received.")
- self.UpdateIndividualList()
- self.UpdateGroupList()
- self.UpdateSelectionEdit()
-
- else: # Printer status...
- if self.dev is not None and device_uri == self.dev.device_uri:
- log.debug("Device status update event received for %s." % device_uri)
- self.StateText.setText(error_string_short)
-
- def allowableTypesPushButton_clicked(self):
- x = {}
- for a in self.allowable_mime_types:
- x[a] = self.MIME_TYPES_DESC.get(a, ('Unknown', 'n/a'))
-
- log.debug(x)
- dlg = FaxAllowableTypesDlg(x, self)
- dlg.exec_loop()
-
- # ************************************** Event handling
- # Event handler for adding files from a external print job (not during fax send thread)
- def addFileFromJob(self, event, title, username, job_id=0, job_size=0):
- log.debug("Transfering job %d (%d bytes)" % (job_id, job_size))
-
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- try:
- sock.connect((prop.hpssd_host, prop.hpssd_port))
- except socket.error:
- log.error("Unable to contact HPLIP I/O (hpssd).")
- sys.exit(1)
-
- fax_dir = os.path.expanduser("~/hpfax")
-
- if not os.path.exists(fax_dir):
- os.mkdir(fax_dir)
-
- fax_file = os.path.expanduser(os.path.join(fax_dir, "hpfax-%d.g3" % job_id))
- fd = file(fax_file, 'w')
- bytes_read = 0
- header_read = False
- total_pages = 0
-
- if self.waitdlg is not None:
- self.waitdlg.setMessage(self.__tr("Receiving fax data..."))
-
- while True:
- qApp.processEvents()
-
- fields, data, result_code = \
- msg.xmitMessage(sock, "FaxGetData", None,
- {"username": username,
- "job-id": job_id,
- })
-
- log.debug(repr(data)), len(data)
- if len(data) and result_code == ERROR_SUCCESS:
- fd.write(data)
- bytes_read += len(data)
-
- if not header_read and len(data) >= fax.FILE_HEADER_SIZE:
- mg, version, total_pages, hort_dpi, vert_dpi, page_size, \
- resolution, encoding, reserved1, reserved2 = \
- struct.unpack(">8sBIHHBBBII", data[:fax.FILE_HEADER_SIZE])
-
- log.debug("Magic=%s Ver=%d Pages=%d hDPI=%d vDPI=%d Size=%d Res=%d Enc=%d" %
- (mg, version, total_pages, hort_dpi, vert_dpi, page_size, resolution, encoding))
-
- header_read = True
-
- else:
- break
-
- fd.close()
- sock.close()
- QApplication.restoreOverrideCursor()
-
- if self.waitdlg is not None:
- self.waitdlg.hide()
- self.waitdlg.close()
- self.waitdlg = None
-
- log.debug("Transfered %d bytes" % bytes_read)
-
- #self.file_list.append((fax_file, "application/hplip-fax", "HP Fax", title, total_pages))
- mime_type = job_types.get(job_id, "application/hplip-fax")
- mime_type_desc = self.MIME_TYPES_DESC.get(mime_type, ('Unknown', 'n/a'))[0]
- log.debug("%s (%s)" % (mime_type, mime_type_desc))
- self.file_list.append((fax_file, mime_type, mime_type_desc, title, total_pages))
-
- self.UpdateFileList()
- self.document_num += 1
- self.fileEdit.setText("")
- self.CheckSendButtons()
-
-
- # Event handler called during fax send thread
- # NEW: Used only for rendering coverpages
- def sendFaxEvent(self, event, title, username, job_id=0, job_size=0): # event handler during send
- self.event_queue.put((event, title, username, job_id, job_size))
- QApplication.restoreOverrideCursor()
-
- # **************************************
-
- def addFile(self, path, title, mime_type, mime_type_desc, pages):
- self.file_list.append((path, mime_type, mime_type_desc, title, pages))
-
- self.UpdateFileList()
- self.document_num += 1
- self.fileEdit.setText("")
- self.CheckSendButtons()
-
- def decode_fax_header(self, header):
- try:
- return struct.unpack(">8sBIHHBBBII", header)
- except struct.error:
- return -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-
-
- def processFile(self, path, title): # Process an arbitrary file ("Add file...")
- path = os.path.realpath(path)
-
- if os.path.exists(path):
- mime_type = magic.mime_type(path)
- log.debug(mime_type)
- mime_type_desc = mime_type
-
- log.debug(mime_type)
-
- if mime_type == 'application/hplip-fax':
- mime_type_desc = self.MIME_TYPES_DESC[mime_type][0]
-
-
- fax_file_fd = file(path, 'r')
- header = fax_file_fd.read(fax.FILE_HEADER_SIZE)
-
- mg, version, pages, hort_dpi, vert_dpi, page_size, \
- resolution, encoding, reserved1, reserved2 = self.decode_fax_header(header)
-
- if mg != 'hplip_g3':
- log.error("Invalid file header. Bad magic.")
- self.WarningUI(self.__tr("<b>Invalid HPLIP Fax file.</b><p>Bad magic!"))
- return
-
- self.addFile(path, title, mime_type, mime_type_desc, pages)
- else:
-
- try:
- mime_type_desc = self.MIME_TYPES_DESC[mime_type][0]
- except KeyError:
- self.WarningUI(self.__tr("<b>You are trying to add a file that cannot be directly faxed with this utility.</b><p>To print this file, use the print command in the application that created it."))
- return
- else:
- log.debug("Adding file: title='%s' file=%s mime_type=%s mime_desc=%s)" % (title, path, mime_type, mime_type_desc))
-
- all_pages = True
- page_range = ''
- page_set = 0
- nup = 1
-
- cups.resetOptions()
-
- if mime_type in ["application/x-cshell",
- "application/x-perl",
- "application/x-python",
- "application/x-shell",
- "text/plain",]:
-
- cups.addOption('prettyprint')
-
- if nup > 1:
- cups.addOption('number-up=%d' % nup)
-
- cups.addOption('scaling=100')
-
- self.cups_printers = cups.getPrinters()
-
- printer_state = cups.IPP_PRINTER_STATE_STOPPED
- for p in self.cups_printers:
- if p.name == self.current_printer:
- printer_state = p.state
-
- log.debug("Printer state = %d" % printer_state)
-
- if printer_state == cups.IPP_PRINTER_STATE_IDLE:
- sent_job_id = cups.printFile(self.current_printer, path, os.path.basename(path))
- job_types[sent_job_id] = mime_type # save for later
- log.debug("Job ID=%d" % sent_job_id)
-
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- self.waitdlg = WaitForm(0, self.__tr("Processing fax file..."), None, self, modal=1)
- self.waitdlg.show()
-
- else:
- self.FailureUI(self.__tr("<b>Printer '%1' is in a stopped or error state.</b><p>Check the printer queue in CUPS and try again.").arg(self.current_printer))
- cups.resetOptions()
- return
-
- cups.resetOptions()
- QApplication.restoreOverrideCursor()
-
- else:
- self.FailureUI(self.__tr("<b>Unable to add file '%1' to file list.</b><p>Check the file name and try again.".arg(path)))
-
-
- def UpdateFileList(self, j=0):
- self.fileListView.clear()
- temp = self.file_list[:]
- temp.reverse()
-
- total_pages = 0
-
- if j<0: j=0
- if j>len(temp)-1: j=len(temp)-1
-
- k, selected = len(temp)-1, False
- for path, mime_type, mime_type_desc, title, pages in temp:
-
- if pages == 0:
- str_pages = '?'
- else:
- str_pages = str(pages)
-
- i = FileListViewItem(self.fileListView, title, mime_type_desc, path, str_pages)
- total_pages += pages
-
- if k == j and not selected:
- self.fileListView.setCurrentItem(i)
- selected = True
-
- k -= 1
-
- self.fileListView.setColumnText(2, self.__tr("Pages (Total=%1)").arg(total_pages))
-
- self.delFileButton.setEnabled(self.fileListView.childCount() > 0)
- self.upFileButton.setEnabled(self.fileListView.childCount() > 1)
- self.downFileButton.setEnabled(self.fileListView.childCount() > 1)
-
-
- # ************************************** Coverpages
-
- def showCoverPageDlg(self):
- dlg = CoverpageForm(self.cover_page_name, self)
- dlg = CoverpageForm(self.cover_page_name, self)
- dlg.messageTextEdit.setText(self.cover_page_message)
- dlg.regardingTextEdit.setText(self.cover_page_re)
-
- if dlg.exec_loop() == QDialog.Accepted:
-
- self.cover_page_func, cover_page_png = dlg.data
- self.cover_page_message = str(dlg.messageTextEdit.text())
- self.cover_page_re = str(dlg.regardingTextEdit.text())
- self.cover_page_name = dlg.coverpage_name
- return True
-
- return False
-
- def addCoverpagePushButton_clicked(self):
- if self.showCoverPageDlg():
- self.file_list.insert(0, ('coverpage', "application/hplip-fax-coverpage",
- self.__tr("HP Fax Coverpage"), self.__tr("Cover Page"), 1))
-
- self.UpdateFileList()
- self.document_num += 1
- self.CheckSendButtons()
-
- self.addCoverpagePushButton.setEnabled(False)
- self.editCoverpagePushButton.setEnabled(True)
-
- def editCoverpagePushButton_clicked(self):
- self.showCoverPageDlg()
-
-
- # ************************************** Misc
-
- def closeEvent(self, event):
- if self.dev is not None and self.dev.isSendFaxActive():
- self.FailureUI(self.__tr("<b>Send fax is active.</b><p>Please wait for operation to complete."))
- else:
- event.accept()
-
-
- def settingsPushButton_clicked(self):
- try:
- self.dev.open()
-
- try:
- result_code, fax_num = self.dev.getPML(pml.OID_FAX_LOCAL_PHONE_NUM)
- except Error:
- log.error("PML failure.")
- self.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
- return
-
- fax_num = str(fax_num)
-
- try:
- result_code, name = self.dev.getPML(pml.OID_FAX_STATION_NAME)
- except Error:
- log.error("PML failure.")
- self.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
- return
-
- name = str(name)
-
- dlg = FaxSettingsForm(self.dev, fax_num, name, self)
- dlg.exec_loop()
-
- finally:
- self.dev.close()
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Send Fax"))
def SuccessUI(self):
QMessageBox.information(self,
@@ -1045,6 +196,3 @@ class FaxSendJobForm(FaxSendJobForm_base):
def __tr(self,s,c = None):
return qApp.translate("FaxSendJobForm", s, c)
-
- def __trUtf8(self,s,c = None):
- return qApp.translate("FaxSendJobForm", s, c, QApplication.UnicodeUTF8)
diff --git a/ui/faxsendjobform_base.py b/ui/faxsendjobform_base.py
deleted file mode 100644
index 6b671102b..000000000
--- a/ui/faxsendjobform_base.py
+++ /dev/null
@@ -1,463 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'faxsendjobform_base.ui'
-#
-# Created: Tue Apr 11 10:17:21 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
-#
-# WARNING! All changes made in this file will be lost!
-
-
-from qt import *
-
-
-class FaxSendJobForm_base(QDialog):
- def __init__(self,parent = None,name = None,modal = 0,fl = 0):
- QDialog.__init__(self,parent,name,modal,fl)
-
- if not name:
- self.setName("FaxSendJobForm_base")
-
-
- FaxSendJobForm_baseLayout = QGridLayout(self,1,1,11,6,"FaxSendJobForm_baseLayout")
-
- self.addressBookButton = QPushButton(self,"addressBookButton")
-
- FaxSendJobForm_baseLayout.addWidget(self.addressBookButton,1,0)
-
- self.pushButton29 = QPushButton(self,"pushButton29")
-
- FaxSendJobForm_baseLayout.addWidget(self.pushButton29,1,3)
-
- self.sendNowButton = QPushButton(self,"sendNowButton")
- self.sendNowButton.setEnabled(0)
-
- FaxSendJobForm_baseLayout.addWidget(self.sendNowButton,1,4)
-
- self.tabWidget2 = QTabWidget(self,"tabWidget2")
-
- self.tab = QWidget(self.tabWidget2,"tab")
- tabLayout = QGridLayout(self.tab,1,1,11,6,"tabLayout")
-
- self.textLabel3_2 = QLabel(self.tab,"textLabel3_2")
- self.textLabel3_2.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.textLabel3_2.sizePolicy().hasHeightForWidth()))
-
- tabLayout.addMultiCellWidget(self.textLabel3_2,0,0,0,1)
-
- self.fileListView = QListView(self.tab,"fileListView")
- self.fileListView.addColumn(self.__tr("Name/Title"))
- self.fileListView.header().setClickEnabled(0,self.fileListView.header().count() - 1)
- self.fileListView.addColumn(self.__tr("File Type"))
- self.fileListView.header().setClickEnabled(0,self.fileListView.header().count() - 1)
- self.fileListView.addColumn(self.__tr("Pages (Total=0)"))
- self.fileListView.header().setClickEnabled(0,self.fileListView.header().count() - 1)
-
- tabLayout.addMultiCellWidget(self.fileListView,3,6,0,0)
-
- self.buttonGroup3 = QButtonGroup(self.tab,"buttonGroup3")
- self.buttonGroup3.setColumnLayout(0,Qt.Vertical)
- self.buttonGroup3.layout().setSpacing(6)
- self.buttonGroup3.layout().setMargin(11)
- buttonGroup3Layout = QGridLayout(self.buttonGroup3.layout())
- buttonGroup3Layout.setAlignment(Qt.AlignTop)
-
- layout9 = QHBoxLayout(None,0,6,"layout9")
-
- self.textLabel1_2 = QLabel(self.buttonGroup3,"textLabel1_2")
- layout9.addWidget(self.textLabel1_2)
-
- self.fileEdit = QLineEdit(self.buttonGroup3,"fileEdit")
- layout9.addWidget(self.fileEdit)
-
- self.browsePushButton = QPushButton(self.buttonGroup3,"browsePushButton")
- layout9.addWidget(self.browsePushButton)
-
- buttonGroup3Layout.addMultiCellLayout(layout9,0,0,0,2)
-
- self.addFilePushButton = QPushButton(self.buttonGroup3,"addFilePushButton")
- self.addFilePushButton.setEnabled(0)
-
- buttonGroup3Layout.addWidget(self.addFilePushButton,1,2)
- spacer8 = QSpacerItem(170,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- buttonGroup3Layout.addItem(spacer8,1,1)
-
- self.allowableTypesPushButton = QPushButton(self.buttonGroup3,"allowableTypesPushButton")
-
- buttonGroup3Layout.addWidget(self.allowableTypesPushButton,1,0)
-
- tabLayout.addWidget(self.buttonGroup3,7,0)
-
- self.groupBox1 = QGroupBox(self.tab,"groupBox1")
- self.groupBox1.setColumnLayout(0,Qt.Vertical)
- self.groupBox1.layout().setSpacing(6)
- self.groupBox1.layout().setMargin(11)
- groupBox1Layout = QGridLayout(self.groupBox1.layout())
- groupBox1Layout.setAlignment(Qt.AlignTop)
-
- self.addCoverpagePushButton = QPushButton(self.groupBox1,"addCoverpagePushButton")
-
- groupBox1Layout.addWidget(self.addCoverpagePushButton,0,2)
-
- self.editCoverpagePushButton = QPushButton(self.groupBox1,"editCoverpagePushButton")
- self.editCoverpagePushButton.setEnabled(0)
-
- groupBox1Layout.addWidget(self.editCoverpagePushButton,0,1)
- spacer6 = QSpacerItem(190,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox1Layout.addItem(spacer6,0,0)
-
- tabLayout.addWidget(self.groupBox1,8,0)
-
- self.line1_2 = QFrame(self.tab,"line1_2")
- self.line1_2.setFrameShape(QFrame.HLine)
- self.line1_2.setFrameShadow(QFrame.Sunken)
- self.line1_2.setFrameShape(QFrame.HLine)
-
- tabLayout.addMultiCellWidget(self.line1_2,1,2,0,1)
-
- self.delFileButton = QToolButton(self.tab,"delFileButton")
- self.delFileButton.setEnabled(0)
- self.delFileButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.delFileButton.sizePolicy().hasHeightForWidth()))
- self.delFileButton.setMinimumSize(QSize(32,32))
- self.delFileButton.setMaximumSize(QSize(32,32))
-
- tabLayout.addMultiCellWidget(self.delFileButton,2,3,1,1)
-
- self.upFileButton = QToolButton(self.tab,"upFileButton")
- self.upFileButton.setEnabled(0)
- self.upFileButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.upFileButton.sizePolicy().hasHeightForWidth()))
- self.upFileButton.setMinimumSize(QSize(32,32))
- self.upFileButton.setMaximumSize(QSize(32,32))
-
- tabLayout.addWidget(self.upFileButton,4,1)
-
- self.downFileButton = QToolButton(self.tab,"downFileButton")
- self.downFileButton.setEnabled(0)
- self.downFileButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.downFileButton.sizePolicy().hasHeightForWidth()))
- self.downFileButton.setMinimumSize(QSize(32,32))
- self.downFileButton.setMaximumSize(QSize(32,32))
-
- tabLayout.addWidget(self.downFileButton,5,1)
- spacer7 = QSpacerItem(20,300,QSizePolicy.Minimum,QSizePolicy.Expanding)
- tabLayout.addMultiCell(spacer7,6,9,1,1)
-
- self.groupBox5 = QGroupBox(self.tab,"groupBox5")
- self.groupBox5.setColumnLayout(0,Qt.Vertical)
- self.groupBox5.layout().setSpacing(6)
- self.groupBox5.layout().setMargin(11)
- groupBox5Layout = QGridLayout(self.groupBox5.layout())
- groupBox5Layout.setAlignment(Qt.AlignTop)
-
- self.appPrintNoteLabel = QLabel(self.groupBox5,"appPrintNoteLabel")
-
- groupBox5Layout.addWidget(self.appPrintNoteLabel,0,0)
-
- tabLayout.addWidget(self.groupBox5,9,0)
- spacer7_2 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding)
- tabLayout.addItem(spacer7_2,10,0)
- self.tabWidget2.insertTab(self.tab,QString.fromLatin1(""))
-
- self.tab_2 = QWidget(self.tabWidget2,"tab_2")
- tabLayout_2 = QGridLayout(self.tab_2,1,1,11,6,"tabLayout_2")
-
- self.textLabel3 = QLabel(self.tab_2,"textLabel3")
-
- tabLayout_2.addMultiCellWidget(self.textLabel3,0,0,0,1)
-
- self.line1 = QFrame(self.tab_2,"line1")
- self.line1.setFrameShape(QFrame.HLine)
- self.line1.setFrameShadow(QFrame.Sunken)
- self.line1.setFrameShape(QFrame.HLine)
-
- tabLayout_2.addMultiCellWidget(self.line1,1,1,0,1)
-
- self.textLabel1 = QLabel(self.tab_2,"textLabel1")
-
- tabLayout_2.addMultiCellWidget(self.textLabel1,2,2,0,1)
-
- self.individualSendListView = QListView(self.tab_2,"individualSendListView")
- self.individualSendListView.addColumn(self.__tr("Select"))
- self.individualSendListView.addColumn(self.__tr("Name"))
- self.individualSendListView.addColumn(self.__tr("Fax Number"))
- self.individualSendListView.addColumn(self.__tr("Notes/Other Information"))
- self.individualSendListView.setSelectionMode(QListView.NoSelection)
-
- tabLayout_2.addMultiCellWidget(self.individualSendListView,3,3,0,1)
-
- self.textLabel2 = QLabel(self.tab_2,"textLabel2")
-
- tabLayout_2.addMultiCellWidget(self.textLabel2,4,4,0,1)
-
- self.groupSendListView = QListView(self.tab_2,"groupSendListView")
- self.groupSendListView.addColumn(self.__tr("Select"))
- self.groupSendListView.addColumn(self.__tr("Group"))
- self.groupSendListView.addColumn(self.__tr("Group Members"))
- self.groupSendListView.setEnabled(1)
- self.groupSendListView.setSelectionMode(QListView.NoSelection)
-
- tabLayout_2.addMultiCellWidget(self.groupSendListView,5,5,0,1)
-
- self.textLabel5 = QLabel(self.tab_2,"textLabel5")
-
- tabLayout_2.addWidget(self.textLabel5,6,0)
-
- self.selectionEdit = QLineEdit(self.tab_2,"selectionEdit")
- self.selectionEdit.setReadOnly(1)
-
- tabLayout_2.addWidget(self.selectionEdit,6,1)
- self.tabWidget2.insertTab(self.tab_2,QString.fromLatin1(""))
-
- self.TabPage = QWidget(self.tabWidget2,"TabPage")
- TabPageLayout = QGridLayout(self.TabPage,1,1,11,6,"TabPageLayout")
- spacer11 = QSpacerItem(20,200,QSizePolicy.Minimum,QSizePolicy.Expanding)
- TabPageLayout.addItem(spacer11,9,0)
-
- layout7 = QHBoxLayout(None,0,6,"layout7")
-
- self.textLabel7_2 = QLabel(self.TabPage,"textLabel7_2")
- layout7.addWidget(self.textLabel7_2)
-
- layout6 = QHBoxLayout(None,0,6,"layout6")
-
- self.StateText = QLabel(self.TabPage,"StateText")
- self.StateText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.StateText.sizePolicy().hasHeightForWidth()))
- layout6.addWidget(self.StateText)
-
- self.refreshToolButton = QToolButton(self.TabPage,"refreshToolButton")
- self.refreshToolButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.refreshToolButton.sizePolicy().hasHeightForWidth()))
- self.refreshToolButton.setMinimumSize(QSize(32,32))
- self.refreshToolButton.setMaximumSize(QSize(32,32))
- layout6.addWidget(self.refreshToolButton)
- layout7.addLayout(layout6)
-
- TabPageLayout.addLayout(layout7,8,0)
-
- layout9_2 = QHBoxLayout(None,0,6,"layout9_2")
-
- self.textLabel9 = QLabel(self.TabPage,"textLabel9")
- layout9_2.addWidget(self.textLabel9)
-
- self.LocationText = QLabel(self.TabPage,"LocationText")
- self.LocationText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.LocationText.sizePolicy().hasHeightForWidth()))
- layout9_2.addWidget(self.LocationText)
-
- TabPageLayout.addLayout(layout9_2,5,0)
-
- self.line12 = QFrame(self.TabPage,"line12")
- self.line12.setFrameShape(QFrame.HLine)
- self.line12.setFrameShadow(QFrame.Sunken)
- self.line12.setFrameShape(QFrame.HLine)
-
- TabPageLayout.addWidget(self.line12,7,0)
-
- layout5 = QHBoxLayout(None,0,6,"layout5")
-
- self.textLabel6 = QLabel(self.TabPage,"textLabel6")
- layout5.addWidget(self.textLabel6)
-
- self.printerNameComboBox = QComboBox(0,self.TabPage,"printerNameComboBox")
- self.printerNameComboBox.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Fixed,0,0,self.printerNameComboBox.sizePolicy().hasHeightForWidth()))
- layout5.addWidget(self.printerNameComboBox)
-
- TabPageLayout.addLayout(layout5,2,0)
-
- self.line11 = QFrame(self.TabPage,"line11")
- self.line11.setFrameShape(QFrame.HLine)
- self.line11.setFrameShadow(QFrame.Sunken)
- self.line11.setFrameShape(QFrame.HLine)
-
- TabPageLayout.addWidget(self.line11,3,0)
-
- layout10 = QHBoxLayout(None,0,6,"layout10")
-
- self.textLabel7 = QLabel(self.TabPage,"textLabel7")
- layout10.addWidget(self.textLabel7)
-
- self.DeviceURIText = QLabel(self.TabPage,"DeviceURIText")
- self.DeviceURIText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.DeviceURIText.sizePolicy().hasHeightForWidth()))
- layout10.addWidget(self.DeviceURIText)
-
- TabPageLayout.addLayout(layout10,4,0)
-
- layout8 = QHBoxLayout(None,0,6,"layout8")
-
- self.textLabel10 = QLabel(self.TabPage,"textLabel10")
- layout8.addWidget(self.textLabel10)
-
- self.CommentText = QLabel(self.TabPage,"CommentText")
- self.CommentText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.CommentText.sizePolicy().hasHeightForWidth()))
- layout8.addWidget(self.CommentText)
-
- TabPageLayout.addLayout(layout8,6,0)
-
- self.line1_2_2_2 = QFrame(self.TabPage,"line1_2_2_2")
- self.line1_2_2_2.setFrameShape(QFrame.HLine)
- self.line1_2_2_2.setFrameShadow(QFrame.Sunken)
- self.line1_2_2_2.setFrameShape(QFrame.HLine)
-
- TabPageLayout.addWidget(self.line1_2_2_2,1,0)
-
- self.textLabel3_2_2_2 = QLabel(self.TabPage,"textLabel3_2_2_2")
-
- TabPageLayout.addWidget(self.textLabel3_2_2_2,0,0)
- self.tabWidget2.insertTab(self.TabPage,QString.fromLatin1(""))
-
- FaxSendJobForm_baseLayout.addMultiCellWidget(self.tabWidget2,0,0,0,4)
- spacer30 = QSpacerItem(70,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- FaxSendJobForm_baseLayout.addItem(spacer30,1,2)
-
- self.settingsPushButton = QPushButton(self,"settingsPushButton")
-
- FaxSendJobForm_baseLayout.addWidget(self.settingsPushButton,1,1)
-
- self.languageChange()
-
- self.resize(QSize(546,541).expandedTo(self.minimumSizeHint()))
- self.clearWState(Qt.WState_Polished)
-
- self.connect(self.pushButton29,SIGNAL("clicked()"),self.reject)
- self.connect(self.individualSendListView,SIGNAL("clicked(QListViewItem*)"),self.individualSendListView_clicked)
- self.connect(self.groupSendListView,SIGNAL("clicked(QListViewItem*)"),self.groupSendListView_clicked)
- self.connect(self.addressBookButton,SIGNAL("clicked()"),self.addressBookButton_clicked)
- self.connect(self.sendNowButton,SIGNAL("clicked()"),self.sendNowButton_clicked)
- self.connect(self.delFileButton,SIGNAL("clicked()"),self.delFileButton_clicked)
- self.connect(self.addFilePushButton,SIGNAL("clicked()"),self.addFilePushButton_clicked)
- self.connect(self.browsePushButton,SIGNAL("clicked()"),self.browsePushButton_clicked)
- self.connect(self.upFileButton,SIGNAL("clicked()"),self.upFileButton_clicked)
- self.connect(self.downFileButton,SIGNAL("clicked()"),self.downFileButton_clicked)
- self.connect(self.fileEdit,SIGNAL("textChanged(const QString&)"),self.fileEdit_textChanged)
- self.connect(self.addCoverpagePushButton,SIGNAL("clicked()"),self.addCoverpagePushButton_clicked)
- self.connect(self.refreshToolButton,SIGNAL("clicked()"),self.refreshToolButton_clicked)
- self.connect(self.printerNameComboBox,SIGNAL("highlighted(const QString&)"),self.printerNameComboBox_highlighted)
- self.connect(self.editCoverpagePushButton,SIGNAL("clicked()"),self.editCoverpagePushButton_clicked)
- self.connect(self.settingsPushButton,SIGNAL("clicked()"),self.settingsPushButton_clicked)
- self.connect(self.allowableTypesPushButton,SIGNAL("clicked()"),self.allowableTypesPushButton_clicked)
-
- self.setTabOrder(self.fileListView,self.fileEdit)
- self.setTabOrder(self.fileEdit,self.browsePushButton)
- self.setTabOrder(self.browsePushButton,self.addFilePushButton)
- self.setTabOrder(self.addFilePushButton,self.editCoverpagePushButton)
- self.setTabOrder(self.editCoverpagePushButton,self.addCoverpagePushButton)
- self.setTabOrder(self.addCoverpagePushButton,self.addressBookButton)
- self.setTabOrder(self.addressBookButton,self.settingsPushButton)
- self.setTabOrder(self.settingsPushButton,self.pushButton29)
- self.setTabOrder(self.pushButton29,self.sendNowButton)
- self.setTabOrder(self.sendNowButton,self.tabWidget2)
- self.setTabOrder(self.tabWidget2,self.individualSendListView)
- self.setTabOrder(self.individualSendListView,self.groupSendListView)
- self.setTabOrder(self.groupSendListView,self.selectionEdit)
- self.setTabOrder(self.selectionEdit,self.printerNameComboBox)
-
-
- def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Send Fax"))
- self.addressBookButton.setText(self.__tr("Address Book..."))
- self.pushButton29.setText(self.__tr("Close"))
- self.sendNowButton.setText(self.__tr("Send Fax"))
- self.textLabel3_2.setText(self.__tr("<b>Add items to the list to send as a fax.</b>"))
- self.fileListView.header().setLabel(0,self.__tr("Name/Title"))
- self.fileListView.header().setLabel(1,self.__tr("File Type"))
- self.fileListView.header().setLabel(2,self.__tr("Pages (Total=0)"))
- self.buttonGroup3.setTitle(self.__tr("File"))
- self.textLabel1_2.setText(self.__tr("File:"))
- self.browsePushButton.setText(self.__tr("Browse..."))
- self.addFilePushButton.setText(self.__tr("Add to List"))
- self.allowableTypesPushButton.setText(self.__tr("Show Types..."))
- self.groupBox1.setTitle(self.__tr("Coverpage"))
- self.addCoverpagePushButton.setText(self.__tr("Add to List..."))
- self.editCoverpagePushButton.setText(self.__tr("Edit..."))
- self.delFileButton.setText(QString.null)
- self.delFileButton.setTextLabel(self.__tr("Remove file from list"))
- self.upFileButton.setText(QString.null)
- self.upFileButton.setTextLabel(self.__tr("Move file up in list"))
- self.downFileButton.setText(QString.null)
- self.downFileButton.setTextLabel(self.__tr("Move file down in list"))
- self.groupBox5.setTitle(self.__tr("Application Document"))
- self.appPrintNoteLabel.setText(self.__tr("<i>You can also add items by printing documents from an application using the CUPS printer '%1'.</i>"))
- self.tabWidget2.changeTab(self.tab,self.__tr("Items"))
- self.textLabel3.setText(self.__tr("<b>Select the individuals and/or groups as fax recipients.</b>"))
- self.textLabel1.setText(self.__tr("Individual(s):"))
- self.individualSendListView.header().setLabel(0,self.__tr("Select"))
- self.individualSendListView.header().setLabel(1,self.__tr("Name"))
- self.individualSendListView.header().setLabel(2,self.__tr("Fax Number"))
- self.individualSendListView.header().setLabel(3,self.__tr("Notes/Other Information"))
- self.textLabel2.setText(self.__tr("Group(s):"))
- self.groupSendListView.header().setLabel(0,self.__tr("Select"))
- self.groupSendListView.header().setLabel(1,self.__tr("Group"))
- self.groupSendListView.header().setLabel(2,self.__tr("Group Members"))
- self.textLabel5.setText(self.__tr("Selection:"))
- self.tabWidget2.changeTab(self.tab_2,self.__tr("Recipients"))
- self.textLabel7_2.setText(self.__tr("Status:"))
- self.StateText.setText(QString.null)
- self.refreshToolButton.setText(QString.null)
- QToolTip.add(self.refreshToolButton,self.__tr("Refresh status"))
- self.textLabel9.setText(self.__tr("Location:"))
- self.LocationText.setText(QString.null)
- self.textLabel6.setText(self.__tr("Name:"))
- self.textLabel7.setText(self.__tr("Device URI:"))
- self.DeviceURIText.setText(QString.null)
- self.textLabel10.setText(self.__tr("Comment:"))
- self.CommentText.setText(QString.null)
- self.textLabel3_2_2_2.setText(self.__tr("<b>Device information and status.</b>"))
- self.tabWidget2.changeTab(self.TabPage,self.__tr("Device"))
- self.settingsPushButton.setText(self.__tr("Settings..."))
-
-
- def individualSendListView_clicked(self,a0):
- print "FaxSendJobForm_base.individualSendListView_clicked(QListViewItem*): Not implemented yet"
-
- def groupSendListView_clicked(self,a0):
- print "FaxSendJobForm_base.groupSendListView_clicked(QListViewItem*): Not implemented yet"
-
- def addressBookButton_clicked(self):
- print "FaxSendJobForm_base.addressBookButton_clicked(): Not implemented yet"
-
- def sendLaterButton_clicked(self):
- print "FaxSendJobForm_base.sendLaterButton_clicked(): Not implemented yet"
-
- def sendNowButton_clicked(self):
- print "FaxSendJobForm_base.sendNowButton_clicked(): Not implemented yet"
-
- def addFileButton_clicked(self):
- print "FaxSendJobForm_base.addFileButton_clicked(): Not implemented yet"
-
- def delFileButton_clicked(self):
- print "FaxSendJobForm_base.delFileButton_clicked(): Not implemented yet"
-
- def addFilePushButton_clicked(self):
- print "FaxSendJobForm_base.addFilePushButton_clicked(): Not implemented yet"
-
- def browsePushButton_clicked(self):
- print "FaxSendJobForm_base.browsePushButton_clicked(): Not implemented yet"
-
- def upFileButton_clicked(self):
- print "FaxSendJobForm_base.upFileButton_clicked(): Not implemented yet"
-
- def downFileButton_clicked(self):
- print "FaxSendJobForm_base.downFileButton_clicked(): Not implemented yet"
-
- def fileEdit_textChanged(self,a0):
- print "FaxSendJobForm_base.fileEdit_textChanged(const QString&): Not implemented yet"
-
- def titleEdit_textChanged(self,a0):
- print "FaxSendJobForm_base.titleEdit_textChanged(const QString&): Not implemented yet"
-
- def addCoverpagePushButton_clicked(self):
- print "FaxSendJobForm_base.addCoverpagePushButton_clicked(): Not implemented yet"
-
- def refreshToolButton_clicked(self):
- print "FaxSendJobForm_base.refreshToolButton_clicked(): Not implemented yet"
-
- def printerNameComboBox_highlighted(self,a0):
- print "FaxSendJobForm_base.printerNameComboBox_highlighted(const QString&): Not implemented yet"
-
- def editCoverpagePushButton_clicked(self):
- print "FaxSendJobForm_base.editCoverpagePushButton_clicked(): Not implemented yet"
-
- def settingsPushButton_clicked(self):
- print "FaxSendJobForm_base.settingsPushButton_clicked(): Not implemented yet"
-
- def allowableTypesPushButton_clicked(self):
- print "FaxSendJobForm_base.allowableTypesPushButton_clicked(): Not implemented yet"
-
- def __tr(self,s,c = None):
- return qApp.translate("FaxSendJobForm_base",s,c)
diff --git a/ui/faxsendjobform_base.ui b/ui/faxsendjobform_base.ui
deleted file mode 100644
index 7a81fa666..000000000
--- a/ui/faxsendjobform_base.ui
+++ /dev/null
@@ -1,1045 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>FaxSendJobForm_base</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>FaxSendJobForm_base</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>546</width>
- <height>541</height>
- </rect>
- </property>
- <property name="caption">
- <string>HP Device Manager - Send Fax</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton" row="1" column="0">
- <property name="name">
- <cstring>addressBookButton</cstring>
- </property>
- <property name="text">
- <string>Address Book...</string>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="3">
- <property name="name">
- <cstring>pushButton29</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="4">
- <property name="name">
- <cstring>sendNowButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Send Fax</string>
- </property>
- </widget>
- <widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="5">
- <property name="name">
- <cstring>tabWidget2</cstring>
- </property>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Items</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel3_2</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&lt;b&gt;Add items to the list to send as a fax.&lt;/b&gt;</string>
- </property>
- </widget>
- <widget class="QListView" row="3" column="0" rowspan="4" colspan="1">
- <column>
- <property name="text">
- <string>Name/Title</string>
- </property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>File Type</string>
- </property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Pages (Total=0)</string>
- </property>
- <property name="clickable">
- <bool>false</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>fileListView</cstring>
- </property>
- </widget>
- <widget class="QButtonGroup" row="7" column="0">
- <property name="name">
- <cstring>buttonGroup3</cstring>
- </property>
- <property name="title">
- <string>File</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>layout9</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel1_2</cstring>
- </property>
- <property name="text">
- <string>File:</string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>fileEdit</cstring>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>browsePushButton</cstring>
- </property>
- <property name="text">
- <string>Browse...</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QPushButton" row="1" column="2">
- <property name="name">
- <cstring>addFilePushButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Add to List</string>
- </property>
- </widget>
- <spacer row="1" column="1">
- <property name="name">
- <cstring>spacer8</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>170</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="1" column="0">
- <property name="name">
- <cstring>allowableTypesPushButton</cstring>
- </property>
- <property name="text">
- <string>Show Types...</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="8" column="0">
- <property name="name">
- <cstring>groupBox1</cstring>
- </property>
- <property name="title">
- <string>Coverpage</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton" row="0" column="2">
- <property name="name">
- <cstring>addCoverpagePushButton</cstring>
- </property>
- <property name="text">
- <string>Add to List...</string>
- </property>
- </widget>
- <widget class="QPushButton" row="0" column="1">
- <property name="name">
- <cstring>editCoverpagePushButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Edit...</string>
- </property>
- </widget>
- <spacer row="0" column="0">
- <property name="name">
- <cstring>spacer6</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>190</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- <widget class="Line" row="1" column="0" rowspan="2" colspan="2">
- <property name="name">
- <cstring>line1_2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QToolButton" row="2" column="1" rowspan="2" colspan="1">
- <property name="name">
- <cstring>delFileButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="textLabel">
- <string>Remove file from list</string>
- </property>
- </widget>
- <widget class="QToolButton" row="4" column="1">
- <property name="name">
- <cstring>upFileButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="textLabel">
- <string>Move file up in list</string>
- </property>
- </widget>
- <widget class="QToolButton" row="5" column="1">
- <property name="name">
- <cstring>downFileButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="textLabel">
- <string>Move file down in list</string>
- </property>
- </widget>
- <spacer row="6" column="1" rowspan="4" colspan="1">
- <property name="name">
- <cstring>spacer7</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>300</height>
- </size>
- </property>
- </spacer>
- <widget class="QGroupBox" row="9" column="0">
- <property name="name">
- <cstring>groupBox5</cstring>
- </property>
- <property name="title">
- <string>Application Document</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>appPrintNoteLabel</cstring>
- </property>
- <property name="text">
- <string>&lt;i&gt;You can also add items by printing documents from an application using the CUPS printer '%1'.&lt;/i&gt;</string>
- </property>
- </widget>
- </grid>
- </widget>
- <spacer row="10" column="0">
- <property name="name">
- <cstring>spacer7_2</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Recipients</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>&lt;b&gt;Select the individuals and/or groups as fax recipients.&lt;/b&gt;</string>
- </property>
- </widget>
- <widget class="Line" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>line1</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Individual(s):</string>
- </property>
- </widget>
- <widget class="QListView" row="3" column="0" rowspan="1" colspan="2">
- <column>
- <property name="text">
- <string>Select</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Fax Number</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Notes/Other Information</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>individualSendListView</cstring>
- </property>
- <property name="selectionMode">
- <enum>NoSelection</enum>
- </property>
- </widget>
- <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Group(s):</string>
- </property>
- </widget>
- <widget class="QListView" row="5" column="0" rowspan="1" colspan="2">
- <column>
- <property name="text">
- <string>Select</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Group</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Group Members</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>groupSendListView</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="selectionMode">
- <enum>NoSelection</enum>
- </property>
- </widget>
- <widget class="QLabel" row="6" column="0">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>Selection:</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="6" column="1">
- <property name="name">
- <cstring>selectionEdit</cstring>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>TabPage</cstring>
- </property>
- <attribute name="title">
- <string>Device</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer row="9" column="0">
- <property name="name">
- <cstring>spacer11</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>200</height>
- </size>
- </property>
- </spacer>
- <widget class="QLayoutWidget" row="8" column="0">
- <property name="name">
- <cstring>layout7</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel7_2</cstring>
- </property>
- <property name="text">
- <string>Status:</string>
- </property>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout6</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>StateText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QToolButton">
- <property name="name">
- <cstring>refreshToolButton</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="toolTip" stdset="0">
- <string>Refresh status</string>
- </property>
- </widget>
- </hbox>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="5" column="0">
- <property name="name">
- <cstring>layout9</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel9</cstring>
- </property>
- <property name="text">
- <string>Location:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>LocationText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="Line" row="7" column="0">
- <property name="name">
- <cstring>line12</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="2" column="0">
- <property name="name">
- <cstring>layout5</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel6</cstring>
- </property>
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- <widget class="QComboBox">
- <property name="name">
- <cstring>printerNameComboBox</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="Line" row="3" column="0">
- <property name="name">
- <cstring>line11</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="4" column="0">
- <property name="name">
- <cstring>layout10</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel7</cstring>
- </property>
- <property name="text">
- <string>Device URI:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>DeviceURIText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="6" column="0">
- <property name="name">
- <cstring>layout8</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel10</cstring>
- </property>
- <property name="text">
- <string>Comment:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>CommentText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="Line" row="1" column="0">
- <property name="name">
- <cstring>line1_2_2_2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel3_2_2_2</cstring>
- </property>
- <property name="text">
- <string>&lt;b&gt;Device information and status.&lt;/b&gt;</string>
- </property>
- </widget>
- </grid>
- </widget>
- </widget>
- <spacer row="1" column="2">
- <property name="name">
- <cstring>spacer30</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>70</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>settingsPushButton</cstring>
- </property>
- <property name="text">
- <string>Settings...</string>
- </property>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>pushButton29</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>individualSendListView</sender>
- <signal>clicked(QListViewItem*)</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>individualSendListView_clicked(QListViewItem*)</slot>
- </connection>
- <connection>
- <sender>groupSendListView</sender>
- <signal>clicked(QListViewItem*)</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>groupSendListView_clicked(QListViewItem*)</slot>
- </connection>
- <connection>
- <sender>addressBookButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>addressBookButton_clicked()</slot>
- </connection>
- <connection>
- <sender>sendNowButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>sendNowButton_clicked()</slot>
- </connection>
- <connection>
- <sender>delFileButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>delFileButton_clicked()</slot>
- </connection>
- <connection>
- <sender>addFilePushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>addFilePushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>browsePushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>browsePushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>upFileButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>upFileButton_clicked()</slot>
- </connection>
- <connection>
- <sender>downFileButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>downFileButton_clicked()</slot>
- </connection>
- <connection>
- <sender>fileEdit</sender>
- <signal>textChanged(const QString&amp;)</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>fileEdit_textChanged(const QString&amp;)</slot>
- </connection>
- <connection>
- <sender>addCoverpagePushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>addCoverpagePushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>refreshToolButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>refreshToolButton_clicked()</slot>
- </connection>
- <connection>
- <sender>printerNameComboBox</sender>
- <signal>highlighted(const QString&amp;)</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>printerNameComboBox_highlighted(const QString&amp;)</slot>
- </connection>
- <connection>
- <sender>editCoverpagePushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>editCoverpagePushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>settingsPushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>settingsPushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>allowableTypesPushButton</sender>
- <signal>clicked()</signal>
- <receiver>FaxSendJobForm_base</receiver>
- <slot>allowableTypesPushButton_clicked()</slot>
- </connection>
-</connections>
-<tabstops>
- <tabstop>fileListView</tabstop>
- <tabstop>fileEdit</tabstop>
- <tabstop>browsePushButton</tabstop>
- <tabstop>addFilePushButton</tabstop>
- <tabstop>editCoverpagePushButton</tabstop>
- <tabstop>addCoverpagePushButton</tabstop>
- <tabstop>addressBookButton</tabstop>
- <tabstop>settingsPushButton</tabstop>
- <tabstop>pushButton29</tabstop>
- <tabstop>sendNowButton</tabstop>
- <tabstop>tabWidget2</tabstop>
- <tabstop>individualSendListView</tabstop>
- <tabstop>groupSendListView</tabstop>
- <tabstop>selectionEdit</tabstop>
- <tabstop>printerNameComboBox</tabstop>
-</tabstops>
-<includes>
- <include location="local" impldecl="in implementation">faxsendjobform_base.ui.h</include>
-</includes>
-<slots>
- <slot>individualSendListView_clicked( QListViewItem * )</slot>
- <slot>groupSendListView_clicked( QListViewItem * )</slot>
- <slot>addressBookButton_clicked()</slot>
- <slot>sendLaterButton_clicked()</slot>
- <slot>sendNowButton_clicked()</slot>
- <slot>addFileButton_clicked()</slot>
- <slot>delFileButton_clicked()</slot>
- <slot>addFilePushButton_clicked()</slot>
- <slot>browsePushButton_clicked()</slot>
- <slot>upFileButton_clicked()</slot>
- <slot>downFileButton_clicked()</slot>
- <slot>fileEdit_textChanged( const QString &amp; )</slot>
- <slot>titleEdit_textChanged( const QString &amp; )</slot>
- <slot>addCoverpagePushButton_clicked()</slot>
- <slot>refreshToolButton_clicked()</slot>
- <slot>printerNameComboBox_highlighted( const QString &amp; )</slot>
- <slot>editCoverpagePushButton_clicked()</slot>
- <slot>settingsPushButton_clicked()</slot>
- <slot>allowableTypesPushButton_clicked()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/ui/faxsettingsform.py b/ui/faxsettingsform.py
index 9011fd381..2f7001ec2 100644
--- a/ui/faxsettingsform.py
+++ b/ui/faxsettingsform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2006 Hewlett-Packard Development Company, L.P.
+# (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
@@ -31,7 +31,12 @@ class PhoneNumValidator(QValidator):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
+ input = unicode(input)
+ try:
+ input = input.encode('ascii')
+ except UnicodeEncodeError:
+ return QValidator.Invalid, pos
+
if not input:
return QValidator.Acceptable, pos
elif input[pos-1] not in '0123456789-(+) ':
@@ -40,14 +45,20 @@ class PhoneNumValidator(QValidator):
return QValidator.Invalid, pos
else:
return QValidator.Acceptable, pos
-
-
+
+
class StationNameValidator(QValidator):
def __init__(self, parent=None, name=None):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
+ input = unicode(input)
+
+ try:
+ input = input.encode('ascii')
+ except UnicodeEncodeError:
+ return QValidator.Invalid, pos
+
if not input:
return QValidator.Acceptable, pos
# TODO: Find valid chars for this field
@@ -57,62 +68,52 @@ class StationNameValidator(QValidator):
return QValidator.Invalid, pos
else:
return QValidator.Acceptable, pos
-
-
+
+
class FaxSettingsForm(FaxSettingsForm_base):
def __init__(self, dev, fax_num, name_co, parent = None,name = None,modal = 0,fl = 0):
FaxSettingsForm_base.__init__(self,parent,name,modal,fl)
self.dev = dev
-
self.faxEdit.setValidator(PhoneNumValidator(self.faxEdit))
self.nameEdit.setValidator(StationNameValidator(self.nameEdit))
self.voiceEdit.setValidator(PhoneNumValidator(self.voiceEdit))
-
-## try:
-## result_code, fax_num = dev.getPML(pml.OID_FAX_LOCAL_PHONE_NUM)
-## except Error:
-## log.error("PML failure.")
-## else:
-## fax_num = str(fax_num)
self.faxEdit.setText(fax_num)
-##
-## try:
-## result_code, name = dev.getPML(pml.OID_FAX_STATION_NAME)
-## except Error:
-## log.error("PML failure.")
-## name = str(name)
self.nameEdit.setText(name_co)
-
self.setOKButton(fax_num and name_co)
-
self.voiceEdit.setText(user_cfg.fax.voice_phone or '')
self.emailEdit.setText(user_cfg.fax.email_address or user_cfg.alerts.email_address or '')
-
+
def faxEdit_textChanged(self,a0):
self.setOKButton()
-
+
def nameEdit_textChanged(self,a0):
self.setOKButton()
-
+
def setOKButton(self, toggle=None):
if toggle is not None:
self.pushButtonOK.setEnabled(bool(toggle))
else:
- name = str(self.nameEdit.text())
- fax_num = str(self.faxEdit.text())
+ name = unicode(self.nameEdit.text())
+ fax_num = unicode(self.faxEdit.text())
self.pushButtonOK.setEnabled(bool(name and fax_num))
-
-
+
def accept(self):
+ # str() is OK here since the validators removed any non-ascii chars
+ fax = str(self.faxEdit.text())
+ log.debug(fax)
+ name = str(self.nameEdit.text())
+ log.debug(name)
try:
- self.dev.setPML(pml.OID_FAX_LOCAL_PHONE_NUM, str(self.faxEdit.text()))
- self.dev.setPML(pml.OID_FAX_STATION_NAME, str(self.nameEdit.text()))
+ self.dev.setPML(pml.OID_FAX_LOCAL_PHONE_NUM, fax)
+ self.dev.setPML(pml.OID_FAX_STATION_NAME, name)
except Error:
log.error("Error setting fax settings to device.")
-
- user_cfg.fax.voice_phone = str(self.voiceEdit.text())
- user_cfg.fax.email_address = str(self.emailEdit.text())
+
+ # TODO: This is a problem - user can enter non-ascii chars...
+ # user config needs to be in utf-8 encoding (but its not right now)
+ user_cfg.fax.voice_phone = unicode(self.voiceEdit.text()).encode('ascii')
+ user_cfg.fax.email_address = unicode(self.emailEdit.text()).encode('ascii')
FaxSettingsForm_base.accept(self)
-
+
diff --git a/ui/imagepropertiesdlg.py b/ui/imagepropertiesdlg.py
index 7715e6dbf..536fc5689 100644
--- a/ui/imagepropertiesdlg.py
+++ b/ui/imagepropertiesdlg.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -21,7 +21,6 @@
import sys
from qt import *
-#from string import printable
from imagepropertiesdlg_base import ImagePropertiesDlg_base
class ImagePropertiesDlg(ImagePropertiesDlg_base):
@@ -37,6 +36,7 @@ class ImagePropertiesDlg(ImagePropertiesDlg_base):
for k in exif_info:
kk = k.lower()
if kk != "jpegthumbnail":
+ print repr(k), repr(exif_info[k])
QListViewItem(self.EXifDataListView, k, str(exif_info[k]))
diff --git a/ui/informationform.py b/ui/informationform.py
deleted file mode 100644
index a7e15b7bb..000000000
--- a/ui/informationform.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from qt import *
-from informationform_base import InformationForm_base
-
-
-class InformationForm(InformationForm_base):
-
- def __init__(self, dev, parent = None,name = None,modal = 0,fl = 0):
- InformationForm_base.__init__(self,parent,name,modal,fl)
-
- dq_keys = dev.dq.keys()
- dq_keys.sort()
- dq_keys.reverse()
- for key,i in zip(dq_keys, range(len(dq_keys))):
- QListViewItem(self.listView1, key, str(dev.dq[key]))
-
- mq_keys = dev.mq.keys()
- mq_keys.sort()
- mq_keys.reverse()
- for key,i in zip(mq_keys, range(len(mq_keys))):
- QListViewItem(self.listView1, key, str(dev.mq[key]))
-
diff --git a/ui/informationform_base.py b/ui/informationform_base.py
deleted file mode 100644
index 0734cf280..000000000
--- a/ui/informationform_base.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file '/home/dwelch/linux-imaging-and-printing/src/ui/informationform_base.ui'
-#
-# Created: Tue Aug 30 13:48:23 2005
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
-#
-# WARNING! All changes made in this file will be lost!
-
-
-import sys
-from qt import *
-
-
-class InformationForm_base(QDialog):
- def __init__(self,parent = None,name = None,modal = 0,fl = 0):
- QDialog.__init__(self,parent,name,modal,fl)
-
- if not name:
- self.setName("InformationForm_base")
-
-
- InformationForm_baseLayout = QGridLayout(self,1,1,11,6,"InformationForm_baseLayout")
-
- self.listView1 = QListView(self,"listView1")
- self.listView1.addColumn(self.__tr("Key"))
- self.listView1.addColumn(self.__tr("Value"))
-
- InformationForm_baseLayout.addMultiCellWidget(self.listView1,0,0,0,1)
-
- self.pushButton3 = QPushButton(self,"pushButton3")
-
- InformationForm_baseLayout.addWidget(self.pushButton3,1,1)
- spacer20 = QSpacerItem(471,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- InformationForm_baseLayout.addItem(spacer20,1,0)
-
- self.languageChange()
-
- self.resize(QSize(600,480).expandedTo(self.minimumSizeHint()))
- self.clearWState(Qt.WState_Polished)
-
- self.connect(self.pushButton3,SIGNAL("clicked()"),self.accept)
-
-
- def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Device Information"))
- self.listView1.header().setLabel(0,self.__tr("Key"))
- self.listView1.header().setLabel(1,self.__tr("Value"))
- self.pushButton3.setText(self.__tr("Close"))
-
-
- def __tr(self,s,c = None):
- return qApp.translate("InformationForm_base",s,c)
-
-if __name__ == "__main__":
- a = QApplication(sys.argv)
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
- w = InformationForm_base()
- a.setMainWidget(w)
- w.show()
- a.exec_loop()
diff --git a/ui/informationform_base.ui b/ui/informationform_base.ui
deleted file mode 100644
index 418994713..000000000
--- a/ui/informationform_base.ui
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>InformationForm_base</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>InformationForm_base</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>600</width>
- <height>480</height>
- </rect>
- </property>
- <property name="caption">
- <string>HP Device Manager - Device Information</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView" row="0" column="0" rowspan="1" colspan="2">
- <column>
- <property name="text">
- <string>Key</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Value</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>listView1</cstring>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>pushButton3</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer20</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>471</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>pushButton3</sender>
- <signal>clicked()</signal>
- <receiver>InformationForm_base</receiver>
- <slot>accept()</slot>
- </connection>
-</connections>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/ui/loadpaperform.py b/ui/loadpaperform.py
index 0540ca881..bdb346757 100644
--- a/ui/loadpaperform.py
+++ b/ui/loadpaperform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,7 +19,6 @@
# Author: Don Welch
#
-
from base.g import *
from qt import *
from loadpaperform_base import LoadPaperForm_base
diff --git a/ui/makecopiesform.py b/ui/makecopiesform.py
index 154f6f3d1..6f7bdc5c8 100644
--- a/ui/makecopiesform.py
+++ b/ui/makecopiesform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -18,73 +18,63 @@
#
# Authors: Don Welch
-import os, Queue
+# Std Lib
+import operator
+# Local
from base.g import *
-from prnt import cups, printable_areas
+from prnt import cups
from base import device, utils, pml, service
from copier import copier
+# Qt
from qt import *
-from makecopiesform_base import MakeCopiesForm_base
-from waitform import WaitForm
+from scrollcopy import ScrollCopyView
-
-##try:
-## import Image
-## import PSDraw
-##except ImportError:
-## imaging_avail = False
-##else:
-## imaging_avail = True
-##
-##import scanext
-
-class MakeCopiesForm(MakeCopiesForm_base):
+class MakeCopiesForm(QMainWindow):
def __init__(self, sock, bus='cups', device_uri=None, printer_name=None,
num_copies=None, contrast=None, quality=None,
reduction=None, fit_to_page=None,
parent=None, name=None, modal=0, fl=0):
-
- MakeCopiesForm_base.__init__(self,parent,name,modal,fl)
+
+ QMainWindow.__init__(self,parent,name,fl)
+
+ icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
+ self.setIcon(icon)
self.sock = sock
- self.device_uri = device_uri
+ self.cur_deviceice_uri = device_uri
self.printer_name = printer_name
self.init_failed = False
- self.waitdlg = None
self.num_copies = num_copies
self.contrast = contrast
self.quality = quality
self.reduction = reduction
self.fit_to_page = fit_to_page
-
- self.update_queue = Queue.Queue() # UI updates from copy thread
- self.event_queue = Queue.Queue() # UI events (from hpssd) to send thread
-
- icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
- self.setIcon(icon)
-
- pix = QPixmap(os.path.join(prop.image_dir, 'status_refresh.png'))
- self.refreshToolButton.setPixmap(pix)
-
- if self.device_uri and self.printer_name:
+
+ self.setCentralWidget(QWidget(self,"qt_central_widget"))
+ self.FormLayout = QGridLayout(self.centralWidget(),1,1,11,6,"FormLayout")
+ self.resize(QSize(600,480).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+ self.languageChange()
+
+ if self.cur_deviceice_uri and self.printer_name:
log.error("You may not specify both a printer (-p) and a device (-d).")
self.FailureUI(self.__tr("<p><b>You may not specify both a printer (-p) and a device (-d)."))
- self.device_uri, self.printer_name = None, None
+ self.cur_deviceice_uri, self.printer_name = None, None
self.init_failed = True
-
+
self.cups_printers = cups.getPrinters()
log.debug(self.cups_printers)
- if not self.device_uri and not self.printer_name:
- t = device.probeDevices(self.sock, bus=bus, filter='copy')
+ if not self.cur_deviceice_uri and not self.printer_name:
+ t = device.probeDevices(bus=bus, filter={'copy-type': (operator.gt, 0)})
probed_devices = []
-
+
for d in t:
if d.startswith('hp:'):
probed_devices.append(d)
-
+
log.debug(probed_devices)
max_deviceid_size, x, devices = 0, 0, {}
@@ -104,481 +94,65 @@ class MakeCopiesForm(MakeCopiesForm_base):
self.init_failed = True
elif x == 1:
- log.info(utils.bold("Using device: %s" % devices[0][0]))
- self.device_uri = devices[0][0]
+ log.info(log.bold("Using device: %s" % devices[0][0]))
+ self.cur_deviceice_uri = devices[0][0]
else:
- #x = []
- #for z in self.cups_printers:
- # if z.device_uri in probed_devices:
- # x.append(z)
-
from choosedevicedlg import ChooseDeviceDlg
- #dlg = ChoosePrinterDlg(self.cups_printers, ['hp'])
- #dlg = ChoosePrinterDlg(x, ['hp'])
dlg = ChooseDeviceDlg(devices) #, ['hp'])
-
+
if dlg.exec_loop() == QDialog.Accepted:
- self.device_uri = dlg.device_uri
+ self.cur_deviceice_uri = dlg.device_uri
else:
self.init_failed = True
-
- QTimer.singleShot(0, self.InitialUpdate)
-
- def InitialUpdate(self):
- if self.init_failed:
- self.close()
- return
-
-## if not imaging_avail:
-## self.FailureUI(self.__tr("<b>The PIL (Python Imaging Library) is not installed.</b><p>Make copies requires that the PIL be installed. Please install the PIL and try again."))
-## self.close()
-## return
-
- self.printer_list = []
-
-## self.dev = device.Device(device_uri=self.device_uri,
-## printer_name=self.printer_name,
-## hpssd_sock=self.sock)
-
- self.dev = copier.PMLCopyDevice(device_uri=self.device_uri,
- printer_name=self.printer_name,
- hpssd_sock=self.sock)
-
- if self.dev.copy_type not in (COPY_TYPE_DEVICE, COPY_TYPE_AIO_DEVICE):
- self.FailureUI(self.__tr("<b>Sorry, make copies functionality is not implemented for this device type.</b>"))
- self.close()
- return
+ self.CopyView = ScrollCopyView(self.sock, False, num_copies=num_copies,
+ contrast=contrast, quality=quality,
+ reduction=reduction, fit_to_page=fit_to_page,
+ parent=self.centralWidget(), form=self)
- self.scan_style = self.dev.mq.get('scan-style', SCAN_STYLE_FLATBED)
- self.copy_type = self.dev.mq.get('copy-type', COPY_TYPE_DEVICE)
+ self.FormLayout.addWidget(self.CopyView,0,0)
- #log.debug(self.scan_style)
+ self.cur_device = self.cur_deviceice_uri
- if self.scan_style == SCAN_STYLE_SCROLLFED:
- self.fitToPageCheckBox.setEnabled(False)
- self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
-
- self.device_uri = self.dev.device_uri
-
- log.debug(self.device_uri)
- self.DeviceURIText.setText(self.device_uri)
-
- for p in self.cups_printers:
- if p.device_uri == self.device_uri:
- self.printer_list.append(p.name)
-
- for p in self.printer_list:
- self.printerNameComboBox.insertItem(p)
-
- self.UpdatePrinterStatus()
-
- if self.printer_name is None:
- self.printerNameComboBox.setCurrentItem(0)
-
- elif self.printer_name in self.printer_list:
- self.printerNameComboBox.setCurrentText(self.printer_name)
-
- self.current_printer = str(self.printerNameComboBox.currentText())
-
- self.UpdatePrinterInfo()
-
-
- def UpdatePrinterStatus(self):
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- try:
+ if not self.init_failed:
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()
- QApplication.restoreOverrideCursor()
-
-
- self.StateText.setText(self.dev.status_desc)
-
- if self.dev.device_state == DEVICE_STATE_NOT_FOUND:
- self.FailureUI(self.__tr("<b>Unable to communicate with device:</b><p>%s" % self.device_uri))
- else:
- # get sticky settings as defaults (if not spec'd on command line)
- if self.num_copies is None:
- result_code, self.num_copies = self.dev.getPML(pml.OID_COPIER_NUM_COPIES)
-
- if self.contrast is None:
- result_code, self.contrast = self.dev.getPML(pml.OID_COPIER_CONTRAST)
-
- if self.reduction is None:
- result_code, self.reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION)
-
- if self.quality is None:
- result_code, self.quality = self.dev.getPML(pml.OID_COPIER_QUALITY)
-
- if self.scan_style == SCAN_STYLE_FLATBED and self.fit_to_page is None:
- result_code, self.fit_to_page = self.dev.getPML(pml.OID_COPIER_FIT_TO_PAGE)
-
- if result_code != pml.ERROR_OK:
- self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
- self.fitToPageCheckBox.setEnabled(False)
-
- else:
- self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
-
- if self.scan_style != SCAN_STYLE_FLATBED:
- self.fitToPageCheckBox.setEnabled(False)
-
-
- result_code, self.max_reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION_MAXIMUM)
- result_code, self.max_enlargement = self.dev.getPML(pml.OID_COPIER_ENLARGEMENT_MAXIMUM)
-
- # contrast
- self.contrastTextLabel.setText("%d" % (self.contrast/25))
- self.contrastSlider.setValue(self.contrast/25)
- self.contrastSlider.setTickmarks(QSlider.Below)
- self.contrastSlider.setTickInterval(1)
-
- self.reductionSlider.setValue(self.reduction)
- self.reductionSlider.setRange(self.max_reduction, self.max_enlargement)
- self.reductionSlider.setTickmarks(QSlider.Below)
- self.reductionSlider.setTickInterval(10)
+ self.cur_device = copier.PMLCopyDevice(device_uri=self.cur_deviceice_uri,
+ printer_name=self.printer_name,
+ hpssd_sock=self.sock)
+ except Error:
+ log.error("Invalid device URI or printer name.")
+ self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-print and try again.")
+ self.init_failed = True
- if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
- self.fitToPageCheckBox.setChecked(True)
- self.reductionTextLabel.setText("")
- self.reductionSlider.setEnabled(False)
else:
- self.fitToPageCheckBox.setChecked(False)
- self.reductionTextLabel.setText("%d%%" % self.reduction)
- self.reductionSlider.setEnabled(True)
-
- # num_copies
- self.numberCopiesSpinBox.setValue(self.num_copies)
-
- # quality
- if self.quality == pml.COPIER_QUALITY_FAST:
- self.qualityButtonGroup.setButton(0)
-
- elif self.quality == pml.COPIER_QUALITY_DRAFT:
- self.qualityButtonGroup.setButton(1)
-
- elif self.quality == pml.COPIER_QUALITY_NORMAL:
- self.qualityButtonGroup.setButton(2)
-
- elif self.quality == pml.COPIER_QUALITY_PRESENTATION:
- self.qualityButtonGroup.setButton(3)
-
- elif self.quality == pml.COPIER_QUALITY_BEST:
- self.qualityButtonGroup.setButton(4)
+
+ if self.cur_device.copy_type == COPY_TYPE_NONE:
+ self.FailureUI(self.__tr("<b>Sorry, make copies functionality is not implemented for this device.</b>"))
+ self.close()
+ return
+ self.cur_deviceice_uri = self.cur_device.device_uri
+ user_cfg.last_used.device_uri = self.cur_deviceice_uri
+
+ log.debug(self.cur_deviceice_uri)
-
- def EventUI(self, event_code, event_type, error_string_short,
- error_string_long, retry_timeout, job_id,
- device_uri):
-
- log.debug("Event: device_uri=%s code=%d type=%s string=%s timeout=%d id=%d uri=%s" %
- (device_uri, event_code, event_type,
- error_string_short, retry_timeout, job_id, device_uri))
-
- if device_uri == self.dev.device_uri:
- self.StateText.setText(error_string_short)
-
-
- def UpdatePrinterInfo(self):
- for p in self.cups_printers:
- if p.name == self.current_printer:
-
- try:
- self.LocationText.setText(p.location)
- except AttributeError:
- self.LocationText.setText('')
-
- try:
- self.CommentText.setText(p.info)
- except AttributeError:
- self.CommentText.setText('')
-
- #cups.openPPD(p.name)
- #self.UpdateDuplex()
- #cups.closePPD()
- break
+ self.statusBar().message(self.cur_device.device_uri)
- #def callback(self, x, y):
- # update_spinner()
-
- def copy_canceled(self):
- self.event_queue.put(copier.COPY_CANCELED)
- service.sendEvent(self.sock, EVENT_COPY_JOB_CANCELED, device_uri=self.device_uri)
-
-
- def copy_timer_timeout(self):
- while self.update_queue.qsize():
- try:
- status = self.update_queue.get(0)
- except Queue.Empty:
- break
-
- if status == copier.STATUS_IDLE:
- self.copy_timer.stop()
-
- if self.waitdlg is not None:
- self.waitdlg.hide()
- self.waitdlg.close()
- self.waitdlg = None
-
- elif status in (copier.STATUS_SETTING_UP, copier.STATUS_WARMING_UP):
- self.waitdlg.setMessage(self.__tr("Warming up..."))
-
- elif status == copier.STATUS_ACTIVE:
- self.waitdlg.setMessage(self.__tr("Copying..."))
-
- elif status in (copier.STATUS_ERROR, copier.STATUS_DONE):
- self.copy_timer.stop()
-
- if self.waitdlg is not None:
- self.waitdlg.hide()
- self.waitdlg.close()
- self.waitdlg = None
-
- if status == copier.STATUS_ERROR:
- self.FailureUI(self.__tr("<b>Copier error.</b><p>"))
- service.sendEvent(self.sock, EVENT_COPY_JOB_FAIL, device_uri=self.device_uri)
+ QTimer.singleShot(0, self.InitialUpdate)
- elif status == copier.STATUS_DONE:
- service.sendEvent(self.sock, EVENT_END_COPY_JOB, device_uri=self.device_uri)
-
- def makeCopiesPushButton_clicked(self):
- service.sendEvent(self.sock, EVENT_START_COPY_JOB, device_uri=self.device_uri)
-
- self.waitdlg = WaitForm(0, self.__tr("Initializing..."), self.copy_canceled, self, modal=1)
- self.waitdlg.show()
+ def InitialUpdate(self):
+ if self.init_failed:
+ self.close()
+ return
- self.copy_timer = QTimer(self, "CopyTimer")
- self.connect(self.copy_timer, SIGNAL('timeout()'), self.copy_timer_timeout)
- self.copy_timer.start(1000) # 1 sec UI updates
+ self.CopyView.onDeviceChange(self.cur_device)
- self.dev.copy(self.num_copies, self.contrast, self.reduction,
- self.quality, self.fit_to_page, self.scan_style,
- self.update_queue, self.event_queue)
-
-
-
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Make Copies"))
-## log.debug(scanext.init())
-##
-## try:
-## scanner = scanext.open(self.device_uri.replace('hp:/', 'hpaio:/'))
-## except scanext.error, e:
-## log.error(e)
-## self.FailureUI(e)
-## return
-##
-## try:
-## #if 1:
-## tech_class = self.dev.tech_class
-## print tech_class
-##
-## paper_data = None
-##
-##
-## #return
-##
-## scanner.mode = 'Color'
-## scanner.compression = "JPEG"
-## scanner.jpeg_compression_factor = 10
-## scanner.brightness = 10
-## dpi = 300
-## scanner.resolution = dpi
-##
-## cups.openPPD(self.current_printer)
-##
-## page_name, page_width_pt, page_height_pt, page_left_pt, page_bottom_pt, page_right_pt, page_top_pt = \
-## cups.getPPDPageSize()
-##
-## print "Page size (PPD)(pt)=", page_name, page_width_pt, page_height_pt, page_left_pt, page_bottom_pt, page_right_pt, page_top_pt
-## cups.closePPD()
-##
-## #return
-## try:
-## paper_data_set = printable_areas.data[tech_class]
-## except KeyError:
-## # Hack to handle DJGenericVIP vs. GenericVIP issue
-## paper_data_set = printable_areas.data.get(tech_class.replace("DJ", ""), None)
-##
-## #print paper_data_set
-##
-## try:
-## paper_data = paper_data_set[page_name]
-## except:
-## page_name = page_name.title()
-## paper_data = paper_data_set.get(page_name, (8.5000, 11.0000, 0.1250, 0.1250, 8.2500, 10.3750))
-##
-## print paper_data
-##
-## # W H L B R T
-## # Page size (PPD)(pt)= Letter 612.0 792.0 18.0 36.0 594.0 783.0
-## # Page size (printable_areas)(pt)= Letter 612.0 792.0 9.0 36.0 9.0 9.0
-##
-## media_width_in, media_height_in, page_left_in, page_top_in, page_width_in, page_height_in = paper_data
-##
-##
-## page_right_in = media_width_in - (page_left_in + page_width_in)
-## page_bottom_in = media_height_in - (page_top_in + page_height_in)
-##
-## page_left_pt = page_left_in * 72.0
-## page_right_pt = page_right_in * 72.0
-## page_bottom_pt = page_bottom_in * 72.0
-## page_top_pt = page_top_in * 72.0
-##
-## print "Page size (printable_areas)(pt)=", page_name, page_width_pt, page_height_pt, page_left_pt, page_bottom_pt, page_right_pt, page_top_pt
-##
-## (mode, last_frame, (scan_width_px, scan_height_px), depth, bytes_per_line) = \
-## scanner.get_parameters()
-##
-## #print params
-## #log.debug(params)
-## print "Scan (px)=", mode, last_frame, scan_width_px, scan_height_px, depth, bytes_per_line
-##
-## scanner.start()
-##
-## im = scanner.snap(callback=self.callback)
-## #im.save("test.jpg")
-## print
-## print im.size
-## print im.mode
-## print im.format
-## #print im.info
-##
-## page_left_px = page_left_pt / 72.0 * dpi
-## page_right_px = page_right_pt / 72.0 * dpi
-## page_top_px = page_top_pt / 72.0 * dpi
-## page_bottom_px = page_bottom_pt / 72.0 * dpi
-## page_width_px = (page_right_pt - page_left_pt) / 72.0 * dpi # px
-## page_height_px = (page_top_pt - page_bottom_pt) / 72.0 * dpi # px
-##
-## print "Page (px) =", page_width_px, page_height_px, page_left_px, page_top_px, page_right_px, page_bottom_px
-##
-## print_width_px = page_right_px - page_left_px
-## print_height_px = page_top_px - page_bottom_px
-##
-## print "Print (px) =", print_width_px, print_height_px
-##
-## #cropped_im = im.crop((0, 0, int(width), int(height))) # left, top, right, bottom
-## cropped_im = im.crop((int(page_left_px), int(page_bottom_px), int(print_width_px), int(print_height_px)))
-## cropped_im.load()
-## print cropped_im.size
-## cropped_im.save("test.jpg", "JPEG")
-##
-## if print_width_px > print_height_px:
-## scale = 256.0/print_width_px
-## thumb_xsize = 256
-## thumb_ysize = int(print_height_px * scale)
-## else:
-## scale = 256.0/print_height_px
-## thumb_ysize = 256
-## thumb_xsize = int(print_width_px * scale)
-##
-## print thumb_xsize, thumb_ysize
-##
-## thumb = cropped_im.copy()
-## thumb.thumbnail((thumb_xsize, thumb_ysize), Image.ANTIALIAS)
-##
-## #image = QImage()
-## pixmap = QPixmap()
-## s = thumb.convert("RGB").tostring("jpeg", "RGB")
-## pixmap.loadFromData(QByteArray(s))
-##
-## self.thumbnailPixmap.setPixmap(pixmap)
-##
-##
-##
-## #import cStringIO
-##
-## #temp_file_fd = cStringIO.StringIO()
-## #temp_file_fd, temp_file_name = utils.make_temp_file()
-## #fd = file("test.ps", "w")
-##
-## #ps = PSDraw.PSDraw(fd)
-##
-## #ps.begin_document()
-## #ps.setfont("Helvetica-Narrow-Bold", 18)
-## #ps.text((letter[0], letter[3]+24), title)
-## #ps.setfont("Helvetica-Narrow-Bold", 8)
-## #ps.text((letter[0], letter[1]-30), VERSION)
-## #letter = ( 1.0*72, 1.0*72, 7.5*72, 10.0*72 )
-## #letter = (0.0, 0.0, 8.5*72, 11.0*72)
-##
-## #ps.image(letter, im, dpi=dpi)
-## #ps.end_document()
-##
-## #fd.close()
-##
-##
-## #sys.exit(0)
-## #return
-##
-## cups.resetOptions()
-## cups.addOption('ppi=%d' % dpi)
-## cups.addOption('scaling=%d' % 100)
-##
-## self.cups_printers = cups.getPrinters()
-## #log.debug(self.cups_printers)
-##
-## printer_state = cups.IPP_PRINTER_STATE_STOPPED
-## for p in self.cups_printers:
-## if p.name == self.current_printer:
-## printer_state = p.state
-##
-## log.debug("Printer state = %d" % printer_state)
-##
-## if printer_state == cups.IPP_PRINTER_STATE_IDLE:
-## sent_job_id = cups.printFile(self.current_printer, "test.jpg", "test.jpg")
-## #job_types[sent_job_id] = mime_type # save for later
-## log.debug("Job ID=%d" % sent_job_id)
-##
-## #QApplication.setOverrideCursor(QApplication.waitCursor)
-##
-## #self.waitdlg = WaitForm(0, self.__tr("Processing fax file..."), None, self, modal=1)
-## #self.waitdlg.show()
-##
-## else:
-## self.FailureUI(self.__tr("<b>Printer '%1' is in a stopped or error state.</b><p>Check the printer queue in CUPS and try again.").arg(self.current_printer))
-## cups.resetOptions()
-## return
-##
-## cups.resetOptions()
-##
-## #self.dev.printFile("test.jpg", direct=False, raw=False, remove=False)
-## #self.dev.printFile("test.ps", direct=False, raw=False, remove=False)
-## #self.dev.printData(self, temp_file_fd.getvalue(), direct=False, raw=False)
-## #self.dev.printData(temp_file_fd.getvalue(), direct=False, raw=False)
-##
-##
-## finally:
-## scanner.close()
-## del scanner
-## scanext.exit()
-
-
- def SuccessUI(self):
- QMessageBox.information(self,
- self.caption(),
- self.__tr("<p><b>The operation completed successfully.</b>"),
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
def FailureUI(self, error_text):
QMessageBox.critical(self,
self.caption(),
@@ -593,41 +167,8 @@ class MakeCopiesForm(MakeCopiesForm_base):
msg,
QMessageBox.Ok,
QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- def qualityButtonGroup_clicked(self,a0):
- if a0 == 0:
- self.quality = pml.COPIER_QUALITY_FAST
- elif a0 == 1:
- self.quality = pml.COPIER_QUALITY_DRAFT
- elif a0 == 2:
- self.quality = pml.COPIER_QUALITY_NORMAL
- elif a0 == 3:
- self.quality = pml.COPIER_QUALITY_PRESENTATION
- elif a0 == 4:
- self.quality = pml.COPIER_QUALITY_BEST
+ QMessageBox.NoButton)
+
- def reductionSlider_valueChanged(self,a0):
- self.reduction = a0
- self.reductionTextLabel.setText("%d%%" % self.reduction)
-
- def contrastSlider_valueChanged(self,a0):
- self.contrast = a0 * 25
- self.contrastTextLabel.setText("%+d" % a0)
-
- def fitToPageCheckBox_clicked(self):
- if self.fitToPageCheckBox.isChecked():
- self.fit_to_page = pml.COPIER_FIT_TO_PAGE_ENABLED
- self.reductionTextLabel.setText("")
- self.reductionSlider.setEnabled(False)
- else:
- self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
- self.reductionTextLabel.setText("%d%%" % self.reduction)
- self.reductionSlider.setEnabled(True)
-
- def numberCopiesSpinBox_valueChanged(self,a0):
- self.num_copies = a0
-
-
def __tr(self,s,c = None):
return qApp.translate("MakeCopiesForm",s,c)
diff --git a/ui/makecopiesform_base.py b/ui/makecopiesform_base.py
deleted file mode 100644
index bf409938e..000000000
--- a/ui/makecopiesform_base.py
+++ /dev/null
@@ -1,303 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'makecopiesform_base.ui'
-#
-# Created: Wed Jun 28 09:12:14 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.15.1
-#
-# WARNING! All changes made in this file will be lost!
-
-
-from qt import *
-
-
-class MakeCopiesForm_base(QDialog):
- def __init__(self,parent = None,name = None,modal = 0,fl = 0):
- QDialog.__init__(self,parent,name,modal,fl)
-
- if not name:
- self.setName("MakeCopiesForm_base")
-
-
- MakeCopiesForm_baseLayout = QGridLayout(self,1,1,11,6,"MakeCopiesForm_baseLayout")
-
- self.pushButton2 = QPushButton(self,"pushButton2")
-
- MakeCopiesForm_baseLayout.addWidget(self.pushButton2,1,1)
- spacer1 = QSpacerItem(431,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- MakeCopiesForm_baseLayout.addItem(spacer1,1,0)
-
- self.tabWidget2 = QTabWidget(self,"tabWidget2")
-
- self.tab = QWidget(self.tabWidget2,"tab")
- tabLayout = QGridLayout(self.tab,1,1,11,6,"tabLayout")
-
- self.textLabel3_2_2_2_2 = QLabel(self.tab,"textLabel3_2_2_2_2")
-
- tabLayout.addMultiCellWidget(self.textLabel3_2_2_2_2,0,0,0,1)
-
- self.makeCopiesPushButton = QPushButton(self.tab,"makeCopiesPushButton")
-
- tabLayout.addMultiCellWidget(self.makeCopiesPushButton,6,6,0,1)
- spacer7 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding)
- tabLayout.addItem(spacer7,5,0)
- spacer8 = QSpacerItem(20,20,QSizePolicy.Minimum,QSizePolicy.Expanding)
- tabLayout.addItem(spacer8,5,1)
-
- self.qualityButtonGroup = QButtonGroup(self.tab,"qualityButtonGroup")
-
- self.radioButton1 = QRadioButton(self.qualityButtonGroup,"radioButton1")
- self.radioButton1.setGeometry(QRect(11,21,200,20))
-
- self.radioButton2 = QRadioButton(self.qualityButtonGroup,"radioButton2")
- self.radioButton2.setGeometry(QRect(11,47,200,20))
-
- self.radioButton3 = QRadioButton(self.qualityButtonGroup,"radioButton3")
- self.radioButton3.setGeometry(QRect(11,73,200,20))
-
- self.radioButton4 = QRadioButton(self.qualityButtonGroup,"radioButton4")
- self.radioButton4.setGeometry(QRect(11,99,200,20))
-
- self.radioButton5 = QRadioButton(self.qualityButtonGroup,"radioButton5")
- self.radioButton5.setGeometry(QRect(11,125,200,20))
-
- tabLayout.addWidget(self.qualityButtonGroup,4,0)
-
- self.groupBox5 = QGroupBox(self.tab,"groupBox5")
- self.groupBox5.setColumnLayout(0,Qt.Vertical)
- self.groupBox5.layout().setSpacing(6)
- self.groupBox5.layout().setMargin(11)
- groupBox5Layout = QGridLayout(self.groupBox5.layout())
- groupBox5Layout.setAlignment(Qt.AlignTop)
-
- layout7 = QHBoxLayout(None,0,6,"layout7")
-
- self.textLabel1 = QLabel(self.groupBox5,"textLabel1")
- layout7.addWidget(self.textLabel1)
-
- self.numberCopiesSpinBox = QSpinBox(self.groupBox5,"numberCopiesSpinBox")
- self.numberCopiesSpinBox.setMinValue(1)
- layout7.addWidget(self.numberCopiesSpinBox)
-
- groupBox5Layout.addLayout(layout7,0,0)
-
- tabLayout.addWidget(self.groupBox5,4,1)
-
- self.line1_2_2_2_2 = QFrame(self.tab,"line1_2_2_2_2")
- self.line1_2_2_2_2.setFrameShape(QFrame.HLine)
- self.line1_2_2_2_2.setFrameShadow(QFrame.Sunken)
- self.line1_2_2_2_2.setFrameShape(QFrame.HLine)
-
- tabLayout.addMultiCellWidget(self.line1_2_2_2_2,1,1,0,1)
-
- self.groupBox2 = QGroupBox(self.tab,"groupBox2")
- self.groupBox2.setColumnLayout(0,Qt.Vertical)
- self.groupBox2.layout().setSpacing(6)
- self.groupBox2.layout().setMargin(11)
- groupBox2Layout = QGridLayout(self.groupBox2.layout())
- groupBox2Layout.setAlignment(Qt.AlignTop)
-
- self.contrastTextLabel = QLabel(self.groupBox2,"contrastTextLabel")
- self.contrastTextLabel.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Preferred,0,0,self.contrastTextLabel.sizePolicy().hasHeightForWidth()))
-
- groupBox2Layout.addWidget(self.contrastTextLabel,0,1)
- spacer9 = QSpacerItem(181,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox2Layout.addItem(spacer9,0,2)
- spacer10 = QSpacerItem(181,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox2Layout.addItem(spacer10,0,0)
-
- self.contrastSlider = QSlider(self.groupBox2,"contrastSlider")
- self.contrastSlider.setMinValue(-5)
- self.contrastSlider.setMaxValue(5)
- self.contrastSlider.setPageStep(1)
- self.contrastSlider.setOrientation(QSlider.Horizontal)
-
- groupBox2Layout.addMultiCellWidget(self.contrastSlider,1,1,0,2)
-
- tabLayout.addMultiCellWidget(self.groupBox2,2,2,0,1)
-
- self.groupBox3 = QGroupBox(self.tab,"groupBox3")
- self.groupBox3.setColumnLayout(0,Qt.Vertical)
- self.groupBox3.layout().setSpacing(6)
- self.groupBox3.layout().setMargin(11)
- groupBox3Layout = QGridLayout(self.groupBox3.layout())
- groupBox3Layout.setAlignment(Qt.AlignTop)
-
- self.reductionTextLabel = QLabel(self.groupBox3,"reductionTextLabel")
- self.reductionTextLabel.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Preferred,0,0,self.reductionTextLabel.sizePolicy().hasHeightForWidth()))
-
- groupBox3Layout.addMultiCellWidget(self.reductionTextLabel,0,1,2,2)
-
- self.reductionSlider = QSlider(self.groupBox3,"reductionSlider")
- self.reductionSlider.setOrientation(QSlider.Horizontal)
-
- groupBox3Layout.addMultiCellWidget(self.reductionSlider,2,2,0,3)
-
- self.fitToPageCheckBox = QCheckBox(self.groupBox3,"fitToPageCheckBox")
-
- groupBox3Layout.addMultiCellWidget(self.fitToPageCheckBox,0,1,0,1)
- spacer11 = QSpacerItem(91,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox3Layout.addItem(spacer11,1,1)
- spacer12 = QSpacerItem(151,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox3Layout.addItem(spacer12,1,3)
-
- tabLayout.addMultiCellWidget(self.groupBox3,3,3,0,1)
- self.tabWidget2.insertTab(self.tab,QString.fromLatin1(""))
-
- self.tab_2 = QWidget(self.tabWidget2,"tab_2")
- tabLayout_2 = QGridLayout(self.tab_2,1,1,11,6,"tabLayout_2")
- spacer13 = QSpacerItem(20,150,QSizePolicy.Minimum,QSizePolicy.Expanding)
- tabLayout_2.addItem(spacer13,8,0)
-
- self.line1_2_2_2 = QFrame(self.tab_2,"line1_2_2_2")
- self.line1_2_2_2.setFrameShape(QFrame.HLine)
- self.line1_2_2_2.setFrameShadow(QFrame.Sunken)
- self.line1_2_2_2.setFrameShape(QFrame.HLine)
-
- tabLayout_2.addWidget(self.line1_2_2_2,1,0)
-
- self.line10 = QFrame(self.tab_2,"line10")
- self.line10.setFrameShape(QFrame.HLine)
- self.line10.setFrameShadow(QFrame.Sunken)
- self.line10.setFrameShape(QFrame.HLine)
-
- tabLayout_2.addWidget(self.line10,3,0)
-
- layout18 = QHBoxLayout(None,0,6,"layout18")
-
- self.textLabel4 = QLabel(self.tab_2,"textLabel4")
- layout18.addWidget(self.textLabel4)
-
- self.printerNameComboBox = QComboBox(0,self.tab_2,"printerNameComboBox")
- self.printerNameComboBox.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Fixed,0,0,self.printerNameComboBox.sizePolicy().hasHeightForWidth()))
- layout18.addWidget(self.printerNameComboBox)
-
- tabLayout_2.addLayout(layout18,2,0)
-
- self.textLabel3_2_2_2 = QLabel(self.tab_2,"textLabel3_2_2_2")
-
- tabLayout_2.addWidget(self.textLabel3_2_2_2,0,0)
-
- layout17 = QHBoxLayout(None,0,6,"layout17")
-
- self.textLabel2_2 = QLabel(self.tab_2,"textLabel2_2")
- layout17.addWidget(self.textLabel2_2)
-
- self.StateText = QLabel(self.tab_2,"StateText")
- self.StateText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.StateText.sizePolicy().hasHeightForWidth()))
- self.StateText.setFrameShape(QLabel.NoFrame)
- layout17.addWidget(self.StateText)
-
- self.refreshToolButton = QToolButton(self.tab_2,"refreshToolButton")
- self.refreshToolButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.refreshToolButton.sizePolicy().hasHeightForWidth()))
- self.refreshToolButton.setMinimumSize(QSize(32,32))
- self.refreshToolButton.setMaximumSize(QSize(32,32))
- layout17.addWidget(self.refreshToolButton)
-
- tabLayout_2.addLayout(layout17,7,0)
-
- layout8 = QHBoxLayout(None,0,6,"layout8")
-
- self.textLabel10 = QLabel(self.tab_2,"textLabel10")
- layout8.addWidget(self.textLabel10)
-
- self.CommentText = QLabel(self.tab_2,"CommentText")
- self.CommentText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.CommentText.sizePolicy().hasHeightForWidth()))
- layout8.addWidget(self.CommentText)
-
- tabLayout_2.addLayout(layout8,6,0)
-
- layout20 = QHBoxLayout(None,0,6,"layout20")
-
- self.textLabel9 = QLabel(self.tab_2,"textLabel9")
- layout20.addWidget(self.textLabel9)
-
- self.LocationText = QLabel(self.tab_2,"LocationText")
- self.LocationText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.LocationText.sizePolicy().hasHeightForWidth()))
- layout20.addWidget(self.LocationText)
-
- tabLayout_2.addLayout(layout20,5,0)
-
- layout15 = QHBoxLayout(None,0,6,"layout15")
-
- self.textLabel2 = QLabel(self.tab_2,"textLabel2")
- layout15.addWidget(self.textLabel2)
-
- self.DeviceURIText = QLabel(self.tab_2,"DeviceURIText")
- self.DeviceURIText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.DeviceURIText.sizePolicy().hasHeightForWidth()))
- self.DeviceURIText.setFrameShape(QLabel.NoFrame)
- layout15.addWidget(self.DeviceURIText)
-
- tabLayout_2.addLayout(layout15,4,0)
- self.tabWidget2.insertTab(self.tab_2,QString.fromLatin1(""))
-
- MakeCopiesForm_baseLayout.addMultiCellWidget(self.tabWidget2,0,0,0,1)
-
- self.languageChange()
-
- self.resize(QSize(497,546).expandedTo(self.minimumSizeHint()))
- self.clearWState(Qt.WState_Polished)
-
- self.connect(self.pushButton2,SIGNAL("clicked()"),self.reject)
- self.connect(self.makeCopiesPushButton,SIGNAL("clicked()"),self.makeCopiesPushButton_clicked)
- self.connect(self.qualityButtonGroup,SIGNAL("clicked(int)"),self.qualityButtonGroup_clicked)
- self.connect(self.reductionSlider,SIGNAL("valueChanged(int)"),self.reductionSlider_valueChanged)
- self.connect(self.contrastSlider,SIGNAL("valueChanged(int)"),self.contrastSlider_valueChanged)
- self.connect(self.fitToPageCheckBox,SIGNAL("clicked()"),self.fitToPageCheckBox_clicked)
- self.connect(self.numberCopiesSpinBox,SIGNAL("valueChanged(int)"),self.numberCopiesSpinBox_valueChanged)
-
-
- def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Make Copies"))
- self.pushButton2.setText(self.__tr("Close"))
- self.textLabel3_2_2_2_2.setText(self.__tr("<b>Make copies.</b>"))
- self.makeCopiesPushButton.setText(self.__tr("Make Copies"))
- self.qualityButtonGroup.setTitle(self.__tr("Quality:"))
- self.radioButton1.setText(self.__tr("Fast"))
- self.radioButton2.setText(self.__tr("Draft"))
- self.radioButton3.setText(self.__tr("Normal"))
- self.radioButton4.setText(self.__tr("Presentation"))
- self.radioButton5.setText(self.__tr("Best"))
- self.groupBox5.setTitle(self.__tr("Number of Copies:"))
- self.textLabel1.setText(self.__tr("Number of Copies:"))
- self.groupBox2.setTitle(self.__tr("Contrast:"))
- self.contrastTextLabel.setText(self.__tr("+0"))
- self.groupBox3.setTitle(self.__tr("Enlargement/Reduction:"))
- self.reductionTextLabel.setText(self.__tr("400%"))
- self.fitToPageCheckBox.setText(self.__tr("Fit to page"))
- self.tabWidget2.changeTab(self.tab,self.__tr("Copy"))
- self.textLabel4.setText(self.__tr("Name:"))
- self.textLabel3_2_2_2.setText(self.__tr("<b>Device information/status and output queue name.</b>"))
- self.textLabel2_2.setText(self.__tr("Status:"))
- self.StateText.setText(QString.null)
- self.refreshToolButton.setText(QString.null)
- QToolTip.add(self.refreshToolButton,self.__tr("Refresh status"))
- self.textLabel10.setText(self.__tr("Comment:"))
- self.CommentText.setText(QString.null)
- self.textLabel9.setText(self.__tr("Location:"))
- self.LocationText.setText(QString.null)
- self.textLabel2.setText(self.__tr("Device URI:"))
- self.DeviceURIText.setText(QString.null)
- self.tabWidget2.changeTab(self.tab_2,self.__tr("Device"))
-
-
- def makeCopiesPushButton_clicked(self):
- print "MakeCopiesForm_base.makeCopiesPushButton_clicked(): Not implemented yet"
-
- def qualityButtonGroup_clicked(self,a0):
- print "MakeCopiesForm_base.qualityButtonGroup_clicked(int): Not implemented yet"
-
- def reductionSlider_valueChanged(self,a0):
- print "MakeCopiesForm_base.reductionSlider_valueChanged(int): Not implemented yet"
-
- def contrastSlider_valueChanged(self,a0):
- print "MakeCopiesForm_base.contrastSlider_valueChanged(int): Not implemented yet"
-
- def fitToPageCheckBox_clicked(self):
- print "MakeCopiesForm_base.fitToPageCheckBox_clicked(): Not implemented yet"
-
- def numberCopiesSpinBox_valueChanged(self,a0):
- print "MakeCopiesForm_base.numberCopiesSpinBox_valueChanged(int): Not implemented yet"
-
- def __tr(self,s,c = None):
- return qApp.translate("MakeCopiesForm_base",s,c)
diff --git a/ui/makecopiesform_base.ui b/ui/makecopiesform_base.ui
deleted file mode 100644
index dddd75bf9..000000000
--- a/ui/makecopiesform_base.ui
+++ /dev/null
@@ -1,751 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>MakeCopiesForm_base</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>MakeCopiesForm_base</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>497</width>
- <height>546</height>
- </rect>
- </property>
- <property name="caption">
- <string>HP Device Manager - Make Copies</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>pushButton2</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>431</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>tabWidget2</cstring>
- </property>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Copy</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel3_2_2_2_2</cstring>
- </property>
- <property name="text">
- <string>&lt;b&gt;Make copies.&lt;/b&gt;</string>
- </property>
- </widget>
- <widget class="QPushButton" row="6" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>makeCopiesPushButton</cstring>
- </property>
- <property name="text">
- <string>Make Copies</string>
- </property>
- </widget>
- <spacer row="5" column="0">
- <property name="name">
- <cstring>spacer7</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <spacer row="5" column="1">
- <property name="name">
- <cstring>spacer8</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QButtonGroup" row="4" column="0">
- <property name="name">
- <cstring>qualityButtonGroup</cstring>
- </property>
- <property name="title">
- <string>Quality:</string>
- </property>
- <widget class="QRadioButton">
- <property name="name">
- <cstring>radioButton1</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>11</x>
- <y>21</y>
- <width>200</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Fast</string>
- </property>
- </widget>
- <widget class="QRadioButton">
- <property name="name">
- <cstring>radioButton2</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>11</x>
- <y>47</y>
- <width>200</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Draft</string>
- </property>
- </widget>
- <widget class="QRadioButton">
- <property name="name">
- <cstring>radioButton3</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>11</x>
- <y>73</y>
- <width>200</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Normal</string>
- </property>
- </widget>
- <widget class="QRadioButton">
- <property name="name">
- <cstring>radioButton4</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>11</x>
- <y>99</y>
- <width>200</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Presentation</string>
- </property>
- </widget>
- <widget class="QRadioButton">
- <property name="name">
- <cstring>radioButton5</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>11</x>
- <y>125</y>
- <width>200</width>
- <height>20</height>
- </rect>
- </property>
- <property name="text">
- <string>Best</string>
- </property>
- </widget>
- </widget>
- <widget class="QGroupBox" row="4" column="1">
- <property name="name">
- <cstring>groupBox5</cstring>
- </property>
- <property name="title">
- <string>Number of Copies:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout7</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Number of Copies:</string>
- </property>
- </widget>
- <widget class="QSpinBox">
- <property name="name">
- <cstring>numberCopiesSpinBox</cstring>
- </property>
- <property name="minValue">
- <number>1</number>
- </property>
- </widget>
- </hbox>
- </widget>
- </grid>
- </widget>
- <widget class="Line" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>line1_2_2_2_2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>groupBox2</cstring>
- </property>
- <property name="title">
- <string>Contrast:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="1">
- <property name="name">
- <cstring>contrastTextLabel</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>+0</string>
- </property>
- </widget>
- <spacer row="0" column="2">
- <property name="name">
- <cstring>spacer9</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>181</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <spacer row="0" column="0">
- <property name="name">
- <cstring>spacer10</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>181</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QSlider" row="1" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>contrastSlider</cstring>
- </property>
- <property name="minValue">
- <number>-5</number>
- </property>
- <property name="maxValue">
- <number>5</number>
- </property>
- <property name="pageStep">
- <number>1</number>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>groupBox3</cstring>
- </property>
- <property name="title">
- <string>Enlargement/Reduction:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="2" rowspan="2" colspan="1">
- <property name="name">
- <cstring>reductionTextLabel</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>400%</string>
- </property>
- </widget>
- <widget class="QSlider" row="2" column="0" rowspan="1" colspan="4">
- <property name="name">
- <cstring>reductionSlider</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QCheckBox" row="0" column="0" rowspan="2" colspan="2">
- <property name="name">
- <cstring>fitToPageCheckBox</cstring>
- </property>
- <property name="text">
- <string>Fit to page</string>
- </property>
- </widget>
- <spacer row="1" column="1">
- <property name="name">
- <cstring>spacer11</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>91</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <spacer row="1" column="3">
- <property name="name">
- <cstring>spacer12</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>151</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Device</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer row="8" column="0">
- <property name="name">
- <cstring>spacer13</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>150</height>
- </size>
- </property>
- </spacer>
- <widget class="Line" row="1" column="0">
- <property name="name">
- <cstring>line1_2_2_2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="Line" row="3" column="0">
- <property name="name">
- <cstring>line10</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="2" column="0">
- <property name="name">
- <cstring>layout18</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- <widget class="QComboBox">
- <property name="name">
- <cstring>printerNameComboBox</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel3_2_2_2</cstring>
- </property>
- <property name="text">
- <string>&lt;b&gt;Device information/status and output queue name.&lt;/b&gt;</string>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="7" column="0">
- <property name="name">
- <cstring>layout17</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel2_2</cstring>
- </property>
- <property name="text">
- <string>Status:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>StateText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>NoFrame</enum>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QToolButton">
- <property name="name">
- <cstring>refreshToolButton</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="toolTip" stdset="0">
- <string>Refresh status</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="6" column="0">
- <property name="name">
- <cstring>layout8</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel10</cstring>
- </property>
- <property name="text">
- <string>Comment:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>CommentText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="5" column="0">
- <property name="name">
- <cstring>layout20</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel9</cstring>
- </property>
- <property name="text">
- <string>Location:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>LocationText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget" row="4" column="0">
- <property name="name">
- <cstring>layout15</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Device URI:</string>
- </property>
- </widget>
- <widget class="QLabel">
- <property name="name">
- <cstring>DeviceURIText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="frameShape">
- <enum>NoFrame</enum>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- </grid>
- </widget>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>pushButton2</sender>
- <signal>clicked()</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>makeCopiesPushButton</sender>
- <signal>clicked()</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>makeCopiesPushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>qualityButtonGroup</sender>
- <signal>clicked(int)</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>qualityButtonGroup_clicked(int)</slot>
- </connection>
- <connection>
- <sender>reductionSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>reductionSlider_valueChanged(int)</slot>
- </connection>
- <connection>
- <sender>contrastSlider</sender>
- <signal>valueChanged(int)</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>contrastSlider_valueChanged(int)</slot>
- </connection>
- <connection>
- <sender>fitToPageCheckBox</sender>
- <signal>clicked()</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>fitToPageCheckBox_clicked()</slot>
- </connection>
- <connection>
- <sender>numberCopiesSpinBox</sender>
- <signal>valueChanged(int)</signal>
- <receiver>MakeCopiesForm_base</receiver>
- <slot>numberCopiesSpinBox_valueChanged(int)</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in implementation">makecopiesform_base.ui.h</include>
-</includes>
-<slots>
- <slot>makeCopiesPushButton_clicked()</slot>
- <slot>qualityButtonGroup_clicked( int )</slot>
- <slot>reductionSlider_valueChanged( int )</slot>
- <slot>contrastSlider_valueChanged( int )</slot>
- <slot>fitToPageCheckBox_clicked()</slot>
- <slot>numberCopiesSpinBox_valueChanged( int )</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/ui/nodevicesform.py b/ui/nodevicesform.py
index d2f86577f..2918ef5d7 100644
--- a/ui/nodevicesform.py
+++ b/ui/nodevicesform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -29,32 +29,52 @@ from nodevicesform_base import NoDevicesForm_base
class NoDevicesForm(NoDevicesForm_base):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
NoDevicesForm_base.__init__(self,parent,name,modal,fl)
-
+
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, "warning.png")))
-
+
def CUPSButton_clicked(self):
self.close()
- utils.openURL("http://localhost:631/printers")
-
+ utils.openURL("http://localhost:631/admin?op=add-printer")
+
def ExitButton_clicked(self):
self.close()
-
+
def setupPushButton_clicked(self):
self.close()
-
+ su_sudo = None
+
if utils.which('kdesu'):
su_sudo = 'kdesu -- %s'
-
+
elif utils.which('gksu'):
su_sudo = 'gksu "%s"'
-
- if utils.which('hp-setup'):
- cmd = su_sudo % 'hp-setup -u'
+
+ if su_sudo is None:
+ QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-setup.</b>"),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
else:
- cmd = su_sudo % 'python ./setup.py -u'
-
- log.debug(cmd)
- os.system(cmd)
-
-
-
+ if utils.which('hp-setup'):
+ cmd = su_sudo % 'hp-setup -u'
+ else:
+ cmd = su_sudo % '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.caption(),
+ self.__tr("<b>An I/O error occurred.</b><p>Please re-start the Device Manager and try again."),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+ def __tr(self,s,c = None):
+ return qApp.translate("NoDevicesForm",s,c)
diff --git a/ui/paperedgealignform.py b/ui/paperedgealignform.py
index 6fa28c535..25c7027bb 100644
--- a/ui/paperedgealignform.py
+++ b/ui/paperedgealignform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -28,11 +28,9 @@ import os.path
class PaperEdgeAlignForm(PaperEdgeAlignForm_base):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
PaperEdgeAlignForm_base.__init__(self,parent,name,modal,fl)
-
self.Icon.setPixmap(QPixmap(os.path.join(prop.image_dir, "zca.png")))
-
self.value = 1
-
+
def buttonGroup_clicked(self,a0):
self.value = a0 + 1
-
+
diff --git a/ui/pluginform.py b/ui/pluginform.py
new file mode 100644
index 000000000..857cd0fdc
--- /dev/null
+++ b/ui/pluginform.py
@@ -0,0 +1,247 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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
+#
+# Authors: Don Welch
+
+# Local
+from base.g import *
+from base import device
+
+# Std Lib
+import sys
+import os
+import os.path
+
+# Qt
+from qt import *
+from pluginform_base import PluginForm_base
+from waitform import WaitForm
+
+
+class PluginForm(PluginForm_base):
+ def __init__(self, core, norm_model, device_uri, plugin_lib, fw_download,
+ parent = None, name = None, modal = 0, fl = 0):
+
+ PluginForm_base.__init__(self,parent,name,modal,fl)
+
+ icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
+ self.setIcon(icon)
+
+ self.setTitleFont(QFont("Helvetica", 16))
+
+ self.sourceGroup.setButton(0)
+ self.browsePushButton.setEnabled(False)
+ self.pathLineEdit.setEnabled(False)
+
+ self.downloadText = self.__tr("Agree to License, Download and Install Plug-in")
+ self.optionalText = self.__tr("""An optional driver plug-in is available to enhance the operation of this printer. You may skip this installation, download the plug-in directly from an HP authorized server, or, if you already have a copy of the file, you can specify a path to the file.""")
+ self.optionalTitle = self.__tr("Optional Driver Plug-in Available")
+ self.skipText = self.__tr("Skip installation of optional plug-in")
+
+ self.setTitle(self.InstallPage, self.downloadText)
+ self.installPushButton.setText(self.downloadText)
+ self.bg = self.pathLineEdit.paletteBackgroundColor()
+ self.download = True
+ self.path = u''
+ self.norm_model = norm_model
+ self.waitdlg = None
+ self.device_uri = device_uri
+ self.plugin_lib = plugin_lib
+ self.fw_download = fw_download
+ self.core = core
+
+
+ def showPage(self, page):
+ if page is self.SourcePage:
+ self.setFinishEnabled(self.SourcePage, False)
+ self.setHelpEnabled(self.SourcePage, False)
+ #print "Source Page"
+
+ elif page is self.InstallPage:
+ self.setBackEnabled(self.InstallPage, False)
+ self.setFinishEnabled(self.SourcePage, False)
+ self.setHelpEnabled(self.InstallPage, False)
+ #print "Download Page"
+
+ QWizard.showPage(self, page)
+
+ def sourceGroup_clicked(self,a0):
+ print a0
+ if a0 == 0: # download
+ self.browsePushButton.setEnabled(False)
+ self.pathLineEdit.setEnabled(False)
+ self.setTitle(self.InstallPage, self.downloadText)
+ self.installPushButton.setText(self.downloadText)
+ self.download = True
+ self.setNextEnabled(self.SourcePage, True)
+
+ else: # local file
+ self.browsePushButton.setEnabled(True)
+ self.pathLineEdit.setEnabled(True)
+ s = self.__tr("Agree to License and Install Plug-in")
+ self.setTitle(self.InstallPage, s)
+ self.installPushButton.setText(s)
+ self.download = False
+ self.checkPath()
+
+ def browsePushButton_clicked(self):
+ workingDirectory = user_cfg.last_used.working_dir
+
+ if not workingDirectory or not os.path.exists(workingDirectory):
+ workingDirectory = os.path.expanduser("~")
+
+ log.debug("workingDirectory: %s" % workingDirectory)
+
+ dlg = QFileDialog(workingDirectory, self.__tr("HPLIP Plug-in (*.plugin)"), None, None, True)
+
+ dlg.setCaption("openfile")
+ dlg.setMode(QFileDialog.ExistingFile)
+ dlg.show()
+
+ if dlg.exec_loop() == QDialog.Accepted:
+ results = dlg.selectedFile()
+ workingDirectory = unicode(dlg.dir().absPath())
+ log.debug("results: %s" % results)
+ log.debug("workingDirectory: %s" % workingDirectory)
+
+ user_cfg.last_used.working_dir = workingDirectory
+
+ if results:
+ self.path = unicode(results)
+ self.pathLineEdit.setText(self.path)
+
+
+ def pathLineEdit_textChanged(self,a0):
+ self.path = unicode(a0)
+ self.checkPath()
+
+ def checkPath(self):
+ if not self.download and self.path and \
+ self.path.endswith('.plugin') and os.path.exists(self.path):
+
+ self.pathLineEdit.setPaletteBackgroundColor(self.bg)
+ self.setNextEnabled(self.SourcePage, True)
+ else:
+ self.pathLineEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+ self.setNextEnabled(self.SourcePage, False)
+
+
+ def cancelled(self):
+ print "Cancel!"
+
+ def installPushButton_clicked(self):
+ self.waitdlg = WaitForm(0, self.__tr("Initializing..."), self.cancelled, self, modal=1)
+ self.waitdlg.show()
+
+ try:
+ core = self.core
+ if self.download:
+ log.debug("Checking for network connection...")
+ self.waitdlg.setMessage(self.__tr("Checking for network connection..."))
+ ok = core.check_network_connection()
+
+ if ok:
+ self.waitdlg.setMessage(self.__tr("Downloading configuration..."))
+ log.debug("Downloading configuration...")
+ url, size, checksum, timestamp, ok = core.get_plugin_info(self.norm_model)
+ log.debug("url= %s" % url)
+ log.debug("size=%d" % size)
+ log.debug("checksum=%s" % checksum)
+ log.debug("timestamp=%f" % timestamp)
+
+ if url and size and checksum and timestamp and ok:
+ log.debug("Downloading plug-in...")
+ self.waitdlg.setMessage(self.__tr("Downloading plug-in..."))
+ ok, plugin_file = core.download_plugin(self.norm_model, url, size, checksum, timestamp)
+
+ if not ok:
+ self.FailureUI(self.__tr("<b>An error occured downloading plugin file.</b><p>Please check your network connection try again."))
+ self.reject()
+ return
+
+ else:
+ self.FailureUI(self.__tr("<b>No network connection found.</b><p>Please check your network connection try again."))
+ self.reject()
+ return
+
+
+ else: # local path
+ ok = core.copy_plugin(self.norm_model, self.path)
+
+ if not ok:
+ self.FailureUI(self.__tr("<b>Plugin copy failed.</b>"))
+ self.reject()
+ return
+
+
+ if ok:
+ log.debug("Installing plug-in...")
+ self.waitdlg.setMessage(self.__tr("Installing plug-in..."))
+ ok = core.install_plugin(self.norm_model, self.plugin_lib)
+
+ if not ok:
+ self.FailureUI(self.__tr("<b>Plug-in install failed.</b><p>"))
+ self.reject()
+ return
+
+ else:
+ log.debug("Plug-in installation complete.")
+
+ # Download firmware if needed
+ if self.fw_download:
+ self.waitdlg.setMessage(self.__tr("Downloading firmware..."))
+ try:
+ d = device.Device(self.device_uri)
+ except Error:
+ self.FailureUI(self.__tr("<b>An error occured downloading firmware file.</b><p>Please check your printer and try again."))
+ self.reject()
+ return
+
+ if d.downloadFirmware():
+ log.debug("Done.")
+
+ d.close()
+
+ finally:
+ if self.waitdlg is not None:
+ self.waitdlg.hide()
+ self.waitdlg.close()
+ self.waitdlg = None
+
+ self.accept()
+
+
+ def reject(self):
+ QWizard.reject(self)
+
+ def accept(self):
+ QWizard.accept(self)
+
+ def FailureUI(self, error_text):
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", ""))
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PluginForm",s,c)
+
diff --git a/ui/pluginform_base.py b/ui/pluginform_base.py
new file mode 100644
index 000000000..efaf4d40e
--- /dev/null
+++ b/ui/pluginform_base.py
@@ -0,0 +1,148 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'ui/pluginform_base.ui'
+#
+# Created: Fri Sep 21 09:24:18 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.17
+#
+# WARNING! All changes made in this file will be lost!
+
+
+from qt import *
+
+
+class PluginForm_base(QWizard):
+ def __init__(self,parent = None,name = None,modal = 0,fl = 0):
+ QWizard.__init__(self,parent,name,modal,fl)
+
+ if not name:
+ self.setName("PluginForm_base")
+
+
+
+ self.SourcePage = QWidget(self,"SourcePage")
+ SourcePageLayout = QGridLayout(self.SourcePage,1,1,11,6,"SourcePageLayout")
+
+ self.textLabel1 = QLabel(self.SourcePage,"textLabel1")
+ self.textLabel1.setAlignment(QLabel.WordBreak | QLabel.AlignVCenter)
+
+ SourcePageLayout.addWidget(self.textLabel1,0,0)
+ spacer9 = QSpacerItem(20,60,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ SourcePageLayout.addItem(spacer9,3,0)
+
+ self.sourceGroup = QButtonGroup(self.SourcePage,"sourceGroup")
+ self.sourceGroup.setColumnLayout(0,Qt.Vertical)
+ self.sourceGroup.layout().setSpacing(6)
+ self.sourceGroup.layout().setMargin(11)
+ sourceGroupLayout = QGridLayout(self.sourceGroup.layout())
+ sourceGroupLayout.setAlignment(Qt.AlignTop)
+
+ self.radioButton5 = QRadioButton(self.sourceGroup,"radioButton5")
+ self.sourceGroup.insert( self.radioButton5,1)
+
+ sourceGroupLayout.addWidget(self.radioButton5,1,0)
+
+ self.pathLineEdit = QLineEdit(self.sourceGroup,"pathLineEdit")
+ self.pathLineEdit.setEnabled(0)
+
+ sourceGroupLayout.addWidget(self.pathLineEdit,2,0)
+
+ self.browsePushButton = QPushButton(self.sourceGroup,"browsePushButton")
+ self.browsePushButton.setEnabled(0)
+
+ sourceGroupLayout.addWidget(self.browsePushButton,2,1)
+
+ self.radioButton4 = QRadioButton(self.sourceGroup,"radioButton4")
+ self.radioButton4.setChecked(1)
+ self.sourceGroup.insert( self.radioButton4,0)
+
+ sourceGroupLayout.addWidget(self.radioButton4,0,0)
+
+ SourcePageLayout.addWidget(self.sourceGroup,2,0)
+ spacer2 = QSpacerItem(20,21,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ SourcePageLayout.addItem(spacer2,1,0)
+ self.addPage(self.SourcePage,QString(""))
+
+ self.InstallPage = QWidget(self,"InstallPage")
+ InstallPageLayout = QGridLayout(self.InstallPage,1,1,11,6,"InstallPageLayout")
+
+ self.installPushButton = QPushButton(self.InstallPage,"installPushButton")
+
+ InstallPageLayout.addWidget(self.installPushButton,2,0)
+
+ self.textLabel2 = QLabel(self.InstallPage,"textLabel2")
+
+ InstallPageLayout.addWidget(self.textLabel2,1,0)
+
+ self.licenseTextEdit = QTextEdit(self.InstallPage,"licenseTextEdit")
+ self.licenseTextEdit.setWordWrap(QTextEdit.WidgetWidth)
+ self.licenseTextEdit.setReadOnly(1)
+
+ InstallPageLayout.addWidget(self.licenseTextEdit,0,0)
+ self.addPage(self.InstallPage,QString(""))
+
+ self.languageChange()
+
+ self.resize(QSize(597,398).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+
+ self.connect(self.sourceGroup,SIGNAL("clicked(int)"),self.sourceGroup_clicked)
+ self.connect(self.browsePushButton,SIGNAL("clicked()"),self.browsePushButton_clicked)
+ self.connect(self.pathLineEdit,SIGNAL("textChanged(const QString&)"),self.pathLineEdit_textChanged)
+ self.connect(self.installPushButton,SIGNAL("clicked()"),self.installPushButton_clicked)
+
+
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Plug-in Installer"))
+ self.textLabel1.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, or, if you already have a copy of the file, you can specify a path to the file."))
+ self.sourceGroup.setTitle(self.__tr("Plug-in Source"))
+ self.radioButton5.setText(self.__tr("Use an exisiting copy of the plug-in file (advanced):"))
+ self.browsePushButton.setText(self.__tr("Browse..."))
+ self.radioButton4.setText(self.__tr("Download the plug-in from an HP authorized server (recommended)"))
+ self.setTitle(self.SourcePage,self.__tr("Driver Plug-in Required"))
+ self.installPushButton.setText(QString.null)
+ self.textLabel2.setText(self.__tr("By installing the driver plug-in, you are agreeing to this license agreement."))
+ self.licenseTextEdit.setText(self.__tr("<b>LICENSE TERMS FOR HP Linux Imaging and Printing (HPLIP) Driver Plug-in</b>\n"
+"<p>\n"
+"These License Terms govern your Use of the HPLIP Driver Plug-in Software (the \"Software\"). USE OF THE SOFTWARE INCLUDING, WITHOUT LIMITATION, ANY DOCUMENTATION, IS SUBJECT TO THESE LICENSE TERMS AND THE APPLICABLE AS-IS WARRANTY STATEMENT. BY DOWNLOADING AND INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THESE TERMS. IF YOU DO NOT AGREE TO ALL OF THESE TERMS, DO NOT DOWNLOAD AND INSTALL THE SOFTWARE ON YOUR SYSTEM.\n"
+"<p>\n"
+"<b>1. License Grant.</b> HP grants you a license to Use one copy of the Software with HP printing products only. \"Use\" includes using, storing, loading, installing, executing, and displaying the Software. You may not modify the Software or disable any licensing or control features of the Software.\n"
+"<p>\n"
+"<b>2. Ownership.</b> The Software is owned and copyrighted by HP or its third party suppliers. Your license confers no title to, or ownership in, the Software and is not a sale of any rights in the Software. HP's third party suppliers may protect their rights in the Software in the event of any violation of these license terms.\n"
+"<p>\n"
+"<b>3. Copies and Adaptations.</b> You may only make copies or adaptations of the Software for archival purposes or when copying or adaptation is an essential step in the authorized Use of the Software. You must reproduce all copyright notices in the original Software on all copies or adaptations. You may not copy the Software onto any public network.\n"
+"<p>\n"
+"<b>4. No Disassembly.</b> You may not Disassemble the Software unless HP's prior written consent is obtained. \"Disassemble\" includes disassembling, decompiling, decrypting, and reverse engineering. In some jurisdictions, HP's consent may not be required for limited Disassembly. Upon request, you will provide HP with reasonably detailed information regarding any Disassembly.\n"
+"<p>\n"
+"<b>5. No Transfer.</b> You may not assign, sublicense or otherwise transfer all or any part of these License Terms or the Software.\n"
+"<p>\n"
+"<b>6. Termination.</b> HP may terminate your license, upon notice, for failure to comply with any of these License Terms. Upon termination, you must immediately destroy the Software, together with all copies, adaptations and merged portions in any form.\n"
+"<p>\n"
+"<b>7. Export Requirements.</b> You may not export or re-export the Software or any copy or adaptation in violation of any applicable laws or regulations.\n"
+"<p>\n"
+"<b>8. U.S. Government Restricted Rights.</b> The Software has been developed entirely at private expense. It is delivered and licensed, as defined in any applicable DFARS, FARS, or other equivalent federal agency regulation or contract clause, as either \"commercial computer software\" or \"restricted computer software\", whichever is applicable. You have only those rights provided for such Software by the applicable clause or regulation or by these License Terms.\n"
+"<p>\n"
+"<b>9. DISCLAIMER OF WARRANTIES.</b> TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, HP AND ITS SUPPLIERS PROVIDE THE SOFTWARE \"AS IS\" AND WITH ALL FAULTS, AND HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE AND NON-INFRINGEMENT, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, AND OF LACK OF VIRUSES ALL WITH REGARD TO THE SOFTWARE. Some states/jurisdictions do not allow exclusion of implied warranties or limitations on the duration of implied warranties, so the above disclaimer may not apply to you in its entirety.\n"
+"<p>\n"
+"<b>10. LIMITATION OF LIABILITY.</b> Notwithstanding any damages that you might incur, the entire liability of HP and any of its suppliers under any provision of this agreement and your exclusive remedy for all of the foregoing shall be limited to the greater of the amount actually paid by you separately for the Software or U.S. $5.00. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL HP OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS OR CONFIDENTIAL OR OTHER INFORMATION, FOR BUSINESS INTERRUPTION, FOR PERSONAL INJURY, FOR LOSS OF PRIVACY ARISING OUT OF OR IN ANY WAY RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE, OR OTHERWISE IN CONNECTION WITH ANY PROVISION OF THIS AGREEMENT, EVEN IF HP OR ANY SUPPLIER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF THE REMEDY FAILS OF ITS ESSENTIAL PURPOSE. Some states/jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to you.\n"
+""))
+ self.setTitle(self.InstallPage,self.__tr("Install Driver Plug-in"))
+
+
+ def sourceGroup_clicked(self,a0):
+ print "PluginForm_base.sourceGroup_clicked(int): Not implemented yet"
+
+ def browsePushButton_clicked(self):
+ print "PluginForm_base.browsePushButton_clicked(): Not implemented yet"
+
+ def pathLineEdit_textChanged(self,a0):
+ print "PluginForm_base.pathLineEdit_textChanged(const QString&): Not implemented yet"
+
+ def downloadPushButton_clicked(self):
+ print "PluginForm_base.downloadPushButton_clicked(): Not implemented yet"
+
+ def installPushButton_clicked(self):
+ print "PluginForm_base.installPushButton_clicked(): Not implemented yet"
+
+ def __tr(self,s,c = None):
+ return qApp.translate("PluginForm_base",s,c)
diff --git a/ui/pluginform_base.ui b/ui/pluginform_base.ui
new file mode 100644
index 000000000..9b677f401
--- /dev/null
+++ b/ui/pluginform_base.ui
@@ -0,0 +1,237 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>PluginForm_base</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>PluginForm_base</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>597</width>
+ <height>398</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>HP Device Manager - Plug-in Installer</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>SourcePage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Driver Plug-in Required</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>An additional driver plug-in is required to operate this printer. You may download the plug-in directly from an HP authorized server, or, if you already have a copy of the file, you can specify a path to the file.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="2" column="0">
+ <property name="name">
+ <cstring>sourceGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Plug-in Source</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton5</cstring>
+ </property>
+ <property name="text">
+ <string>Use an exisiting copy of the plug-in file (advanced):</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="2" column="0">
+ <property name="name">
+ <cstring>pathLineEdit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>browsePushButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>radioButton4</cstring>
+ </property>
+ <property name="text">
+ <string>Download the plug-in from an HP authorized server (recommended)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>InstallPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Install Driver Plug-in</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>installPushButton</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>By installing the driver plug-in, you are agreeing to this license agreement.</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit" row="0" column="0">
+ <property name="name">
+ <cstring>licenseTextEdit</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;LICENSE TERMS FOR HP Linux Imaging and Printing (HPLIP) Driver Plug-in&lt;/b&gt;
+&lt;p&gt;
+These License Terms govern your Use of the HPLIP Driver Plug-in Software (the "Software"). USE OF THE SOFTWARE INCLUDING, WITHOUT LIMITATION, ANY DOCUMENTATION, IS SUBJECT TO THESE LICENSE TERMS AND THE APPLICABLE AS-IS WARRANTY STATEMENT. BY DOWNLOADING AND INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THESE TERMS. IF YOU DO NOT AGREE TO ALL OF THESE TERMS, DO NOT DOWNLOAD AND INSTALL THE SOFTWARE ON YOUR SYSTEM.
+&lt;p&gt;
+&lt;b&gt;1. License Grant.&lt;/b&gt; HP grants you a license to Use one copy of the Software with HP printing products only. "Use" includes using, storing, loading, installing, executing, and displaying the Software. You may not modify the Software or disable any licensing or control features of the Software.
+&lt;p&gt;
+&lt;b&gt;2. Ownership.&lt;/b&gt; The Software is owned and copyrighted by HP or its third party suppliers. Your license confers no title to, or ownership in, the Software and is not a sale of any rights in the Software. HP's third party suppliers may protect their rights in the Software in the event of any violation of these license terms.
+&lt;p&gt;
+&lt;b&gt;3. Copies and Adaptations.&lt;/b&gt; You may only make copies or adaptations of the Software for archival purposes or when copying or adaptation is an essential step in the authorized Use of the Software. You must reproduce all copyright notices in the original Software on all copies or adaptations. You may not copy the Software onto any public network.
+&lt;p&gt;
+&lt;b&gt;4. No Disassembly.&lt;/b&gt; You may not Disassemble the Software unless HP's prior written consent is obtained. "Disassemble" includes disassembling, decompiling, decrypting, and reverse engineering. In some jurisdictions, HP's consent may not be required for limited Disassembly. Upon request, you will provide HP with reasonably detailed information regarding any Disassembly.
+&lt;p&gt;
+&lt;b&gt;5. No Transfer.&lt;/b&gt; You may not assign, sublicense or otherwise transfer all or any part of these License Terms or the Software.
+&lt;p&gt;
+&lt;b&gt;6. Termination.&lt;/b&gt; HP may terminate your license, upon notice, for failure to comply with any of these License Terms. Upon termination, you must immediately destroy the Software, together with all copies, adaptations and merged portions in any form.
+&lt;p&gt;
+&lt;b&gt;7. Export Requirements.&lt;/b&gt; You may not export or re-export the Software or any copy or adaptation in violation of any applicable laws or regulations.
+&lt;p&gt;
+&lt;b&gt;8. U.S. Government Restricted Rights.&lt;/b&gt; The Software has been developed entirely at private expense. It is delivered and licensed, as defined in any applicable DFARS, FARS, or other equivalent federal agency regulation or contract clause, as either "commercial computer software" or "restricted computer software", whichever is applicable. You have only those rights provided for such Software by the applicable clause or regulation or by these License Terms.
+&lt;p&gt;
+&lt;b&gt;9. DISCLAIMER OF WARRANTIES.&lt;/b&gt; TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, HP AND ITS SUPPLIERS PROVIDE THE SOFTWARE "AS IS" AND WITH ALL FAULTS, AND HEREBY DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF TITLE AND NON-INFRINGEMENT, ANY IMPLIED WARRANTIES, DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE, AND OF LACK OF VIRUSES ALL WITH REGARD TO THE SOFTWARE. Some states/jurisdictions do not allow exclusion of implied warranties or limitations on the duration of implied warranties, so the above disclaimer may not apply to you in its entirety.
+&lt;p&gt;
+&lt;b&gt;10. LIMITATION OF LIABILITY.&lt;/b&gt; Notwithstanding any damages that you might incur, the entire liability of HP and any of its suppliers under any provision of this agreement and your exclusive remedy for all of the foregoing shall be limited to the greater of the amount actually paid by you separately for the Software or U.S. $5.00. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL HP OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS OR CONFIDENTIAL OR OTHER INFORMATION, FOR BUSINESS INTERRUPTION, FOR PERSONAL INJURY, FOR LOSS OF PRIVACY ARISING OUT OF OR IN ANY WAY RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE, OR OTHERWISE IN CONNECTION WITH ANY PROVISION OF THIS AGREEMENT, EVEN IF HP OR ANY SUPPLIER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND EVEN IF THE REMEDY FAILS OF ITS ESSENTIAL PURPOSE. Some states/jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to you.
+</string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>sourceGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>PluginForm_base</receiver>
+ <slot>sourceGroup_clicked(int)</slot>
+ </connection>
+ <connection>
+ <sender>browsePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>PluginForm_base</receiver>
+ <slot>browsePushButton_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>pathLineEdit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>PluginForm_base</receiver>
+ <slot>pathLineEdit_textChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>installPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>PluginForm_base</receiver>
+ <slot>installPushButton_clicked()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">pluginform_base.ui.h</include>
+</includes>
+<slots>
+ <slot>sourceGroup_clicked( int )</slot>
+ <slot>browsePushButton_clicked()</slot>
+ <slot>pathLineEdit_textChanged( const QString &amp; )</slot>
+ <slot>downloadPushButton_clicked()</slot>
+ <slot>installPushButton_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/ui/printerform.py b/ui/printerform.py
index a78dcf7f9..84a9e77f6 100644
--- a/ui/printerform.py
+++ b/ui/printerform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -18,103 +18,45 @@
#
# Authors: Don Welch
-
+# Qt
from qt import *
-from printerform_base import PrinterForm_base
+from scrollprint import ScrollPrintView
+
+# Local
from base.g import *
from base.codes import *
-from base import utils, device, magic
+from base import utils, device
from prnt import cups
-import glob
-
-
-class RangeValidator(QValidator):
- def __init__(self, parent=None, name=None):
- QValidator.__init__(self, parent, name)
-
- def validate(self, input, pos):
- for x in str(input)[pos-1:]:
- if x not in '0123456789,-':
- return QValidator.Invalid, pos
- return QValidator.Acceptable, pos
-
-
-class PrinterForm(PrinterForm_base):
+class PrinterForm(QMainWindow):
def __init__(self, sock, bus='cups', device_uri=None, printer_name=None, args=None,
parent=None,name=None,modal=0,fl=0):
-
- PrinterForm_base.__init__(self,parent,name,modal,fl)
+
+ QMainWindow.__init__(self,parent,name,fl)
+
self.sock = sock
self.device_uri = device_uri
self.printer_name = printer_name
self.file_list = []
- self.auto_duplex_button_group = 0
- self.orientation_button_group = 0
- self.pages_button_group = 0
+ self.args = args
self.init_failed = False
-
- self.pageRangeEdit.setValidator(RangeValidator(self.pageRangeEdit))
-
- icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
- self.setIcon(icon)
- pix = QPixmap(os.path.join(prop.image_dir, 'folder_open.png'))
- self.addFileButton.setPixmap(pix)
- pix = QPixmap(os.path.join(prop.image_dir, 'folder_remove.png'))
- self.delFileButton.setPixmap(pix)
- pix = QPixmap(os.path.join(prop.image_dir, 'status_refresh.png'))
- self.refreshToolButton.setPixmap(pix)
- self.fileListView.setSorting(-1)
-
- self.allowable_mime_types = cups.getAllowableMIMETypes()
- log.debug(self.allowable_mime_types)
-
- self.MIME_TYPES_DESC = \
- {
- "application/pdf" : self.__tr("PDF Document"),
- "application/postscript" : self.__tr("Postscript Document"),
- "application/vnd.hp-HPGL" : self.__tr("HP Graphics Language File"),
- "application/x-cshell" : self.__tr("C Shell Script"),
- "application/x-perl" : self.__tr("Perl Script"),
- "application/x-python" : self.__tr("Python Program"),
- "application/x-shell" : self.__tr("Shell Script"),
- "text/plain" : self.__tr("Plain Text"),
- "text/html" : self.__tr("HTML Dcoument"),
- "image/gif" : self.__tr("GIF Image"),
- "image/png" : self.__tr("PNG Image"),
- "image/jpeg" : self.__tr("JPEG Image"),
- "image/tiff" : self.__tr("TIFF Image"),
- "image/x-bitmap" : self.__tr("Bitmap (BMP) Image"),
- "image/x-photocd" : self.__tr("Photo CD Image"),
- "image/x-portable-anymap" : self.__tr("Portable Image (PNM)"),
- "image/x-portable-bitmap" : self.__tr("Portable B&W Image (PBM)"),
- "image/x-portable-graymap" : self.__tr("Portable Grayscale Image (PGM)"),
- "image/x-portable-pixmap" : self.__tr("Portable Color Image (PPM)"),
- "image/x-sgi-rgb" : self.__tr("SGI RGB"),
- "image/x-xbitmap" : self.__tr("X11 Bitmap (XBM)"),
- "image/x-xpixmap" : self.__tr("X11 Pixmap (XPM)"),
- "image/x-sun-raster" : self.__tr("Sun Raster Format"),
- }
-
- if args is not None:
- for f in args:
- self.addFile(f)
-
+
+ self.statusBar()
+
icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
self.setIcon(icon)
- pix = QPixmap(os.path.join(prop.image_dir, 'folder_open.png'))
- self.addFileButton.setPixmap(pix)
-
- pix = QPixmap(os.path.join(prop.image_dir, 'folder_remove.png'))
- self.delFileButton.setPixmap(pix)
+ if not name:
+ self.setName("Form3")
- pix = QPixmap(os.path.join(prop.image_dir, 'status_refresh.png'))
- self.refreshToolButton.setPixmap(pix)
+ self.setCentralWidget(QWidget(self,"qt_central_widget"))
+ self.FormLayout = QGridLayout(self.centralWidget(),1,1,11,6,"FormLayout")
- self.fileListView.setSorting(-1)
+ self.languageChange()
+ self.resize(QSize(600,480).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
if self.device_uri and self.printer_name:
log.error("You may not specify both a printer (-p) and a device (-d).")
@@ -126,13 +68,13 @@ class PrinterForm(PrinterForm_base):
log.debug(self.cups_printers)
if not self.device_uri and not self.printer_name:
- t = device.probeDevices(self.sock, bus=bus, filter='none')
+ t = device.probeDevices(bus=bus)
probed_devices = []
-
+
for d in t:
if d.startswith('hp:'):
probed_devices.append(d)
-
+
log.debug(probed_devices)
max_deviceid_size, x, devices = 0, 0, {}
@@ -152,19 +94,38 @@ class PrinterForm(PrinterForm_base):
self.init_failed = True
elif x == 1:
- log.info(utils.bold("Using device: %s" % devices[0][0]))
+ log.info(log.bold("Using device: %s" % devices[0][0]))
self.device_uri = devices[0][0]
-
else:
- from chooseprinterdlg import ChoosePrinterDlg
- dlg = ChoosePrinterDlg(self.cups_printers)
+ from choosedevicedlg import ChooseDeviceDlg
+ dlg = ChooseDeviceDlg(devices)
if dlg.exec_loop() == QDialog.Accepted:
self.device_uri = dlg.device_uri
else:
self.init_failed = True
+ if not self.init_failed:
+ self.PrintView = ScrollPrintView(False, self.centralWidget(), self, "PrintView")
+ self.FormLayout.addWidget(self.PrintView,0,0)
+
+ try:
+ self.cur_device = device.Device(device_uri=self.device_uri,
+ printer_name=self.printer_name,
+ hpssd_sock=self.sock)
+ except Error, e:
+ log.error("Invalid device URI or printer name.")
+ self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-print and try again.")
+ self.init_failed = True
+
+ else:
+ self.device_uri = self.cur_device.device_uri
+ user_cfg.last_used.device_uri = self.device_uri
+
+ log.debug(self.device_uri)
+
+ self.statusBar().message(self.device_uri)
QTimer.singleShot(0, self.InitialUpdate)
@@ -173,315 +134,19 @@ class PrinterForm(PrinterForm_base):
if self.init_failed:
self.close()
return
-
- self.printer_list = []
-
- try:
- self.dev = device.Device(device_uri=self.device_uri,
- printer_name=self.printer_name,
- hpssd_sock=self.sock)
- except Error, e:
- log.error("Invalid device URI or printer name.")
- self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-print and try again.")
- self.close()
- return
-
- self.device_uri = self.dev.device_uri
-
- log.debug(self.device_uri)
- self.DeviceURIText.setText(self.device_uri)
-
- for p in self.cups_printers:
- if p.device_uri == self.device_uri:
- self.printer_list.append(p.name)
-
- for p in self.printer_list:
- self.printerNameComboBox.insertItem(p)
-
- self.UpdatePrinterStatus()
-
- if self.printer_name is None:
- self.printerNameComboBox.setCurrentItem(0)
-
- elif self.printer_name in self.printer_list:
- self.printerNameComboBox.setCurrentText(self.printer_name)
-
- self.current_printer = str(self.printerNameComboBox.currentText())
-
- self.UpdatePrinterInfo()
-
- def UpdatePrinterStatus(self):
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- 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()
- QApplication.restoreOverrideCursor()
+
+ self.PrintView.onDeviceChange(self.cur_device)
-
- if self.dev.device_state == DEVICE_STATE_NOT_FOUND:
- self.FailureUI(self.__tr("<b>Unable to communicate with device:</b><p>%s" % self.device_uri))
-
- try:
- self.StateText.setText(self.dev.status_desc)
- except AttributeError:
- pass
-
-
-
- def EventUI(self, event_code, event_type, error_string_short,
- error_string_long, retry_timeout, job_id,
- device_uri):
-
- log.debug("Event: device_uri=%s code=%d type=%s string=%s timeout=%d id=%d uri=%s" %
- (device_uri, event_code, event_type,
- error_string_short, retry_timeout, job_id, device_uri))
-
- if device_uri == self.dev.device_uri:
- self.StateText.setText(error_string_short)
-
-
- def addFile(self, path):
- path = os.path.realpath(path)
- if os.path.exists(path):
- mime_type = magic.mime_type(path)
- mime_type_desc = mime_type
-
- try:
- mime_type_desc = self.MIME_TYPES_DESC[mime_type]
- except KeyError:
- self.WarningUI(self.__tr("<b>You are trying to add a file that cannot be directly printed with this utility.</b><p>To print this file, use the print command in the application that created it."))
- else:
- log.debug("Adding file %s (%s,%s)" % (path, mime_type, mime_type_desc))
- self.file_list.append((path, mime_type, mime_type_desc))
- else:
- self.FailureUI(self.__tr("<b>Unable to add file '%s' to file list.</b><p>Check the file name and try again." % path))
-
- self.UpdateFileList()
-
- def UpdateFileList(self):
- self.fileListView.clear()
- temp = self.file_list[:]
- temp.reverse()
-
- for p, t, d in temp:
- i = QListViewItem(self.fileListView, os.path.basename(p), d, p)
- #self.fileListView.setSelected( i, True )
-
- non_empty_file_list = self.fileListView.childCount() > 0
- ##self.delFileButton.setEnabled( non_empty_file_list )
- self.printPushButton.setEnabled(non_empty_file_list)
-
- def addFileButton_clicked(self):
- self.setFocus()
-
- log.debug("isTopLevel %d" % self.isTopLevel())
- log.debug("hasFocus %d" % self.hasFocus())
- log.debug("isEnabled %d" % self.isEnabled())
-
- workingDirectory = os.path.expanduser("~")
-
- log.debug("workingDirectory: %s" % workingDirectory)
-
- dlg = QFileDialog(workingDirectory, QString.null, None, None, True)
-
- dlg.setCaption("openfile")
- dlg.setMode(QFileDialog.ExistingFile)
- dlg.show()
-
- if dlg.exec_loop() == QDialog.Accepted:
- results = dlg.selectedFile()
- workingDirectory = dlg.url()
- log.debug("results: %s" % results)
- log.debug("workingDirectory: %s" % workingDirectory)
-
- if results:
- self.addFile(str(results))
-
-
-
- def delFileButton_clicked(self):
- try:
- path = self.fileListView.currentItem().text(2)
- except AttributeError:
- return
- else:
- temp = self.file_list[:]
- index = 0
- for p, t, d in temp:
- if p == path:
- del self.file_list[index]
- break
- index += 1
-
- self.UpdateFileList()
-
-
- def fileListView_currentChanged(self,item):
- #print item
- pass
-
- def printerNameComboBox_highlighted(self,a0):
- self.current_printer = str(a0)
- self.UpdatePrinterInfo()
-
- def UpdatePrinterInfo(self):
- for p in self.cups_printers:
- if p.name == self.current_printer:
-
- try:
- self.LocationText.setText(p.location)
- except AttributeError:
- self.LocationText.setText('')
-
- try:
- self.CommentText.setText(p.info)
- except AttributeError:
- self.CommentText.setText('')
-
- cups.openPPD(p.name)
- self.UpdateDuplex()
- cups.closePPD()
- break
-
- def UpdateDuplex(self):
- duplex = cups.getPPDOption("Duplex")
- if duplex is not None:
- if duplex.startswith("long"):
- self.duplexButtonGroup.setButton(1)
- self.auto_duplex_button_group = 1
- elif duplex.startswith("short"):
- self.duplexButtonGroup.setButton(2)
- self.auto_duplex_button_group = 2
- else:
- self.duplexButtonGroup.setButton(0)
- self.auto_duplex_button_group = 0
- else:
- self.duplexButtonGroup.setEnabled(False)
-
-
- def pagesButtonGroup_clicked(self,item):
- self.pageRangeEdit.setEnabled(item == 1)
-
- def printPushButton_clicked(self):
- copies = int(self.copiesSpinBox.value())
- rev = bool(self.reverseCheckBox.isChecked())
- collate = bool(self.collateCheckBox.isChecked())
- all_pages = self.pages_button_group == 0
- page_range = str(self.pageRangeEdit.text())
- page_set = int(self.pageSetComboBox.currentItem())
- nup = int(str(self.nUpComboBox.currentText()))
- mirror = bool(self.mirrorCheckBox.isChecked())
-
- for p, t, d in self.file_list:
-
- alt_nup = (nup > 1 and t == 'application/postscript' and utils.which('psnup'))
+ if self.args is not None:
+ for f in self.args:
+ self.PrintView.addFile(f)
- if utils.which('lpr'):
- if alt_nup:
- cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lpr -P', self.current_printer])
- else:
- cmd = ' '.join(['lpr -P', self.current_printer])
-
- if copies > 1:
- cmd = ' '.join([cmd, '-#%d' % copies])
-
- else:
- if alt_nup:
- cmd = ' '.join(['psnup', '-%d' % nup, ''.join(['"', p, '"']), '| lp -c -d', self.current_printer])
- else:
- cmd = ' '.join(['lp -c -d', self.current_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'])
-
- if rev:
- cmd = ' '.join([cmd, '-o outputorder=reverse'])
-
- if mirror:
- cmd = ' '.join([cmd, '-o mirror'])
-
- if collate and copies > 1:
- cmd = ' '.join([cmd, '-o Collate=True'])
-
- if t in ["application/x-cshell",
- "application/x-perl",
- "application/x-python",
- "application/x-shell",
- "text/plain",]:
-
- cmd = ' '.join([cmd, '-o prettyprint'])
-
- if nup > 1 and not alt_nup:
- cmd = ' '.join([cmd, '-o number-up=%d' % nup])
-
- if self.auto_duplex_button_group == 1: # long
- cmd = ' '.join([cmd, '-o sides=two-sided-long-edge'])
- elif self.auto_duplex_button_group == 2: # short
- cmd = ' '.join([cmd, '-o sides=two-sided-short-edge'])
- else:
- cmd = ' '.join([cmd, '-o sides=one-sided'])
-
- if self.orientation_button_group == 1:
- cmd = ' '.join([cmd, '-o landscape'])
-
- if not alt_nup:
- cmd = ''.join([cmd, ' "', p, '"'])
-
- log.debug("Printing: %s" % cmd)
-
- if os.system(cmd) != 0:
- log.error("Print command failed.")
- self.FailureUI(self.__tr("Print command failed."))
+ if self.printer_name is not None:
+ self.PrintView.onPrinterChange(self.printer_name)
+
- del self.file_list[:]
- self.UpdateFileList()
-
- def pagesButtonGroup_clicked(self,a0):
- self.pages_button_group = a0
- self.pageRangeEdit.setEnabled(a0 == 1)
-
-
- def duplexButtonGroup_clicked(self,a0):
- self.auto_duplex_button_group = a0
-
- def orientationButtonGroup_clicked(self,a0):
- self.orientation_button_group = a0
-
- def refreshToolButton_clicked(self):
- self.UpdatePrinterStatus()
-
-
- def SuccessUI(self):
- QMessageBox.information(self,
- self.caption(),
- self.__tr("<p><b>The operation completed successfully.</b>"),
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
def FailureUI(self, error_text):
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", ""))
QMessageBox.critical(self,
self.caption(),
error_text,
@@ -489,16 +154,9 @@ class PrinterForm(PrinterForm_base):
QMessageBox.NoButton,
QMessageBox.NoButton)
- def WarningUI(self, msg):
- QMessageBox.warning(self,
- self.caption(),
- msg,
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Print"))
+
def __tr(self,s,c = None):
return qApp.translate("PrinterForm",s,c)
-
-
diff --git a/ui/printerform_base.py b/ui/printerform_base.py
deleted file mode 100644
index 4e344af07..000000000
--- a/ui/printerform_base.py
+++ /dev/null
@@ -1,433 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'printerform_base.ui'
-#
-# Created: Wed Jan 11 14:42:39 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
-#
-# WARNING! All changes made in this file will be lost!
-
-
-from qt import *
-
-
-class PrinterForm_base(QDialog):
- def __init__(self,parent = None,name = None,modal = 0,fl = 0):
- QDialog.__init__(self,parent,name,modal,fl)
-
- if not name:
- self.setName("PrinterForm_base")
-
-
- PrinterForm_baseLayout = QGridLayout(self,1,1,11,6,"PrinterForm_baseLayout")
- spacer18 = QSpacerItem(430,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- PrinterForm_baseLayout.addItem(spacer18,3,0)
-
- self.pushButton5 = QPushButton(self,"pushButton5")
-
- PrinterForm_baseLayout.addWidget(self.pushButton5,3,1)
-
- self.printPushButton = QPushButton(self,"printPushButton")
- self.printPushButton.setEnabled(0)
-
- PrinterForm_baseLayout.addWidget(self.printPushButton,3,2)
-
- self.tabWidget3 = QTabWidget(self,"tabWidget3")
-
- self.tab = QWidget(self.tabWidget3,"tab")
- tabLayout = QGridLayout(self.tab,1,1,11,6,"tabLayout")
-
- self.groupBox5 = QGroupBox(self.tab,"groupBox5")
- self.groupBox5.setColumnLayout(0,Qt.Vertical)
- self.groupBox5.layout().setSpacing(6)
- self.groupBox5.layout().setMargin(11)
- groupBox5Layout = QGridLayout(self.groupBox5.layout())
- groupBox5Layout.setAlignment(Qt.AlignTop)
-
- layout4 = QHBoxLayout(None,0,6,"layout4")
-
- self.textLabel3 = QLabel(self.groupBox5,"textLabel3")
- layout4.addWidget(self.textLabel3)
-
- self.copiesSpinBox = QSpinBox(self.groupBox5,"copiesSpinBox")
- self.copiesSpinBox.setMaxValue(100)
- self.copiesSpinBox.setMinValue(1)
- layout4.addWidget(self.copiesSpinBox)
-
- groupBox5Layout.addLayout(layout4,0,0)
-
- self.collateCheckBox = QCheckBox(self.groupBox5,"collateCheckBox")
-
- groupBox5Layout.addWidget(self.collateCheckBox,1,0)
-
- self.reverseCheckBox = QCheckBox(self.groupBox5,"reverseCheckBox")
-
- groupBox5Layout.addMultiCellWidget(self.reverseCheckBox,2,2,0,1)
-
- tabLayout.addWidget(self.groupBox5,0,0)
- self.tabWidget3.insertTab(self.tab,QString.fromLatin1(""))
-
- self.tab_2 = QWidget(self.tabWidget3,"tab_2")
- tabLayout_2 = QGridLayout(self.tab_2,1,1,11,6,"tabLayout_2")
-
- self.pagesButtonGroup = QButtonGroup(self.tab_2,"pagesButtonGroup")
- self.pagesButtonGroup.setColumnLayout(0,Qt.Vertical)
- self.pagesButtonGroup.layout().setSpacing(6)
- self.pagesButtonGroup.layout().setMargin(11)
- pagesButtonGroupLayout = QGridLayout(self.pagesButtonGroup.layout())
- pagesButtonGroupLayout.setAlignment(Qt.AlignTop)
-
- self.radioButton3 = QRadioButton(self.pagesButtonGroup,"radioButton3")
- self.radioButton3.setChecked(1)
-
- pagesButtonGroupLayout.addMultiCellWidget(self.radioButton3,0,0,0,1)
-
- self.radioButton4 = QRadioButton(self.pagesButtonGroup,"radioButton4")
-
- pagesButtonGroupLayout.addMultiCellWidget(self.radioButton4,1,1,0,1)
-
- self.line2 = QFrame(self.pagesButtonGroup,"line2")
- self.line2.setFrameShape(QFrame.HLine)
- self.line2.setFrameShadow(QFrame.Sunken)
- self.line2.setFrameShape(QFrame.HLine)
-
- pagesButtonGroupLayout.addMultiCellWidget(self.line2,2,2,0,5)
- spacer26 = QSpacerItem(230,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- pagesButtonGroupLayout.addMultiCell(spacer26,0,0,2,5)
-
- self.pageSetComboBox = QComboBox(0,self.pagesButtonGroup,"pageSetComboBox")
-
- pagesButtonGroupLayout.addMultiCellWidget(self.pageSetComboBox,4,4,4,5)
-
- self.textLabel11 = QLabel(self.pagesButtonGroup,"textLabel11")
-
- pagesButtonGroupLayout.addMultiCellWidget(self.textLabel11,3,4,0,0)
-
- self.pageRangeEdit = QLineEdit(self.pagesButtonGroup,"pageRangeEdit")
- self.pageRangeEdit.setEnabled(0)
-
- pagesButtonGroupLayout.addMultiCellWidget(self.pageRangeEdit,1,1,2,5)
-
- self.textLabel12 = QLabel(self.pagesButtonGroup,"textLabel12")
-
- pagesButtonGroupLayout.addMultiCellWidget(self.textLabel12,6,6,0,2)
- spacer30 = QSpacerItem(31,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- pagesButtonGroupLayout.addMultiCell(spacer30,6,6,3,4)
-
- self.nUpComboBox = QComboBox(0,self.pagesButtonGroup,"nUpComboBox")
-
- pagesButtonGroupLayout.addWidget(self.nUpComboBox,6,5)
-
- self.line2_2 = QFrame(self.pagesButtonGroup,"line2_2")
- self.line2_2.setFrameShape(QFrame.HLine)
- self.line2_2.setFrameShadow(QFrame.Sunken)
- self.line2_2.setFrameShape(QFrame.HLine)
-
- pagesButtonGroupLayout.addMultiCellWidget(self.line2_2,5,5,0,5)
- spacer29 = QSpacerItem(140,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- pagesButtonGroupLayout.addMultiCell(spacer29,4,4,1,3)
-
- tabLayout_2.addWidget(self.pagesButtonGroup,0,0)
- self.tabWidget3.insertTab(self.tab_2,QString.fromLatin1(""))
-
- self.TabPage = QWidget(self.tabWidget3,"TabPage")
- TabPageLayout = QGridLayout(self.TabPage,1,1,11,6,"TabPageLayout")
-
- self.orientationButtonGroup = QButtonGroup(self.TabPage,"orientationButtonGroup")
- self.orientationButtonGroup.setColumnLayout(0,Qt.Vertical)
- self.orientationButtonGroup.layout().setSpacing(6)
- self.orientationButtonGroup.layout().setMargin(11)
- orientationButtonGroupLayout = QGridLayout(self.orientationButtonGroup.layout())
- orientationButtonGroupLayout.setAlignment(Qt.AlignTop)
-
- self.radioButton5 = QRadioButton(self.orientationButtonGroup,"radioButton5")
- self.radioButton5.setChecked(1)
-
- orientationButtonGroupLayout.addWidget(self.radioButton5,0,0)
-
- self.radioButton6 = QRadioButton(self.orientationButtonGroup,"radioButton6")
-
- orientationButtonGroupLayout.addWidget(self.radioButton6,1,0)
-
- TabPageLayout.addWidget(self.orientationButtonGroup,0,0)
-
- self.buttonGroup4 = QButtonGroup(self.TabPage,"buttonGroup4")
- self.buttonGroup4.setColumnLayout(0,Qt.Vertical)
- self.buttonGroup4.layout().setSpacing(6)
- self.buttonGroup4.layout().setMargin(11)
- buttonGroup4Layout = QGridLayout(self.buttonGroup4.layout())
- buttonGroup4Layout.setAlignment(Qt.AlignTop)
-
- self.mirrorCheckBox = QCheckBox(self.buttonGroup4,"mirrorCheckBox")
-
- buttonGroup4Layout.addWidget(self.mirrorCheckBox,0,0)
-
- TabPageLayout.addWidget(self.buttonGroup4,0,1)
- self.tabWidget3.insertTab(self.TabPage,QString.fromLatin1(""))
-
- self.TabPage_2 = QWidget(self.tabWidget3,"TabPage_2")
- TabPageLayout_2 = QGridLayout(self.TabPage_2,1,1,11,6,"TabPageLayout_2")
-
- self.duplexButtonGroup = QButtonGroup(self.TabPage_2,"duplexButtonGroup")
- self.duplexButtonGroup.setExclusive(1)
- self.duplexButtonGroup.setColumnLayout(0,Qt.Vertical)
- self.duplexButtonGroup.layout().setSpacing(6)
- self.duplexButtonGroup.layout().setMargin(11)
- duplexButtonGroupLayout = QGridLayout(self.duplexButtonGroup.layout())
- duplexButtonGroupLayout.setAlignment(Qt.AlignTop)
-
- self.radioButton7 = QRadioButton(self.duplexButtonGroup,"radioButton7")
- self.radioButton7.setChecked(1)
-
- duplexButtonGroupLayout.addWidget(self.radioButton7,0,0)
-
- self.radioButton8 = QRadioButton(self.duplexButtonGroup,"radioButton8")
-
- duplexButtonGroupLayout.addWidget(self.radioButton8,1,0)
-
- self.radioButton9 = QRadioButton(self.duplexButtonGroup,"radioButton9")
-
- duplexButtonGroupLayout.addWidget(self.radioButton9,2,0)
-
- TabPageLayout_2.addWidget(self.duplexButtonGroup,0,0)
-
- self.groupBox7 = QGroupBox(self.TabPage_2,"groupBox7")
- self.groupBox7.setEnabled(0)
- self.groupBox7.setColumnLayout(0,Qt.Vertical)
- self.groupBox7.layout().setSpacing(6)
- self.groupBox7.layout().setMargin(11)
- groupBox7Layout = QGridLayout(self.groupBox7.layout())
- groupBox7Layout.setAlignment(Qt.AlignTop)
-
- self.manualDuplexCheckBox = QCheckBox(self.groupBox7,"manualDuplexCheckBox")
- self.manualDuplexCheckBox.setEnabled(0)
-
- groupBox7Layout.addWidget(self.manualDuplexCheckBox,0,0)
-
- TabPageLayout_2.addWidget(self.groupBox7,1,0)
- self.tabWidget3.insertTab(self.TabPage_2,QString.fromLatin1(""))
-
- PrinterForm_baseLayout.addMultiCellWidget(self.tabWidget3,2,2,0,2)
-
- self.groupBox3 = QGroupBox(self,"groupBox3")
- self.groupBox3.setColumnLayout(0,Qt.Vertical)
- self.groupBox3.layout().setSpacing(6)
- self.groupBox3.layout().setMargin(11)
- groupBox3Layout = QGridLayout(self.groupBox3.layout())
- groupBox3Layout.setAlignment(Qt.AlignTop)
-
- self.textLabel4 = QLabel(self.groupBox3,"textLabel4")
-
- groupBox3Layout.addMultiCellWidget(self.textLabel4,4,4,0,1)
-
- self.textLabel5 = QLabel(self.groupBox3,"textLabel5")
-
- groupBox3Layout.addMultiCellWidget(self.textLabel5,5,5,0,1)
-
- self.textLabel10 = QLabel(self.groupBox3,"textLabel10")
-
- groupBox3Layout.addMultiCellWidget(self.textLabel10,3,3,0,1)
-
- self.printerNameComboBox = QComboBox(0,self.groupBox3,"printerNameComboBox")
- self.printerNameComboBox.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,QSizePolicy.Fixed,80,0,self.printerNameComboBox.sizePolicy().hasHeightForWidth()))
-
- groupBox3Layout.addWidget(self.printerNameComboBox,0,2)
-
- self.textLabel2 = QLabel(self.groupBox3,"textLabel2")
-
- groupBox3Layout.addMultiCellWidget(self.textLabel2,0,0,0,1)
-
- self.line4 = QFrame(self.groupBox3,"line4")
- self.line4.setFrameShape(QFrame.HLine)
- self.line4.setFrameShadow(QFrame.Sunken)
- self.line4.setFrameShape(QFrame.HLine)
-
- groupBox3Layout.addMultiCellWidget(self.line4,1,2,0,2)
-
- self.line3 = QFrame(self.groupBox3,"line3")
- self.line3.setFrameShape(QFrame.HLine)
- self.line3.setFrameShadow(QFrame.Sunken)
- self.line3.setFrameShape(QFrame.HLine)
-
- groupBox3Layout.addMultiCellWidget(self.line3,6,6,0,2)
-
- self.CommentText = QLabel(self.groupBox3,"CommentText")
- self.CommentText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.CommentText.sizePolicy().hasHeightForWidth()))
-
- groupBox3Layout.addWidget(self.CommentText,5,2)
-
- self.LocationText = QLabel(self.groupBox3,"LocationText")
- self.LocationText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.LocationText.sizePolicy().hasHeightForWidth()))
-
- groupBox3Layout.addWidget(self.LocationText,4,2)
-
- self.DeviceURIText = QLabel(self.groupBox3,"DeviceURIText")
- self.DeviceURIText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.DeviceURIText.sizePolicy().hasHeightForWidth()))
-
- groupBox3Layout.addMultiCellWidget(self.DeviceURIText,2,3,2,2)
-
- self.textLabel7 = QLabel(self.groupBox3,"textLabel7")
-
- groupBox3Layout.addWidget(self.textLabel7,7,0)
-
- layout6 = QHBoxLayout(None,0,6,"layout6")
-
- self.StateText = QLabel(self.groupBox3,"StateText")
- self.StateText.setSizePolicy(QSizePolicy(QSizePolicy.Ignored,QSizePolicy.Preferred,0,0,self.StateText.sizePolicy().hasHeightForWidth()))
- layout6.addWidget(self.StateText)
-
- self.refreshToolButton = QToolButton(self.groupBox3,"refreshToolButton")
- self.refreshToolButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.refreshToolButton.sizePolicy().hasHeightForWidth()))
- self.refreshToolButton.setMinimumSize(QSize(32,32))
- self.refreshToolButton.setMaximumSize(QSize(32,32))
- layout6.addWidget(self.refreshToolButton)
-
- groupBox3Layout.addMultiCellLayout(layout6,7,7,1,2)
-
- PrinterForm_baseLayout.addMultiCellWidget(self.groupBox3,0,0,0,2)
-
- self.groupBox4 = QGroupBox(self,"groupBox4")
- self.groupBox4.setColumnLayout(0,Qt.Vertical)
- self.groupBox4.layout().setSpacing(6)
- self.groupBox4.layout().setMargin(11)
- groupBox4Layout = QGridLayout(self.groupBox4.layout())
- groupBox4Layout.setAlignment(Qt.AlignTop)
-
- self.fileListView = QListView(self.groupBox4,"fileListView")
- self.fileListView.addColumn(self.__tr("Name"))
- self.fileListView.addColumn(self.__tr("Type"))
- self.fileListView.addColumn(self.__tr("Path"))
- self.fileListView.setAllColumnsShowFocus(1)
-
- groupBox4Layout.addMultiCellWidget(self.fileListView,0,2,0,0)
-
- self.addFileButton = QToolButton(self.groupBox4,"addFileButton")
- self.addFileButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.addFileButton.sizePolicy().hasHeightForWidth()))
- self.addFileButton.setMinimumSize(QSize(32,32))
- self.addFileButton.setMaximumSize(QSize(32,32))
-
- groupBox4Layout.addWidget(self.addFileButton,0,1)
-
- self.delFileButton = QToolButton(self.groupBox4,"delFileButton")
- self.delFileButton.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.delFileButton.sizePolicy().hasHeightForWidth()))
- self.delFileButton.setMinimumSize(QSize(32,32))
- self.delFileButton.setMaximumSize(QSize(32,32))
-
- groupBox4Layout.addWidget(self.delFileButton,1,1)
- spacer23 = QSpacerItem(20,61,QSizePolicy.Minimum,QSizePolicy.Expanding)
- groupBox4Layout.addItem(spacer23,2,1)
-
- PrinterForm_baseLayout.addMultiCellWidget(self.groupBox4,1,1,0,2)
-
- self.languageChange()
-
- self.resize(QSize(622,654).expandedTo(self.minimumSizeHint()))
- self.clearWState(Qt.WState_Polished)
-
- self.connect(self.pushButton5,SIGNAL("clicked()"),self.reject)
- self.connect(self.addFileButton,SIGNAL("clicked()"),self.addFileButton_clicked)
- self.connect(self.delFileButton,SIGNAL("clicked()"),self.delFileButton_clicked)
- self.connect(self.fileListView,SIGNAL("currentChanged(QListViewItem*)"),self.fileListView_currentChanged)
- self.connect(self.printerNameComboBox,SIGNAL("highlighted(const QString&)"),self.printerNameComboBox_highlighted)
- self.connect(self.pagesButtonGroup,SIGNAL("clicked(int)"),self.pagesButtonGroup_clicked)
- self.connect(self.printPushButton,SIGNAL("clicked()"),self.printPushButton_clicked)
- self.connect(self.duplexButtonGroup,SIGNAL("clicked(int)"),self.duplexButtonGroup_clicked)
- self.connect(self.orientationButtonGroup,SIGNAL("clicked(int)"),self.orientationButtonGroup_clicked)
- self.connect(self.refreshToolButton,SIGNAL("clicked()"),self.refreshToolButton_clicked)
-
-
- def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Print"))
- self.pushButton5.setText(self.__tr("Close"))
- QToolTip.add(self.pushButton5,QString.null)
- self.printPushButton.setText(self.__tr("Print"))
- QToolTip.add(self.printPushButton,QString.null)
- self.groupBox5.setTitle(self.__tr("Copies"))
- self.textLabel3.setText(self.__tr("Copies:"))
- QToolTip.add(self.copiesSpinBox,self.__tr("Number of copies"))
- self.collateCheckBox.setText(self.__tr("Collate copies"))
- self.reverseCheckBox.setText(self.__tr("Reverse print order"))
- self.tabWidget3.changeTab(self.tab,self.__tr("Copies"))
- self.pagesButtonGroup.setTitle(self.__tr("Pages"))
- self.radioButton3.setText(self.__tr("All pages"))
- self.radioButton4.setText(self.__tr("Page range:"))
- self.pageSetComboBox.clear()
- self.pageSetComboBox.insertItem(self.__tr("All pages"))
- self.pageSetComboBox.insertItem(self.__tr("Even pages"))
- self.pageSetComboBox.insertItem(self.__tr("Odd pages"))
- self.textLabel11.setText(self.__tr("Page set:"))
- QToolTip.add(self.pageRangeEdit,self.__tr("Enter pages or ranges of pages separated by commas (e.g., 1-2,4,6-7)"))
- self.textLabel12.setText(self.__tr("Pages per sheet (N-up):"))
- self.nUpComboBox.clear()
- self.nUpComboBox.insertItem(self.__tr("1"))
- self.nUpComboBox.insertItem(self.__tr("2"))
- self.nUpComboBox.insertItem(self.__tr("4"))
- self.nUpComboBox.insertItem(self.__tr("8"))
- self.nUpComboBox.insertItem(self.__tr("16"))
- self.tabWidget3.changeTab(self.tab_2,self.__tr("Pages"))
- self.orientationButtonGroup.setTitle(self.__tr("Orientation"))
- self.radioButton5.setText(self.__tr("Portrait"))
- self.radioButton6.setText(self.__tr("Landscape"))
- self.buttonGroup4.setTitle(self.__tr("Mirror"))
- self.mirrorCheckBox.setText(self.__tr("Enable mirror printing"))
- self.tabWidget3.changeTab(self.TabPage,self.__tr("Orientation"))
- self.duplexButtonGroup.setTitle(self.__tr("Automatic Duplex"))
- self.radioButton7.setText(self.__tr("Off"))
- self.radioButton8.setText(self.__tr("Long edge (standard)"))
- self.radioButton9.setText(self.__tr("Short edge (flip)"))
- self.groupBox7.setTitle(self.__tr("Manual Duplex"))
- self.manualDuplexCheckBox.setText(self.__tr("Manual duplex"))
- self.tabWidget3.changeTab(self.TabPage_2,self.__tr("Duplex"))
- self.groupBox3.setTitle(self.__tr("Printer"))
- self.textLabel4.setText(self.__tr("Location:"))
- self.textLabel5.setText(self.__tr("Comment:"))
- self.textLabel10.setText(self.__tr("Device URI:"))
- QToolTip.add(self.printerNameComboBox,self.__tr("CUPS printer name"))
- self.textLabel2.setText(self.__tr("Name:"))
- self.CommentText.setText(QString.null)
- self.LocationText.setText(QString.null)
- self.DeviceURIText.setText(QString.null)
- self.textLabel7.setText(self.__tr("Status:"))
- self.StateText.setText(QString.null)
- self.refreshToolButton.setText(QString.null)
- QToolTip.add(self.refreshToolButton,self.__tr("Refresh status"))
- self.groupBox4.setTitle(self.__tr("File(s)"))
- self.fileListView.header().setLabel(0,self.__tr("Name"))
- self.fileListView.header().setLabel(1,self.__tr("Type"))
- self.fileListView.header().setLabel(2,self.__tr("Path"))
- QToolTip.add(self.fileListView,self.__tr("List of files to print"))
- self.addFileButton.setText(QString.null)
- self.addFileButton.setTextLabel(self.__tr("Add file to list"))
- self.delFileButton.setText(QString.null)
- self.delFileButton.setTextLabel(self.__tr("Remove file from list"))
-
-
- def addFileButton_clicked(self):
- print "PrinterForm_base.addFileButton_clicked(): Not implemented yet"
-
- def delFileButton_clicked(self):
- print "PrinterForm_base.delFileButton_clicked(): Not implemented yet"
-
- def fileListView_currentChanged(self,a0):
- print "PrinterForm_base.fileListView_currentChanged(QListViewItem*): Not implemented yet"
-
- def printerNameComboBox_highlighted(self,a0):
- print "PrinterForm_base.printerNameComboBox_highlighted(const QString&): Not implemented yet"
-
- def pagesButtonGroup_clicked(self,a0):
- print "PrinterForm_base.pagesButtonGroup_clicked(int): Not implemented yet"
-
- def printPushButton_clicked(self):
- print "PrinterForm_base.printPushButton_clicked(): Not implemented yet"
-
- def duplexButtonGroup_clicked(self,a0):
- print "PrinterForm_base.duplexButtonGroup_clicked(int): Not implemented yet"
-
- def orientationButtonGroup_clicked(self,a0):
- print "PrinterForm_base.orientationButtonGroup_clicked(int): Not implemented yet"
-
- def refreshToolButton_clicked(self):
- print "PrinterForm_base.refreshToolButton_clicked(): Not implemented yet"
-
- def __tr(self,s,c = None):
- return qApp.translate("PrinterForm_base",s,c)
diff --git a/ui/printerform_base.ui b/ui/printerform_base.ui
deleted file mode 100644
index 332d4514d..000000000
--- a/ui/printerform_base.ui
+++ /dev/null
@@ -1,907 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>PrinterForm_base</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>PrinterForm_base</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>622</width>
- <height>654</height>
- </rect>
- </property>
- <property name="caption">
- <string>HP Device Manager - Print</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer row="3" column="0">
- <property name="name">
- <cstring>spacer18</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>430</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="3" column="1">
- <property name="name">
- <cstring>pushButton5</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- <property name="toolTip" stdset="0">
- <string></string>
- </property>
- </widget>
- <widget class="QPushButton" row="3" column="2">
- <property name="name">
- <cstring>printPushButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Print</string>
- </property>
- <property name="toolTip" stdset="0">
- <string></string>
- </property>
- </widget>
- <widget class="QTabWidget" row="2" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>tabWidget3</cstring>
- </property>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Copies</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QGroupBox" row="0" column="0">
- <property name="name">
- <cstring>groupBox5</cstring>
- </property>
- <property name="title">
- <string>Copies</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLayoutWidget" row="0" column="0">
- <property name="name">
- <cstring>layout4</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>Copies:</string>
- </property>
- </widget>
- <widget class="QSpinBox">
- <property name="name">
- <cstring>copiesSpinBox</cstring>
- </property>
- <property name="maxValue">
- <number>100</number>
- </property>
- <property name="minValue">
- <number>1</number>
- </property>
- <property name="toolTip" stdset="0">
- <string>Number of copies</string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QCheckBox" row="1" column="0">
- <property name="name">
- <cstring>collateCheckBox</cstring>
- </property>
- <property name="text">
- <string>Collate copies</string>
- </property>
- </widget>
- <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>reverseCheckBox</cstring>
- </property>
- <property name="text">
- <string>Reverse print order</string>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>tab</cstring>
- </property>
- <attribute name="title">
- <string>Pages</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QButtonGroup" row="0" column="0">
- <property name="name">
- <cstring>pagesButtonGroup</cstring>
- </property>
- <property name="title">
- <string>Pages</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>radioButton3</cstring>
- </property>
- <property name="text">
- <string>All pages</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>radioButton4</cstring>
- </property>
- <property name="text">
- <string>Page range:</string>
- </property>
- </widget>
- <widget class="Line" row="2" column="0" rowspan="1" colspan="6">
- <property name="name">
- <cstring>line2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <spacer row="0" column="2" rowspan="1" colspan="4">
- <property name="name">
- <cstring>spacer26</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>230</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QComboBox" row="4" column="4" rowspan="1" colspan="2">
- <item>
- <property name="text">
- <string>All pages</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Even pages</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Odd pages</string>
- </property>
- </item>
- <property name="name">
- <cstring>pageSetComboBox</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="3" column="0" rowspan="2" colspan="1">
- <property name="name">
- <cstring>textLabel11</cstring>
- </property>
- <property name="text">
- <string>Page set:</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="4">
- <property name="name">
- <cstring>pageRangeEdit</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip" stdset="0">
- <string>Enter pages or ranges of pages separated by commas (e.g., 1-2,4,6-7)</string>
- </property>
- </widget>
- <widget class="QLabel" row="6" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>textLabel12</cstring>
- </property>
- <property name="text">
- <string>Pages per sheet (N-up):</string>
- </property>
- </widget>
- <spacer row="6" column="3" rowspan="1" colspan="2">
- <property name="name">
- <cstring>spacer30</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>31</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QComboBox" row="6" column="5">
- <item>
- <property name="text">
- <string>1</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>2</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>4</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>8</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>16</string>
- </property>
- </item>
- <property name="name">
- <cstring>nUpComboBox</cstring>
- </property>
- </widget>
- <widget class="Line" row="5" column="0" rowspan="1" colspan="6">
- <property name="name">
- <cstring>line2_2</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <spacer row="4" column="1" rowspan="1" colspan="3">
- <property name="name">
- <cstring>spacer29</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>140</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>TabPage</cstring>
- </property>
- <attribute name="title">
- <string>Orientation</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QButtonGroup" row="0" column="0">
- <property name="name">
- <cstring>orientationButtonGroup</cstring>
- </property>
- <property name="title">
- <string>Orientation</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0">
- <property name="name">
- <cstring>radioButton5</cstring>
- </property>
- <property name="text">
- <string>Portrait</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0">
- <property name="name">
- <cstring>radioButton6</cstring>
- </property>
- <property name="text">
- <string>Landscape</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QButtonGroup" row="0" column="1">
- <property name="name">
- <cstring>buttonGroup4</cstring>
- </property>
- <property name="title">
- <string>Mirror</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QCheckBox" row="0" column="0">
- <property name="name">
- <cstring>mirrorCheckBox</cstring>
- </property>
- <property name="text">
- <string>Enable mirror printing</string>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget class="QWidget">
- <property name="name">
- <cstring>TabPage</cstring>
- </property>
- <attribute name="title">
- <string>Duplex</string>
- </attribute>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QButtonGroup" row="0" column="0">
- <property name="name">
- <cstring>duplexButtonGroup</cstring>
- </property>
- <property name="title">
- <string>Automatic Duplex</string>
- </property>
- <property name="exclusive">
- <bool>true</bool>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0">
- <property name="name">
- <cstring>radioButton7</cstring>
- </property>
- <property name="text">
- <string>Off</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0">
- <property name="name">
- <cstring>radioButton8</cstring>
- </property>
- <property name="text">
- <string>Long edge (standard)</string>
- </property>
- </widget>
- <widget class="QRadioButton" row="2" column="0">
- <property name="name">
- <cstring>radioButton9</cstring>
- </property>
- <property name="text">
- <string>Short edge (flip)</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="1" column="0">
- <property name="name">
- <cstring>groupBox7</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="title">
- <string>Manual Duplex</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QCheckBox" row="0" column="0">
- <property name="name">
- <cstring>manualDuplexCheckBox</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Manual duplex</string>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
- </widget>
- </widget>
- <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>groupBox3</cstring>
- </property>
- <property name="title">
- <string>Printer</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>Location:</string>
- </property>
- </widget>
- <widget class="QLabel" row="5" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>Comment:</string>
- </property>
- </widget>
- <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel10</cstring>
- </property>
- <property name="text">
- <string>Device URI:</string>
- </property>
- </widget>
- <widget class="QComboBox" row="0" column="2">
- <property name="name">
- <cstring>printerNameComboBox</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>80</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip" stdset="0">
- <string>CUPS printer name</string>
- </property>
- </widget>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- <widget class="Line" row="1" column="0" rowspan="2" colspan="3">
- <property name="name">
- <cstring>line4</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="Line" row="6" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>line3</cstring>
- </property>
- <property name="frameShape">
- <enum>HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>Sunken</enum>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget class="QLabel" row="5" column="2">
- <property name="name">
- <cstring>CommentText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLabel" row="4" column="2">
- <property name="name">
- <cstring>LocationText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLabel" row="2" column="2" rowspan="2" colspan="1">
- <property name="name">
- <cstring>DeviceURIText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLabel" row="7" column="0">
- <property name="name">
- <cstring>textLabel7</cstring>
- </property>
- <property name="text">
- <string>Status:</string>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="7" column="1" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout6</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>StateText</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>2</hsizetype>
- <vsizetype>5</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QToolButton">
- <property name="name">
- <cstring>refreshToolButton</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="toolTip" stdset="0">
- <string>Refresh status</string>
- </property>
- </widget>
- </hbox>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>groupBox4</cstring>
- </property>
- <property name="title">
- <string>File(s)</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView" row="0" column="0" rowspan="3" colspan="1">
- <column>
- <property name="text">
- <string>Name</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Type</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Path</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>fileListView</cstring>
- </property>
- <property name="allColumnsShowFocus">
- <bool>true</bool>
- </property>
- <property name="toolTip" stdset="0">
- <string>List of files to print</string>
- </property>
- </widget>
- <widget class="QToolButton" row="0" column="1">
- <property name="name">
- <cstring>addFileButton</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="textLabel">
- <string>Add file to list</string>
- </property>
- </widget>
- <widget class="QToolButton" row="1" column="1">
- <property name="name">
- <cstring>delFileButton</cstring>
- </property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- <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="text">
- <string></string>
- </property>
- <property name="textLabel">
- <string>Remove file from list</string>
- </property>
- </widget>
- <spacer row="2" column="1">
- <property name="name">
- <cstring>spacer23</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>61</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>pushButton5</sender>
- <signal>clicked()</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>addFileButton</sender>
- <signal>clicked()</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>addFileButton_clicked()</slot>
- </connection>
- <connection>
- <sender>delFileButton</sender>
- <signal>clicked()</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>delFileButton_clicked()</slot>
- </connection>
- <connection>
- <sender>fileListView</sender>
- <signal>currentChanged(QListViewItem*)</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>fileListView_currentChanged(QListViewItem*)</slot>
- </connection>
- <connection>
- <sender>printerNameComboBox</sender>
- <signal>highlighted(const QString&amp;)</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>printerNameComboBox_highlighted(const QString&amp;)</slot>
- </connection>
- <connection>
- <sender>pagesButtonGroup</sender>
- <signal>clicked(int)</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>pagesButtonGroup_clicked(int)</slot>
- </connection>
- <connection>
- <sender>printPushButton</sender>
- <signal>clicked()</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>printPushButton_clicked()</slot>
- </connection>
- <connection>
- <sender>duplexButtonGroup</sender>
- <signal>clicked(int)</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>duplexButtonGroup_clicked(int)</slot>
- </connection>
- <connection>
- <sender>orientationButtonGroup</sender>
- <signal>clicked(int)</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>orientationButtonGroup_clicked(int)</slot>
- </connection>
- <connection>
- <sender>refreshToolButton</sender>
- <signal>clicked()</signal>
- <receiver>PrinterForm_base</receiver>
- <slot>refreshToolButton_clicked()</slot>
- </connection>
-</connections>
-<slots>
- <slot>addFileButton_clicked()</slot>
- <slot>delFileButton_clicked()</slot>
- <slot>fileListView_currentChanged( QListViewItem * )</slot>
- <slot>printerNameComboBox_highlighted( const QString &amp; )</slot>
- <slot>pagesButtonGroup_clicked( int )</slot>
- <slot>printPushButton_clicked()</slot>
- <slot>duplexButtonGroup_clicked( int )</slot>
- <slot>orientationButtonGroup_clicked( int )</slot>
- <slot>refreshToolButton_clicked()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/ui/scrollcopy.py b/ui/scrollcopy.py
new file mode 100644
index 000000000..451820118
--- /dev/null
+++ b/ui/scrollcopy.py
@@ -0,0 +1,552 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils, pml, service
+from copier import copier
+
+# Qt
+from qt import *
+from scrollview import ScrollView, PixmapLabelButton
+from waitform import WaitForm
+
+# Std Lib
+import os.path, os
+import Queue
+
+
+class ScrollCopyView(ScrollView):
+ def __init__(self, hpssd_sock, toolbox_hosted=True, num_copies=None, contrast=None, quality=None,
+ reduction=None, fit_to_page=None, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.toolbox_hosted = toolbox_hosted
+ self.form = form
+ self.sock = hpssd_sock
+
+ self.num_copies = num_copies
+ self.contrast = contrast
+ self.quality = quality
+ self.reduction = reduction
+ self.fit_to_page = fit_to_page
+
+ self.update_queue = Queue.Queue() # UI updates from copy thread
+ self.event_queue = Queue.Queue() # UI events to copy thread
+
+ def getDeviceSettings(self):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ # get sticky settings as defaults (if not spec'd on command line)
+ if self.num_copies is None:
+ result_code, self.num_copies = self.dev.getPML(pml.OID_COPIER_NUM_COPIES)
+
+ if self.contrast is None:
+ result_code, self.contrast = self.dev.getPML(pml.OID_COPIER_CONTRAST)
+
+ if self.reduction is None:
+ result_code, self.reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION)
+
+ if self.quality is None:
+ result_code, self.quality = self.dev.getPML(pml.OID_COPIER_QUALITY)
+
+ if self.scan_style == SCAN_STYLE_FLATBED and self.fit_to_page is None:
+ result_code, self.fit_to_page = self.dev.getPML(pml.OID_COPIER_FIT_TO_PAGE)
+
+ if result_code != pml.ERROR_OK:
+ self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
+ self.fitToPageCheckBox.setEnabled(False)
+
+ else:
+ self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
+
+ if self.scan_style != SCAN_STYLE_FLATBED:
+ self.fitToPageCheckBox.setEnabled(False)
+
+ result_code, self.max_reduction = self.dev.getPML(pml.OID_COPIER_REDUCTION_MAXIMUM)
+ result_code, self.max_enlargement = self.dev.getPML(pml.OID_COPIER_ENLARGEMENT_MAXIMUM)
+
+ # contrast
+ a = self.contrast/25
+ self.contrastSpinBox.setValue(a)
+
+ if a >= 0:
+ self.contrastSpinBox.setPrefix("+")
+ else:
+ self.contrastSpinBox.setPrefix("")
+
+ self.contrastSlider.setValue(a)
+ self.contrastSlider.setTickmarks(QSlider.Below)
+ self.contrastSlider.setTickInterval(1)
+
+ self.contrastDefaultPushButton.setEnabled(a != 0)
+
+ # reduction/enlargement/fittopage
+
+ self.reductionSlider.setRange(self.max_reduction, self.max_enlargement)
+ self.reductionSlider.setTickmarks(QSlider.Below)
+ self.reductionSlider.setTickInterval(10)
+ self.reductionSlider.setValue(self.reduction)
+
+ self.reductionSpinBox.setMaxValue(self.max_enlargement)
+ self.reductionSpinBox.setMinValue(self.max_reduction)
+ self.reductionSlider.setValue(self.reduction)
+ self.reductionSpinBox.setSuffix("%")
+
+ if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
+ self.fitToPageCheckBox.setChecked(True)
+ self.reductionSpinBox.setEnabled(False)
+ self.reductionSlider.setEnabled(False)
+ self.reductionDefaultPushButton.setEnabled(True)
+ else:
+ self.fitToPageCheckBox.setChecked(False)
+ self.reductionSlider.setEnabled(True)
+ self.reductionSpinBox.setEnabled(True)
+ self.reductionDefaultPushButton.setEnabled(self.reduction != 100)
+
+ # num_copies
+ self.copiesSpinBox.setValue(self.num_copies)
+ self.copiesDefaultPushButton.setEnabled(self.num_copies != 1)
+
+ # quality
+ if self.quality == pml.COPIER_QUALITY_FAST:
+ self.qualityComboBox.setCurrentItem(0)
+ s = 'Fast'
+
+ elif self.quality == pml.COPIER_QUALITY_DRAFT:
+ self.qualityComboBox.setCurrentItem(1)
+ s = 'Draft'
+
+ elif self.quality == pml.COPIER_QUALITY_NORMAL:
+ self.qualityComboBox.setCurrentItem(2)
+ s = 'Normal'
+
+ elif self.quality == pml.COPIER_QUALITY_PRESENTATION:
+ self.qualityComboBox.setCurrentItem(3)
+ s = 'Presentation'
+
+ elif self.quality == pml.COPIER_QUALITY_BEST:
+ self.qualityComboBox.setCurrentItem(4)
+ s = 'Best'
+
+ log.debug("Default Quality: %d (%s)" % (self.quality, s))
+
+ self.qualityDefaultPushButton.setEnabled(self.quality != pml.COPIER_QUALITY_NORMAL)
+
+ log.debug("Default Num copies: %d" % self.num_copies)
+ log.debug("Default Contrast: %d" % self.contrast)
+ log.debug("Default Reduction: %d" % self.reduction)
+ log.debug("Maximum Reduction: %d" % self.max_reduction)
+ log.debug("Maximum Enlargement: %d" % self.max_enlargement)
+
+ if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
+ s = 'Enabled' # 2
+ else:
+ s = 'Disabled' # 1
+
+ log.debug("Default Fit to page: %s (%s)" % (self.fit_to_page, s))
+ log.debug("Scan style (models.dat: scan-style): %d" % self.scan_style)
+
+ finally:
+ self.dev.closePML()
+ QApplication.restoreOverrideCursor()
+
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ self.addGroupHeading("copies", self.__tr("Number of Copies"))
+ self.addCopies()
+
+ self.addGroupHeading("reduction", self.__tr("Enlargement, Reduction and Fit to Page"))
+ self.addEnlargementReduction()
+
+ self.addGroupHeading("contrast", self.__tr("Copy Contrast"))
+ self.addContrast()
+
+ self.addGroupHeading("quality", self.__tr("Copy Quality"))
+ self.addQuality()
+
+ self.addGroupHeading("space1", "")
+
+ if self.toolbox_hosted:
+ s = self.__tr("<< Functions")
+ else:
+ s = self.__tr("Close")
+
+ self.copyButton = self.addActionButton("bottom_nav", self.__tr("Make Copies(s)"),
+ self.copyButton_clicked, 'print.png', 'print-disabled.png',
+ s, self.funcButton_clicked)
+
+
+
+ def onUpdate(self, cur_device=None):
+ log.debug("ScrollPrintView.onUpdate()")
+
+ def onDeviceChange(self, cur_device=None):
+ ScrollView.onDeviceChange(self, cur_device)
+
+ self.dev = copier.PMLCopyDevice(device_uri=self.cur_device.device_uri,
+ printer_name=self.cur_printer,
+ hpssd_sock=self.sock)
+
+ self.scan_style = self.dev.mq.get('scan-style', SCAN_STYLE_FLATBED)
+ self.copy_type = self.dev.mq.get('copy-type', COPY_TYPE_DEVICE)
+
+ if self.scan_style == SCAN_STYLE_SCROLLFED:
+ self.fitToPageCheckBox.setEnabled(False)
+ self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
+
+ self.getDeviceSettings()
+
+
+ def addCopies(self):
+ widget = self.getWidget()
+
+ layout12 = QHBoxLayout(widget,5,10,"layout12")
+
+ self.textLabel5 = QLabel(widget,"textLabel5")
+ layout12.addWidget(self.textLabel5)
+ spacer20 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout12.addItem(spacer20)
+
+ self.copiesSpinBox = QSpinBox(widget,"copiesSpinBox")
+ layout12.addWidget(self.copiesSpinBox)
+
+ self.copiesDefaultPushButton = QPushButton(widget,"copiesDefaultPushButton")
+ layout12.addWidget(self.copiesDefaultPushButton)
+
+ self.textLabel5.setText(self.__tr("Number of copies:"))
+ self.copiesDefaultPushButton.setText(self.__tr("Default"))
+
+ self.copiesSpinBox.setMaxValue(99)
+ self.copiesSpinBox.setMinValue(1)
+ self.copiesSpinBox.setValue(1)
+
+ self.copiesDefaultPushButton.setEnabled(False)
+
+ self.connect(self.copiesDefaultPushButton, SIGNAL("clicked()"), self.copiesDefaultPushButton_clicked)
+ self.connect(self.copiesSpinBox, SIGNAL("valueChanged(int)"), self.copiesSpinBox_valueChanged)
+
+ self.addWidget(widget, "copies")
+
+ def copiesDefaultPushButton_clicked(self):
+ self.copiesSpinBox.setValue(1)
+ self.copiesDefaultPushButton.setEnabled(False)
+
+ def copiesSpinBox_valueChanged(self, i):
+ self.copiesDefaultPushButton.setEnabled(i != 1)
+ self.num_copies = i
+
+ def addQuality(self):
+ widget = self.getWidget()
+ layout34 = QHBoxLayout(widget,5,10,"layout34")
+
+ self.textLabel5_4 = QLabel(widget,"textLabel5_4")
+ self.textLabel5_4.setText(self.__tr("Quality:"))
+ layout34.addWidget(self.textLabel5_4)
+
+ spacer20_4 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout34.addItem(spacer20_4)
+
+ self.qualityComboBox = QComboBox(0,widget,"qualityComboBox")
+ layout34.addWidget(self.qualityComboBox)
+
+ self.qualityDefaultPushButton = QPushButton(widget,"qualityDefaultPushButton")
+ layout34.addWidget(self.qualityDefaultPushButton)
+
+ self.qualityComboBox.clear()
+ self.qualityComboBox.insertItem(self.__tr("Fast")) # 0
+ self.qualityComboBox.insertItem(self.__tr("Draft")) # 1
+ self.qualityComboBox.insertItem(self.__tr("Normal")) # 2
+ self.qualityComboBox.insertItem(self.__tr("Presentation")) # 3
+ self.qualityComboBox.insertItem(self.__tr("Best")) # 4
+ self.qualityComboBox.setCurrentItem(2) # Normal
+
+ self.qualityDefaultPushButton.setText(self.__tr("Default"))
+ self.qualityDefaultPushButton.setEnabled(False)
+
+ self.connect(self.qualityComboBox, SIGNAL("activated(int)"), self.qualityComboBox_activated)
+ self.connect(self.qualityDefaultPushButton, SIGNAL("clicked()"), self.qualityDefaultPushButton_clicked)
+
+ self.addWidget(widget, "quality")
+
+ def qualityDefaultPushButton_clicked(self):
+ self.qualityDefaultPushButton.setEnabled(False)
+ self.qualityComboBox.setCurrentItem(2) # Normal
+ self.quality = pml.COPIER_QUALITY_NORMAL
+
+ def qualityComboBox_activated(self, i):
+ self.qualityDefaultPushButton.setEnabled(i != 2) # Normal
+
+ if i == 0:
+ self.quality = pml.COPIER_QUALITY_FAST
+ elif i == 1:
+ self.quality = pml.COPIER_QUALITY_DRAFT
+ elif i == 2:
+ self.quality = pml.COPIER_QUALITY_NORMAL
+ elif i == 3:
+ self.quality = pml.COPIER_QUALITY_PRESENTATION
+ elif i == 4:
+ self.quality = pml.COPIER_QUALITY_BEST
+
+
+ def addEnlargementReduction(self):
+ widget = self.getWidget()
+ layout43 = QGridLayout(widget,1,1,5,10,"layout43")
+
+ self.reductionSlider = QSlider(widget,"reductionSlider")
+ self.reductionSlider.setOrientation(QSlider.Horizontal)
+
+ layout43.addWidget(self.reductionSlider,0,2)
+
+ self.reductionSpinBox = QSpinBox(widget, "reductionSpinBox")
+ self.reductionSpinBox.setSuffix("%")
+ layout43.addWidget(self.reductionSpinBox,0,3)
+
+ spacer42 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout43.addItem(spacer42,0,1)
+
+ self.fitToPageCheckBox = QCheckBox(widget,"fitToPageCheckBox")
+ layout43.addWidget(self.fitToPageCheckBox,1,2)
+
+ self.reductionDefaultPushButton = QPushButton(widget,"reductionDefaultPushButton")
+ layout43.addWidget(self.reductionDefaultPushButton,0,4)
+
+ self.textLabel1 = QLabel(widget,"textLabel1")
+ layout43.addWidget(self.textLabel1,0,0)
+
+ self.textLabel1.setText(self.__tr("Enlargement or reduction (percent):"))
+ self.fitToPageCheckBox.setText(self.__tr("Fit to Page"))
+ self.reductionDefaultPushButton.setText(self.__tr("Default"))
+
+ self.reductionSlider.setRange(25, 400)
+
+ self.connect(self.reductionSlider,SIGNAL("valueChanged(int)"),self.reductionSlider_valueChanged)
+ self.connect(self.fitToPageCheckBox,SIGNAL("clicked()"),self.fitToPageCheckBox_clicked)
+ self.connect(self.reductionDefaultPushButton, SIGNAL("clicked()"), self.reductionDefaultPushButton_clicked)
+ self.connect(self.reductionSpinBox, SIGNAL("valueChanged(int)"), self.reductionSpinBox_valueChanged)
+
+ self.addWidget(widget, "reduction")
+
+ def reductionSlider_valueChanged(self,a0):
+ self.reduction = a0
+ self.reductionSpinBox.setValue(a0)
+ self.reductionDefaultPushButton.setEnabled(a0 != 100)
+
+ def reductionSpinBox_valueChanged(self, a0):
+ self.reduction = a0
+ self.reductionSlider.setValue(a0)
+ self.reductionDefaultPushButton.setEnabled(a0 != 100)
+
+ def fitToPageCheckBox_clicked(self):
+ if self.fitToPageCheckBox.isChecked():
+ self.fit_to_page = pml.COPIER_FIT_TO_PAGE_ENABLED
+ self.reductionSpinBox.setEnabled(False)
+ self.reductionSlider.setEnabled(False)
+ self.reductionDefaultPushButton.setEnabled(True)
+ else:
+ self.fit_to_page = pml.COPIER_FIT_TO_PAGE_DISABLED
+ self.reductionSlider.setEnabled(True)
+ self.reductionSpinBox.setEnabled(True)
+ self.reductionDefaultPushButton.setEnabled(self.reductionSlider.value() != 100)
+
+ def reductionDefaultPushButton_clicked(self):
+ self.reduction = 100
+ self.reductionSlider.setValue(100)
+ self.reductionSlider.setEnabled(True)
+ self.reductionSpinBox.setValue(100)
+ self.reductionSpinBox.setEnabled(True)
+ self.fitToPageCheckBox.setChecked(False)
+ self.fit_to_page = False
+
+ def addContrast(self):
+ widget = self.getWidget()
+
+ layout41 = QGridLayout(widget,1,1,5,10,"layout41")
+
+ self.textLabel1_2 = QLabel(widget,"textLabel1_2")
+
+ layout41.addWidget(self.textLabel1_2,0,0)
+
+ self.contrastDefaultPushButton = QPushButton(widget,"contrastDefaultPushButton")
+
+ layout41.addWidget(self.contrastDefaultPushButton,0,4)
+ spacer41 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout41.addItem(spacer41,0,1)
+
+ self.contrastSlider = QSlider(widget,"contrastSlider")
+ self.contrastSlider.setMinValue(-5)
+ self.contrastSlider.setMaxValue(5)
+ self.contrastSlider.setPageStep(1)
+ self.contrastSlider.setOrientation(QSlider.Horizontal)
+
+ layout41.addWidget(self.contrastSlider,0,2)
+
+ self.contrastSpinBox = QSpinBox(widget, "contrastSpinBox")
+ self.contrastSpinBox.setMinValue(-5)
+ self.contrastSpinBox.setMaxValue(5)
+
+ layout41.addWidget(self.contrastSpinBox,0,3)
+
+ self.textLabel1_2.setText(self.__tr("Contrast (-5 lighter to +5 darker):"))
+ self.contrastDefaultPushButton.setText(self.__tr("Default"))
+
+ self.connect(self.contrastSlider,SIGNAL("valueChanged(int)"),self.contrastSlider_valueChanged)
+ self.connect(self.contrastSpinBox, SIGNAL("valueChanged(int)"), self.contrastSpinBox_valueChanged)
+ self.connect(self.contrastDefaultPushButton, SIGNAL("clicked()"), self.contrastDefaultPushButton_clicked)
+
+ self.addWidget(widget, "contrast")
+
+
+ def contrastSlider_valueChanged(self, a0):
+ self.contrastSpinBox.setValue(a0)
+ self.contrast = a0 * 25
+ self.contrastDefaultPushButton.setEnabled(a0 != 0)
+
+ def contrastSpinBox_valueChanged(self, a0):
+ if a0 >= 0:
+ self.contrastSpinBox.setPrefix("+")
+ else:
+ self.contrastSpinBox.setPrefix("")
+
+ self.contrastSlider.setValue(a0)
+ self.contrast = a0 * 25
+ self.contrastDefaultPushButton.setEnabled(a0 != 0)
+
+ def contrastDefaultPushButton_clicked(self):
+ self.contrastSpinBox.setValue(0)
+ self.contrastSpinBox.setPrefix("+")
+ self.contrastSlider.setValue(0)
+ self.contrast = 0
+
+
+ def copy_canceled(self):
+ self.event_queue.put(copier.COPY_CANCELED)
+ service.sendEvent(self.sock, EVENT_COPY_JOB_CANCELED, device_uri=self.device_uri)
+
+
+ def copy_timer_timeout(self):
+ while self.update_queue.qsize():
+ try:
+ status = self.update_queue.get(0)
+ except Queue.Empty:
+ break
+
+ if status == copier.STATUS_IDLE:
+ self.copy_timer.stop()
+
+ #self.pb.hide()
+ #self.form.statusBar().removeWidget(self.pb)
+
+ elif status in (copier.STATUS_SETTING_UP, copier.STATUS_WARMING_UP):
+ #self.pb.setProgress(self.pb.progress()+1)
+ pass
+
+ elif status == copier.STATUS_ACTIVE:
+ #self.pb.setProgress(self.pb.progress()+1)
+ pass
+
+ elif status in (copier.STATUS_ERROR, copier.STATUS_DONE):
+ self.copy_timer.stop()
+ #self.pb.hide()
+ #self.form.statusBar().removeWidget(self.pb)
+
+ if status == copier.STATUS_ERROR:
+ self.form.FailureUI(self.__tr("<b>Copier error.</b><p>"))
+ service.sendEvent(self.sock, EVENT_COPY_JOB_FAIL, device_uri=self.cur_device.device_uri)
+
+ elif status == copier.STATUS_DONE:
+ service.sendEvent(self.sock, EVENT_END_COPY_JOB, device_uri=self.cur_device.device_uri)
+
+ self.cur_device.close()
+ self.copyButton.setEnabled(True)
+
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+
+ def copyButton_clicked(self):
+ self.copyButton.setEnabled(False)
+ try:
+ try:
+ self.dev.open()
+ except Error:
+ self.form.FailureUI(self.__tr("<b>Cannot copy: Device is busy or not available.</b><p>Please check device and try again. [1]"))
+ return
+
+ service.sendEvent(self.sock, EVENT_START_COPY_JOB, device_uri=self.cur_device.device_uri)
+
+ #self.pb = QProgressBar()
+ #self.pb.setTotalSteps(2)
+ #self.form.statusBar().addWidget(self.pb)
+ #self.pb.show()
+
+ log.debug("Num copies: %d" % self.num_copies)
+ log.debug("Contrast: %d" % self.contrast)
+ log.debug("Reduction: %d" % self.reduction)
+
+ s = 'Normal'
+ if self.quality == pml.COPIER_QUALITY_FAST:
+ s = 'Fast'
+ elif self.quality == pml.COPIER_QUALITY_DRAFT:
+ s = 'Draft'
+ elif self.quality == pml.COPIER_QUALITY_NORMAL:
+ s = 'Normal'
+ elif self.quality == pml.COPIER_QUALITY_PRESENTATION:
+ s = 'Presentation'
+ elif self.quality == pml.COPIER_QUALITY_BEST:
+ s = 'Best'
+
+ log.debug("Quality: %d (%s)" % (self.quality, s))
+
+ if self.fit_to_page == pml.COPIER_FIT_TO_PAGE_ENABLED:
+ s = 'Enabled' # 2
+ else:
+ s = 'Disabled' # 1
+
+ log.debug("Fit to page: %s (%s)" % (self.fit_to_page, s))
+ log.debug("Scan style: %d" % self.scan_style)
+
+ self.copy_timer = QTimer(self, "CopyTimer")
+ self.connect(self.copy_timer, SIGNAL('timeout()'), self.copy_timer_timeout)
+ self.copy_timer.start(1000) # 1 sec UI updates
+
+ self.dev.copy(self.num_copies, self.contrast, self.reduction,
+ self.quality, self.fit_to_page, self.scan_style,
+ self.update_queue, self.event_queue)
+
+ finally:
+ #self.cur_device.close()
+ #self.copyButton.setEnabled(True)
+ pass
+
+ def funcButton_clicked(self):
+ self.dev.close()
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollCopy",s,c)
diff --git a/ui/scrollfax.py b/ui/scrollfax.py
new file mode 100644
index 000000000..45e0f8d8b
--- /dev/null
+++ b/ui/scrollfax.py
@@ -0,0 +1,1293 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils, magic, msg, service
+from prnt import cups
+
+# Qt
+from qt import *
+from scrollview import ScrollView, PixmapLabelButton
+from allowabletypesdlg import AllowableTypesDlg
+from waitform import WaitForm
+
+# Std Lib
+import os.path, os
+import struct, Queue
+
+fax_enabled = False
+try:
+ from fax import fax
+ fax_enabled = True
+except ImportError:
+ # This can fail on Python < 2.3 due to the datetime module
+ # or if fax was diabled during the build
+ log.warn("Fax send disabled - Python 2.3+ required.")
+
+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 and coverpages_enabled:
+ from fax import coverpages
+ from coverpageform import CoverpageForm
+
+
+# Used to store MIME types for files
+# added directly in interface.
+job_types = {} # { job_id : "mime_type", ...}
+
+class FileListViewItem(QListViewItem):
+ def __init__(self, parent, order, title, mime_type_desc, str_pages, path):
+ QListViewItem.__init__(self, parent, order, title, mime_type_desc, str_pages, path)
+ self.path = path
+
+
+class RecipientListViewItem(QListViewItem):
+ def __init__(self, parent, order, name, fax, notes):
+ QListViewItem.__init__(self, parent, order, name, fax, notes)
+ self.name = name
+ #self.entry = entry
+
+
+class PhoneNumValidator(QValidator):
+ def __init__(self, parent=None, name=None):
+ QValidator.__init__(self, parent, name)
+
+ def validate(self, input, pos):
+ input = unicode(input)
+ if not input:
+ return QValidator.Acceptable, pos
+ elif input[pos-1] not in u'0123456789-(+) *#':
+ return QValidator.Invalid, pos
+ elif len(input) > 50:
+ return QValidator.Invalid, pos
+ else:
+ return QValidator.Acceptable, pos
+
+
+class ScrollFaxView(ScrollView):
+ def __init__(self, hpssd_sock, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.toolbox_hosted = toolbox_hosted
+ self.form = form
+ self.file_list = []
+ self.pages_button_group = 0
+ self.sock = hpssd_sock
+ self.recipient_list = []
+ self.username = prop.username
+ self.busy = False
+ self.allowable_mime_types = cups.getAllowableMIMETypes()
+ self.allowable_mime_types.append("application/x-python")
+ self.cover_page_func, cover_page_png = None, None
+ self.cover_page_message = ''
+ self.cover_page_re = ''
+ self.cover_page_name = ''
+ self.update_queue = Queue.Queue() # UI updates from send thread
+ self.event_queue = Queue.Queue() # UI events (cancel) to send thread
+ self.prev_selected_file_path = ''
+ self.prev_selected_recipient = ''
+ self.preserve_formatting = False
+ self.waitdlg = None
+ log.debug(self.allowable_mime_types)
+
+ self.db = fax.FaxAddressBook2()
+ self.last_db_modification = self.db.last_modification_time()
+
+ self.MIME_TYPES_DESC = \
+ {
+ "application/pdf" : (self.__tr("PDF Document"), '.pdf'),
+ "application/postscript" : (self.__tr("Postscript Document"), '.ps'),
+ "application/vnd.hp-HPGL" : (self.__tr("HP Graphics Language File"), '.hgl, .hpg, .plt, .prn'),
+ "application/x-cshell" : (self.__tr("C Shell Script"), '.csh, .sh'),
+ "application/x-csource" : (self.__tr("C Source Code"), '.c'),
+ "text/cpp": (self.__tr("C++ Source Code"), '.cpp, .cxx'),
+ "application/x-perl" : (self.__tr("Perl Script"), '.pl'),
+ "application/x-python" : (self.__tr("Python Program"), '.py'),
+ "application/x-shell" : (self.__tr("Shell Script"), '.sh'),
+ "text/plain" : (self.__tr("Plain Text"), '.txt, .log, etc'),
+ "text/html" : (self.__tr("HTML Dcoument"), '.htm, .html'),
+ "image/gif" : (self.__tr("GIF Image"), '.gif'),
+ "image/png" : (self.__tr("PNG Image"), '.png'),
+ "image/jpeg" : (self.__tr("JPEG Image"), '.jpg, .jpeg'),
+ "image/tiff" : (self.__tr("TIFF Image"), '.tif, .tiff'),
+ "image/x-bitmap" : (self.__tr("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-bmp" : (self.__tr("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-photocd" : (self.__tr("Photo CD Image"), '.pcd'),
+ "image/x-portable-anymap" : (self.__tr("Portable Image (PNM)"), '.pnm'),
+ "image/x-portable-bitmap" : (self.__tr("Portable B&W Image (PBM)"), '.pbm'),
+ "image/x-portable-graymap" : (self.__tr("Portable Grayscale Image (PGM)"), '.pgm'),
+ "image/x-portable-pixmap" : (self.__tr("Portable Color Image (PPM)"), '.ppm'),
+ "image/x-sgi-rgb" : (self.__tr("SGI RGB"), '.rgb'),
+ "image/x-xbitmap" : (self.__tr("X11 Bitmap (XBM)"), '.xbm'),
+ "image/x-xpixmap" : (self.__tr("X11 Pixmap (XPM)"), '.xpm'),
+ "image/x-sun-raster" : (self.__tr("Sun Raster Format"), '.ras'),
+ }
+
+ user_settings = utils.UserSettings()
+ self.cmd_fab = user_settings.cmd_fab
+ log.debug("FAB command: %s" % self.cmd_fab)
+
+ self.check_timer = QTimer(self, "CheckTimer")
+ self.connect(self.check_timer, SIGNAL('timeout()'), self.PeriodicCheck)
+ self.check_timer.start(3000)
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if fax_enabled:
+ if self.addPrinterFaxList(faxes=True, printers=False):
+ self.addGroupHeading("files_to_fax", self.__tr("File(s) to Fax"))
+ self.addFileList()
+
+ if coverpages_enabled:
+ self.addGroupHeading("coverpage", self.__tr("Add/Edit Fax Coverpage"))
+ self.addCoverpage()
+
+ self.addGroupHeading("recipients", self.__tr("Recipient(s)"))
+
+ self.addRecipientList()
+
+ self.addGroupHeading("recipient_add_from_fab", self.__tr("Add Recipients from the Fax Address Book"))
+
+ self.addRecipientAddFromFAB()
+
+ self.addGroupHeading("recipient_quick_add", self.__tr("<i>Quick Add</i> an Individual Recipient"))
+
+ self.addRecipientQuickAdd()
+
+ self.addGroupHeading("space1", "")
+
+ if self.toolbox_hosted:
+ s = self.__tr("<< Functions")
+ else:
+ s = self.__tr("Close")
+
+ self.faxButton = self.addActionButton("bottom_nav", self.__tr("Send Fax Now"),
+ self.faxButton_clicked, 'fax.png', 'fax-disabled.png',
+ s, self.funcButton_clicked)
+
+ self.faxButton.setEnabled(False)
+
+ self.updateRecipientCombos()
+
+ self.maximizeControl()
+
+ else:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI("<b>Fax is disabled.</b><p>No CUPS fax queue found for this device.")
+ self.funcButton_clicked()
+
+ else:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI("<b>Fax is disabled.</b><p>Python version 2.3 or greater required or fax was disabled during build.")
+ self.funcButton_clicked()
+
+
+
+ def onUpdate(self, cur_device=None):
+ log.debug("ScrollPrintView.onUpdate()")
+ self.updateFileList()
+ self.updateRecipientList()
+
+ def PeriodicCheck(self):
+ if not self.busy:
+ log.debug("Checking for incoming faxes...")
+
+ fields, data, result_code = \
+ msg.xmitMessage(self.sock, "FaxCheck", None,
+ {"username": self.username})
+
+ if result_code == ERROR_FAX_READY:
+ # fax is waiting
+ username = fields['username']
+ job_id = fields['job-id']
+ job_size = fields['job-size']
+ title = fields['title']
+
+ #if self.isMinimized():
+ # self.showNormal()
+
+ self.check_timer.stop()
+ self.addFileFromJob(0, title, username, job_id, job_size)
+ self.check_timer.start(3000)
+ return
+
+ elif result_code == ERROR_FAX_PROCESSING:
+ # fax is being processed
+ print "processing..."
+
+ if self.waitdlg is None:
+ self.waitdlg = WaitForm(0, self.__tr("Processing fax..."), None, self, modal=1) # self.add_fax_canceled
+ self.waitdlg.show()
+
+ # Check for updated FAB
+ last_db_modification = self.db.last_modification_time()
+
+ if last_db_modification > self.last_db_modification:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ log.debug("FAB has been modified. Re-reading...")
+ self.last_db_modification = last_db_modification
+ self.updateRecipientCombos()
+ QApplication.restoreOverrideCursor()
+
+
+ # Event handler for adding files from a external print job (not during fax send thread)
+ def addFileFromJob(self, event, title, username, job_id=0, job_size=0):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ self.busy = True
+
+ try:
+ if self.waitdlg is None:
+ self.waitdlg = WaitForm(0, self.__tr("Receiving fax data..."), self.add_fax_canceled, self, modal=1)
+ self.waitdlg.show()
+
+ log.debug("Transfering job %d (%d bytes)" % (job_id, job_size))
+ fax_dir = prop.user_dir
+
+ if not os.path.exists(fax_dir):
+ os.mkdir(fax_dir)
+
+ fax_file = os.path.expanduser(os.path.join(fax_dir, "hpfax-%d.g3" % job_id))
+ fd = file(fax_file, 'w')
+ bytes_read = 0
+ header_read = False
+ total_pages = 0
+
+ #if self.waitdlg is not None:
+ # self.waitdlg.setMessage(self.__tr("Receiving fax data..."))
+
+ while True:
+ qApp.processEvents()
+ log.debug("Transfering fax data...")
+
+ fields, data, result_code = \
+ msg.xmitMessage(self.sock, "FaxGetData", None,
+ {"username": username,
+ "job-id": job_id,
+ })
+
+ log.debug(repr(data)), len(data)
+
+ if data and result_code == ERROR_SUCCESS:
+ fd.write(data)
+ bytes_read += len(data)
+
+ self.waitdlg.setMessage(self.__tr("Read %1 of fax data...").arg(utils.format_bytes(bytes_read)))
+
+ if not header_read and len(data) >= fax.FILE_HEADER_SIZE:
+ mg, version, total_pages, hort_dpi, vert_dpi, page_size, \
+ resolution, encoding, reserved1, reserved2 = \
+ struct.unpack(">8sBIHHBBBII", data[:fax.FILE_HEADER_SIZE])
+
+ log.debug("Magic=%s Ver=%d Pages=%d hDPI=%d vDPI=%d Size=%d Res=%d Enc=%d" %
+ (mg, version, total_pages, hort_dpi, vert_dpi, page_size, resolution, encoding))
+
+ header_read = True
+
+ else:
+ break # Done
+
+ fd.close()
+
+ if self.waitdlg is not None:
+ self.waitdlg.hide()
+ self.waitdlg.close()
+ self.waitdlg = None
+
+ log.debug("Transfered %d bytes" % bytes_read)
+
+ if total_pages > 0:
+ mime_type = job_types.get(job_id, "application/hplip-fax")
+ mime_type_desc = self.MIME_TYPES_DESC.get(mime_type, ('Unknown', 'n/a'))[0]
+ log.debug("%s (%s)" % (mime_type, mime_type_desc))
+ self.file_list.append((fax_file, mime_type, mime_type_desc, title, total_pages))
+ self.prev_selected_file_path = fax_file
+ else:
+ self.form.FailureUI("<b>Render Failure:</b><p>Rendered document contains no data.")
+
+ self.updateFileList()
+
+ finally:
+ self.busy = False
+ QApplication.restoreOverrideCursor()
+
+ def add_fax_canceled(self):
+ pass
+
+ #
+ # FILE LIST
+ #
+
+ def addFileList(self):
+ widget = self.getWidget()
+
+ layout37 = QGridLayout(widget,1,1,5,10,"layout37")
+
+ self.addFilePushButton = PixmapLabelButton(widget, "list-add.png",
+ "list-add-disabled.png", name='addFilePushButton')
+
+ layout37.addWidget(self.addFilePushButton,2,0)
+
+ self.removeFilePushButton = PixmapLabelButton(widget,
+ "list-remove.png", "list-remove-disabled.png", name='removeFilePushButton')
+
+ layout37.addWidget(self.removeFilePushButton,2,1)
+
+ self.moveFileUpPushButton = PixmapLabelButton(widget, "up.png",
+ "up-disabled.png", name='moveFileUpPushButton')
+
+ layout37.addWidget(self.moveFileUpPushButton,2,2)
+
+ self.moveFileDownPushButton = PixmapLabelButton(widget, "down.png",
+ "down-disabled.png", name='moveFileDownPushButton')
+
+ layout37.addWidget(self.moveFileDownPushButton,2,3)
+
+ self.showTypesPushButton = PixmapLabelButton(widget, "mimetypes.png",
+ None, name='showTypesPushButton')
+
+ layout37.addWidget(self.showTypesPushButton,2,5)
+
+
+ self.fileListView = QListView(widget,"fileListView")
+ self.fileListView.addColumn(self.__tr("Order"))
+ self.fileListView.addColumn(self.__tr("Name"))
+ self.fileListView.addColumn(self.__tr("Type"))
+ self.fileListView.addColumn(self.__tr("Pages"))
+ self.fileListView.addColumn(self.__tr("Path"))
+ self.fileListView.setAllColumnsShowFocus(1)
+ self.fileListView.setShowSortIndicator(1)
+ self.fileListView.setColumnWidth(0, 100) # Order
+ self.fileListView.setColumnWidth(1, 150) # Name
+ self.fileListView.setColumnWidth(2, 100) # Type
+ self.fileListView.setColumnWidth(3, 100) # Pages
+ self.fileListView.setColumnWidth(4, 300) # Path
+ self.fileListView.setItemMargin(2)
+ self.fileListView.setSorting(-1)
+
+ layout37.addMultiCellWidget(self.fileListView,1,1,0,5)
+
+ spacer26 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout37.addItem(spacer26,2,4)
+
+ self.addFilePushButton.setText(self.__tr("Add File..."))
+ self.showTypesPushButton.setText(self.__tr("Show Types..."))
+ self.removeFilePushButton.setText(self.__tr("Remove File"))
+ self.moveFileDownPushButton.setText(self.__tr("Move Down"))
+ self.moveFileUpPushButton.setText(self.__tr("Move Up"))
+
+ self.removeFilePushButton.setEnabled(False)
+ self.moveFileDownPushButton.setEnabled(False)
+ self.moveFileUpPushButton.setEnabled(False)
+ self.connect(self.addFilePushButton, SIGNAL("clicked()"), self.addFile_clicked)
+ self.connect(self.removeFilePushButton, SIGNAL("clicked()"), self.removeFile_clicked)
+ self.connect(self.showTypesPushButton, SIGNAL("clicked()"), self.showFileTypes_clicked)
+
+ self.connect(self.moveFileUpPushButton, SIGNAL("clicked()"), self.moveFileUp_clicked)
+ self.connect(self.moveFileDownPushButton, SIGNAL("clicked()"), self.moveFileDown_clicked)
+
+ self.connect(self.fileListView,SIGNAL("rightButtonClicked(QListViewItem*,const QPoint&, int)"),self.fileListView_rightButtonClicked)
+
+ self.connect(self.fileListView, SIGNAL("selectionChanged(QListViewItem*)"), self.fileListView_selectionChanged)
+
+ self.addWidget(widget, "file_list", maximize=True)
+
+ def fileListView_selectionChanged(self, i):
+ try:
+ self.prev_selected_file_path = i.path
+ except AttributeError:
+ pass
+ else:
+ flv = self.fileListView
+ selected_item = flv.selectedItem()
+ file_count = flv.childCount()
+ last_item = flv.firstChild()
+ while last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ self.moveFileDownPushButton.setEnabled(file_count > 1 and selected_item is not last_item)
+ self.moveFileUpPushButton.setEnabled(file_count > 1 and selected_item is not flv.firstChild())
+
+
+ def moveFileUp_clicked(self):
+ try:
+ path = self.fileListView.selectedItem().path
+ except AttributeError:
+ return
+ else:
+ for i in range(1, len(self.file_list)):
+ if self.file_list[i][0] == path:
+ self.file_list[i-1],self.file_list[i] = self.file_list[i], self.file_list[i-1]
+
+ self.updateFileList()
+
+ def moveFileDown_clicked(self):
+ try:
+ path = self.fileListView.selectedItem().path
+ except AttributeError:
+ return
+ else:
+ for i in range(len(self.file_list) - 2, -1, -1):
+ if self.file_list[i][0] == path:
+ self.file_list[i], self.file_list[i+1] = self.file_list[i+1], self.file_list[i]
+
+ self.updateFileList()
+
+
+ def fileListView_rightButtonClicked(self, item, pos, col):
+ popup = QPopupMenu(self)
+
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'list-add.png'))),
+ self.__tr("Add File..."), self.addFile_clicked)
+
+ if item is not None:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'list-remove.png'))), self.__tr("Remove File"), self.removeFile_clicked)
+
+ if self.fileListView.childCount() > 1:
+ last_item = self.fileListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ if item is not self.fileListView.firstChild():
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'up.png'))), self.__tr("Move Up"), self.moveFileUp_clicked)
+
+ if item is not last_item:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'down.png'))), self.__tr("Move Down"), self.moveFileDown_clicked)
+
+
+ popup.insertSeparator(-1)
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'mimetypes.png'))), self.__tr("Show File Types..."), self.showFileTypes_clicked)
+ popup.popup(pos)
+
+
+ def addFile(self, path, title, mime_type, mime_type_desc, pages):
+ self.file_list.append((path, mime_type, mime_type_desc, title, pages))
+ self.prev_selected_file_path = path
+
+ self.updateFileList()
+
+ def processFile(self, path, title=''): # Process an arbitrary file ("Add file...")
+ path = os.path.realpath(path)
+ if not title:
+ title = os.path.basename(path)
+
+ if os.path.exists(path):
+ mime_type = magic.mime_type(path)
+ log.debug(mime_type)
+ mime_type_desc = mime_type
+
+ log.debug(mime_type)
+
+ if mime_type == 'application/hplip-fax':
+ mime_type_desc = self.MIME_TYPES_DESC[mime_type][0]
+
+
+ fax_file_fd = file(path, 'r')
+ header = fax_file_fd.read(fax.FILE_HEADER_SIZE)
+
+ mg, version, pages, hort_dpi, vert_dpi, page_size, \
+ resolution, encoding, reserved1, reserved2 = self.decode_fax_header(header)
+
+ if mg != 'hplip_g3':
+ log.error("Invalid file header. Bad magic.")
+ self.form.WarningUI(self.__tr("<b>Invalid HPLIP Fax file.</b><p>Bad magic!"))
+ return
+
+ self.addFile(path, title, mime_type, mime_type_desc, pages)
+ else:
+ log.debug(repr(mime_type))
+ try:
+ mime_type_desc = self.MIME_TYPES_DESC[mime_type][0]
+ except KeyError:
+ self.form.WarningUI(self.__tr("<b>You are trying to add a file that cannot be directly faxed with this utility.</b><p>To print this file, use the print command in the application that created it."))
+ return
+ else:
+ log.debug("Adding file: title='%s' file=%s mime_type=%s mime_desc=%s)" % (title, path, mime_type, mime_type_desc))
+
+ all_pages = True
+ page_range = ''
+ page_set = 0
+ #nup = 1
+
+ cups.resetOptions()
+
+ self.cups_printers = cups.getPrinters()
+
+ printer_state = cups.IPP_PRINTER_STATE_STOPPED
+ for p in self.cups_printers:
+ if p.name == self.cur_printer:
+ printer_state = p.state
+
+ log.debug("Printer state = %d" % printer_state)
+
+ if printer_state == cups.IPP_PRINTER_STATE_IDLE:
+ sent_job_id = cups.printFile(self.cur_printer, path, os.path.basename(path))
+ job_types[sent_job_id] = mime_type # save for later
+ log.debug("Job ID=%d" % sent_job_id)
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ self.waitdlg = WaitForm(0, self.__tr("Processing fax file..."), None, self, modal=1) # self.add_fax_canceled
+ self.waitdlg.show()
+
+ else:
+ self.form.FailureUI(self.__tr("<b>Printer '%1' is in a stopped or error state.</b><p>Check the printer queue in CUPS and try again.").arg(self.cur_printer))
+ cups.resetOptions()
+ return
+
+ cups.resetOptions()
+ QApplication.restoreOverrideCursor()
+
+ else:
+ self.form.FailureUI(self.__tr("<b>Unable to add file '%1' to file list.</b><p>Check the file name and try again.".arg(path)))
+
+
+
+ def updateFileList(self):
+ self.fileListView.clear()
+ temp = self.file_list[:]
+ temp.reverse()
+ order = len(temp)
+ last_item = None
+ selected_item = None
+
+ for path, mime_type, mime_type_desc, title, pages in temp:
+ i = FileListViewItem(self.fileListView, str(order), title, mime_type_desc, str(pages), path)
+
+ if not self.prev_selected_file_path or self.prev_selected_file_path == path:
+ self.fileListView.setSelected(i, True)
+ selected_item = i
+ self.prev_selected_file_path = path
+
+ order -= 1
+
+ last_item = self.fileListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ file_count = self.fileListView.childCount()
+ self.moveFileDownPushButton.setEnabled(file_count > 1 and selected_item is not last_item)
+ self.moveFileUpPushButton.setEnabled(file_count > 1 and selected_item is not self.fileListView.firstChild())
+ self.checkSendFaxButton()
+ self.removeFilePushButton.setEnabled(file_count > 0)
+
+
+
+ def addFile_clicked(self):
+ workingDirectory = user_cfg.last_used.working_dir
+
+ if not workingDirectory or not os.path.exists(workingDirectory):
+ workingDirectory = os.path.expanduser("~")
+
+ log.debug("workingDirectory: %s" % workingDirectory)
+
+ dlg = QFileDialog(workingDirectory, QString.null, None, None, True)
+
+ dlg.setCaption("openfile")
+ dlg.setMode(QFileDialog.ExistingFile)
+ dlg.show()
+
+ if dlg.exec_loop() == QDialog.Accepted:
+ results = dlg.selectedFile()
+ workingDirectory = unicode(dlg.dir().absPath())
+ log.debug("results: %s" % results)
+ log.debug("workingDirectory: %s" % workingDirectory)
+
+ user_cfg.last_used.working_dir = workingDirectory
+
+ if results:
+ path = unicode(results)
+ self.processFile(path)
+
+
+ def removeFile_clicked(self):
+ try:
+ path = self.fileListView.selectedItem().path
+ except AttributeError:
+ return
+ else:
+ temp = self.file_list[:]
+ index = 0
+ for p, t, d, x, g in temp:
+ if p == path:
+ del self.file_list[index]
+
+ if t == 'application/hplip-fax-coverpage':
+ self.addCoverpagePushButton.setEnabled(coverpages_enabled)
+ self.editCoverpagePushButton.setEnabled(False)
+
+ self.prev_selected_file_path = ''
+ self.updateFileList()
+ break
+
+ index += 1
+
+
+ def showFileTypes_clicked(self):
+ x = {}
+ for a in self.allowable_mime_types:
+ x[a] = self.MIME_TYPES_DESC.get(a, ('Unknown', 'n/a'))
+
+ log.debug(x)
+ dlg = AllowableTypesDlg(x, self)
+ dlg.exec_loop()
+
+
+ #
+ # COVERPAGE
+ #
+
+ def addCoverpage(self):
+ widget = self.getWidget()
+
+ layout14 = QGridLayout(widget,1,1,5,10,"layout14")
+
+ self.editCoverpagePushButton = PixmapLabelButton(widget,
+ "edit.png", "edit-disabled.png", name='')
+
+ layout14.addWidget(self.editCoverpagePushButton,0,1)
+
+ self.addCoverpagePushButton = PixmapLabelButton(widget,
+ "list-add.png", "list-add-disabled.png", name='')
+
+ layout14.addWidget(self.addCoverpagePushButton,0,2)
+ spacer12_2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout14.addItem(spacer12_2,0,0)
+
+ self.editCoverpagePushButton.setText(self.__tr("Edit..."))
+ self.editCoverpagePushButton.setEnabled(False)
+
+ self.addCoverpagePushButton.setText(self.__tr("Add..."))
+
+ self.connect(self.editCoverpagePushButton,SIGNAL("clicked()"),self.editCoverpagePushButton_clicked)
+ self.connect(self.addCoverpagePushButton,SIGNAL("clicked()"),self.addCoverpagePushButton_clicked)
+
+ self.addWidget(widget, "coverpage")
+
+ def editCoverpagePushButton_clicked(self):
+ self.showCoverPageDlg()
+
+ def addCoverpagePushButton_clicked(self):
+ if self.showCoverPageDlg():
+ self.file_list.insert(0, ('n/a', "application/hplip-fax-coverpage",
+ self.__tr("HP Fax Coverpage"), self.__tr("Cover Page"), 1))
+
+ self.updateFileList()
+ self.addCoverpagePushButton.setEnabled(False)
+ self.editCoverpagePushButton.setEnabled(True)
+
+ def showCoverPageDlg(self):
+ dlg = CoverpageForm(self.cover_page_name, self.preserve_formatting, parent=self)
+ dlg.messageTextEdit.setText(self.cover_page_message)
+ dlg.regardingTextEdit.setText(self.cover_page_re)
+
+ if dlg.exec_loop() == QDialog.Accepted:
+
+ self.cover_page_func, cover_page_png = dlg.data
+ self.cover_page_message = unicode(dlg.messageTextEdit.text())
+ self.cover_page_re = unicode(dlg.regardingTextEdit.text())
+ self.cover_page_name = dlg.coverpage_name
+ self.preserve_formatting = dlg.preserve_formatting
+ return True
+
+ return False
+
+
+
+ #
+ # RECIPIENT LIST
+ #
+
+ def addRecipientList(self):
+ widget = self.getWidget()
+
+ layout9 = QGridLayout(widget,1,1,5,10,"layout9")
+
+ self.moveDownPushButton = PixmapLabelButton(widget,
+ "down-user.png", "down-user-disabled.png", name='')
+
+ layout9.addWidget(self.moveDownPushButton,1,2)
+
+ self.recipientListView = QListView(widget,"recipientListView")
+ self.recipientListView.addColumn(self.__tr("Order"))
+ self.recipientListView.addColumn(self.__tr("Name"))
+ self.recipientListView.addColumn(self.__tr("Fax Number"))
+ self.recipientListView.addColumn(self.__tr("Notes"))
+
+ self.recipientListView.setAllColumnsShowFocus(1)
+ self.recipientListView.setShowSortIndicator(1)
+ self.recipientListView.setColumnWidth(0, 100) # Order
+ self.recipientListView.setColumnWidth(1, 150) # Name
+ self.recipientListView.setColumnWidth(2, 200) # Fax Number
+ self.recipientListView.setColumnWidth(3, 250) # Notes
+ self.recipientListView.setItemMargin(2)
+ self.recipientListView.setSorting(-1)
+
+ widget.setMaximumHeight(250)
+
+ layout9.addMultiCellWidget(self.recipientListView,0,0,0,4)
+
+ self.fabPushButton = PixmapLabelButton(widget,
+ "fab.png", None, name='')
+
+ layout9.addWidget(self.fabPushButton,1,4)
+
+ self.removeRecipientPushButton = PixmapLabelButton(widget,
+ "remove-user.png", "remove-user-disabled.png", name='')
+
+ self.removeRecipientPushButton.setEnabled(1)
+
+ layout9.addWidget(self.removeRecipientPushButton,1,0)
+ spacer10 = QSpacerItem(20,20,QSizePolicy.MinimumExpanding,QSizePolicy.Minimum)
+ layout9.addItem(spacer10,1,3)
+
+ self.moveUpPushButton = PixmapLabelButton(widget,
+ "up-user.png", "up-user-disabled.png", name='')
+
+ layout9.addWidget(self.moveUpPushButton,1,1)
+
+ self.moveDownPushButton.setEnabled(False)
+ self.moveUpPushButton.setEnabled(False)
+ self.removeRecipientPushButton.setEnabled(False)
+
+ self.moveDownPushButton.setText(self.__tr("Move Down"))
+ self.fabPushButton.setText(self.__tr("Fax Address Book..."))
+ self.removeRecipientPushButton.setText(self.__tr("Remove"))
+ self.moveUpPushButton.setText(self.__tr("Move Up"))
+
+
+ self.connect(self.recipientListView,SIGNAL("rightButtonClicked(QListViewItem*,const QPoint&,int)"),self.recipientListView_rightButtonClicked)
+
+ self.connect(self.removeRecipientPushButton,SIGNAL("clicked()"),self.removeRecipientPushButton_clicked)
+ self.connect(self.moveUpPushButton,SIGNAL("clicked()"),self.moveUpPushButton_clicked)
+ self.connect(self.moveDownPushButton,SIGNAL("clicked()"),self.moveDownPushButton_clicked)
+ self.connect(self.fabPushButton,SIGNAL("clicked()"),self.fabPushButton_clicked)
+
+ self.connect(self.recipientListView, SIGNAL("selectionChanged(QListViewItem*)"), self.recipientListView_selectionChanged)
+
+ self.addWidget(widget, "recipient_list", maximize=False)
+
+
+ def recipientListView_selectionChanged(self, i):
+ try:
+ self.prev_selected_recipient = i.name
+ except AttributeError:
+ pass
+ else:
+ rlv = self.recipientListView
+ selected_item = rlv.selectedItem()
+ recipient_count = rlv.childCount()
+ last_item = rlv.firstChild()
+ while last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ self.moveDownPushButton.setEnabled(recipient_count > 1 and selected_item is not last_item)
+ self.moveUpPushButton.setEnabled(recipient_count > 1 and selected_item is not rlv.firstChild())
+
+
+
+ def updateRecipientList(self):
+ self.recipientListView.clear()
+ temp = self.recipient_list[:]
+ temp.reverse()
+ last_item = None
+ selected_item = None
+ order = len(temp)
+
+ for name in temp:
+ entry = self.db.get(name)
+ i = RecipientListViewItem(self.recipientListView, str(order), name, entry['fax'], entry['notes'])
+
+ if not self.prev_selected_recipient or self.prev_selected_recipient == name:
+ self.recipientListView.setSelected(i, True)
+ selected_item = i
+ self.prev_selected_recipient = name
+
+ order -= 1
+
+ last_item = self.recipientListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ child_count = self.recipientListView.childCount()
+ self.removeRecipientPushButton.setEnabled(child_count > 0)
+ self.moveDownPushButton.setEnabled(child_count > 1 and selected_item is not last_item)
+ self.moveUpPushButton.setEnabled(child_count > 1 and selected_item is not self.recipientListView.firstChild())
+
+ self.checkSendFaxButton()
+
+
+
+ def recipientListView_rightButtonClicked(self, item, pos, col):
+ self.ind_map = {}
+ self.grp_map = {}
+ popup = QPopupMenu(self)
+ ind = QPopupMenu(popup)
+ grp = QPopupMenu(popup)
+
+ all_entries = self.db.get_all_records()
+ if all_entries:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'add-user.png'))),
+ self.__tr("Add Individual"), ind)
+
+ for e, v in all_entries.items():
+ self.ind_map[ind.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'add-user.png'))),
+ e, None)] = e
+
+ all_groups = self.db.get_all_groups()
+ if all_groups:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'add-users.png'))),
+ self.__tr("Add Group"), grp)
+
+ for g in all_groups:
+ self.grp_map[grp.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'add-users.png'))),
+ g, None)] = g
+
+ if item is not None:
+ popup.insertSeparator(-1)
+
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'remove-user.png'))), self.__tr("Remove"), self.removeRecipientPushButton_clicked)
+
+ if self.recipientListView.childCount() > 1:
+ last_item = self.recipientListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ if item is not self.recipientListView.firstChild():
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'up-user.png'))), self.__tr("Move Up"), self.moveUpPushButton_clicked)
+
+ if item is not last_item:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'down-user.png'))), self.__tr("Move Down"), self.moveDownPushButton_clicked)
+
+ popup.insertSeparator(-1)
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'fab.png'))), self.__tr("Fax Address Book..."), self.fabPushButton_clicked)
+
+ self.connect(ind, SIGNAL("activated(int)"), self.ind_popup_activated)
+ self.connect(grp, SIGNAL("activated(int)"), self.grp_popup_activated)
+
+ popup.popup(pos)
+
+
+ def ind_popup_activated(self, i):
+ self.addRecipient(self.ind_map[i])
+
+ def grp_popup_activated(self, i):
+ self.addRecipient(self.grp_map[i], True)
+
+ def moveUpPushButton_clicked(self):
+ try:
+ name = self.recipientListView.selectedItem().name
+ except AttributeError:
+ return
+ else:
+ utils.list_move_up(self.recipient_list, name)
+ self.updateRecipientList()
+
+ def moveDownPushButton_clicked(self):
+ try:
+ name = self.recipientListView.selectedItem().name
+ except AttributeError:
+ return
+ else:
+ utils.list_move_down(self.recipient_list, name)
+ self.updateRecipientList()
+
+
+ def fabPushButton_clicked(self):
+ log.debug(self.cmd_fab)
+ #print self.cmd_fab
+ cmd = ''.join([self.cur_device.device_vars.get(x, x) \
+ for x in self.cmd_fab.split('%')])
+ log.debug(cmd)
+
+ path = cmd.split()[0]
+ args = cmd.split()
+
+ self.CleanupChildren()
+ #os.spawnvp(os.P_NOWAIT, path, args)
+ os.system(cmd)
+
+ self.db.load()
+ self.updateRecipientList()
+ self.updateRecipientCombos()
+
+
+ def CleanupChildren(self):
+ log.debug("Cleaning up child processes.")
+ try:
+ os.waitpid(-1, os.WNOHANG)
+ except OSError:
+ pass
+
+
+ def removeRecipientPushButton_clicked(self):
+ try:
+ name = self.recipientListView.selectedItem().name
+ except AttributeError:
+ return
+ else:
+ temp = self.recipient_list[:]
+ index = 0
+ for n in temp:
+ if name == n:
+ del self.recipient_list[index]
+
+ self.prev_selected_recipient = ''
+ self.updateRecipientList()
+ break
+
+ index += 1
+
+
+
+ #
+ # ADD FROM ADDRESS BOOK
+ #
+
+ def addRecipientAddFromFAB(self):
+ widget = self.getWidget()
+
+ layout13 = QGridLayout(widget,1,1,5,10,"layout13")
+
+ self.groupComboBox = QComboBox(0,widget,"groupComboBox")
+ self.groupComboBox.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Fixed,0,0,self.groupComboBox.sizePolicy().hasHeightForWidth()))
+
+ layout13.addWidget(self.groupComboBox,1,2)
+ spacer12 = QSpacerItem(20,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ layout13.addItem(spacer12,1,1)
+
+ self.textLabel1 = QLabel(widget,"textLabel1")
+ self.textLabel1.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred,0,0,self.textLabel1.sizePolicy().hasHeightForWidth()))
+
+ layout13.addWidget(self.textLabel1,0,0)
+
+ self.individualComboBox = QComboBox(0,widget,"individualComboBox")
+ self.individualComboBox.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Fixed,0,0,self.individualComboBox.sizePolicy().hasHeightForWidth()))
+
+ layout13.addWidget(self.individualComboBox,0,2)
+
+ self.textLabel2 = QLabel(widget,"textLabel2")
+ self.textLabel2.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Preferred,0,0,self.textLabel2.sizePolicy().hasHeightForWidth()))
+
+ layout13.addWidget(self.textLabel2,1,0)
+ spacer11 = QSpacerItem(30,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ layout13.addItem(spacer11,0,1)
+
+ self.addGroupPushButton = PixmapLabelButton(widget,
+ "add-users.png", "add-users-disabled.png", name='addGroupPushButton')
+
+ layout13.addWidget(self.addGroupPushButton,1,3)
+
+ self.addIndividualPushButton = PixmapLabelButton(widget,
+ "add-user.png", "add-user-disabled.png", name='addIndividualPushButton')
+
+
+ layout13.addWidget(self.addIndividualPushButton,0,3)
+
+ self.textLabel1.setText(self.__tr("Add an <b>individual </b>from the fax address book:"))
+ self.textLabel2.setText(self.__tr("Add a <b>group</b> from the fax address book:"))
+ self.addGroupPushButton.setText(self.__tr("Add"))
+ self.addIndividualPushButton.setText(self.__tr("Add"))
+
+ self.connect(self.addIndividualPushButton,SIGNAL("clicked()"),self.addIndividualPushButton_clicked)
+ self.connect(self.addGroupPushButton,SIGNAL("clicked()"),self.addGroupPushButton_clicked)
+
+
+ self.addWidget(widget, "recipient_add_from_fab")
+
+ def addIndividualPushButton_clicked(self):
+ self.addRecipient(unicode(self.individualComboBox.currentText()))
+
+ def addGroupPushButton_clicked(self):
+ self.addRecipient(unicode(self.groupComboBox.currentText()), True)
+
+ def addRecipient(self, name, is_group=False):
+ if is_group:
+ for i in self.db.group_members(name):
+ #for i in self.db.GroupEntries(name):
+ self.recipient_list.append(i)
+ self.prev_selected_recipient = self.recipient_list[-1]
+ else:
+ self.recipient_list.append(name)
+ self.prev_selected_recipient = name
+
+ self.updateRecipientList()
+
+ def updateRecipientCombos(self):
+ # Individuals
+ self.individualComboBox.clear()
+ all_entries = self.db.get_all_records()
+ self.addIndividualPushButton.setEnabled(len(all_entries))
+
+ for e, v in all_entries.items():
+ self.individualComboBox.insertItem(e)
+
+ # Groups
+ self.groupComboBox.clear()
+ all_groups = self.db.get_all_groups()
+ self.addGroupPushButton.setEnabled(len(all_groups))
+
+ for g in all_groups:
+ self.groupComboBox.insertItem(g)
+
+
+ #
+ # QUICK ADD
+ #
+
+ def addRecipientQuickAdd(self):
+ widget = self.getWidget()
+
+ layout12 = QGridLayout(widget,1,1,5,10,"layout12")
+ self.quickAddFaxLineEdit = QLineEdit(widget,"quickAddFaxLineEdit")
+
+ self.quickAddFaxLineEdit.setValidator(PhoneNumValidator(self.quickAddFaxLineEdit))
+ layout12.addWidget(self.quickAddFaxLineEdit,0,3)
+
+ self.quickAddNameLineEdit = QLineEdit(widget,"quickAddNameLineEdit")
+ layout12.addWidget(self.quickAddNameLineEdit,0,1)
+
+ self.textLabel4 = QLabel(widget,"textLabel4")
+ layout12.addWidget(self.textLabel4,0,0)
+
+ self.quickAddPushButton = PixmapLabelButton(widget,
+ "add-user-quick.png", "add-user-quick-disabled.png", name='quickAddPushButton')
+
+ layout12.addWidget(self.quickAddPushButton,0,4)
+
+ self.textLabel5 = QLabel(widget,"textLabel5")
+ layout12.addWidget(self.textLabel5,0,2)
+
+ self.textLabel4.setText(self.__tr("Name:"))
+ self.quickAddPushButton.setText(self.__tr("Add"))
+ self.textLabel5.setText(self.__tr("Fax Number:"))
+
+ self.quickAddPushButton.setEnabled(False)
+
+ self.connect(self.quickAddPushButton,SIGNAL("clicked()"),self.quickAddPushButton_clicked)
+ self.connect(self.quickAddNameLineEdit,SIGNAL("textChanged(const QString&)"),self.quickAddNameLineEdit_textChanged)
+ self.connect(self.quickAddFaxLineEdit,SIGNAL("textChanged(const QString&)"),self.quickAddFaxLineEdit_textChanged)
+
+ self.addWidget(widget, "recipient_quick_add")
+
+
+ def quickAddPushButton_clicked(self):
+
+ # TODO: Check for duplicate already in FAB
+
+ name = unicode(self.quickAddNameLineEdit.text())
+ self.db.set(name, u'', u'', u'', unicode(self.quickAddFaxLineEdit.text()), [], self.__tr('Added with Quick Add'))
+ self.db.save()
+ self.addRecipient(name)
+
+ self.quickAddNameLineEdit.setText("")
+ self.quickAddFaxLineEdit.setText("")
+
+ def quickAddNameLineEdit_textChanged(self, s):
+ self.quickAddPushButton.setEnabled(len(s) and len(self.quickAddFaxLineEdit.text()))
+
+ def quickAddFaxLineEdit_textChanged(self, s):
+ self.quickAddPushButton.setEnabled(len(self.quickAddNameLineEdit.text()) and len(s))
+
+ def checkSendFaxButton(self):
+ self.faxButton.setEnabled(len(self.file_list) and len(self.recipient_list))
+
+ def faxButton_clicked(self):
+ self.check_timer.stop()
+ phone_num_list = []
+
+ log.debug("Current printer=%s" % self.cur_printer)
+ ppd_file = cups.getPPD(self.cur_printer)
+
+ if ppd_file is not None and os.path.exists(ppd_file):
+ if file(ppd_file, 'r').read().find('HP Fax') == -1:
+ self.form.FailureUI(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.cur_printer))
+ return
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ dev = fax.FaxDevice(device_uri=self.cur_device.device_uri,
+ printer_name=self.cur_printer)
+
+ try:
+ try:
+ dev.open()
+ except Error, e:
+ log.warn(e.msg)
+
+ try:
+ dev.queryDevice(quick=True)
+ except Error, e:
+ log.error("Query device error (%s)." % e.msg)
+ dev.error_state = ERROR_STATE_ERROR
+
+ finally:
+ dev.close()
+ QApplication.restoreOverrideCursor()
+
+ if dev.error_state > ERROR_STATE_MAX_OK and \
+ dev.error_state not in (ERROR_STATE_LOW_SUPPLIES, ERROR_STATE_LOW_PAPER):
+
+ self.form.FailureUI(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.cur_device.status_code))
+ 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.cur_printer:
+ if p.state == cups.IPP_PRINTER_STATE_STOPPED:
+ self.form.FailureUI(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.cur_printer))
+ 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(unicode(f))
+
+ self.busy = True
+
+ service.sendEvent(self.sock, EVENT_START_FAX_JOB, device_uri=dev.device_uri)
+
+ if not dev.sendFaxes(phone_num_list, self.file_list, self.cover_page_message,
+ self.cover_page_re, self.cover_page_func, self.preserve_formatting,
+ self.cur_printer, self.update_queue, self.event_queue):
+
+ self.form.FailureUI(self.__tr("<b>Send fax is active.</b><p>Please wait for operation to complete."))
+ service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=dev.device_uri)
+ self.busy = False
+ return
+
+
+ self.waitdlg = WaitForm(0, self.__tr("Initializing..."), self.send_fax_canceled, self, modal=1)
+ self.waitdlg.show()
+
+ self.send_fax_timer = QTimer(self, "SendFaxTimer")
+ self.connect(self.send_fax_timer, SIGNAL('timeout()'), self.send_fax_timer_timeout)
+ self.send_fax_timer.start(1000) # 1 sec UI updates
+
+ def send_fax_canceled(self):
+ self.event_queue.put((fax.EVENT_FAX_SEND_CANCELED, '', '', ''))
+ service.sendEvent(self.sock, EVENT_FAX_JOB_CANCELED, device_uri=self.cur_device.device_uri)
+
+
+ def send_fax_timer_timeout(self):
+ while self.update_queue.qsize():
+ try:
+ status, page_num, phone_num = self.update_queue.get(0)
+ except Queue.Empty:
+ break
+
+ if status == fax.STATUS_IDLE:
+ self.busy = False
+ self.send_fax_timer.stop()
+
+ if self.waitdlg is not None:
+ self.waitdlg.hide()
+ self.waitdlg.close()
+ self.waitdlg = None
+
+ elif status == fax.STATUS_PROCESSING_FILES:
+ self.waitdlg.setMessage(self.__tr("Processing page %1...").arg(page_num))
+
+ elif status == fax.STATUS_DIALING:
+ self.waitdlg.setMessage(self.__tr("Dialing %1...").arg(phone_num))
+
+ elif status == fax.STATUS_CONNECTING:
+ self.waitdlg.setMessage(self.__tr("Connecting to %1...").arg(phone_num))
+
+ elif status == fax.STATUS_SENDING:
+ self.waitdlg.setMessage(self.__tr("Sending page %1 to %2...").arg(page_num).arg(phone_num))
+
+ elif status == fax.STATUS_CLEANUP:
+ self.waitdlg.setMessage(self.__tr("Cleaning up..."))
+
+ elif status in (fax.STATUS_ERROR, fax.STATUS_BUSY, fax.STATUS_COMPLETED):
+ self.busy = False
+ self.send_fax_timer.stop()
+
+ if self.waitdlg is not None:
+ self.waitdlg.hide()
+ self.waitdlg.close()
+ self.waitdlg = None
+
+ if status == fax.STATUS_ERROR:
+ self.form.FailureUI(self.__tr("<b>Fax send error.</b><p>"))
+ service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=self.cur_device.device_uri)
+
+ elif status == fax.STATUS_BUSY:
+ self.form.FailureUI(self.__tr("<b>Fax device is busy.</b><p>Please try again later."))
+ service.sendEvent(self.sock, EVENT_FAX_JOB_FAIL, device_uri=self.cur_device.device_uri)
+
+ elif status == fax.STATUS_COMPLETED:
+ service.sendEvent(self.sock, EVENT_END_FAX_JOB, device_uri=self.cur_device.device_uri)
+
+ self.funcButton_clicked()
+
+
+
+ def funcButton_clicked(self):
+ self.check_timer.stop()
+
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollFaxView",s,c)
diff --git a/ui/scrollfunc.py b/ui/scrollfunc.py
new file mode 100644
index 000000000..f8a865748
--- /dev/null
+++ b/ui/scrollfunc.py
@@ -0,0 +1,217 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils
+
+# Qt
+from qt import *
+from scrollview import ScrollView
+
+# Std Lib
+import os.path, os
+
+class ScrollFunctionsView(ScrollView):
+ def __init__(self, parent = None,form=None, name = None,fl = 0):
+
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.user_settings = utils.UserSettings()
+ self.form = form
+
+ self.ScanPixmap = QPixmap(os.path.join(prop.image_dir, "scan_icon.png"))
+ self.PrintPixmap = QPixmap(os.path.join(prop.image_dir, "print_icon.png"))
+ self.SendFaxPixmap =QPixmap(os.path.join(prop.image_dir, "fax_icon.png"))
+ self.PhotoCardPixmap = QPixmap(os.path.join(prop.image_dir, "pcard_icon.png"))
+ self.MakeCopiesPixmap = QPixmap(os.path.join(prop.image_dir, "makecopies_icon.png"))
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if self.cur_device is not None and \
+ self.cur_device.supported and \
+ self.cur_device.device_state != DEVICE_STATE_NOT_FOUND:
+
+ if self.user_settings.cmd_print_int:
+ s = self.__tr("Print >>")
+ else:
+ s = self.__tr("Print...")
+
+ self.addItem(self.__tr("<b>Print</b>"), self.__tr("Print documents or files."),
+ s, self.PrintPixmap, self.PrintButton_clicked)
+
+ if self.cur_device.scan_type and prop.scan_build:
+ if self.user_settings.cmd_scan_int:
+ s = self.__tr("Scan >>")
+ else:
+ s = self.__tr("Scan...")
+
+ self.addItem(self.__tr("<b>Scan</b>"), self.__tr("Scan a document, image, or photograph."),
+ s, self.ScanPixmap, self.ScanButton_clicked)
+
+ if self.cur_device.fax_type and prop.fax_build:
+ if self.user_settings.cmd_fax_int:
+ s = self.__tr("Send PC Fax >>")
+ else:
+ s = self.__tr("Send PC Fax...")
+
+ self.addItem(self.__tr("<b>Send PC Fax</b>"), self.__tr("Send a fax from the PC."),
+ s, self.SendFaxPixmap, self.SendFaxButton_clicked)
+
+ if self.cur_device.copy_type:
+ if self.user_settings.cmd_copy_int:
+ s = self.__tr("Make Copies >>")
+ else:
+ s = self.__tr("Make Copies...")
+
+ self.addItem(self.__tr("<b>Make Copies</b>"), self.__tr("Make copies on the device controlled by the PC."),
+ s, self.MakeCopiesPixmap, self.MakeCopiesButton_clicked)
+
+ if self.cur_device.pcard_type:
+ if self.user_settings.cmd_pcard_int:
+ s = self.__tr("Unload Photo Card >>")
+ else:
+ s = self.__tr("Unload Photo Card...")
+
+ self.addItem(self.__tr("<b>Unload Photo Card</b>"), self.__tr("Copy images from the device's photo card to the PC."),
+ s, self.PhotoCardPixmap, self.PCardButton_clicked)
+
+ else:
+ if not self.cur_device.supported:
+ self.addGroupHeading("not_supported", self.__tr("ERROR: Device not supported."))
+ else:
+ self.addGroupHeading("not_found", self.__tr("ERROR: Device not found. Please check connection and power-on device."))
+
+ def PrintButton_clicked(self):
+ if self.user_settings.cmd_print_int:
+ self.form.SwitchFunctionsTab("print")
+ else:
+ self.RunCommand(self.user_settings.cmd_print)
+
+ def ScanButton_clicked(self):
+ if self.user_settings.cmd_scan_int:
+ self.form.SwitchFunctionsTab("scan")
+ else:
+ self.RunCommand(self.user_settings.cmd_scan)
+
+ def PCardButton_clicked(self):
+ if self.cur_device.pcard_type == PCARD_TYPE_MLC:
+ if self.user_settings.cmd_pcard_int:
+ self.form.SwitchFunctionsTab("pcard")
+ else:
+ self.RunCommand(self.user_settings.cmd_pcard)
+
+ elif self.cur_device.pcard_type == PCARD_TYPE_USB_MASS_STORAGE:
+ self.form.FailureUI(self.__tr("<p><b>Photocards on your printer are only available by mounting them as drives using USB mass storage.</b><p>Please refer to your distribution's documentation for setup and usage instructions."))
+
+ def SendFaxButton_clicked(self):
+ if self.user_settings.cmd_fax_int:
+ self.form.SwitchFunctionsTab("fax")
+ else:
+ self.RunCommand(self.user_settings.cmd_fax)
+
+ def MakeCopiesButton_clicked(self):
+ if self.user_settings.cmd_copy_int:
+ self.form.SwitchFunctionsTab("copy")
+ else:
+ self.RunCommand(self.user_settings.cmd_copy)
+
+ def RunCommand(self, cmd, macro_char='%'):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ if len(cmd) == 0:
+ self.form.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.device_uri, "*"*20))
+ log.debug(cmd)
+ cmd = ''.join([self.cur_device.device_vars.get(x, x) \
+ for x in cmd.split(macro_char)])
+ 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)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ def CleanupChildren(self):
+ log.debug("Cleaning up child processes.")
+ try:
+ os.waitpid(-1, os.WNOHANG)
+ except OSError:
+ pass
+
+ def addItem(self, title, text, button_text, pixmap, button_func):
+ widget = self.getWidget()
+
+ self.addGroupHeading(title, title)
+
+ layout1 = QGridLayout(widget, 1, 3, 5, 10,"layout1")
+
+ layout1.setColStretch(0, 1)
+ layout1.setColStretch(1, 10)
+ layout1.setColStretch(2, 2)
+
+ pushButton = QPushButton(widget, "pushButton")
+ pushButton.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed, 0, 0,
+ pushButton.sizePolicy().hasHeightForWidth()))
+
+ layout1.addWidget(pushButton, 0, 3)
+
+ icon = QLabel(widget, "icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed, 0, 0,
+ icon.sizePolicy().hasHeightForWidth()))
+
+ icon.setMinimumSize(QSize(32, 32))
+ icon.setMaximumSize(QSize(32, 32))
+ icon.setScaledContents(1)
+ layout1.addWidget(icon, 0, 0)
+
+ textLabel = QLabel(widget, "textLabel")
+ textLabel.setAlignment(QLabel.WordBreak)
+ textLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred, 0, 0,
+ textLabel.sizePolicy().hasHeightForWidth()))
+ textLabel.setFrameShape(self.frame_shape)
+ layout1.addWidget(textLabel, 0, 1)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout1.addItem(spacer1, 0, 2)
+
+ textLabel.setText(text)
+ pushButton.setText(button_text)
+ icon.setPixmap(pixmap)
+
+ self.connect(pushButton, SIGNAL("clicked()"), button_func)
+
+ self.addWidget(widget, unicode(title))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollFunctionsView",s,c)
diff --git a/ui/scrollprint.py b/ui/scrollprint.py
new file mode 100644
index 000000000..fe8d7de91
--- /dev/null
+++ b/ui/scrollprint.py
@@ -0,0 +1,642 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils, magic
+from prnt import cups
+
+# Qt
+from qt import *
+from scrollview import ScrollView, PixmapLabelButton
+from allowabletypesdlg import AllowableTypesDlg
+
+# Std Lib
+import os.path, os
+
+
+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 FileListViewItem(QListViewItem):
+ def __init__(self, parent, index, filename, mime_type_desc, path):
+ QListViewItem.__init__(self, parent, str(index+1), filename, mime_type_desc, path)
+ self.path = path
+ self.index = index
+
+
+class ScrollPrintView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.toolbox_hosted = toolbox_hosted
+ self.form = form
+ self.file_list = []
+ self.pages_button_group = 0
+ #self.prev_selected_file_path = ''
+ self.prev_selected_file_index = 0
+
+ self.allowable_mime_types = cups.getAllowableMIMETypes()
+ self.allowable_mime_types.append("application/x-python")
+
+ log.debug(self.allowable_mime_types)
+
+ self.MIME_TYPES_DESC = \
+ {
+ "application/pdf" : (self.__tr("PDF Document"), '.pdf'),
+ "application/postscript" : (self.__tr("Postscript Document"), '.ps'),
+ "application/vnd.hp-HPGL" : (self.__tr("HP Graphics Language File"), '.hgl, .hpg, .plt, .prn'),
+ "application/x-cshell" : (self.__tr("C Shell Script"), '.csh, .sh'),
+ "application/x-csource" : (self.__tr("C Source Code"), '.c'),
+ "text/cpp": (self.__tr("C++ Source Code"), '.cpp, .cxx'),
+ "application/x-perl" : (self.__tr("Perl Script"), '.pl'),
+ "application/x-python" : (self.__tr("Python Program"), '.py'),
+ "application/x-shell" : (self.__tr("Shell Script"), '.sh'),
+ "text/plain" : (self.__tr("Plain Text"), '.txt, .log, etc'),
+ "text/html" : (self.__tr("HTML Dcoument"), '.htm, .html'),
+ "image/gif" : (self.__tr("GIF Image"), '.gif'),
+ "image/png" : (self.__tr("PNG Image"), '.png'),
+ "image/jpeg" : (self.__tr("JPEG Image"), '.jpg, .jpeg'),
+ "image/tiff" : (self.__tr("TIFF Image"), '.tif, .tiff'),
+ "image/x-bitmap" : (self.__tr("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-bmp" : (self.__tr("Bitmap (BMP) Image"), '.bmp'),
+ "image/x-photocd" : (self.__tr("Photo CD Image"), '.pcd'),
+ "image/x-portable-anymap" : (self.__tr("Portable Image (PNM)"), '.pnm'),
+ "image/x-portable-bitmap" : (self.__tr("Portable B&W Image (PBM)"), '.pbm'),
+ "image/x-portable-graymap" : (self.__tr("Portable Grayscale Image (PGM)"), '.pgm'),
+ "image/x-portable-pixmap" : (self.__tr("Portable Color Image (PPM)"), '.ppm'),
+ "image/x-sgi-rgb" : (self.__tr("SGI RGB"), '.rgb'),
+ "image/x-xbitmap" : (self.__tr("X11 Bitmap (XBM)"), '.xbm'),
+ "image/x-xpixmap" : (self.__tr("X11 Pixmap (XPM)"), '.xpm'),
+ "image/x-sun-raster" : (self.__tr("Sun Raster Format"), '.ras'),
+ }
+
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if self.addPrinterFaxList():
+ self.addGroupHeading("files_to_print", self.__tr("File(s) to Print"))
+ self.addFileList()
+ self.addGroupHeading("options", self.__tr("Print Options"))
+ self.addCopies()
+ self.addPageRange()
+ self.addPageSet()
+ self.addGroupHeading("space1", "")
+
+ if self.toolbox_hosted:
+ s = self.__tr("<< Functions")
+ else:
+ s = self.__tr("Close")
+
+ self.printButton = self.addActionButton("bottom_nav", self.__tr("Print File(s)"),
+ self.printButton_clicked, 'print.png', 'print-disabled.png',
+ s, self.funcButton_clicked)
+
+ self.printButton.setEnabled(False)
+ self.maximizeControl()
+
+ else:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI("<b>Print is disabled.</b><p>No CUPS print queue found for this device.")
+ self.funcButton_clicked()
+
+
+ def onUpdate(self, cur_device=None):
+ log.debug("ScrollPrintView.onUpdate()")
+ self.updateFileList()
+
+ def onDeviceChange(self, cur_device=None):
+ self.file_list = []
+ ScrollView.onDeviceChange(self, cur_device)
+
+ def addFileList(self):
+ widget = self.getWidget()
+ layout37 = QGridLayout(widget,1,1,5,10,"layout37")
+
+ self.addFilePushButton = PixmapLabelButton(widget,
+ "list-add.png", "list-add-disabled.png")
+
+ layout37.addWidget(self.addFilePushButton,2,0)
+
+ self.removeFilePushButton = PixmapLabelButton(widget,
+ "list-remove.png", "list-remove-disabled.png")
+
+ layout37.addWidget(self.removeFilePushButton,2,1)
+
+ self.moveFileUpPushButton = PixmapLabelButton(widget, "up.png",
+ "up-disabled.png", name='moveFileUpPushButton')
+
+ layout37.addWidget(self.moveFileUpPushButton,2,2)
+
+ self.moveFileDownPushButton = PixmapLabelButton(widget, "down.png",
+ "down-disabled.png", name='moveFileDownPushButton')
+
+ layout37.addWidget(self.moveFileDownPushButton,2,3)
+
+ self.showTypesPushButton = PixmapLabelButton(widget, "mimetypes.png",
+ None, name='addFilePushButton')
+
+ layout37.addWidget(self.showTypesPushButton,2,5)
+ self.fileListView = QListView(widget,"fileListView")
+ self.fileListView.addColumn(self.__tr("Order"))
+ self.fileListView.addColumn(self.__tr("Name"))
+ self.fileListView.addColumn(self.__tr("Type"))
+ self.fileListView.addColumn(self.__tr("Path"))
+ self.fileListView.setAllColumnsShowFocus(1)
+ self.fileListView.setShowSortIndicator(1)
+ self.fileListView.setColumnWidth(0, 100)
+ self.fileListView.setColumnWidth(1, 150)
+ self.fileListView.setColumnWidth(2, 75)
+ self.fileListView.setColumnWidth(3, 300)
+ self.fileListView.setItemMargin(2)
+ self.fileListView.setSorting(-1)
+
+ layout37.addMultiCellWidget(self.fileListView,1,1,0,5)
+
+ spacer26 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout37.addItem(spacer26,2,4)
+
+ self.addFilePushButton.setText(self.__tr("Add File..."))
+ self.showTypesPushButton.setText(self.__tr("Show Types..."))
+ self.removeFilePushButton.setText(self.__tr("Remove File"))
+ self.moveFileDownPushButton.setText(self.__tr("Move Down"))
+ self.moveFileUpPushButton.setText(self.__tr("Move Up"))
+
+ self.removeFilePushButton.setEnabled(False)
+ self.moveFileDownPushButton.setEnabled(False)
+ self.moveFileUpPushButton.setEnabled(False)
+
+ self.connect(self.addFilePushButton, SIGNAL("clicked()"), self.addFile_clicked)
+ self.connect(self.removeFilePushButton, SIGNAL("clicked()"), self.removeFile_clicked)
+ self.connect(self.showTypesPushButton, SIGNAL("clicked()"), self.showFileTypes_clicked)
+ self.connect(self.fileListView,SIGNAL("rightButtonClicked(QListViewItem*,const QPoint&, int)"),self.fileListView_rightButtonClicked)
+
+ self.connect(self.moveFileUpPushButton, SIGNAL("clicked()"), self.moveFileUp_clicked)
+ self.connect(self.moveFileDownPushButton, SIGNAL("clicked()"), self.moveFileDown_clicked)
+ self.connect(self.fileListView, SIGNAL("selectionChanged(QListViewItem*)"),
+ self.fileListView_selectionChanged)
+
+ self.addWidget(widget, "file_list", maximize=True)
+
+ def fileListView_selectionChanged(self, i):
+ try:
+ self.prev_selected_file_index = i.index
+ except AttributeError:
+ pass
+ else:
+ flv = self.fileListView
+ selected_item = flv.selectedItem()
+ file_count = flv.childCount()
+ last_item = flv.firstChild()
+ while last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ self.moveFileDownPushButton.setEnabled(file_count > 1 and selected_item is not last_item)
+ self.moveFileUpPushButton.setEnabled(file_count > 1 and selected_item is not flv.firstChild())
+
+ def fileListView_rightButtonClicked(self, item, pos, col):
+ popup = QPopupMenu(self)
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir, 'list-add.png'))),
+ self.__tr("Add File..."), self.addFile_clicked)
+
+ if item is not None:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'list-remove.png'))), self.__tr("Remove File"), self.removeFile_clicked)
+
+ if self.fileListView.childCount() > 1:
+ last_item = self.fileListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ if item is not self.fileListView.firstChild():
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'up.png'))), self.__tr("Move Up"), self.moveFileUp_clicked)
+
+ if item is not last_item:
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'down.png'))), self.__tr("Move Down"), self.moveFileDown_clicked)
+
+ popup.insertSeparator(-1)
+ popup.insertItem(QIconSet(QPixmap(os.path.join(prop.image_dir,
+ 'mimetypes.png'))), self.__tr("Show File Types..."), self.showFileTypes_clicked)
+
+ popup.popup(pos)
+
+ def moveFileUp_clicked(self):
+ log.debug("Move file up")
+ try:
+ item = self.fileListView.selectedItem()
+ path, index = item.path, item.index
+ except AttributeError:
+ return
+ else:
+ new_pos = index-1
+ self.file_list[new_pos], self.file_list[index] = self.file_list[index], self.file_list[new_pos]
+ item.index = new_pos
+ self.prev_selected_file_index = new_pos
+ self.updateFileList()
+
+ def moveFileDown_clicked(self):
+ log.debug("Move file down")
+ try:
+ item = self.fileListView.selectedItem()
+ path, index = item.path, item.index
+ except AttributeError:
+ return
+ else:
+ new_pos = index+1
+ self.file_list[index], self.file_list[new_pos] = self.file_list[new_pos], self.file_list[index]
+ item.index = new_pos
+ self.prev_selected_file_index = new_pos
+ self.updateFileList()
+
+ def addFile(self, path):
+ path = os.path.realpath(path)
+ if os.path.exists(path):
+ mime_type = magic.mime_type(path)
+ mime_type_desc = mime_type
+ log.debug(mime_type)
+
+ try:
+ mime_type_desc = self.MIME_TYPES_DESC[mime_type][0]
+ except KeyError:
+ self.form.FailureUI(self.__tr("<b>You are trying to add a file that cannot be directly printed with this utility.</b><p>To print this file, use the print command in the application that created it."))
+ else:
+ log.debug("Adding file %s (%s,%s)" % (path, mime_type, mime_type_desc))
+ self.file_list.append((path, mime_type, mime_type_desc))
+ else:
+ self.form.FailureUI(self.__tr("<b>Unable to add file '%s' to file list (file not found).</b><p>Check the file name and try again." % path))
+
+ self.updateFileList()
+
+ def updateFileList(self):
+ self.fileListView.clear()
+ temp = self.file_list[:]
+ temp.reverse()
+ last_item = None
+ selected_item = None
+ index = len(temp)-1
+
+ for path, mime_type, desc in temp:
+ log.debug("path=%s, mime_type=%s, desc=%s, index=%d" % (path, mime_type, desc, index))
+ i = FileListViewItem(self.fileListView, index, os.path.basename(path), desc, path)
+
+ if self.prev_selected_file_index == index:
+ self.fileListView.setSelected(i, True)
+ self.prev_selected_file_index = index
+ selected_item = i
+
+ index -= 1
+
+ last_item = self.fileListView.firstChild()
+ while last_item is not None and last_item.nextSibling():
+ last_item = last_item.nextSibling()
+
+ file_count = self.fileListView.childCount()
+ self.moveFileDownPushButton.setEnabled(file_count > 1 and selected_item is not last_item)
+ self.moveFileUpPushButton.setEnabled(file_count > 1 and selected_item is not self.fileListView.firstChild())
+ self.removeFilePushButton.setEnabled(file_count > 0)
+ self.printButton.setEnabled(file_count > 0)
+
+ def addFile_clicked(self):
+ workingDirectory = user_cfg.last_used.working_dir
+
+ if not workingDirectory or not os.path.exists(workingDirectory):
+ workingDirectory = os.path.expanduser("~")
+
+ log.debug("workingDirectory: %s" % workingDirectory)
+
+ dlg = QFileDialog(workingDirectory, QString.null, None, None, True)
+
+ dlg.setCaption("openfile")
+ dlg.setMode(QFileDialog.ExistingFile)
+ dlg.show()
+
+ if dlg.exec_loop() == QDialog.Accepted:
+ results = dlg.selectedFile()
+ workingDirectory = unicode(dlg.dir().absPath())
+ log.debug("results: %s" % results)
+ log.debug("workingDirectory: %s" % workingDirectory)
+ user_cfg.last_used.working_dir = workingDirectory
+
+ if results:
+ self.addFile(unicode(results))
+
+ def removeFile_clicked(self):
+ try:
+ path = self.fileListView.selectedItem().path
+ except AttributeError:
+ return
+ else:
+ temp = self.file_list[:]
+ index = 0
+ for p, t, d in temp:
+ if p == path:
+ del self.file_list[index]
+ if index == self.prev_selected_file_index:
+ self.prev_selected_file_index = 0
+ break
+ index += 1
+
+ self.updateFileList()
+
+ def showFileTypes_clicked(self):
+ x = {}
+ for a in self.allowable_mime_types:
+ x[a] = self.MIME_TYPES_DESC.get(a, ('Unknown', 'n/a'))
+
+ log.debug(x)
+ dlg = AllowableTypesDlg(x, self)
+ dlg.exec_loop()
+
+
+ def addCopies(self):
+ widget = self.getWidget()
+
+ layout12 = QHBoxLayout(widget,5,10,"layout12")
+
+ self.textLabel5 = QLabel(widget,"textLabel5")
+ layout12.addWidget(self.textLabel5)
+ spacer20 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout12.addItem(spacer20)
+
+ self.copiesSpinBox = QSpinBox(widget,"copiesSpinBox")
+ layout12.addWidget(self.copiesSpinBox)
+
+ self.copiesDefaultPushButton = QPushButton(widget,"copiesDefaultPushButton")
+ layout12.addWidget(self.copiesDefaultPushButton)
+
+ self.textLabel5.setText(self.__tr("Number of copies:"))
+ self.copiesDefaultPushButton.setText(self.__tr("Default"))
+
+ self.copiesSpinBox.setMaxValue(99)
+ self.copiesSpinBox.setMinValue(1)
+ self.copiesSpinBox.setValue(1)
+
+ self.copiesDefaultPushButton.setEnabled(False)
+
+ self.connect(self.copiesDefaultPushButton, SIGNAL("clicked()"), self.copiesDefaultPushButton_clicked)
+ self.connect(self.copiesSpinBox, SIGNAL("valueChanged(int)"), self.copiesSpinBox_valueChanged)
+
+ self.addWidget(widget, "copies")
+
+ def copiesDefaultPushButton_clicked(self):
+ self.copiesSpinBox.setValue(1)
+ self.copiesDefaultPushButton.setEnabled(False)
+
+ def copiesSpinBox_valueChanged(self, i):
+ self.copiesDefaultPushButton.setEnabled(i != 1)
+
+ def addPageRange(self):
+ widget = self.getWidget()
+
+ layout39 = QGridLayout(widget,1,1,5,10,"layout39")
+
+ self.pageRangeEdit = QLineEdit(widget,"self.pageRangeEdit")
+ self.pageRangeEdit.setEnabled(0)
+ layout39.addWidget(self.pageRangeEdit,0,3)
+
+ spacer20_2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout39.addItem(spacer20_2,0,1)
+
+ textLabel5_2 = QLabel(widget,"textLabel5_2")
+ layout39.addWidget(textLabel5_2,0,0)
+
+ self.pagerangeDefaultPushButton = QPushButton(widget,"pagerangeDefaultPushButton")
+ layout39.addWidget(self.pagerangeDefaultPushButton,0,4)
+
+ self.rangeButtonGroup = QButtonGroup(widget,"self.rangeButtonGroup")
+ self.rangeButtonGroup.setLineWidth(0)
+ self.rangeButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.rangeButtonGroup.layout().setSpacing(0)
+ self.rangeButtonGroup.layout().setMargin(0)
+ self.rangeButtonGroupLayout = QGridLayout(self.rangeButtonGroup.layout())
+ self.rangeButtonGroupLayout.setAlignment(Qt.AlignTop)
+
+ radioButton3_2 = QRadioButton(self.rangeButtonGroup,"radioButton3_2")
+ radioButton3_2.setChecked(1)
+ self.rangeButtonGroup.insert( radioButton3_2,0)
+ self.rangeButtonGroupLayout.addWidget(radioButton3_2,0,0)
+
+ radioButton4_2 = QRadioButton(self.rangeButtonGroup,"radioButton4_2")
+ self.rangeButtonGroup.insert( radioButton4_2,1)
+ self.rangeButtonGroupLayout.addWidget(radioButton4_2,0,1)
+
+ layout39.addWidget(self.rangeButtonGroup,0,2)
+
+ self.bg = self.pageRangeEdit.paletteBackgroundColor()
+ self.invalid_page_range = False
+
+ self.pageRangeEdit.setValidator(RangeValidator(self.pageRangeEdit))
+
+ textLabel5_2.setText(self.__tr("Page Range:"))
+ radioButton3_2.setText(self.__tr("All pages"))
+ radioButton4_2.setText(self.__tr("Page range:"))
+
+ self.pagerangeDefaultPushButton.setText(self.__tr("Default"))
+
+ self.pagerangeDefaultPushButton.setEnabled(False)
+
+ self.connect(self.rangeButtonGroup, SIGNAL("clicked(int)"), self.rangeButtonGroup_clicked)
+ self.connect(self.pageRangeEdit,SIGNAL("lostFocus()"),self.pageRangeEdit_lostFocus)
+ self.connect(self.pageRangeEdit,SIGNAL("textChanged(const QString&)"),self.pageRangeEdit_textChanged)
+ self.connect(self.pagerangeDefaultPushButton, SIGNAL("clicked()"), self.pagerangeDefaultPushButton_clicked)
+
+ self.addWidget(widget, "range")
+
+ def pagerangeDefaultPushButton_clicked(self):
+ self.rangeButtonGroup.setButton(0)
+ self.pagerangeDefaultPushButton.setEnabled(False)
+ self.pageRangeEdit.setEnabled(False)
+
+ def rangeButtonGroup_clicked(self, a0):
+ self.pages_button_group = a0
+ self.pageRangeEdit.setEnabled(a0 == 1)
+ self.pagerangeDefaultPushButton.setEnabled(a0 == 1)
+
+ def pageRangeEdit_lostFocus(self):
+ x = []
+ try:
+ x = utils.expand_range(unicode(self.pageRangeEdit.text()))
+ except ValueError:
+ log.error("Invalid page range entered.")
+ self.invalid_page_range = True
+ self.pageRangeEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+
+ else:
+ self.pageRangeEdit.setText(QString(utils.collapse_range(x)))
+ self.pageRangeEdit.setPaletteBackgroundColor(self.bg)
+ self.invalid_page_range = False
+
+ def pageRangeEdit_textChanged(self,a0):
+ x = []
+ try:
+ x = utils.expand_range(str(self.pageRangeEdit.text()))
+ except ValueError:
+ self.invalid_page_range = True
+ self.pageRangeEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+
+ else:
+ self.pageRangeEdit.setPaletteBackgroundColor(self.bg)
+ self.invalid_page_range = False
+
+ def addPageSet(self):
+ widget = self.getWidget()
+
+ layout34 = QHBoxLayout(widget,5,10,"layout34")
+
+ self.textLabel5_4 = QLabel(widget,"textLabel5_4")
+ layout34.addWidget(self.textLabel5_4)
+ spacer20_4 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout34.addItem(spacer20_4)
+
+ self.pageSetComboBox = QComboBox(0,widget,"pageSetComboBox")
+ layout34.addWidget(self.pageSetComboBox)
+
+ self.pagesetDefaultPushButton = QPushButton(widget,"pagesetDefaultPushButton")
+ layout34.addWidget(self.pagesetDefaultPushButton)
+
+ self.textLabel5_4.setText(self.__tr("Page set:"))
+ self.pageSetComboBox.clear()
+ self.pageSetComboBox.insertItem(self.__tr("All pages"))
+ self.pageSetComboBox.insertItem(self.__tr("Even pages"))
+ self.pageSetComboBox.insertItem(self.__tr("Odd pages"))
+ self.pagesetDefaultPushButton.setText(self.__tr("Default"))
+
+ self.pagesetDefaultPushButton.setEnabled(False)
+
+ self.connect(self.pageSetComboBox, SIGNAL("activated(int)"), self.pageSetComboBox_activated)
+ self.connect(self.pagesetDefaultPushButton, SIGNAL("clicked()"), self.pagesetDefaultPushButton_clicked)
+
+ self.addWidget(widget, "set")
+
+ def pagesetDefaultPushButton_clicked(self):
+ self.pagesetDefaultPushButton.setEnabled(False)
+ self.pageSetComboBox.setCurrentItem(0)
+
+ def pageSetComboBox_activated(self, i):
+ self.pagesetDefaultPushButton.setEnabled(i != 0)
+
+ 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'])
+
+ 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))
+
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+ finally:
+ self.cur_device.close()
+
+ def funcButton_clicked(self):
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollPrintView",s,c)
diff --git a/ui/scrollprintcontrol.py b/ui/scrollprintcontrol.py
new file mode 100644
index 000000000..70a343115
--- /dev/null
+++ b/ui/scrollprintcontrol.py
@@ -0,0 +1,337 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils
+from prnt import cups
+
+# Qt
+from qt import *
+from scrollview import ScrollView
+
+# Std Lib
+import os.path, os
+import time
+
+
+class CancelJobPushButton(QPushButton):
+ def __init__(self, parent, name, job_id):
+ QPushButton.__init__(self, parent, name)
+ self.job_id = job_id
+
+
+class ScrollPrintJobView(ScrollView):
+ def __init__(self,parent = None,name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ #self.heading_color = "#cccccc"
+
+ 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.warning_pix = QPixmap(os.path.join(prop.image_dir, "warning.png"))
+ self.error_pix = QPixmap(os.path.join(prop.image_dir, "error.png"))
+ self.ok_pix = QPixmap(os.path.join(prop.image_dir, "ok.png"))
+ self.busy_pix = QPixmap(os.path.join(prop.image_dir, 'busy.png'))
+ self.idle_pix = QPixmap(os.path.join(prop.image_dir, 'idle.png'))
+ self.print_pix = QPixmap(os.path.join(prop.image_dir, "print_icon.png"))
+
+ self.JOB_STATE_ICONS = { cups.IPP_JOB_PENDING: self.busy_pix,
+ cups.IPP_JOB_HELD : self.busy_pix,
+ cups.IPP_JOB_PROCESSING : self.print_pix,
+ cups.IPP_JOB_STOPPED : self.warning_pix,
+ cups.IPP_JOB_CANCELLED : self.warning_pix,
+ cups.IPP_JOB_ABORTED : self.error_pix,
+ cups.IPP_JOB_COMPLETED : self.ok_pix,
+ }
+
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ self.addGroupHeading("print_control", self.__tr("Print Control"))
+
+ self.addPrintController()
+ self.updatePrintController()
+
+ jobs = cups.getJobs()
+
+ num_jobs = 0
+ for j in jobs:
+ if j.dest == self.cur_printer:
+ num_jobs += 1
+
+ if num_jobs > 1:
+ self.addGroupHeading("job_control", self.__tr("Job Control"))
+ self.addCancelAllJobsController()
+
+ if num_jobs:
+ if num_jobs == 1:
+ self.addGroupHeading("jobs", self.__tr("1 Active Print Job"))
+
+ elif num_jobs > 1:
+ self.addGroupHeading("jobs", self.__tr("%1 Active Print Jobs").arg(num_jobs))
+
+ for j in jobs:
+ if j.dest == self.cur_printer:
+ self.addItem(j.dest, j.id, j.state, j.user, j.title)
+
+ def addPrintController(self):
+ widget = self.getWidget()
+
+ layout1 = QGridLayout(widget,1,1,5,10,"layout1")
+
+ layout2 = QVBoxLayout(None,10,10,"layout2")
+
+ self.stopstartTextLabel = QLabel(widget,"stopstartTextLabel")
+ self.stopstartTextLabel.setFrameShape(self.frame_shape)
+ layout2.addWidget(self.stopstartTextLabel)
+
+ self.acceptrejectTextLabel = QLabel(widget,"acceptrejectTextLabel")
+ self.acceptrejectTextLabel.setFrameShape(self.frame_shape)
+ layout2.addWidget(self.acceptrejectTextLabel)
+
+ self.defaultTextLabel = QLabel(widget,"defaultTextLabel")
+ self.defaultTextLabel.setFrameShape(self.frame_shape)
+ layout2.addWidget(self.defaultTextLabel)
+
+ layout1.addMultiCellLayout(layout2,2,3,0,0)
+
+ layout3 = QVBoxLayout(None,0,6,"layout3")
+
+ self.stopstartPushButton = QPushButton(widget,"stopstartPushButton")
+ layout3.addWidget(self.stopstartPushButton)
+
+ self.rejectacceptPushButton = QPushButton(widget,"rejectacceptPushButton")
+ layout3.addWidget(self.rejectacceptPushButton)
+
+ self.defaultPushButton = QPushButton(widget,"defaultPushButton")
+ layout3.addWidget(self.defaultPushButton)
+ layout1.addMultiCellLayout(layout3,2,3,2,2)
+
+ spacer1 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer1,3,1)
+
+ spacer2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer2,2,1)
+
+ self.connect(self.stopstartPushButton,SIGNAL("clicked()"),self.stopstartPushButton_clicked)
+ self.connect(self.rejectacceptPushButton,SIGNAL("clicked()"),self.rejectacceptPushButton_clicked)
+ self.connect(self.defaultPushButton,SIGNAL("clicked()"),self.defaultPushButton_clicked)
+
+ self.addWidget(widget, "print_control")
+
+ def updatePrintController(self):
+ # default printer
+ self.defaultPushButton.setText(self.__tr("Set as Default"))
+ default_printer = cups.getDefaultPrinter()
+
+ if default_printer == self.cur_printer:
+ s = self.__tr("SET AS DEFAULT")
+ self.defaultPushButton.setEnabled(False)
+ else:
+ s = self.__tr("NOT SET AS DEFAULT")
+ self.defaultPushButton.setEnabled(True)
+
+ self.defaultTextLabel.setText(self.__tr("The printer is currently: %1").arg(s))
+
+ cups_printers = cups.getPrinters()
+ for p in cups_printers:
+ if p.name == self.cur_printer:
+ self.printer_state = p.state
+ self.printer_accepting = p.accepting
+ break
+
+ # start/stop
+ if self.printer_state == cups.IPP_PRINTER_STATE_IDLE:
+ s = self.__tr("IDLE")
+ self.stopstartPushButton.setText(self.__tr("Stop Printer"))
+
+ elif self.printer_state == cups.IPP_PRINTER_STATE_PROCESSING:
+ s = self.__tr("PROCESSING")
+ self.stopstartPushButton.setText(self.__tr("Stop Printer"))
+
+ else:
+ s = self.__tr("STOPPED")
+ self.stopstartPushButton.setText(self.__tr("Start Printer"))
+
+ self.stopstartTextLabel.setText(self.__tr("The printer is currently: %1").arg(s))
+
+ # reject/accept
+ if self.printer_accepting:
+ s = self.__tr("ACCEPTING JOBS")
+ self.rejectacceptPushButton.setText(self.__tr("Reject Jobs"))
+ else:
+ s = self.__tr("REJECTING JOBS")
+ self.rejectacceptPushButton.setText(self.__tr("Accept Jobs"))
+
+ self.acceptrejectTextLabel.setText(self.__tr("The printer is currently: %1").arg(s))
+
+
+ def stopstartPushButton_clicked(self):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ if self.printer_state in (cups.IPP_PRINTER_STATE_IDLE, cups.IPP_PRINTER_STATE_PROCESSING):
+ cups.stop(self.cur_printer)
+ else:
+ cups.start(self.cur_printer)
+
+ self.updatePrintController()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ def rejectacceptPushButton_clicked(self):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ if self.printer_accepting:
+ cups.reject(self.cur_printer)
+ else:
+ cups.accept(self.cur_printer)
+
+ self.updatePrintController()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def defaultPushButton_clicked(self):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ result = cups.setDefaultPrinter(self.cur_printer)
+ if not result:
+ log.error("Set default printer failed.")
+ else:
+ self.updatePrintController()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def addCancelAllJobsController(self):
+ widget = self.getWidget()
+
+ layout1 = QHBoxLayout(widget,10,5,"layout1")
+
+ textLabel1 = QLabel(widget,"textLabel1")
+ layout1.addWidget(textLabel1)
+
+ spacer1 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer1)
+
+ cancelPushButton = QPushButton(widget,"cancelPushButton")
+ layout1.addWidget(cancelPushButton)
+
+ self.addWidget(widget, "job_control")
+
+ textLabel1.setText(self.__tr("Cancel all active print jobs"))
+ cancelPushButton.setText(self.__tr("Cancel All Jobs"))
+
+ self.connect(cancelPushButton, SIGNAL("clicked()"), self.cancelAllJobs)
+
+
+ def cancelAllJobs(self):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ if not cups.purge(self.cur_printer):
+ log.error("Cancel all jobs failed.")
+ else:
+ self.fillControls()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+
+ def addItem(self, dest, job_id, state, user, title):
+ widget = self.getWidget()
+
+ layout1 = QGridLayout(widget,1,1,5,10,"layout1")
+
+ #line1 = QFrame(widget,"line1")
+ #line1.setFrameShape(QFrame.HLine)
+
+ #layout1.addMultiCellWidget(line1,3,3,0,4)
+
+ cancelPushButton = CancelJobPushButton(widget,"cancelPushButton", job_id)
+ layout1.addWidget(cancelPushButton,1,4)
+
+ spacer1 = QSpacerItem(30,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer1,1,3)
+
+ icon = QLabel(widget,"icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,
+ icon.sizePolicy().hasHeightForWidth()))
+
+ icon.setMinimumSize(QSize(32,32))
+ icon.setMaximumSize(QSize(32,32))
+ icon.setScaledContents(1)
+ layout1.addMultiCellWidget(icon,1,2,1,1)
+
+ spacer2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer2,0,3)
+
+ titleText = QLabel(widget,"titleText")
+ titleText.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred,0,0,
+ titleText.sizePolicy().hasHeightForWidth()))
+
+ layout1.addMultiCellWidget(titleText,0,0,1,2)
+
+ stateText = QLabel(widget,"stateText")
+ stateText.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Preferred,0,0,
+ stateText.sizePolicy().hasHeightForWidth()))
+
+ layout1.addWidget(stateText,1,2)
+
+ jobIDText = QLabel(widget,"jobIDText")
+ layout1.addWidget(jobIDText,0,4)
+
+ titleText.setText(self.__tr("<b>%1</b>").arg(title))
+ stateText.setText(self.JOB_STATES[state])
+ jobIDText.setText(self.__tr("Job ID: %1").arg(job_id))
+ cancelPushButton.setText(self.__tr("Cancel Job"))
+
+ icon.setPixmap(self.JOB_STATE_ICONS[state])
+
+ self.connect(cancelPushButton, SIGNAL("clicked()"), self.cancelJob)
+
+ self.addWidget(widget, dest+str(job_id))
+
+
+ def cancelJob(self):
+ sender = self.sender()
+
+ job_id = sender.job_id
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ self.cur_device.cancelJob(job_id)
+ time.sleep(1)
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ self.fillControls()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollPrintJobView",s,c)
+
diff --git a/ui/scrollprintsettings.py b/ui/scrollprintsettings.py
new file mode 100644
index 000000000..08996ab40
--- /dev/null
+++ b/ui/scrollprintsettings.py
@@ -0,0 +1,950 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils
+from prnt import cups
+
+# Qt
+from qt import *
+from scrollview import ScrollView
+
+# Std Lib
+import os.path, os
+
+
+class OptionComboBox(QComboBox):
+ def __init__(self, rw, parent, name, group, option, choices, default, typ=cups.PPD_UI_PICKONE, other=None):
+ QComboBox.__init__(self, rw, parent, name)
+ self.group = group
+ self.option = option
+ self.choices = choices
+ self.default = default
+ self.typ = typ
+ self.other = other
+
+ 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):
+ QSpinBox.__init__(self, parent, name)
+ self.group = group
+ self.option = option
+ self.default = default
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+class OptionButtonGroup(QButtonGroup):
+ def __init__(self, parent, name, group, option, default):
+ QButtonGroup.__init__(self, parent, name)
+ self.group = group
+ self.option = option
+ self.default = default
+
+ def setDefaultPushbutton(self, pushbutton):
+ self.pushbutton = pushbutton
+
+
+class DefaultPushButton(QPushButton):
+ def __init__(self, parent, name, group, option, choices, default, control, typ):
+ QPushButton.__init__(self, parent, name)
+ self.group = group
+ self.option = option
+ self.default = default
+ self.control = control
+ self.typ = typ
+ self.choices = choices
+
+
+
+class ScrollPrintSettingsView(ScrollView):
+ def __init__(self,parent = None,name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ self.loading = True
+ cups.resetOptions()
+ cups.openPPD(self.cur_printer)
+
+ try:
+ try:
+ current_options = dict(cups.getOptions())
+
+ if not self.is_fax:
+ self.addGroupHeading("basic", self.__tr("Basic"))
+ log.debug("Group: Basic")
+
+ # Basic
+ # PageSize (in PPD section)
+ # orientation-requested
+ # sides
+ # outputorder
+ # Collate
+
+
+ current = current_options.get('orientation-requested', '3')
+
+ self.addItem("basic", "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.addItem("basic", "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.addItem("basic", "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 = int(utils.to_bool(current_options.get('Collate', '0')))
+
+ self.addItem("basic", "Collate",
+ self.__tr("Collate (Group together multiple copies)"),
+ cups.PPD_UI_BOOLEAN, current,
+ [], 0)
+
+ log.debug("Option: Collate")
+ log.debug("Current value: %s" % current)
+
+ groups = cups.getGroupList()
+
+ for g in groups:
+ log.debug("Group: %s" % g)
+ text, num_subgroups = cups.getGroup(g)
+ read_only = 'install' in g.lower()
+
+ if g.lower() == 'printoutmode':
+ text = self.__tr("Quality")
+
+ self.addGroupHeading(g, text, read_only)
+
+ log.debug(" Text: %s" % text)
+ log.debug("Num subgroups: %d" % num_subgroups)
+
+ options = cups.getOptionList(g)
+
+ for o in options:
+ log.debug(" Option: %s" % o)
+
+ if 'pageregion' in o.lower():
+ log.debug("Skipped.")
+ continue
+
+ option_text, defchoice, conflicted, ui = cups.getOption(g, o)
+
+ if o.lower() == 'quality':
+ option_text = self.__tr("Quality")
+
+ log.debug(" Text: %s" % option_text)
+ log.debug(" Defchoice: %s" % defchoice)
+
+ choices = cups.getChoiceList(g, o)
+
+ value = None
+ choice_data = []
+ for c in choices:
+ log.debug(" Choice: %s" % 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" % choice_text)
+
+ if marked:
+ value = c
+
+ choice_data.append((c, choice_text))
+
+
+ self.addItem(g, o, option_text, ui, value, choice_data, defchoice, read_only)
+
+## if 'pagesize' in o.lower(): # and 'custom' in c.lower():
+## current = 0.0
+## width_widget = self.addItem("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.addItem("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.addGroupHeading("nup",
+ self.__tr("N-Up (Multiple document pages per printed page)"))
+
+ log.debug("Group: N-Up")
+
+ current = current_options.get('number-up', '1')
+
+ self.addItem("nup", "number-up", self.__tr("Pages per Sheet"),
+ cups.PPD_UI_PICKONE, current,
+ [('1', self.__tr('1 sheet per page')),
+ ('2', self.__tr('2 sheets per page')),
+ ('4', self.__tr('4 sheets per page'))], '1')
+
+ log.debug(" Option: number-up")
+ log.debug(" Current value: %s" % current)
+
+ current = current_options.get('number-up-layout', 'lrtb')
+
+ self.addItem("nup", "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.addItem("nup", "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)
+
+ # Adjustment
+ # brightness
+ # gamma
+
+ if not self.is_fax:
+ self.addGroupHeading("adjustment", self.__tr("Printout Appearance"))
+
+ current = int(current_options.get('brightness', 100))
+
+ log.debug(" Option: brightness")
+ log.debug(" Current value: %s" % current)
+
+ self.addItem("adjustment", "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.addItem("adjustment", "gamma", self.__tr("Gamma"), cups.UI_SPINNER, current,
+ (1, 10000), 1000)
+
+ # 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.addItem("margins", "page-top", self.__tr("Top margin"),
+## cups.UI_UNITS_SPINNER, current_top,
+## (0, page_len), top)
+##
+## self.addItem("margins", "page-bottom", self.__tr("Bottom margin"),
+## cups.UI_UNITS_SPINNER, current_bottom,
+## (0, page_len), bottom)
+##
+## self.addItem("margins", "page-left", self.__tr("Right margin"),
+## cups.UI_UNITS_SPINNER, current_left,
+## (0, page_width), left)
+##
+## self.addItem("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.addGroupHeading("image", self.__tr("Image Printing"))
+
+ current = current_options.get('fitplot', 'false')
+
+ self.addItem("image", "fitplot",
+ self.__tr("Fit to Page"),
+ cups.PPD_UI_BOOLEAN, current,
+ [], 0)
+
+
+ current = current_options.get('position', 'center')
+
+ self.addItem("image", "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.is_fax:
+ current = int(current_options.get('saturation', 100))
+
+ log.debug(" Option: saturation")
+ log.debug(" Current value: %s" % current)
+
+ self.addItem("image", "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.addItem("image", "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.addItem("image", "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.addItem("image", "scaling", self.__tr("Scaling (relative to page)"),
+ cups.UI_SPINNER, current,
+ (1, 800), 100, suffix=" %")
+
+ # Misc
+ # PrettyPrint
+ # job-sheets
+ # mirror
+
+ self.addGroupHeading("misc", self.__tr("Miscellaneous"))
+
+ log.debug("Group: Misc")
+
+ current = int(utils.to_bool(current_options.get('prettyprint', '0')))
+
+ self.addItem("misc", "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.is_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.addItem("misc", "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 = int(utils.to_bool(current_options.get('mirror', '0')))
+
+ self.addItem("misc", "mirror", self.__tr('Mirror Printing'),
+ cups.PPD_UI_BOOLEAN, current, [], 0)
+
+ log.debug(" Option: mirror")
+ log.debug(" Current value: %s" % current)
+
+ except Exception, e:
+ log.exception()
+
+ finally:
+ cups.closePPD()
+ self.loading = False
+
+ def optionComboBox_activated(self, a):
+ a = unicode(a)
+ sender = self.sender()
+ choice = None
+
+ if sender.typ == cups.UI_BANNER_JOB_SHEETS:
+ 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]))
+
+ else:
+ choice = None
+ for c, t in sender.choices:
+ if t == a:
+ choice = c
+ break
+
+ if choice is not None and choice.lower() == sender.default.lower():
+ self.removePrinterOption(sender.option)
+ sender.pushbutton.setEnabled(False)
+ else:
+ sender.pushbutton.setEnabled(True)
+
+ if choice is not None:
+ self.setPrinterOption(sender.option, choice)
+
+ self.linkPrintoutModeAndQuality(sender.option, choice)
+
+
+ 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 optionSpinBox_valueChanged(self, i):
+ sender = self.sender()
+
+ if i == sender.default:
+ self.removePrinterOption(sender.option)
+ sender.pushbutton.setEnabled(False)
+ else:
+ sender.pushbutton.setEnabled(True)
+ self.setPrinterOption(sender.option, str(i))
+
+
+ def optionButtonGroup_clicked(self, b):
+ 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 defaultPushButton_clicked(self):
+ sender = self.sender()
+ sender.setEnabled(False)
+
+ if sender.typ == cups.PPD_UI_BOOLEAN:
+ if sender.default:
+ sender.control.setButton(1)
+ else:
+ sender.control.setButton(0)
+
+ 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
+ break
+
+ if choice is not None:
+ self.removePrinterOption(sender.option)
+ sender.control.setCurrentText(text)
+
+ self.linkPrintoutModeAndQuality(sender.option, choice)
+
+ elif sender.typ == cups.UI_SPINNER:
+ sender.control.setValue(sender.default)
+ self.removePrinterOption(sender.option)
+
+ elif sender.typ == cups.UI_BANNER_JOB_SHEETS:
+ 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:
+ sender.control[0].setCurrentText(start_text)
+
+ if end is not None:
+ sender.control[1].setCurrentText(end_text)
+
+ self.removePrinterOption('job-sheets')
+
+
+ def setPrinterOption(self, option, value):
+ cups.openPPD(self.cur_printer)
+
+ try:
+ cups.addOption("%s=%s" % (option, value))
+ cups.setOptions()
+ finally:
+ cups.closePPD()
+
+ def removePrinterOption(self, option):
+ cups.openPPD(self.cur_printer)
+
+ try:
+ cups.removeOption(option)
+ cups.setOptions()
+ finally:
+ cups.closePPD()
+
+
+ def addItem(self, group, option, text, typ, value, choices, default, read_only=False, suffix=""):
+ widget, control = None, None
+
+ if typ == cups.PPD_UI_BOOLEAN: # () On (*) Off widget
+ widget = self.getWidget()
+ layout = QGridLayout(widget, 1, 1, 5, 10, "layout")
+ default = int(utils.to_bool(str(default)))
+ value = int(utils.to_bool(str(value)))
+
+ textLabel1 = QLabel(widget, "textLabel1")
+ layout.addWidget(textLabel1, 0, 0)
+
+ buttonGroup = OptionButtonGroup(widget, "buttonGroup", group, option, default)
+ buttonGroup.setLineWidth(0)
+ buttonGroup.setColumnLayout(0,Qt.Vertical)
+ buttonGroup.layout().setSpacing(1)
+ buttonGroup.layout().setMargin(5)
+ buttonGroupLayout = QHBoxLayout(buttonGroup.layout())
+ buttonGroupLayout.setAlignment(Qt.AlignTop)
+
+ defaultPushButton = DefaultPushButton(widget,"defaultPushButton", group, option,
+ choices, default, buttonGroup, typ)
+
+ buttonGroup.setDefaultPushbutton(defaultPushButton)
+
+ layout.addWidget(defaultPushButton, 0, 3)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout.addItem(spacer1, 0, 1)
+
+ onRadioButton = QRadioButton(buttonGroup,"onRadioButton")
+ buttonGroup.insert(onRadioButton, 1)
+ buttonGroupLayout.addWidget(onRadioButton)
+
+ offRadioButton = QRadioButton(buttonGroup,"offRadioButton")
+ buttonGroup.insert(offRadioButton, 0)
+ buttonGroupLayout.addWidget(offRadioButton)
+
+ layout.addWidget(buttonGroup, 0, 2)
+
+ textLabel1.setText(text)
+ onRadioButton.setText(self.__tr("On"))
+ offRadioButton.setText(self.__tr("Off"))
+
+ if value == default:
+ defaultPushButton.setEnabled(False)
+
+ self.connect(defaultPushButton, SIGNAL("clicked()"), self.defaultPushButton_clicked)
+ self.connect(buttonGroup, SIGNAL("clicked(int)"), self.optionButtonGroup_clicked)
+
+ x = self.__tr('Off')
+ if default:
+ x = self.__tr('On')
+
+ if value:
+ buttonGroup.setButton(1)
+ else:
+ buttonGroup.setButton(0)
+
+ if read_only:
+ onRadioButton.setEnabled(False)
+ offRadioButton.setEnabled(False)
+ defaultPushButton.setEnabled(False)
+ else:
+ QToolTip.add(defaultPushButton, self.__tr('Set to default value of "%1".').arg(x))
+
+ defaultPushButton.setText("Default")
+
+ elif typ == cups.PPD_UI_PICKONE: # Combo box widget
+ widget = self.getWidget()
+
+ layout1 = QHBoxLayout(widget,5,10,"layout1")
+
+ textLabel1 = QLabel(widget,"textLabel1")
+ layout1.addWidget(textLabel1)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout1.addItem(spacer1)
+
+ optionComboBox = OptionComboBox(0, widget, "optionComboBox", group, option, choices, default)
+ layout1.addWidget(optionComboBox)
+
+ defaultPushButton = DefaultPushButton(widget,"defaultPushButton", group, option,
+ choices, default, optionComboBox, typ)
+
+ optionComboBox.setDefaultPushbutton(defaultPushButton)
+
+ layout1.addWidget(defaultPushButton)
+
+ textLabel1.setText(text)
+ defaultPushButton.setText("Default")
+
+ x, y = None, None
+ for c, t in choices:
+ d = c.lower()
+ if value is not None and d == value.lower():
+ x = t
+
+ if d == default.lower():
+ y = t
+
+ optionComboBox.insertItem(t)
+
+ if x is not None:
+ optionComboBox.setCurrentText(x)
+
+ if value is not None and value.lower() == default.lower():
+ defaultPushButton.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(defaultPushButton, SIGNAL("clicked()"), self.defaultPushButton_clicked)
+ self.connect(optionComboBox, SIGNAL("activated(const QString&)"), self.optionComboBox_activated)
+
+ control = optionComboBox
+
+ elif typ == cups.UI_SPINNER: # Spinner widget
+ widget = self.getWidget()
+
+ layout1 = QHBoxLayout(widget,5,10, "layout1")
+
+ textLabel1 = QLabel(widget, "textLabel1")
+ layout1.addWidget(textLabel1)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout1.addItem(spacer1)
+
+ optionSpinBox = OptionSpinBox(widget,"optionSpinBox", group, option, default)
+ layout1.addWidget(optionSpinBox)
+
+ defaultPushButton = DefaultPushButton(widget, "defaultPushButton", group, option, choices,
+ default, optionSpinBox, typ)
+
+ optionSpinBox.setDefaultPushbutton(defaultPushButton)
+
+ layout1.addWidget(defaultPushButton)
+
+ min, max = choices
+ optionSpinBox.setMinValue(min)
+ optionSpinBox.setMaxValue(max)
+ optionSpinBox.setValue(value)
+
+ if suffix:
+ optionSpinBox.setSuffix(suffix)
+
+ textLabel1.setText(text)
+ defaultPushButton.setText("Default")
+
+ self.connect(optionSpinBox, SIGNAL("valueChanged(int)"), self.optionSpinBox_valueChanged)
+ self.connect(defaultPushButton, SIGNAL("clicked()"), self.defaultPushButton_clicked)
+
+ if value == default:
+ defaultPushButton.setEnabled(False)
+
+ if read_only:
+ self.optionSpinBox.setEnabled(False)
+ self.defaultPushButton.setEnabled()
+ else:
+ QToolTip.add(defaultPushButton,
+ self.__tr('Set to default value of "%1".').arg(default))
+
+ elif typ == cups.UI_BANNER_JOB_SHEETS: # Job sheets widget
+ widget = self.getWidget()
+
+ layout1 = QGridLayout(widget,1,1,5,10,"layout1")
+
+ startComboBox = OptionComboBox(0, widget, "startComboBox", group,
+ "start", choices, default, typ)
+
+ layout1.addWidget(startComboBox,0,3)
+
+ startTextLabel = QLabel(widget,"startTextLabel")
+ layout1.addWidget(startTextLabel,0,2)
+
+ endTextLabel = QLabel(widget,"endTextLabel")
+ layout1.addWidget(endTextLabel,0,4)
+
+ endComboBox = OptionComboBox(0, widget, "endComboBox", group, "end", choices,
+ default, typ, startComboBox)
+
+ layout1.addWidget(endComboBox,0,5)
+
+ startComboBox.setOther(endComboBox)
+
+ defaultPushButton = DefaultPushButton(widget, "defaultPushButton", group, option, choices,
+ default, (startComboBox, endComboBox), typ)
+
+ layout1.addWidget(defaultPushButton,0,6)
+
+ startComboBox.setDefaultPushbutton(defaultPushButton)
+ endComboBox.setDefaultPushbutton(defaultPushButton)
+
+ textLabel1 = QLabel(widget,"textLabel1")
+ layout1.addWidget(textLabel1,0,0)
+
+ spacer1 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer1,0,1)
+
+ textLabel1.setText(text)
+ defaultPushButton.setText("Default")
+
+ startTextLabel.setText(self.__tr("Start:"))
+ endTextLabel.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(t)
+ endComboBox.insertItem(t)
+
+ if s is not None:
+ startComboBox.setCurrentText(s)
+
+ if e is not None:
+ endComboBox.setCurrentText(e)
+
+ if value is not None and \
+ value[0].lower() == default[0].lower() and \
+ value[1].lower() == default[1].lower():
+
+ defaultPushButton.setEnabled(False)
+
+ if y is not None and z is not None:
+ QToolTip.add(defaultPushButton, self.__tr('Set to default value of "Start: %1, End: %2".').arg(y).arg(z))
+
+ self.connect(startComboBox, SIGNAL("activated(const QString&)"), self.optionComboBox_activated)
+ self.connect(endComboBox, SIGNAL("activated(const QString&)"), self.optionComboBox_activated)
+ self.connect(defaultPushButton, SIGNAL("clicked()"), self.defaultPushButton_clicked)
+
+ elif typ == cups.PPD_UI_PICKMANY:
+ print "pickmany"
+
+ elif typ == cups.UI_UNITS_SPINNER:
+ widget = self.getWidget()
+
+ layout1 = QHBoxLayout(widget,5,10,"layout1")
+
+ textLabel1 = QLabel(widget,"textLabel1")
+ layout1.addWidget(textLabel1)
+
+ spacer1 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout1.addItem(spacer1)
+
+ lineEdit1 = QLineEdit(widget,"lineEdit1")
+ layout1.addWidget(lineEdit1)
+
+ comboBox1 = QComboBox(0,widget,"comboBox1")
+ layout1.addWidget(comboBox1)
+
+ defaultPushButton = QPushButton(widget,"defaultPushButton")
+ layout1.addWidget(defaultPushButton)
+
+ textLabel1.setText(text)
+ defaultPushButton.setText("Default")
+
+ else:
+ log.error("Invalid UI value: %s/%s" % (group, option))
+
+ if widget is not None:
+ self.addWidget(widget, "o:"+option, control)
+ return widget
+
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollPrintSettingsView",s,c)
+
diff --git a/ui/scrollstatus.py b/ui/scrollstatus.py
new file mode 100644
index 000000000..8ac0198a5
--- /dev/null
+++ b/ui/scrollstatus.py
@@ -0,0 +1,263 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils
+
+# Qt
+from qt import *
+from scrollview import ScrollView
+
+# Std Lib
+import os.path, os
+import time
+
+try:
+ import datetime
+ have_datetime = True
+except ImportError:
+ have_datetime = False
+
+
+
+class ScrollStatusView(ScrollView):
+ def __init__(self,parent = None,name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.warning_pix = QPixmap(os.path.join(prop.image_dir, "warning.png"))
+ self.error_pix = QPixmap(os.path.join(prop.image_dir, "error.png"))
+ self.ok_pix = QPixmap(os.path.join(prop.image_dir, "ok.png"))
+ self.lowink_pix = QPixmap(os.path.join(prop.image_dir, 'inkdrop.png'))
+ self.lowtoner_pix = QPixmap(os.path.join(prop.image_dir, 'toner.png'))
+ self.busy_pix = QPixmap(os.path.join(prop.image_dir, 'busy.png'))
+ self.lowpaper_pix = QPixmap(os.path.join(prop.image_dir, 'paper.png'))
+ self.idle_pix = QPixmap(os.path.join(prop.image_dir, 'idle.png'))
+
+ self.ScanPixmap = QPixmap(os.path.join(prop.image_dir, "scan_icon.png"))
+ self.PrintPixmap = QPixmap(os.path.join(prop.image_dir, "print_icon.png"))
+ self.SendFaxPixmap =QPixmap(os.path.join(prop.image_dir, "fax_icon.png"))
+ self.PhotoCardPixmap = QPixmap(os.path.join(prop.image_dir, "pcard_icon.png"))
+ self.MakeCopiesPixmap = QPixmap(os.path.join(prop.image_dir, "makecopies_icon.png"))
+
+ self.STATUS_ICONS = { ERROR_STATE_CLEAR : (self.idle_pix, self.idle_pix),
+ ERROR_STATE_BUSY : (self.busy_pix, self.busy_pix),
+ ERROR_STATE_ERROR : (self.error_pix, self.error_pix),
+ ERROR_STATE_LOW_SUPPLIES : (self.lowink_pix, self.lowtoner_pix),
+ ERROR_STATE_OK : (self.ok_pix, self.ok_pix),
+ ERROR_STATE_WARNING : (self.warning_pix, self.warning_pix),
+ ERROR_STATE_LOW_PAPER: (self.lowpaper_pix, self.lowpaper_pix),
+ ERROR_STATE_PRINTING : (self.PrintPixmap, self.PrintPixmap),
+ ERROR_STATE_SCANNING : (self.ScanPixmap, self.ScanPixmap),
+ ERROR_STATE_PHOTOCARD : (self.PhotoCardPixmap, self.PrintPixmap),
+ ERROR_STATE_FAXING : (self.SendFaxPixmap, self.SendFaxPixmap),
+ ERROR_STATE_COPYING : (self.MakeCopiesPixmap, self.MakeCopiesPixmap),
+ }
+
+ self.unit_names = { "year" : (self.__tr("year"), self.__tr("years")),
+ "month" : (self.__tr("month"), self.__tr("months")),
+ "week" : (self.__tr("week"), self.__tr("weeks")),
+ "day" : (self.__tr("day"), self.__tr("days")),
+ "hour" : (self.__tr("hour"), self.__tr("hours")),
+ "minute" : (self.__tr("minute"), self.__tr("minutes")),
+ "second" : (self.__tr("second"), self.__tr("seconds")),
+ }
+
+ self.num_repr = { 1 : self.__tr("one"),
+ 2 : self.__tr("two"),
+ 3 : self.__tr("three"),
+ 4 : self.__tr("four"),
+ 5 : self.__tr("five"),
+ 6 : self.__tr("six"),
+ 7 : self.__tr("seven"),
+ 8 : self.__tr("eight"),
+ 9 : self.__tr("nine"),
+ 10 : self.__tr("ten"),
+ 11 : self.__tr("eleven"),
+ 12 : self.__tr("twelve")
+ }
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+ self.row = 0
+
+ for x in self.cur_device.hist:
+ self.addItem(x)
+
+ def addItem(self, hist):
+ yr, mt, dy, hr, mi, sec, wd, yd, dst, job_id, user, ec, ess, esl = hist
+
+ if self.row == 0:
+ desc = self.__tr("(most recent)")
+
+ else:
+ if have_datetime:
+ desc = self.getTimeDeltaDesc(hist[:9])
+ else:
+ desc = ''
+
+ # TODO: In Qt4.x, use QLocale.toString(date, format)
+ tt = QString("<b>%1 %2</b>").arg(QDateTime (QDate(yr, mt, dy), QTime(hr, mi, sec)).toString()).arg(desc).stripWhiteSpace()
+
+ self.addGroupHeading(unicode(tt), tt)
+
+ widget = self.getWidget()
+
+ layout38 = QGridLayout(widget,1,1,5,10,"layout38")
+ layout38.setColStretch(0, 1)
+ layout38.setColStretch(1, 10)
+ layout38.setColStretch(2, 2)
+
+ spacer15 = QSpacerItem(30,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout38.addItem(spacer15,0,2)
+
+ icon = QLabel(widget,"icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,icon.sizePolicy().hasHeightForWidth()))
+ icon.setMinimumSize(QSize(32,32))
+ icon.setMaximumSize(QSize(32,32))
+ icon.setScaledContents(1)
+
+ layout38.addWidget(icon,0,0)
+
+ layout11_2 = QVBoxLayout(None,0,6,"layout11_2")
+
+ essText = QLabel(widget,"essTextLabel")
+ essText.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Preferred,0,0,essText.sizePolicy().hasHeightForWidth()))
+ essText.setAlignment(QLabel.WordBreak | QLabel.AlignVCenter)
+ essText.setFrameShape(self.frame_shape)
+ layout11_2.addWidget(essText)
+
+ eslText = QLabel(widget,"eslTextLabel")
+ eslText.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Preferred,0,0,eslText.sizePolicy().hasHeightForWidth()))
+ eslText.setAlignment(QLabel.WordBreak | QLabel.AlignVCenter)
+ eslText.setFrameShape(self.frame_shape)
+ layout11_2.addWidget(eslText)
+
+ layout38.addLayout(layout11_2,0,1)
+
+ layout12_2 = QGridLayout(None,1,1,5,10,"layout12_2")
+
+ userTextLabel = QLabel(widget,"userLabel")
+ layout12_2.addWidget(userTextLabel,0,1)
+
+ jobIDTextLabel = QLabel(widget,"jobLabel")
+ layout12_2.addWidget(jobIDTextLabel,1,1)
+
+ userText = QLabel(widget,"user")
+ layout12_2.addWidget(userText,0,2)
+
+ codeTextLabel = QLabel(widget,"codeLabel")
+ layout12_2.addWidget(codeTextLabel,2,1)
+
+ jobIDText = QLabel(widget,"job")
+ layout12_2.addWidget(jobIDText,1,2)
+
+ codeText = QLabel(widget,"code")
+ layout12_2.addWidget(codeText,2,2)
+
+ line6 = QFrame(self,"line6")
+ line6.setFrameShape(QFrame.VLine)
+ layout12_2.addMultiCellWidget(line6,0,2,0,0)
+
+ layout38.addLayout(layout12_2,0,3)
+
+ ess = qApp.translate("StringTable", ess)
+ essText.setText(ess)
+
+ esl = qApp.translate("StringTable", esl)
+ eslText.setText(esl)
+
+ userTextLabel.setText(self.__tr("User:"))
+ userText.setText(user)
+
+ jobIDTextLabel.setText(self.__tr("Job ID:"))
+ if job_id <= 0:
+ jobIDText.setText(self.__tr("n/a"))
+ else:
+ jobIDText.setText(str(job_id))
+
+ codeTextLabel.setText(self.__tr("Code:"))
+ codeText.setText(unicode(ec))
+
+ error_state = STATUS_TO_ERROR_STATE_MAP.get(ec, ERROR_STATE_CLEAR)
+
+ try:
+ tech_type = self.cur_device.tech_type
+ except AttributeError:
+ tech_type = TECH_TYPE_NONE
+
+ if tech_type in (TECH_TYPE_COLOR_INK, TECH_TYPE_MONO_INK):
+ status_pix = self.STATUS_ICONS[error_state][0] # ink
+ else:
+ status_pix = self.STATUS_ICONS[error_state][1] # laser
+
+ if status_pix is not None:
+ icon.setPixmap(status_pix)
+
+ self.row += 1
+ self.addWidget(widget, str(self.row))
+
+
+ def getTimeDeltaDesc(self, past):
+ delta = datetime.datetime(*time.localtime()[:7]) - datetime.datetime(*past[:7])
+ return self.__tr("(about %1 ago)").arg(self.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 seconds_in_units(self, 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(self, td):
+ seconds = td.days * 3600 * 24 + td.seconds
+ amount, unit_name = self.seconds_in_units(seconds)
+
+ try:
+ i18n_amount = self.num_repr[amount]
+ except KeyError:
+ i18n_amount = unicode(amount)
+
+ if amount == 1:
+ i18n_unit = self.unit_names[unit_name][0]
+ else:
+ i18n_unit = self.unit_names[unit_name][1]
+
+ return "%s %s" % (i18n_amount, i18n_unit)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollStatusView",s,c)
+
diff --git a/ui/scrollsupplies.py b/ui/scrollsupplies.py
new file mode 100644
index 000000000..738418db8
--- /dev/null
+++ b/ui/scrollsupplies.py
@@ -0,0 +1,338 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils
+from prnt import cups
+
+# Qt
+from qt import *
+from scrollview import ScrollView
+
+# Std Lib
+import os.path, os
+
+
+
+class ScrollSuppliesView(ScrollView):
+ def __init__(self,parent = None,name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.pix_battery = QPixmap(os.path.join(prop.image_dir, 'icon_battery.png'))
+
+ 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_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],
+ }
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ 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])
+ except KeyError:
+ break
+ else:
+ self.cur_device.sorted_supplies.append((a, agent_kind, agent_type))
+
+ a += 1
+
+ self.cur_device.sorted_supplies.sort(lambda x, y: cmp(x[2], y[2]) or cmp(x[1], y[1]))
+
+ for x in self.cur_device.sorted_supplies:
+ a, agent_kind, agent_type = x
+ agent_level = int(self.cur_device.dq['agent%d-level' % a])
+ agent_sku = str(self.cur_device.dq['agent%d-sku' % a])
+ agent_desc = self.cur_device.dq['agent%d-desc' % a]
+ agent_health_desc = self.cur_device.dq['agent%d-health-desc' % a]
+
+ self.addItem("agent %d" % a, "<b>"+agent_desc+"</b>",
+ agent_sku, agent_health_desc,
+ agent_kind, agent_type, agent_level)
+
+
+ else:
+ if not self.cur_device.supported:
+
+ self.addGroupHeading("not_supported", self.__tr("ERROR: Device not supported."))
+
+ elif self.cur_device.status_type == STATUS_TYPE_NONE:
+
+ self.addGroupHeading("not_found", self.__tr("ERROR: Supplies status is not supported on this device."))
+
+ else:
+ self.addGroupHeading("not_found", self.__tr("ERROR: Device not found. Please check connection and power-on device."))
+
+
+ def getIcon(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(32, 32) #, -1, QPixmap.DefaultOptim)
+ pix.fill(qApp.palette().color(QPalette.Active, QColorGroup.Background))
+ p = QPainter()
+ p.begin(pix)
+ p.setBackgroundMode(Qt.OpaqueMode)
+
+ if map_len == 1:
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(8, 8, 16, 16, 0, 5760)
+
+ elif map_len == 2:
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(4, 8, 16, 16, 0, 5760)
+
+ p.setPen(QColor(map[1]))
+ p.setBrush(QBrush(QColor(map[1]), Qt.SolidPattern))
+ p.drawPie(12, 8, 16, 16, 0, 5760)
+
+ elif map_len == 3:
+ p.setPen(QColor(map[2]))
+ p.setBrush(QBrush(QColor(map[2]), Qt.SolidPattern))
+ p.drawPie(12, 12, 16, 16, 0, 5760)
+
+ p.setPen(QColor(map[1]))
+ p.setBrush(QBrush(QColor(map[1]), Qt.SolidPattern))
+ p.drawPie(4, 12, 16, 16, 0, 5760)
+
+ p.setPen(QColor(map[0]))
+ p.setBrush(QBrush(QColor(map[0]), Qt.SolidPattern))
+ p.drawPie(8, 4, 16, 16, 0, 5760)
+
+ p.end()
+ return pix
+
+ else:
+ return map
+
+ elif agent_kind == AGENT_KIND_INT_BATTERY:
+ return self.pix_battery
+
+
+ def createBarGraph(self, percent, agent_type, w=100, h=18):
+ fw = w/100*percent
+ px = QPixmap(w, h)
+ px.fill(qApp.palette().color(QPalette.Active, QColorGroup.Background))
+
+ pp = QPainter(px)
+ pp.setPen(Qt.black)
+ pp.setBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
+
+ 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)
+
+ return px
+
+
+ def addItem(self, name, title_text, part_num_text, status_text,
+ agent_kind, agent_type, percent):
+
+ self.addGroupHeading(title_text, title_text)
+
+ widget = self.getWidget()
+ layout1 = QGridLayout(widget,1,1,5,10,"layout1")
+
+ spacer1 = QSpacerItem(20,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ layout1.addItem(spacer1,0,3)
+
+ barGraph = QLabel(widget,"barGraph")
+ barGraph.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,
+ barGraph.sizePolicy().hasHeightForWidth()))
+
+ barGraph.setMinimumSize(QSize(100,18))
+ barGraph.setMaximumSize(QSize(100,18))
+ barGraph.setScaledContents(1)
+ layout1.addMultiCellWidget(barGraph,0,0,4,5)
+
+ #titleText = QLabel(widget,"titleText")
+ #layout1.addMultiCellWidget(titleText,0,0,0,2)
+
+ #line1 = QFrame(widget,"line1")
+ #line1.setFrameShape(QFrame.HLine)
+ #layout1.addMultiCellWidget(line1,2,2,0,5)
+
+ spacer2 = QSpacerItem(20,20,QSizePolicy.Preferred,QSizePolicy.Minimum)
+ layout1.addMultiCell(spacer2,1,1,2,4)
+
+ statusText = QLabel(widget,"statusText")
+ statusText.setFrameShape(self.frame_shape)
+ layout1.addWidget(statusText,1,5)
+
+ icon = QLabel(widget,"icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,
+ icon.sizePolicy().hasHeightForWidth()))
+
+ icon.setMinimumSize(QSize(32,32))
+ icon.setMaximumSize(QSize(32,32))
+ icon.setScaledContents(1)
+ layout1.addWidget(icon,0,0)
+
+ partNumText = QLabel(widget,"partNumText")
+ partNumText.setFrameShape(self.frame_shape)
+ partNumText.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Preferred,0,0,
+ partNumText.sizePolicy().hasHeightForWidth()))
+
+ partNumText.setAlignment(QLabel.WordBreak | QLabel.AlignVCenter)
+ layout1.addWidget(partNumText,0,1)
+
+ #titleText.setText(title_text)
+
+ if part_num_text:
+ partNumText.setText(self.__tr("Part No. %1").arg(part_num_text))
+
+ statusText.setText(status_text)
+
+ # Bar graph level
+ 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,
+ ):
+
+ barGraph.setPixmap(self.createBarGraph(percent, agent_type))
+
+ # Color icon
+ 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,
+ ):
+
+ pix = self.getIcon(agent_kind, agent_type)
+
+ if pix is not None:
+ icon.setPixmap(pix)
+
+ self.addWidget(widget, name)
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollSuppliesView",s,c)
+
diff --git a/ui/scrolltool.py b/ui/scrolltool.py
new file mode 100644
index 000000000..cea9ff4ee
--- /dev/null
+++ b/ui/scrolltool.py
@@ -0,0 +1,928 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils, pml, maint
+from prnt import cups
+from base.codes import *
+
+# Qt
+from qt import *
+from scrollview import ScrollView, PixmapLabelButton
+
+# Std Lib
+import sys, os.path, os
+
+# Alignment and ColorCal forms
+from alignform import AlignForm
+from aligntype6form1 import AlignType6Form1
+from aligntype6form2 import AlignType6Form2
+from paperedgealignform import PaperEdgeAlignForm
+from colorcalform import ColorCalForm # Type 1 color cal
+from coloradjform import ColorAdjForm # Type 5 and 6 color adj
+from colorcalform2 import ColorCalForm2 # Type 2 color cal
+from colorcal4form import ColorCal4Form # Type 4 color cal
+from align10form import Align10Form # Type 10 and 11 alignment
+
+# Misc forms
+from loadpaperform import LoadPaperForm
+from settingsdialog import SettingsDialog
+from aboutdlg import AboutDlg
+from cleaningform import CleaningForm
+from cleaningform2 import CleaningForm2
+from waitform import WaitForm
+from faxsettingsform import FaxSettingsForm
+
+
+class ScrollToolView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None,form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.form = form
+ self.toolbox_hosted = toolbox_hosted
+
+ user_settings = utils.UserSettings()
+ self.cmd_fab = user_settings.cmd_fab
+ log.debug("FAB command: %s" % self.cmd_fab)
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if self.cur_device is not None and \
+ self.cur_device.supported and \
+ self.cur_device.device_state != DEVICE_STATE_NOT_FOUND:
+
+ if self.cur_device.device_settings_ui is not None:
+ self.addItem( "device_settings", self.__tr("<b>Device Settings</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_settings.png')),
+ self.__tr("Your device has special device settings. You may alter these settings here."),
+ self.__tr("Device Settings..."),
+ self.deviceSettingsButton_clicked)
+
+ if self.cur_device.fax_type and prop.fax_build:
+ self.addItem( "fax_settings", self.__tr("<b>Fax Setup</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_fax.png')),
+ self.__tr("Fax support must be setup before you can send faxes."),
+ self.__tr("Setup Fax..."),
+ self.faxSettingsButton_clicked)
+
+ self.addItem( "fax_address_book", self.__tr("<b>Fax Address Book</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_fax.png')),
+ self.__tr("Setup fax phone numbers to use when sending faxes from the PC."),
+ self.__tr("Fax Address Book..."),
+ self.faxAddressBookButton_clicked)
+
+ self.addItem( "testpage", self.__tr("<b>Print Test Page</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_testpage.png')),
+ self.__tr("Print a test page to test the setup of your printer."),
+ self.__tr("Print Test Page >>"),
+ self.PrintTestPageButton_clicked)
+
+ self.addItem( "printer_info", self.__tr("<b>View Printer (Queue) Information</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_cups.png')),
+ self.__tr("View the printers (queues) installed in CUPS."),
+ self.__tr("View Printer Information >>"),
+ self.viewPrinterInformation)
+
+ self.addItem( "device_info", self.__tr("<b>View Device Information</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_info.png')),
+ self.__tr("This information is primarily useful for debugging and troubleshooting (advanced)."),
+ self.__tr("View Device Information >>"),
+ self.viewInformation)
+
+ if self.cur_device.pq_diag_type:
+ self.addItem( "pqdiag", self.__tr("<b>Print Quality Diagnostics</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_pq_diag.png')),
+ self.__tr("Your printer can print a test page to help diagnose print quality problems."),
+ self.__tr("Print Diagnostic Page..."),
+ self.pqDiag)
+
+ if self.cur_device.fw_download:
+ self.addItem( "fwdownload", self.__tr("<b>Download Firmware</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'download.png')),
+ self.__tr("Download firmware to your printer (required on some devices after each power-up)."),
+ self.__tr("Download Firmware..."),
+ self.downloadFirmware)
+
+ if self.cur_device.clean_type:
+ self.addItem( "clean", self.__tr("<b>Clean Cartridges</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_clean.png')),
+ self.__tr("You only need to perform this action if you are having problems with poor printout quality due to clogged ink nozzles."),
+ self.__tr("Clean Cartridges..."),
+ self.CleanPensButton_clicked)
+
+ if self.cur_device.align_type:
+ self.addItem( "align", self.__tr("<b>Align Cartridges</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_align.png')),
+ self.__tr("This will improve the quality of output when a new cartridge is installed."),
+ self.__tr("Align Cartridges..."),
+ self.AlignPensButton_clicked)
+
+ if self.cur_device.color_cal_type:
+ self.addItem( "colorcal", self.__tr("<b>Perform Color Calibration</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_colorcal.png')),
+ self.__tr("Use this procedure to optimimize your printer's color output."),
+ self.__tr("Color Calibration..."),
+ self.ColorCalibrationButton_clicked)
+
+ if self.cur_device.linefeed_cal_type:
+ self.addItem( "linefeed", self.__tr("<b>Perform Line Feed Calibration</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_linefeed_cal.png')),
+ self.__tr("Use line feed calibration to optimize print quality (to remove gaps in the printed output)."),
+ self.__tr("Line Feed Calibration..."),
+ self.linefeedCalibration)
+
+ if self.cur_device.embedded_server_type and self.cur_device.bus == 'net' and prop.net_build:
+ self.addItem( "ews", self.__tr("<b>Access Embedded Web Page</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_ews.png')),
+ self.__tr("You can use your printer's embedded web server to configure, maintain, and monitor the device from a web browser."),
+ self.__tr("Open in Browser..."),
+ self.OpenEmbeddedBrowserButton_clicked)
+
+ self.addItem("support", self.__tr("<b>View Documentation</b>"),
+ QPixmap(os.path.join(prop.image_dir, 'icon_support2.png')),
+ self.__tr("View documentation installed on your system."),
+ self.__tr("View Documentation..."),
+ self.viewSupport)
+
+
+ def addItem(self, name, title, pix, text, button_text, button_func):
+ self.addGroupHeading(title, title)
+
+ widget = self.getWidget()
+
+ layout1 = QGridLayout(widget, 1, 3, 5, 10,"layout1")
+
+ layout1.setColStretch(0, 1)
+ layout1.setColStretch(1, 10)
+ layout1.setColStretch(2, 2)
+
+ pushButton = QPushButton(widget, "pushButton")
+ pushButton.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed, 0, 0,
+ pushButton.sizePolicy().hasHeightForWidth()))
+
+ layout1.addWidget(pushButton, 0, 3)
+
+ icon = QLabel(widget, "icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed, 0, 0,
+ icon.sizePolicy().hasHeightForWidth()))
+
+ icon.setMinimumSize(QSize(32, 32))
+ icon.setMaximumSize(QSize(32, 32))
+ icon.setScaledContents(1)
+ layout1.addWidget(icon, 0, 0)
+
+
+ textLabel = QLabel(widget, "textLabel")
+ textLabel.setAlignment(QLabel.WordBreak)
+ textLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred, 0, 0,
+ textLabel.sizePolicy().hasHeightForWidth()))
+ textLabel.setFrameShape(self.frame_shape)
+ layout1.addWidget(textLabel, 0, 1)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout1.addItem(spacer1, 0, 2)
+
+ textLabel.setText(text)
+ pushButton.setText(button_text)
+ icon.setPixmap(pix)
+
+ self.connect(pushButton, SIGNAL("clicked()"), button_func)
+
+ self.addWidget(widget, unicode(title))
+
+ def viewInformation(self):
+ self.form.SwitchMaintTab("device_info")
+
+ def viewPrinterInformation(self):
+ self.form.SwitchMaintTab("printer_info")
+
+ def viewSupport(self):
+ f = "http://hplip.sf.net"
+
+ if prop.doc_build:
+ g = os.path.join(sys_cfg.dirs.doc, 'index.html')
+ if os.path.exists(g):
+ f = "file://%s" % g
+
+ log.debug(f)
+ utils.openURL(f)
+
+ def pqDiag(self):
+ d = self.cur_device
+ pq_diag = d.pq_diag_type
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+
+ if pq_diag == 1:
+ maint.printQualityDiagType1(d, self.LoadPaperUI)
+
+ elif pq_diag == 2:
+ maint.printQualityDiagType2(d, self.LoadPaperUI)
+
+ else:
+ self.CheckDeviceUI()
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+
+ def linefeedCalibration(self):
+ d = self.cur_device
+ linefeed_type = d.linefeed_cal_type
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+
+ if linefeed_type == 1:
+ maint.linefeedCalType1(d, self.LoadPaperUI)
+
+ elif linefeed_type == 2:
+ maint.linefeedCalType2(d, self.LoadPaperUI)
+
+ else:
+ self.CheckDeviceUI()
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+ def downloadFirmware(self):
+ d = self.cur_device
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ d.open()
+
+ if d.isIdleAndNoError():
+ d.downloadFirmware()
+ else:
+ self.form.FailureUI(self.__tr("<b>An error occured downloading firmware file.</b><p>Please check your printer and try again."))
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+
+ def CheckDeviceUI(self):
+ self.form.FailureUI(self.__tr("<b>Device is busy or in an error state.</b><p>Please check device and try again."))
+
+ def LoadPaperUI(self):
+ if LoadPaperForm(self).exec_loop() == QDialog.Accepted:
+ return True
+ return False
+
+ def AlignmentNumberUI(self, letter, hortvert, colors, line_count, choice_count):
+ dlg = AlignForm(self, letter, hortvert, colors, line_count, choice_count)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.value
+ else:
+ return False, 0
+
+ def PaperEdgeUI(self, maximum):
+ dlg = PaperEdgeAlignForm(self)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.value
+ else:
+ return False, 0
+
+ def BothPensRequiredUI(self):
+ self.form.WarningUI(self.__tr("<p><b>Both cartridges are required for alignment.</b><p>Please install both cartridges and try again."))
+
+ def InvalidPenUI(self):
+ self.form.WarningUI(self.__tr("<p><b>One or more cartiridges are missing from the printer.</b><p>Please install cartridge(s) and try again."))
+
+ def PhotoPenRequiredUI(self):
+ self.form.WarningUI(self.__tr("<p><b>Both the photo and color cartridges must be inserted into the printer to perform color calibration.</b><p>If you are planning on printing with the photo cartridge, please insert it and try again."))
+
+ def PhotoPenRequiredUI2(self):
+ self.form.WarningUI(self.__tr("<p><b>Both the photo (regular photo or photo blue) and color cartridges must be inserted into the printer to perform color calibration.</b><p>If you are planning on printing with the photo or photo blue cartridge, please insert it and try again."))
+
+ def NotPhotoOnlyRequired(self): # Type 11
+ self.form.WarningUI(self.__tr("<p><b>Cannot align with only the photo cartridge installed.</b><p>Please install other cartridges and try again."))
+
+ def AioUI1(self):
+ dlg = AlignType6Form1(self)
+ return dlg.exec_loop() == QDialog.Accepted
+
+
+ def AioUI2(self):
+ AlignType6Form2(self).exec_loop()
+
+ def Align10and11UI(self, pattern, align_type):
+ dlg = Align10Form(pattern, align_type, self)
+ dlg.exec_loop()
+ return dlg.getValues()
+
+ def AlignPensButton_clicked(self):
+ d = self.cur_device
+ align_type = d.align_type
+
+ log.debug("Align: %s %s (type=%d) %s" % ("*"*20, self.cur_device.device_uri, align_type, "*"*20))
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+
+ if align_type == ALIGN_TYPE_AUTO:
+ maint.AlignType1(d, self.LoadPaperUI)
+
+ elif align_type == ALIGN_TYPE_8XX:
+ maint.AlignType2(d, self.LoadPaperUI, self.AlignmentNumberUI,
+ self.BothPensRequiredUI)
+
+ elif align_type in (ALIGN_TYPE_9XX,ALIGN_TYPE_9XX_NO_EDGE_ALIGN):
+ maint.AlignType3(d, self.LoadPaperUI, self.AlignmentNumberUI,
+ self.PaperEdgeUI, align_type)
+
+ elif align_type in (ALIGN_TYPE_LIDIL_0_3_8, ALIGN_TYPE_LIDIL_0_4_3, ALIGN_TYPE_LIDIL_VIP):
+ maint.AlignxBow(d, align_type, self.LoadPaperUI, self.AlignmentNumberUI,
+ self.PaperEdgeUI, self.InvalidPenUI, self.ColorAdjUI)
+
+ elif align_type == ALIGN_TYPE_LIDIL_AIO:
+ maint.AlignType6(d, self.AioUI1, self.AioUI2, self.LoadPaperUI)
+
+ elif align_type == ALIGN_TYPE_DESKJET_450:
+ maint.AlignType8(d, self.LoadPaperUI, self.AlignmentNumberUI)
+
+ elif align_type == ALIGN_TYPE_LBOW:
+ maint.AlignType10(d, self.LoadPaperUI, self.Align10and11UI)
+
+ elif align_type == ALIGN_TYPE_LIDIL_0_5_4:
+ maint.AlignType11(d, self.LoadPaperUI, self.Align10and11UI, self.NotPhotoOnlyRequired)
+
+ elif align_type == ALIGN_TYPE_OJ_PRO:
+ maint.AlignType12(d, self.LoadPaperUI)
+
+ else:
+ self.CheckDeviceUI()
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+ def ColorAdjUI(self, line, maximum=0):
+ dlg = ColorAdjForm(self, line)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.value
+ else:
+ return False, 0
+
+ def ColorCalUI(self):
+ dlg = ColorCalForm(self)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.value
+ else:
+ return False, 0
+
+ def ColorCalUI2(self):
+ dlg = ColorCalForm2(self)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.value
+ else:
+ return False, 0
+
+ def ColorCalUI4(self):
+ dlg = ColorCal4Form(self)
+ if dlg.exec_loop() == QDialog.Accepted:
+ return True, dlg.values
+ else:
+ return False, None
+
+ def ColorCalibrationButton_clicked(self):
+ d = self.cur_device
+ color_cal_type = d.color_cal_type
+ log.debug("Color-cal: %s %s (type=%d) %s" % ("*"*20, self.cur_device.device_uri, color_cal_type, "*"*20))
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+
+ if color_cal_type == COLOR_CAL_TYPE_DESKJET_450:
+ maint.colorCalType1(d, self.LoadPaperUI, self.ColorCalUI,
+ self.PhotoPenRequiredUI)
+
+ elif color_cal_type == COLOR_CAL_TYPE_MALIBU_CRICK:
+ maint.colorCalType2(d, self.LoadPaperUI, self.ColorCalUI2,
+ self.InvalidPenUI)
+
+ elif color_cal_type == COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADO:
+ maint.colorCalType3(d, self.LoadPaperUI, self.ColorAdjUI,
+ self.PhotoPenRequiredUI2)
+
+ elif color_cal_type == COLOR_CAL_TYPE_CONNERY:
+ maint.colorCalType4(d, self.LoadPaperUI, self.ColorCalUI4,
+ self.WaitUI)
+
+ elif color_cal_type == COLOR_CAL_TYPE_COUSTEAU:
+ maint.colorCalType5(d, self.LoadPaperUI)
+
+ elif color_cal_type == COLOR_CAL_TYPE_CARRIER:
+ maint.colorCalType6(d, self.LoadPaperUI)
+
+ else:
+ self.CheckDeviceUI()
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+
+ def PrintTestPageButton_clicked(self):
+ self.form.SwitchMaintTab("testpage")
+
+
+ def CleanUI1(self):
+ return CleaningForm(self, self.cur_device, 1).exec_loop() == QDialog.Accepted
+
+
+ def CleanUI2(self):
+ return CleaningForm(self, self.cur_device, 2).exec_loop() == QDialog.Accepted
+
+
+ def CleanUI3(self):
+ CleaningForm2(self).exec_loop()
+ return True
+
+
+ def WaitUI(self, seconds):
+ WaitForm(seconds, None, self).exec_loop()
+
+
+ def CleanPensButton_clicked(self):
+ d = self.cur_device
+ clean_type = d.clean_type
+ log.debug("Clean: %s %s (type=%d) %s" % ("*"*20, self.cur_device.device_uri, clean_type, "*"*20))
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+
+ if clean_type == CLEAN_TYPE_PCL:
+ maint.cleaning(d, clean_type, maint.cleanType1, maint.primeType1,
+ maint.wipeAndSpitType1, self.LoadPaperUI,
+ self.CleanUI1, self.CleanUI2, self.CleanUI3,
+ self.WaitUI)
+
+ elif clean_type == CLEAN_TYPE_LIDIL:
+ maint.cleaning(d, clean_type, maint.cleanType2, maint.primeType2,
+ maint.wipeAndSpitType2, self.LoadPaperUI,
+ self.CleanUI1, self.CleanUI2, self.CleanUI3,
+ self.WaitUI)
+
+ elif clean_type == CLEAN_TYPE_PCL_WITH_PRINTOUT:
+ maint.cleaning(d, clean_type, maint.cleanType1, maint.primeType1,
+ maint.wipeAndSpitType1, self.LoadPaperUI,
+ self.CleanUI1, self.CleanUI2, self.CleanUI3,
+ self.WaitUI)
+ else:
+ self.CheckDeviceUI()
+
+ finally:
+ d.close()
+ QApplication.restoreOverrideCursor()
+
+ def OpenEmbeddedBrowserButton_clicked(self):
+ utils.openURL("http://%s" % self.cur_device.host)
+
+ def faxAddressBookButton_clicked(self):
+ self.RunCommand(self.cmd_fab)
+
+ def faxSettingsButton_clicked(self):
+ try:
+ try:
+ self.cur_device.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ try:
+ result_code, fax_num = self.cur_device.getPML(pml.OID_FAX_LOCAL_PHONE_NUM)
+ except Error:
+ log.error("PML failure.")
+ self.form.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
+ return
+
+ fax_num = str(fax_num)
+
+ try:
+ result_code, name = self.cur_device.getPML(pml.OID_FAX_STATION_NAME)
+ except Error:
+ log.error("PML failure.")
+ self.form.FailureUI(self.__tr("<p><b>Operation failed. Device busy.</b>"))
+ return
+
+ name = str(name)
+
+ dlg = FaxSettingsForm(self.cur_device, fax_num, name, self)
+ dlg.exec_loop()
+
+ finally:
+ self.cur_device.close()
+
+
+ def addressBookButton_clicked(self):
+ self.RunCommand(self.cmd_fab)
+
+ def deviceSettingsButton_clicked(self):
+ try:
+ self.cur_device.open()
+ self.cur_device.device_settings_ui(self.cur_device, self)
+ finally:
+ self.cur_device.close()
+
+
+ def RunCommand(self, cmd, macro_char='%'):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ if len(cmd) == 0:
+ self.form.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.device_uri, "*"*20))
+ log.debug(cmd)
+ cmd = ''.join([self.cur_device.device_vars.get(x, x) \
+ for x in cmd.split(macro_char)])
+ 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)
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ def CleanupChildren(self):
+ log.debug("Cleaning up child processes.")
+ try:
+ os.waitpid(-1, os.WNOHANG)
+ except OSError:
+ pass
+
+
+ def FailureUI(self, error_text):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollToolView",s,c)
+
+
+#
+#
+# ScrollDeviceInfoView (View Device Information)
+#
+#
+
+class ScrollDeviceInfoView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.form = form
+ self.toolbox_hosted = toolbox_hosted
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ self.addDeviceInfo()
+
+ # addActionButton(self, name, action_text, action_func, action_pixmap=None, disabled_action_pixmap=None,
+ # nav_text ='', nav_func=None):
+
+ if self.toolbox_hosted:
+ self.navButton = self.addActionButton("bottom_nav", "",
+ None, None, None, self.__tr("<< Tools"), self.navButton_clicked)
+ else:
+ self.navButton = self.addActionButton("bottom_nav", self.__tr("Close"),
+ self.navButton_clicked, None, None, "", None)
+
+ self.maximizeControl()
+
+ def addDeviceInfo(self):
+ self.addGroupHeading("info_title", self.__tr("Device Information"))
+
+ widget = self.getWidget()
+
+ layout37 = QGridLayout(widget,1,1,5,10,"layout37")
+
+ self.infoListView = QListView(widget,"fileListView")
+ self.infoListView.addColumn(self.__tr("Static/Dynamic"))
+ self.infoListView.addColumn(self.__tr("Key"))
+ self.infoListView.addColumn(self.__tr("Value"))
+ self.infoListView.setAllColumnsShowFocus(1)
+ self.infoListView.setShowSortIndicator(1)
+ self.infoListView.setColumnWidth(0, 50)
+ self.infoListView.setColumnWidth(1, 150)
+ self.infoListView.setColumnWidth(2, 300)
+ self.infoListView.setItemMargin(2)
+ self.infoListView.setSorting(-1)
+
+ layout37.addMultiCellWidget(self.infoListView,1,1,0,3)
+
+ mq_keys = self.cur_device.mq.keys()
+ mq_keys.sort()
+ mq_keys.reverse()
+ for key,i in zip(mq_keys, range(len(mq_keys))):
+ QListViewItem(self.infoListView, self.__tr("Static"), key, str(self.cur_device.mq[key]))
+
+ dq_keys = self.cur_device.dq.keys()
+ dq_keys.sort()
+ dq_keys.reverse()
+ for key,i in zip(dq_keys, range(len(dq_keys))):
+ QListViewItem(self.infoListView, self.__tr("Dynamic"), key, str(self.cur_device.dq[key]))
+
+ self.addWidget(widget, "file_list", maximize=True)
+
+ def navButton_clicked(self):
+ if self.toolbox_hosted:
+ self.form.SwitchMaintTab("tools")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollDeviceInfoView",s,c)
+
+
+
+#
+#
+# ScrollTestpageView (Print Test Page)
+#
+#
+
+class ScrollTestpageView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.form = form
+ self.toolbox_hosted = toolbox_hosted
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if self.addPrinterFaxList():
+ self.addTestpageType()
+
+ self.addLoadPaper()
+
+ if self.toolbox_hosted:
+ s = self.__tr("<< Tools")
+ else:
+ s = self.__tr("Close")
+
+ self.printButton = self.addActionButton("bottom_nav", self.__tr("Print Test Page"),
+ self.printButton_clicked, 'print.png', None, s, self.navButton_clicked)
+
+
+ def addTestpageType(self):
+ self.addGroupHeading("testpage_type", self.__tr("Test Page Type"))
+ widget = self.getWidget()
+
+ Form4Layout = QGridLayout(widget,1,1,5,10,"Form4Layout")
+
+ self.buttonGroup3 = QButtonGroup(widget,"buttonGroup3")
+ self.buttonGroup3.setLineWidth(0)
+ self.buttonGroup3.setColumnLayout(0,Qt.Vertical)
+ self.buttonGroup3.layout().setSpacing(5)
+ self.buttonGroup3.layout().setMargin(10)
+
+ buttonGroup3Layout = QGridLayout(self.buttonGroup3.layout())
+ buttonGroup3Layout.setAlignment(Qt.AlignTop)
+
+ self.radioButton6 = QRadioButton(self.buttonGroup3,"radioButton6")
+ self.radioButton6.setEnabled(False)
+ buttonGroup3Layout.addWidget(self.radioButton6,1,0)
+
+ self.radioButton5 = QRadioButton(self.buttonGroup3,"radioButton5")
+ self.radioButton5.setChecked(1)
+ buttonGroup3Layout.addWidget(self.radioButton5,0,0)
+
+ Form4Layout.addWidget(self.buttonGroup3,0,0)
+
+ self.radioButton6.setText(self.__tr("Printer diagnostic page (does not test print driver)"))
+ self.radioButton5.setText(self.__tr("HPLIP test page (tests print driver)"))
+
+
+ self.addWidget(widget, "page_type")
+
+
+ def navButton_clicked(self):
+ if self.toolbox_hosted:
+ self.form.SwitchMaintTab("tools")
+ else:
+ self.form.close()
+
+ def printButton_clicked(self):
+ d = self.cur_device
+ printer_name = self.cur_printer
+ printed = False
+
+ try:
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ d.open()
+ except Error:
+ self.CheckDeviceUI()
+ else:
+ if d.isIdleAndNoError():
+ QApplication.restoreOverrideCursor()
+ d.close()
+
+ d.printTestPage(printer_name)
+ printed = True
+
+ else:
+ d.close()
+ self.CheckDeviceUI()
+
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ if printed:
+ QMessageBox.information(self,
+ self.caption(),
+ self.__tr("<p><b>A test page should be printing on your printer.</b><p>If the page fails to print, please visit http://hplip.sourceforge.net for troubleshooting and support."),
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+ if self.toolbox_hosted:
+ self.form.SwitchMaintTab("tools")
+ else:
+ self.form.close()
+
+ def CheckDeviceUI(self):
+ self.form.FailureUI(self.__tr("<b>Device is busy or in an error state.</b><p>Please check device and try again."))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollTestpageView",s,c)
+
+
+
+
+
+
+
+#
+#
+# ScrollPrinterInfoView (View Device Information)
+#
+#
+
+class ScrollPrinterInfoView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self,parent,name,fl)
+
+ self.form = form
+ self.toolbox_hosted = toolbox_hosted
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ printers = []
+ for p in self.printers:
+ if p.device_uri == self.cur_device.device_uri or \
+ p.device_uri.replace("hpfax:", "hp:") == self.cur_device.device_uri:
+
+ printers.append(p)
+
+ if not printers:
+ self.addGroupHeading("error_title", self.__tr("No printers found for this device."))
+ else:
+ for p in printers:
+ self.addPrinterInfo(p)
+
+ if self.toolbox_hosted:
+ self.navButton = self.addActionButton("bottom_nav", "",
+ None, None, None, self.__tr("<< Tools"), self.navButton_clicked)
+ else:
+ self.navButton = self.addActionButton("bottom_nav", self.__tr("Close"),
+ self.navButton_clicked, None, None, "", None)
+
+ self.maximizeControl()
+
+ def addPrinterInfo(self, p):
+ self.addGroupHeading(p.name, p.name)
+ widget = self.getWidget()
+
+ layout1 = QVBoxLayout(widget,5,10,"layout1")
+
+ textLabel2 = QLabel(widget,"textLabel2")
+
+ if p.device_uri.startswith("hpfax:"):
+ s = self.__tr("Fax")
+ else:
+ s = self.__tr("Printer")
+ textLabel2.setText(self.__tr("Type: %1").arg(s))
+ layout1.addWidget(textLabel2)
+
+ textLabel3 = QLabel(widget,"textLabel3")
+ textLabel3.setText(self.__tr("Location: %1").arg(p.location))
+ layout1.addWidget(textLabel3)
+
+ textLabel4 = QLabel(widget,"textLabel4")
+ textLabel4.setText(self.__tr("Description/Info: %1").arg(p.info))
+ layout1.addWidget(textLabel4)
+
+ textLabel5 = QLabel(widget,"textLabel5")
+
+ if p.state == cups.IPP_PRINTER_STATE_IDLE:
+ s = self.__tr("Idle")
+ elif p.state == cups.IPP_PRINTER_STATE_PROCESSING:
+ s = self.__tr("Processing")
+ elif p.state == cups.IPP_PRINTER_STATE_STOPPED:
+ s = self.__tr("Stopped")
+ else:
+ s = self.__tr("Unknown")
+
+ textLabel5.setText(self.__tr("State: %1").arg(s))
+ layout1.addWidget(textLabel5)
+
+ textLabel6 = QLabel(widget,"textLabel6")
+ textLabel6.setText(self.__tr("PPD/Driver: %1").arg(p.makemodel))
+ layout1.addWidget(textLabel6)
+
+ textLabel7 = QLabel(widget,"textLabel7")
+ textLabel7.setText(self.__tr("CUPS/IPP Printer URI: %1").arg(p.printer_uri))
+ layout1.addWidget(textLabel7)
+
+ self.addWidget(widget, p.name)
+
+ def navButton_clicked(self):
+ if self.toolbox_hosted:
+ self.form.SwitchMaintTab("tools")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollPrinterInfoView",s,c)
diff --git a/ui/scrollunload.py b/ui/scrollunload.py
new file mode 100644
index 000000000..b72f5ae7c
--- /dev/null
+++ b/ui/scrollunload.py
@@ -0,0 +1,651 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from base import utils, magic
+from pcard import photocard
+
+# Qt
+from qt import *
+from scrollview import ScrollView, PixmapLabelButton
+from imagepropertiesdlg import ImagePropertiesDlg
+#from waitform import WaitForm
+
+# Std Lib
+import os.path, os
+
+class IconViewItem(QIconViewItem):
+ def __init__(self, parent, dirname, fname, path, pixmap, mime_type, mime_subtype, size, exif_info={}):
+ QIconViewItem.__init__(self, parent, fname, pixmap)
+ self.mime_type = mime_type
+ self.mime_subtype = mime_subtype
+ self.path = path
+ self.dirname = dirname
+ self.filename = fname
+ self.exif_info = exif_info
+ self.size = size
+ self.thumbnail_set = False
+
+
+class ScrollUnloadView(ScrollView):
+ def __init__(self, toolbox_hosted=True, parent = None, form=None, name = None,fl = 0):
+ ScrollView.__init__(self, parent, name, fl)
+ self.toolbox_hosted = toolbox_hosted
+ self.form = form
+ self.progress_dlg = None
+ self.unload_dir = os.path.normpath(os.path.expanduser('~'))
+
+ self.image_icon_map = {'tiff' : 'tif.png',
+ 'bmp' : 'bmp.png',
+ 'jpeg' : 'jpg.png',
+ 'gif' : 'gif.png',
+ 'unknown' : 'unknown.png',
+ }
+
+ self.video_icon_map = {'unknown' : 'movie.png',
+ 'mpeg' : 'mpg.png',
+ }
+
+ QTimer.singleShot(0, self.fillControls)
+
+
+ def fillControls(self):
+ ScrollView.fillControls(self)
+
+ if 0:
+ self.addGroupHeading("error", self.__tr("ERROR: Photo Card Failed to Mount Properly. Please check device and card and try again."))
+
+ self.addGroupHeading("files_to_unload", self.__tr("Select File(s) to Unload from Photo Card"))
+ self.addIconList()
+
+ self.addGroupHeading("folder", self.__tr("Unload Folder"))
+ self.addFolder()
+
+ self.removal_option = 1 # remove files (default)
+
+ self.addGroupHeading("options", self.__tr("Unload Options"))
+ self.addOptions()
+
+ self.addGroupHeading("space1", "")
+
+ if self.toolbox_hosted:
+ s = self.__tr("<< Functions")
+ else:
+ s = self.__tr("Close")
+
+ self.unloadButton = self.addActionButton("bottom_nav", self.__tr("Unload File(s)"),
+ self.unloadButton_clicked, 'download-small.png', 'download-small-disabled.png',
+ s, self.funcButton_clicked)
+
+ self.unloadButton.setEnabled(False)
+
+ self.maximizeControl()
+
+
+ def onDeviceChange(self, cur_device=None):
+ if cur_device is not None:
+ log.debug("ScrollUnloadView.onDeviceChange(%s)" % cur_device.device_uri)
+ self.cur_device = cur_device
+ else:
+ log.debug("ScrollUnloadView.onDeviceChange(None)")
+
+ # TODO: Print a message telling users to use USB mass storage if possible
+ QTimer.singleShot(0, self.mountCard)
+
+
+ def mountCard(self):
+ self.pc = None
+
+ if self.cur_device is not None and self.cur_device.supported:
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+
+ try:
+ self.pc = photocard.PhotoCard(None, self.cur_device.device_uri, self.cur_printer)
+ except Error, e:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI(self.__tr("An error occured: %s" % e[0]))
+ self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
+ return False
+
+ if self.pc.device.device_uri is None and self.cur_printer:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI(self.__tr("Printer '%s' not found." % self.cur_printer))
+ self.cleanup(EVENT_PCARD_JOB_FAIL)
+ return False
+
+ if self.pc.device.device_uri is None and self.cur_device.device_uri:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI(self.__tr("Malformed/invalid device-uri: %s" % self.device_uri))
+ self.cleanup(EVENT_PCARD_JOB_FAIL)
+
+ return False
+ else:
+ try:
+ self.pc.mount()
+ except Error:
+ QApplication.restoreOverrideCursor()
+ self.form.FailureUI(self.__tr("<b>Unable to mount photo card on device.</b><p>Check that device is powered on and photo card is correctly inserted."))
+ #self.pc.umount()
+ self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
+ return
+
+ self.device_uri = self.pc.device.device_uri
+ user_cfg.last_used.device_uri = self.device_uri
+
+ self.pc.device.sendEvent(EVENT_START_PCARD_JOB)
+
+ disk_info = self.pc.info()
+ self.pc.write_protect = disk_info[8]
+
+ if self.pc.write_protect:
+ log.warning("Photo card is write protected.")
+
+ log.info("Photocard on device %s mounted" % self.pc.device_uri)
+
+ if not self.pc.write_protect:
+ log.info("DO NOT REMOVE PHOTO CARD UNTIL YOU EXIT THIS PROGRAM")
+
+ if user_cfg.last_used.working_dir and \
+ os.path.exists(user_cfg.last_used.working_dir):
+
+ self.unload_dir = user_cfg.last_used.working_dir
+
+ try:
+ os.chdir(self.unload_dir)
+ except OSError:
+ self.unload_dir = ''
+
+ self.UnloadDirectoryEdit.setText(self.unload_dir)
+
+ self.unload_list = self.pc.get_unload_list()
+
+ self.total_number = 0
+ self.total_size = 0
+
+ self.updateSelectionStatus()
+
+ if self.pc.write_protect:
+ self.removal_option = 0 # leave all files on card
+
+ # Item map disambiguates between files of the same
+ # name that are on the pcard in more than one location
+ self.item_map = {}
+
+ QApplication.restoreOverrideCursor()
+
+ else:
+ log.debug("Unsupported device")
+ self.y = 0
+ self.clear()
+ return False
+
+ self.busy = False
+
+ QTimer.singleShot(0, self.updateIconView)
+
+ self.display_update_timer = QTimer(self, "DisplayUpdateTimer")
+ self.connect(self.display_update_timer, SIGNAL('timeout()'), self.updateDisplay)
+
+ self.display_update_timer.start(1000)
+
+ return True
+
+
+
+ def addIconList(self):
+ widget = self.getWidget()
+
+ layout32 = QGridLayout(widget,1,1,5,10,"layout32")
+
+ spacer34 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout32.addItem(spacer34,2,2)
+
+ self.selectAllPushButton = PixmapLabelButton(widget, 'ok_small.png', None)
+
+ layout32.addWidget(self.selectAllPushButton,2,0)
+
+ self.ShowThumbnailsButton = PixmapLabelButton(widget, 'thumbnail.png', None)
+
+ layout32.addWidget(self.ShowThumbnailsButton,2,3)
+
+ self.IconView = QIconView(widget,"IconView")
+ self.IconView.setResizePolicy(QIconView.AutoOneFit)
+ self.IconView.setSelectionMode(QIconView.Multi)
+ self.IconView.setResizeMode(QIconView.Adjust)
+ self.IconView.setMaxItemWidth(200)
+ self.IconView.setAutoArrange(0)
+ self.IconView.setItemsMovable(1)
+
+ layout32.addMultiCellWidget(self.IconView,0,0,0,3)
+
+ self.selectNonePushButton = PixmapLabelButton(widget, 'folder_remove.png', None)
+
+ layout32.addWidget(self.selectNonePushButton,2,1)
+
+ self.selectionStatusText = QLabel(widget,"selectionStatusText")
+ layout32.addMultiCellWidget(self.selectionStatusText,1,1,0,3)
+ self.selectAllPushButton.setText(self.__tr("Select All"))
+ self.selectNonePushButton.setText(self.__tr("Select None"))
+ self.ShowThumbnailsButton.setText(self.__tr("Show Thumbnails"))
+
+ self.connect(self.selectAllPushButton,SIGNAL("clicked()"),self.selectAllPushButton_clicked)
+ self.connect(self.selectNonePushButton,SIGNAL("clicked()"),self.selectNonePushButton_clicked)
+ self.connect(self.IconView,SIGNAL("doubleClicked(QIconViewItem*)"),self.IconView_doubleClicked)
+ self.connect(self.IconView,SIGNAL("rightButtonClicked(QIconViewItem*,const QPoint&)"),self.IconView_rightButtonClicked)
+ self.connect(self.ShowThumbnailsButton,SIGNAL("clicked()"),self.ShowThumbnailsButton_clicked)
+
+ self.addWidget(widget, "file_list", maximize=True)
+
+
+ def selectAllPushButton_clicked(self):
+ self.IconView.selectAll(1)
+
+ def selectNonePushButton_clicked(self):
+ self.IconView.selectAll(0)
+
+ def IconView_doubleClicked(self, a0):
+ return self.PopupProperties()
+
+ def IconView_rightButtonClicked(self, item, pos):
+ popup = QPopupMenu(self)
+ popup.insertItem("Properties", self.PopupProperties)
+
+ if item is not None and \
+ item.mime_type == 'image' and \
+ item.mime_subtype == 'jpeg' and \
+ self.pc.get_exif_path(item.path) and \
+ not item.thumbnail_set:
+
+ popup.insertItem(self.__tr("Show Thumbnail"), self.showThumbNail)
+
+ popup.popup(pos)
+
+ def ShowThumbnailsButton_clicked(self):
+ self.ShowThumbnailsButton.setEnabled(False)
+ self.updateIconView(first_load=False)
+
+ def updateDisplay(self):
+ if not self.busy:
+ self.total_number = 0
+ self.total_size = 0
+ i = self.IconView.firstItem()
+
+ while i is not None:
+
+ if i.isSelected():
+ self.total_number += 1
+ self.total_size += i.size
+
+ i = i.nextItem()
+
+ self.updateSelectionStatus()
+
+ self.updateUnloadButton()
+
+ def updateUnloadButton(self):
+ self.unloadButton.setEnabled(not self.busy and self.total_number and os.path.exists(self.unload_dir))
+ #qApp.processEvents()
+
+ def updateSelectionStatus(self):
+ if self.total_number == 0:
+ s = self.__tr("No files selected")
+
+ elif self.total_number == 1:
+ s = self.__tr("1 file selected, %1").arg(utils.format_bytes(self.total_size, True))
+
+ else:
+ s = self.__tr("%1 files selected, %2").arg(self.total_number).arg(utils.format_bytes(self.total_size, True))
+
+ self.selectionStatusText.setText(s)
+
+
+ def PopupDisplay(self):
+ self.Display(self.IconView.currentItem())
+
+ def PopupProperties(self):
+ self.Properties(self.IconView.currentItem())
+
+ def showThumbNail(self):
+ item = self.IconView.currentItem()
+ exif_info = self.pc.get_exif_path(item.path)
+
+ if len(exif_info) > 0:
+ if 'JPEGThumbnail' in exif_info:
+ pixmap = QPixmap()
+ pixmap.loadFromData(exif_info['JPEGThumbnail'], "JPEG")
+ self.resizePixmap(pixmap)
+ del exif_info['JPEGThumbnail']
+ item.setPixmap(pixmap)
+
+ self.IconView.adjustItems()
+
+ else:
+ self.form.FailureUI(self.__tr("<p><b>No thumbnail found in image.</b>"))
+
+ item.thumbnail_set = True
+
+ def Properties(self, item):
+ if item is not None:
+ if not item.exif_info:
+ item.exif_info = self.pc.get_exif_path(item.path)
+
+ ImagePropertiesDlg(item.filename, item.dirname,
+ '/'.join([item.mime_type, item.mime_subtype]),
+ utils.format_bytes(item.size, True),
+ item.exif_info, self).exec_loop()
+
+
+ def updateIconView(self, first_load=True):
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ self.busy = True
+ self.first_load = first_load
+ self.item_num = 0
+
+ if first_load:
+ self.IconView.clear()
+
+ self.num_items = len(self.unload_list)
+
+ self.progress_dlg = QProgressDialog(self.__tr("Loading..."), \
+ self.__tr("Cancel"), self.num_items, self, "progress", 0)
+ self.progress_dlg.setCaption(self.__tr("HP Device Manager"))
+
+ self.progress_dlg.setMinimumDuration(0)
+ self.progress_dlg.setProgress(0)
+
+ self.load_timer = QTimer(self, "LoadTimer")
+ self.connect(self.load_timer, SIGNAL('timeout()'), self.continueLoadIconView)
+ self.load_timer.start(0)
+
+
+ def continueLoadIconView(self):
+ if self.item_num == self.num_items:
+ self.load_timer.stop()
+ self.disconnect(self.load_timer, SIGNAL('timeout()'), self.continueLoadIconView)
+ self.load_timer = None
+ del self.load_timer
+
+ self.progress_dlg.close()
+ self.progress_dlg = None
+
+ self.IconView.adjustItems()
+ self.busy = False
+ QApplication.restoreOverrideCursor()
+ return
+
+ self.progress_dlg.setProgress(self.item_num)
+
+ f = self.unload_list[self.item_num]
+ self.item_num += 1
+ log.debug(f)
+
+ path, size = f[0], f[1]
+
+ typ, subtyp = self.pc.classify_file(path).split('/')
+
+ if not self.first_load and typ == 'image' and subtyp == 'jpeg':
+
+ exif_info = self.pc.get_exif_path(path)
+ if len(exif_info) > 0:
+
+ if 'JPEGThumbnail' in exif_info:
+ pixmap = QPixmap()
+ pixmap.loadFromData(exif_info['JPEGThumbnail'], "JPEG")
+
+ self.resizePixmap(pixmap)
+
+ del exif_info['JPEGThumbnail']
+ dname, fname=os.path.split(path)
+ x = self.item_map[fname]
+
+ if len(x) == 1:
+ item = self.IconView.findItem(fname, 0)
+ else:
+ i = x.index(path)
+ if i == 0:
+ item = self.IconView.findItem(fname, 0)
+ else:
+ item = self.IconView.findItem(fname + " (%d)" % (i+1), 0)
+
+ if item is not None:
+ item.setPixmap(pixmap)
+ item.thumbnail_set = True
+
+ return
+
+ elif self.first_load:
+ if typ == 'image':
+ f = os.path.join(prop.image_dir, self.image_icon_map.get(subtyp, 'unknown.png'))
+ elif typ == 'video':
+ f = os.path.join(prop.image_dir, self.video_icon_map.get(subtyp, 'movie.png'))
+ elif typ == 'audio':
+ f = os.path.join(prop.image_dir, 'sound.png')
+ else:
+ f = os.path.join(prop.image_dir, 'unknown.png')
+
+ dirname, fname=os.path.split(path)
+ num = 1
+ try:
+ self.item_map[fname]
+ except:
+ self.item_map[fname] = [path]
+ else:
+ self.item_map[fname].append(path)
+ num = len(self.item_map[fname])
+
+ if num == 1:
+ IconViewItem(self.IconView, dirname, fname, path, QPixmap(f),
+ typ, subtyp, size)
+ else:
+ IconViewItem(self.IconView, dirname, fname + " (%d)" % num,
+ path, QPixmap(f), typ, subtyp, size)
+
+ def resizePixmap(self, pixmap):
+ w, h = pixmap.width(), pixmap.height()
+
+ if h > 128 or w > 128:
+ ww, hh = w - 128, h - 128
+ if ww >= hh:
+ pixmap.resize(128, int(float((w-ww))/w*h))
+ else:
+ pixmap.resize(int(float((h-hh))/h*w), 128)
+
+ def addFolder(self):
+ widget = self.getWidget()
+ layout38 = QGridLayout(widget,1,1,5,10,"layout38")
+
+ self.UnloadDirectoryEdit = QLineEdit(widget,"UnloadDirectoryEdit")
+ layout38.addWidget(self.UnloadDirectoryEdit,0,0)
+
+ self.UnloadDirectoryBrowseButton = PixmapLabelButton(widget, 'folder_open.png', None)
+ layout38.addWidget(self.UnloadDirectoryBrowseButton,0,1)
+
+ self.UnloadDirectoryBrowseButton.setText(self.__tr("Browse..."))
+ self.connect(self.UnloadDirectoryBrowseButton,SIGNAL("clicked()"),self.UnloadDirectoryBrowseButton_clicked)
+ self.connect(self.UnloadDirectoryEdit,SIGNAL("textChanged(const QString&)"),self.UnloadDirectoryEdit_textChanged)
+
+ self.bg = self.UnloadDirectoryEdit.paletteBackgroundColor()
+
+ self.addWidget(widget, "folder")
+
+ def UnloadDirectoryEdit_textChanged(self, dir):
+ self.unload_dir = unicode(dir)
+
+ if not os.path.exists(self.unload_dir):
+ self.UnloadDirectoryEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+ else:
+ self.UnloadDirectoryEdit.setPaletteBackgroundColor(self.bg)
+
+ def UnloadDirectoryBrowseButton_clicked(self):
+ old_dir = self.unload_dir
+ self.unload_dir = unicode(QFileDialog.getExistingDirectory(self.unload_dir, self))
+
+ if not len(self.unload_dir):
+ return
+
+ elif not utils.is_path_writable(self.unload_dir):
+ self.form.FailureUI(self.__tr("<p><b>The unload directory path you entered is not valid.</b><p>The directory must exist and you must have write permissions."))
+ self.unload_dir = old_dir
+
+ else:
+ self.UnloadDirectoryEdit.setText(self.unload_dir)
+ os.chdir(self.unload_dir)
+ user_cfg.last_used.working_dir = self.unload_dir.encode('utf-8')
+
+ def addOptions(self):
+ widget = self.getWidget()
+
+ layout34 = QHBoxLayout(widget,5,10,"layout34")
+
+ self.textLabel5_4 = QLabel(widget,"textLabel5_4")
+ layout34.addWidget(self.textLabel5_4)
+ spacer20_4 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout34.addItem(spacer20_4)
+
+ self.optionComboBox = QComboBox(0,widget,"optionsComboBox")
+ layout34.addWidget(self.optionComboBox)
+
+ self.textLabel5_4.setText(self.__tr("File removal:"))
+ self.optionComboBox.clear()
+ self.optionComboBox.insertItem(self.__tr("Leave unloaded files on photo card")) # 0
+ self.optionComboBox.insertItem(self.__tr("Remove all unloaded files from photo card")) # 1
+ self.optionComboBox.setCurrentItem(self.removal_option)
+
+ self.connect(self.optionComboBox, SIGNAL("activated(int)"), self.optionComboBox_activated)
+
+ self.addWidget(widget, "option")
+
+ def optionComboBox_activated(self, i):
+ self.removal_option = i
+
+
+ def unloadButton_clicked(self):
+ was_cancelled = False
+ self.busy = True
+ self.unloadButton.setEnabled(False)
+ self.unload_dir = unicode(self.UnloadDirectoryEdit.text())
+ dir_error = False
+
+ try:
+ try:
+ os.chdir(self.unload_dir)
+ except OSError:
+ log.error("Directory not found: %s" % self.unload_dir)
+ dir_error = True
+
+ if dir_error or not utils.is_path_writable(self.unload_dir):
+ self.form.FailureUI(self.__tr("<p><b>The unload directory path is not valid.</b><p>Please enter a new path and try again."))
+ return
+
+ unload_list = []
+ i = self.IconView.firstItem()
+ self.total_size = 0
+ while i is not None:
+
+ if i.isSelected():
+ unload_list.append((i.path, i.size, i.mime_type, i.mime_subtype))
+ self.total_size += i.size
+ i = i.nextItem()
+
+ if self.total_size == 0:
+ self.form.FailureUI(self.__tr("<p><b>No files are selected to unload.</b><p>Please select one or more files to unload and try again."))
+ return
+
+ self.total_complete = 0
+ self.progress_dlg = QProgressDialog(self.__tr("Unloading card..."), \
+ self.__tr("Cancel"), 100, self, "progress", 1)
+ self.progress_dlg.setCaption(self.__tr("HP Device Manager"))
+ self.progress_dlg.setMinimumDuration(0)
+ self.progress_dlg.setProgress(0)
+ qApp.processEvents()
+
+ if self.removal_option == 0: # Leave files
+ total_size, total_time, was_cancelled = \
+ self.pc.unload(unload_list, self.updateStatusProgressBar, None, True)
+
+ elif self.removal_option == 1: # remove selected
+ total_size, total_time, was_cancelled = \
+ self.pc.unload(unload_list, self.updateStatusProgressBar, None, False)
+
+ else: # remove all
+ total_size, total_time, was_cancelled = \
+ self.pc.unload(unload_list, self.updateStatusProgressBar, None, False)
+ # TODO: Remove remainder of files
+
+ self.progress_dlg.close()
+ self.progress_dlg = None
+
+ self.pc.device.sendEvent(EVENT_PCARD_FILES_TRANSFERED)
+
+ if self.removal_option != 0: # remove selected or remove all
+ self.unload_list = self.pc.get_unload_list()
+ self.total_number = 0
+ self.total_size = 0
+ self.item_map = {}
+ self.total_complete = 0
+ self.updateIconView()
+
+ if was_cancelled:
+ self.form.FailureUI(self.__tr("<b>Unload cancelled at user request.</b>"))
+ else:
+ pass
+
+ finally:
+ self.busy = False
+
+ def updateStatusProgressBar(self, src, trg, size):
+ qApp.processEvents()
+ self.total_complete += size
+ percent = int(100.0 * self.total_complete/self.total_size)
+ self.progress_dlg.setProgress(percent)
+ qApp.processEvents()
+
+ if self.progress_dlg.wasCanceled():
+ return True
+
+ return False
+
+
+ def cleanup(self, error=0):
+ if self.pc is not None:
+ if error > 0:
+ self.pc.device.sendEvent(error, typ='error')
+
+ try:
+ self.pc.umount()
+ self.pc.device.close()
+ except Error:
+ pass
+
+ def funcButton_clicked(self):
+ if self.pc is not None:
+ self.pc.umount()
+ self.pc.device.close()
+
+ if self.toolbox_hosted:
+ self.form.SwitchFunctionsTab("funcs")
+ else:
+ self.form.close()
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollUnloadView",s,c)
diff --git a/ui/scrollview.py b/ui/scrollview.py
new file mode 100644
index 000000000..be60d4912
--- /dev/null
+++ b/ui/scrollview.py
@@ -0,0 +1,455 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-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 *
+from prnt import cups
+
+# Qt
+from qt import *
+
+class Widget(QWidget):
+ def __init__(self, parent=None, name=None, fl=0):
+ QWidget.__init__(self, parent, name, fl)
+ self.control = None
+
+ def setControl(self, control):
+ self.control = control
+
+
+
+class ScrollView(QScrollView):
+ def __init__(self,parent = None,name = None,fl = 0):
+ QScrollView.__init__(self,parent,name,fl)
+ self.items = {}
+ self.enableClipper(True)
+ self.viewport().setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Background))
+ self.cur_device = None
+ self.cur_printer = None
+ self.item_margin = 2
+ self.y = 0
+ self.printers = []
+ self.maximize = None
+ self.orig_height = 0
+ self.content_padding = 20
+
+ if log.is_debug():
+ self.heading_color = qApp.palette().color(QPalette.Active, QColorGroup.Base)
+ self.frame_shape = QFrame.Box
+ else:
+ self.heading_color = qApp.palette().color(QPalette.Active, QColorGroup.Background)
+ self.frame_shape = QFrame.NoFrame
+
+ def getWidget(self):
+ widget = Widget(self.viewport(),"widget")
+ #widget.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Base))
+ widget.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Background))
+ widget.setSizePolicy(QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum))
+ widget.resize(self.visibleWidth(), self.size().height())
+ widget.setMinimumWidth(self.visibleWidth())
+ widget.resize(self.viewport().size().width(), self.size().height())
+ return widget
+
+ def viewportResizeEvent(self, e):
+ QScrollView.viewportResizeEvent(self, e)
+
+ total_height = 0
+ item_margin = self.item_margin
+ width = e.size().width()
+
+ for w in self.items:
+ height = self.items[w].size().height()
+ self.items[w].resize(width, height)
+ self.items[w].setMinimumWidth(width)
+ total_height += (height + item_margin)
+
+ if self.maximize is not None:
+ self.maximizeControl(total_height)
+
+ self.resizeContents(e.size().width(), total_height + self.content_padding)
+
+ def maximizeControl(self, total_height=0):
+ if self.maximize is not None:
+
+ if total_height == 0:
+ item_margin = self.item_margin
+ for w in self.items:
+ total_height += (self.items[w].size().height() + item_margin)
+
+ width = self.items[self.maximize].size().width()
+ old_height = self.items[self.maximize].size().height()
+
+ new_height = max((self.visibleHeight()-(total_height-old_height)),
+ self.orig_height)
+
+ delta = new_height - old_height
+
+ if delta:
+ self.items[self.maximize].resize(width, new_height)
+ self.resizeContents(width, self.contentsHeight()+delta+self.content_padding)
+ m_y = self.childY(self.items[self.maximize])
+
+ for w in self.items:
+ w_y = self.childY(self.items[w])
+ if w_y > m_y:
+ self.moveChild(self.items[w], 0, w_y+delta)
+
+ def isFax(self):
+ self.is_fax = False
+ self.printers = cups.getPrinters()
+ for p in self.printers:
+ if p.name == self.cur_printer:
+ if p.device_uri.startswith("hpfax:"):
+ self.is_fax = True
+
+ break
+
+ def onDeviceChange(self, cur_device=None, updating=False):
+ if cur_device is not None:
+ log.debug("ScrollView.onDeviceChange(%s)" % cur_device.device_uri)
+ else:
+ log.debug("ScrollView.onDeviceChange(None)")
+
+ self.cur_device = cur_device
+
+ if self.cur_device is not None and self.cur_device.supported:
+ if not updating or not self.cur_printer:
+ try:
+ self.cur_printer = self.cur_device.cups_printers[0]
+ except IndexError:
+ log.error("Printer list empty") # Shouldn't happen!
+ self.cur_printer = None
+ else:
+ self.isFax()
+
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ try:
+ self.fillControls()
+ except Exception, e:
+ log.exception()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ else:
+ log.debug("Unsupported device")
+ self.y = 0
+ self.clear()
+
+ self.addGroupHeading("error", self.__tr("ERROR: No device found or unsupported device."))
+
+ def onUpdate(self, cur_device=None):
+ log.debug("ScrollView.onUpdate()")
+ return self.onDeviceChange(cur_device, True)
+
+ def fillControls(self):
+ log.debug("fillControls(%s)" % str(self.name()))
+ self.y = 0
+ self.clear()
+
+ def onPrinterChange(self, printer_name):
+ if printer_name == self.cur_printer:
+ return
+
+ self.cur_printer = str(printer_name)
+
+ if self.cur_device is not None and self.cur_device.supported:
+ self.isFax()
+ QApplication.setOverrideCursor(QApplication.waitCursor)
+ try:
+ try:
+ self.fillControls()
+ except Exception, e:
+ log.exception()
+ finally:
+ QApplication.restoreOverrideCursor()
+
+ try:
+ self.printerComboBox.setCurrentText(self.cur_printer)
+ except AttributeError:
+ pass
+
+ else:
+ self.y = 0
+ self.clear()
+
+ def addWidget(self, widget, key, control=None, maximize=False):
+ try:
+ self.items[key]
+ except KeyError:
+ if maximize:
+ self.maximize = key
+ widget.resize(widget.size().width(), 150)
+ self.orig_height = widget.size().height()
+
+ widget.setControl(control)
+ self.items[key] = widget
+ widget.setMinimumWidth(self.visibleWidth())
+ widget.adjustSize()
+ self.addChild(widget, 0, self.y)
+ self.y += (widget.size().height() + self.item_margin)
+ self.resizeContents(self.visibleWidth(), self.y + self.content_padding)
+ widget.show()
+ else:
+ log.debug("ERROR: Duplicate control name: %s" % key)
+
+ def clear(self):
+ if len(self.items):
+ for x in self.items:
+ self.removeChild(self.items[x])
+ self.items[x].hide()
+
+ self.items.clear()
+
+ def addGroupHeading(self, group, heading, read_only=False):
+ widget = self.getWidget()
+ widget.setMinimumHeight(30)
+ widget.setMaximumHeight(30)
+
+ if heading:
+ widget.setPaletteBackgroundColor(self.heading_color)
+
+ layout = QGridLayout(widget, 1, 1, 5, 10, "layout")
+ textLabel2 = QLabel(widget, "textLabel2")
+
+ if heading:
+ textLabel2.setFrameShape(QFrame.TabWidgetPanel)
+
+ textLabel2.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,
+ QSizePolicy.Minimum, 0, 0,
+ textLabel2.sizePolicy().hasHeightForWidth()))
+
+ textLabel2.setAlignment( QLabel.AlignLeft | QLabel.AlignVCenter)
+ layout.addWidget(textLabel2, 0, 0)
+
+ if read_only:
+ textLabel2.setText(self.__tr("<b>%1 (read only)</b>").arg(heading))
+ else:
+ textLabel2.setText(QString("<b>%1</b>").arg(heading))
+
+ self.addWidget(widget, "g:"+unicode(group))
+
+
+ def addActionButton(self, name, action_text, action_func,
+ action_pixmap=None, disabled_action_pixmap=None,
+ nav_text ='', nav_func=None):
+
+ widget = self.getWidget()
+
+ #widget.setPaletteBackgroundColor(qApp.palette().color(QPalette.Active, QColorGroup.Highlight))
+ self.actionPushButton = None
+ self.navPushButton = None
+
+ layout36 = QHBoxLayout(widget,5,10,"layout36")
+
+ if nav_func is not None:
+ self.navPushButton = QPushButton(widget,"navPushButton")
+ navPushButton_font = QFont(self.navPushButton.font())
+ navPushButton_font.setBold(1)
+ self.navPushButton.setFont(navPushButton_font)
+ self.navPushButton.setText(nav_text)
+ layout36.addWidget(self.navPushButton)
+
+ self.connect(self.navPushButton, SIGNAL("clicked()"), nav_func)
+
+ spacer35 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ layout36.addItem(spacer35)
+
+ if action_func is not None:
+ if action_pixmap is None:
+ self.actionPushButton = QPushButton(widget, "actionPushButton")
+ else:
+ self.actionPushButton = PixmapLabelButton(widget, action_pixmap,
+ disabled_action_pixmap, 'actionPushButton')
+
+ actionPushButton_font = QFont(self.actionPushButton.font())
+ actionPushButton_font.setBold(1)
+ self.actionPushButton.setFont(actionPushButton_font)
+ layout36.addWidget(self.actionPushButton)
+
+ self.actionPushButton.setText(action_text)
+
+ self.connect(self.actionPushButton, SIGNAL("clicked()"), action_func)
+
+ self.addWidget(widget, name)
+
+ if self.actionPushButton is not None:
+ return self.actionPushButton
+
+ elif self.navPushButton is not None:
+ return self.navPushButton
+
+ else:
+ return None
+
+ def printerComboBox_activated(self, p):
+ self.cur_printer = str(p)
+
+ def addPrinterFaxList(self, printers=True, faxes=False):
+ widget = self.getWidget()
+
+ layout = QGridLayout(widget,1,1,5,10,"layout")
+
+ self.printernameTextLabel = QLabel(widget,"printernameTextLabel")
+ layout.addWidget(self.printernameTextLabel,0,0)
+
+ self.printerComboBox = QComboBox(0,widget,"printerComboBox")
+ layout.addWidget(self.printerComboBox,0,1)
+
+ if printers and faxes:
+ self.addGroupHeading("printer_list_heading", self.__tr("Printer/Fax"))
+ self.printernameTextLabel.setText(self.__tr("Printer/Fax Name:"))
+ elif printers:
+ self.addGroupHeading("printer_list_heading", self.__tr("Printer"))
+ self.printernameTextLabel.setText(self.__tr("Printer Name:"))
+ else:
+ self.addGroupHeading("printer_list_heading", self.__tr("Fax"))
+ self.printernameTextLabel.setText(self.__tr("Fax Name:"))
+
+ self.cur_printer = None
+ for p in self.printers:
+ if p.device_uri == self.cur_device.device_uri or \
+ p.device_uri == self.cur_device.device_uri.replace("hp:", "hpfax:"):
+ if (p.device_uri.startswith("hpfax:") and faxes) or \
+ (p.device_uri.startswith("hp:") and printers):
+
+ self.printerComboBox.insertItem(p.name)
+
+ if self.cur_printer is None:
+ self.cur_printer = p.name
+
+ if self.cur_printer is None:
+ #log.error("No fax queue found")
+ self.y = 0
+ self.clear()
+
+ if printers and faxes:
+ self.addGroupHeading("error", self.__tr("ERROR: No CUPS queue found for device."))
+ elif printers:
+ self.addGroupHeading("error", self.__tr("ERROR: No CUPS printer queue found for device."))
+ else:
+ self.addGroupHeading("error", self.__tr("ERROR: No CUPS fax queue found for device."))
+
+ return False
+
+ else:
+ self.connect(self.printerComboBox, SIGNAL("activated(const QString&)"), self.printerComboBox_activated)
+
+ self.addWidget(widget, "printer_list")
+ return True
+
+
+ def addLoadPaper(self):
+ self.addGroupHeading("load_paper", self.__tr("Load Paper"))
+
+ widget = self.getWidget()
+ layout1 = QGridLayout(widget, 1, 2, 5, 10,"layout1")
+
+ layout1.setColStretch(0, 1)
+ layout1.setColStretch(1, 10)
+
+ icon = QLabel(widget, "icon")
+ icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed, 0, 0,
+ icon.sizePolicy().hasHeightForWidth()))
+
+ icon.setScaledContents(1)
+ layout1.addWidget(icon, 0, 0)
+
+ textLabel = QLabel(widget, "textLabel")
+ textLabel.setAlignment(QLabel.WordBreak)
+ textLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred, 0, 0,
+ textLabel.sizePolicy().hasHeightForWidth()))
+ textLabel.setFrameShape(self.frame_shape)
+ layout1.addWidget(textLabel, 0, 1)
+
+ spacer1 = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
+ layout1.addItem(spacer1, 0, 2)
+
+ textLabel.setText(self.__tr("A page will be printed. Please load <b>plain paper</b> into the printer."))
+ icon.setPixmap(QPixmap(os.path.join(prop.image_dir, "load_paper.png")))
+
+ self.addWidget(widget, "load_paper")
+
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("ScrollView",s,c)
+
+
+
+class PixmapLabelButton(QPushButton):
+ def __init__(self, parent=None, pixmap=None, disabled_pixmap=None, name=''):
+ QPushButton.__init__(self, parent, name)
+
+ if type(pixmap) == type(''):
+ self.pixmap = QPixmap(os.path.join(prop.image_dir, pixmap))
+ else:
+ self.pixmap = pixmap
+
+ if type(disabled_pixmap) == type(''):
+ self.disabled_pixmap = QPixmap(os.path.join(prop.image_dir, disabled_pixmap))
+ else:
+ self.disabled_pixmap = disabled_pixmap
+
+ self.pixmap_width, self.pixmap_height = self.pixmap.width(), self.pixmap.height()
+ self.width_set = None
+
+
+ def drawButtonLabel(self, painter):
+ button_width, button_height = self.width(), self.height()
+
+ adj = 0
+ if self.isDown():
+ adj = 1
+
+
+ if self.isEnabled():
+ painter.setPen(Qt.black)
+ else:
+ painter.setPen(Qt.gray)
+
+ #f = QFont()
+ #painter.setFont(f)
+
+ text_rect = painter.boundingRect(0, 0, 1000, 1000, Qt.AlignLeft, self.text())
+ text_width, text_height = text_rect.right() - text_rect.left(), text_rect.bottom() - text_rect.top()
+
+ button_width_center = button_width/2
+ button_height_center = button_height/2
+ combined_width_center = (self.pixmap_width + text_width + 10)/2
+
+
+ if self.isEnabled() or self.disabled_pixmap is None:
+ painter.drawPixmap(button_width_center - combined_width_center + adj,
+ button_height_center - self.pixmap_height/2 + adj, self.pixmap)
+ else:
+ painter.drawPixmap(button_width_center - combined_width_center + adj,
+ button_height_center - self.pixmap_height/2 + adj, self.disabled_pixmap)
+
+ if self.width_set is None:
+ self.setMinimumWidth(self.pixmap_width + text_width + 20)
+ self.width_set = 0
+
+ painter.drawText(button_width_center - combined_width_center +
+ self.pixmap_width + 5 + adj,
+ button_height_center - text_height/2 + adj, 1000, 1000,
+ Qt.AlignLeft, self.text())
+
diff --git a/ui/settingsdialog.py b/ui/settingsdialog.py
index 78f5b1300..0de3c47b4 100644
--- a/ui/settingsdialog.py
+++ b/ui/settingsdialog.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -30,14 +30,87 @@ class SettingsDialog(SettingsDialog_base):
SettingsDialog_base.__init__(self,parent,name,modal,fl)
self.DefaultsButton.setEnabled(False)
self.hpssd_sock = hpssd_sock
- #print repr(user_cfg.refresh.enable)
- #self.auto_refresh = utils.to_bool(user_cfg.refresh.enable)
- #self.autoRefreshCheckBox.setChecked(self.auto_refresh)
-
self.sendmail = utils.which('sendmail')
+
if not self.sendmail:
self.EmailTestButton.setEnabled(False)
+ self.user_settings = utils.UserSettings()
+ self.updateControls()
+
+ def updateControls(self):
+ self.autoRefreshCheckBox.setChecked(self.user_settings.auto_refresh)
+ self.AutoRefreshRate.setValue(self.user_settings.auto_refresh_rate) # min
+ self.refreshScopeButtonGroup.setButton(self.user_settings.auto_refresh_type)
+
+ self.EmailCheckBox.setChecked(self.user_settings.email_alerts)
+ self.EmailAddress.setText(self.user_settings.email_to_addresses)
+ self.senderLineEdit.setText(self.user_settings.email_from_address)
+
+ self.PrintCommand.setText(self.user_settings.cmd_print)
+ self.PrintCommand.setEnabled(not self.user_settings.cmd_print_int)
+
+ if self.user_settings.cmd_print_int:
+ self.printButtonGroup.setButton(0)
+ else:
+ self.printButtonGroup.setButton(1)
+
+ self.ScanCommand.setText(self.user_settings.cmd_scan)
+ self.ScanCommand.setEnabled(not self.user_settings.cmd_scan_int)
+
+ if self.user_settings.cmd_scan_int:
+ self.scanButtonGroup.setButton(0)
+ else:
+ self.scanButtonGroup.setButton(1)
+
+ self.AccessPCardCommand.setText(self.user_settings.cmd_pcard)
+ self.AccessPCardCommand.setEnabled(not self.user_settings.cmd_pcard_int)
+
+ if self.user_settings.cmd_pcard_int:
+ self.pcardButtonGroup.setButton(0)
+ else:
+ self.pcardButtonGroup.setButton(1)
+
+ self.SendFaxCommand.setText(self.user_settings.cmd_fax)
+ self.SendFaxCommand.setEnabled(not self.user_settings.cmd_fax_int)
+
+ if self.user_settings.cmd_fax_int:
+ self.faxButtonGroup.setButton(0)
+ else:
+ self.faxButtonGroup.setButton(1)
+
+ self.MakeCopiesCommand.setText(self.user_settings.cmd_copy)
+ self.MakeCopiesCommand.setEnabled(not self.user_settings.cmd_copy_int)
+
+ if self.user_settings.cmd_copy_int:
+ self.copyButtonGroup.setButton(0)
+ else:
+ self.copyButtonGroup.setButton(1)
+
+ def updateData(self):
+ self.user_settings.cmd_print = unicode(self.PrintCommand.text())
+ self.user_settings.cmd_print_int = (self.printButtonGroup.selectedId() == 0)
+
+ self.user_settings.cmd_scan = unicode(self.ScanCommand.text())
+ self.user_settings.cmd_scan_int = (self.scanButtonGroup.selectedId() == 0)
+
+ self.user_settings.cmd_pcard = unicode(self.AccessPCardCommand.text())
+ self.user_settings.cmd_pcard_int = (self.pcardButtonGroup.selectedId() == 0)
+
+ self.user_settings.cmd_fax = unicode(self.SendFaxCommand.text())
+ self.user_settings.cmd_fax_int = (self.faxButtonGroup.selectedId() == 0)
+
+ self.user_settings.cmd_copy = unicode(self.MakeCopiesCommand.text())
+ self.user_settings.cmd_copy_int = (self.copyButtonGroup.selectedId() == 0)
+
+ self.user_settings.email_alerts = bool(self.EmailCheckBox.isChecked())
+ self.user_settings.email_to_addresses = unicode(self.EmailAddress.text())
+ self.user_settings.email_from_address = unicode(self.senderLineEdit.text())
+
+ self.user_settings.auto_refresh = bool(self.autoRefreshCheckBox.isChecked())
+ self.user_settings.auto_refresh_type = self.refreshScopeButtonGroup.selectedId()
+ self.user_settings.auto_refresh_rate = self.AutoRefreshRate.value()
+
def PrintCmdChangeButton_clicked(self):
pass
@@ -54,14 +127,8 @@ class SettingsDialog(SettingsDialog_base):
pass
def DefaultsButton_clicked(self):
- cmd_print, cmd_scan, cmd_pcard, \
- cmd_copy, cmd_fax, cmd_fab = utils.deviceDefaultFunctions()
-
- self.PrintCommand.setText(cmd_print)
- self.ScanCommand.setText(cmd_scan)
- self.AccessPCardCommand.setText(cmd_pcard)
- self.SendFaxCommand.setText(cmd_fax)
- self.MakeCopiesCommand.setText(cmd_copy)
+ self.user_settings.loadDefaults()
+ self.updateControls()
def TabWidget_currentChanged(self,a0):
name = str(a0.name())
@@ -72,9 +139,9 @@ class SettingsDialog(SettingsDialog_base):
self.DefaultsButton.setEnabled(False)
def EmailTestButton_clicked(self):
- email_to_addresses = str(self.EmailAddress.text())
- email_from_address = str(self.senderLineEdit.text())
-
+ email_to_addresses = unicode(self.EmailAddress.text())
+ email_from_address = unicode(self.senderLineEdit.text())
+
if not email_to_addresses or not email_from_address:
QMessageBox.warning(self,
self.caption(),
@@ -83,11 +150,7 @@ class SettingsDialog(SettingsDialog_base):
QMessageBox.NoButton,
QMessageBox.NoButton)
return
-
- user_cfg.alerts.email_to_addresses = email_to_addresses
- user_cfg.alerts.email_from_address = email_from_address
- user_cfg.alerts.email_alerts = True
-
+
service.setAlerts(self.hpssd_sock,
True,
email_from_address,
@@ -95,7 +158,7 @@ class SettingsDialog(SettingsDialog_base):
result_code = service.testEmail(self.hpssd_sock, prop.username)
log.debug(result_code)
-
+
QMessageBox.information(self,
self.caption(),
self.__tr("<p><b>Please check your email for a test message.</b><p>If the message doesn't arrive, please check your settings and try again."),
@@ -103,18 +166,37 @@ class SettingsDialog(SettingsDialog_base):
QMessageBox.NoButton,
QMessageBox.NoButton)
-
+
def autoRefreshCheckBox_clicked(self):
pass
-
+
def CleaningLevel_clicked(self,a0):
pass
-
+
def refreshScopeButtonGroup_clicked(self,a0):
self.auto_refresh_type = int(a0)
-
-
+
+ def printButtonGroup_clicked(self,a0):
+ self.PrintCommand.setEnabled(a0)
+
+ def scanButtonGroup_clicked(self,a0):
+ self.ScanCommand.setEnabled(a0)
+
+ def faxButtonGroup_clicked(self,a0):
+ self.SendFaxCommand.setEnabled(a0)
+
+ def pcardButtonGroup_clicked(self,a0):
+ self.AccessPCardCommand.setEnabled(a0)
+
+ def copyButtonGroup_clicked(self,a0):
+ self.MakeCopiesCommand.setEnabled(a0)
+
+ def accept(self):
+ self.updateData()
+ self.user_settings.save()
+ SettingsDialog_base.accept(self)
+
def __tr(self,s,c = None):
return qApp.translate("SettingsDialog",s,c)
-
+
diff --git a/ui/settingsdialog_base.py b/ui/settingsdialog_base.py
index e7b1ff116..3939d2471 100644
--- a/ui/settingsdialog_base.py
+++ b/ui/settingsdialog_base.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-# Form implementation generated from reading ui file 'settingsdialog_base.ui'
+# Form implementation generated from reading ui file 'ui/settingsdialog_base.ui'
#
-# Created: Thu Jun 15 14:00:36 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.15.1
+# Created: Tue Apr 24 08:08:38 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.16
#
# WARNING! All changes made in this file will be lost!
@@ -73,8 +73,8 @@ class SettingsDialog_base(QDialog):
self.AutoRefreshRate.setWrapping(1)
self.AutoRefreshRate.setButtonSymbols(QSpinBox.PlusMinus)
self.AutoRefreshRate.setMaxValue(60)
- self.AutoRefreshRate.setMinValue(1)
- self.AutoRefreshRate.setValue(1)
+ self.AutoRefreshRate.setMinValue(5)
+ self.AutoRefreshRate.setValue(6)
layout7.addWidget(self.AutoRefreshRate)
self.textLabel1_3 = QLabel(self.CleaningLevel,"textLabel1_3")
@@ -201,80 +201,141 @@ class SettingsDialog_base(QDialog):
FunctionCommandsLayout.addMultiCellWidget(self.textLabel3_2_2_2,0,0,0,1)
- self.textLabel1_2 = QLabel(self.FunctionCommands,"textLabel1_2")
+ self.pcardButtonGroup = QButtonGroup(self.FunctionCommands,"pcardButtonGroup")
+ self.pcardButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.pcardButtonGroup.layout().setSpacing(6)
+ self.pcardButtonGroup.layout().setMargin(11)
+ pcardButtonGroupLayout = QGridLayout(self.pcardButtonGroup.layout())
+ pcardButtonGroupLayout.setAlignment(Qt.AlignTop)
- FunctionCommandsLayout.addMultiCellWidget(self.textLabel1_2,2,2,0,1)
+ self.radioButton19 = QRadioButton(self.pcardButtonGroup,"radioButton19")
+ self.radioButton19.setEnabled(1)
+ self.radioButton19.setChecked(1)
- layout8_2 = QHBoxLayout(None,0,6,"layout8_2")
+ pcardButtonGroupLayout.addMultiCellWidget(self.radioButton19,0,0,0,1)
- self.PrintCommand = QLineEdit(self.FunctionCommands,"PrintCommand")
- layout8_2.addWidget(self.PrintCommand)
+ self.radioButton20 = QRadioButton(self.pcardButtonGroup,"radioButton20")
+ self.radioButton20.setChecked(0)
- FunctionCommandsLayout.addMultiCellLayout(layout8_2,3,3,0,1)
+ pcardButtonGroupLayout.addWidget(self.radioButton20,1,0)
- self.textLabel1_2_2 = QLabel(self.FunctionCommands,"textLabel1_2_2")
+ self.AccessPCardCommand = QLineEdit(self.pcardButtonGroup,"AccessPCardCommand")
+ self.AccessPCardCommand.setEnabled(0)
- FunctionCommandsLayout.addMultiCellWidget(self.textLabel1_2_2,4,4,0,1)
+ pcardButtonGroupLayout.addWidget(self.AccessPCardCommand,1,1)
- layout9 = QHBoxLayout(None,0,6,"layout9")
+ FunctionCommandsLayout.addMultiCellWidget(self.pcardButtonGroup,5,5,0,1)
- self.ScanCommand = QLineEdit(self.FunctionCommands,"ScanCommand")
- layout9.addWidget(self.ScanCommand)
+ self.faxButtonGroup = QButtonGroup(self.FunctionCommands,"faxButtonGroup")
+ self.faxButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.faxButtonGroup.layout().setSpacing(6)
+ self.faxButtonGroup.layout().setMargin(11)
+ faxButtonGroupLayout = QGridLayout(self.faxButtonGroup.layout())
+ faxButtonGroupLayout.setAlignment(Qt.AlignTop)
- FunctionCommandsLayout.addMultiCellLayout(layout9,5,5,0,1)
+ self.radioButton17 = QRadioButton(self.faxButtonGroup,"radioButton17")
+ self.radioButton17.setChecked(1)
- self.textLabel1_2_3_3 = QLabel(self.FunctionCommands,"textLabel1_2_3_3")
+ faxButtonGroupLayout.addMultiCellWidget(self.radioButton17,0,0,0,1)
- FunctionCommandsLayout.addMultiCellWidget(self.textLabel1_2_3_3,6,6,0,1)
+ self.radioButton18 = QRadioButton(self.faxButtonGroup,"radioButton18")
+ self.radioButton18.setChecked(0)
- layout10_2 = QHBoxLayout(None,0,6,"layout10_2")
+ faxButtonGroupLayout.addWidget(self.radioButton18,1,0)
- self.AccessPCardCommand = QLineEdit(self.FunctionCommands,"AccessPCardCommand")
- layout10_2.addWidget(self.AccessPCardCommand)
+ self.SendFaxCommand = QLineEdit(self.faxButtonGroup,"SendFaxCommand")
+ self.SendFaxCommand.setEnabled(0)
- FunctionCommandsLayout.addMultiCellLayout(layout10_2,7,7,0,1)
+ faxButtonGroupLayout.addWidget(self.SendFaxCommand,1,1)
- self.textLabel1_2_3 = QLabel(self.FunctionCommands,"textLabel1_2_3")
- self.textLabel1_2_3.setEnabled(1)
+ FunctionCommandsLayout.addMultiCellWidget(self.faxButtonGroup,4,4,0,1)
- FunctionCommandsLayout.addMultiCellWidget(self.textLabel1_2_3,8,8,0,1)
+ self.scanButtonGroup = QButtonGroup(self.FunctionCommands,"scanButtonGroup")
+ self.scanButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.scanButtonGroup.layout().setSpacing(6)
+ self.scanButtonGroup.layout().setMargin(11)
+ scanButtonGroupLayout = QGridLayout(self.scanButtonGroup.layout())
+ scanButtonGroupLayout.setAlignment(Qt.AlignTop)
- layout11_2 = QHBoxLayout(None,0,6,"layout11_2")
+ self.radioButton15 = QRadioButton(self.scanButtonGroup,"radioButton15")
+ self.radioButton15.setEnabled(0)
- self.SendFaxCommand = QLineEdit(self.FunctionCommands,"SendFaxCommand")
- self.SendFaxCommand.setEnabled(1)
- layout11_2.addWidget(self.SendFaxCommand)
+ scanButtonGroupLayout.addMultiCellWidget(self.radioButton15,0,0,0,1)
- FunctionCommandsLayout.addMultiCellLayout(layout11_2,9,9,0,1)
+ self.radioButton16 = QRadioButton(self.scanButtonGroup,"radioButton16")
+ self.radioButton16.setChecked(1)
- self.textLabel1_2_3_2 = QLabel(self.FunctionCommands,"textLabel1_2_3_2")
- self.textLabel1_2_3_2.setEnabled(1)
+ scanButtonGroupLayout.addWidget(self.radioButton16,1,0)
- FunctionCommandsLayout.addMultiCellWidget(self.textLabel1_2_3_2,10,10,0,1)
+ self.ScanCommand = QLineEdit(self.scanButtonGroup,"ScanCommand")
- layout12_2 = QHBoxLayout(None,0,6,"layout12_2")
+ scanButtonGroupLayout.addWidget(self.ScanCommand,1,1)
- self.MakeCopiesCommand = QLineEdit(self.FunctionCommands,"MakeCopiesCommand")
- self.MakeCopiesCommand.setEnabled(1)
- layout12_2.addWidget(self.MakeCopiesCommand)
+ FunctionCommandsLayout.addMultiCellWidget(self.scanButtonGroup,3,3,0,1)
+
+ self.printButtonGroup = QButtonGroup(self.FunctionCommands,"printButtonGroup")
+ self.printButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.printButtonGroup.layout().setSpacing(6)
+ self.printButtonGroup.layout().setMargin(11)
+ printButtonGroupLayout = QGridLayout(self.printButtonGroup.layout())
+ printButtonGroupLayout.setAlignment(Qt.AlignTop)
+
+ self.radioButton13 = QRadioButton(self.printButtonGroup,"radioButton13")
+ self.radioButton13.setChecked(1)
+
+ printButtonGroupLayout.addMultiCellWidget(self.radioButton13,0,0,0,1)
+
+ self.radioButton14 = QRadioButton(self.printButtonGroup,"radioButton14")
+
+ printButtonGroupLayout.addWidget(self.radioButton14,1,0)
- FunctionCommandsLayout.addMultiCellLayout(layout12_2,11,11,0,1)
+ self.PrintCommand = QLineEdit(self.printButtonGroup,"PrintCommand")
+ self.PrintCommand.setEnabled(0)
+
+ printButtonGroupLayout.addWidget(self.PrintCommand,1,1)
+
+ FunctionCommandsLayout.addMultiCellWidget(self.printButtonGroup,2,2,0,1)
self.DefaultsButton = QPushButton(self.FunctionCommands,"DefaultsButton")
self.DefaultsButton.setEnabled(1)
- FunctionCommandsLayout.addWidget(self.DefaultsButton,13,0)
- spacer8_2 = QSpacerItem(471,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- FunctionCommandsLayout.addItem(spacer8_2,13,1)
- spacer9 = QSpacerItem(20,81,QSizePolicy.Minimum,QSizePolicy.Expanding)
- FunctionCommandsLayout.addItem(spacer9,12,0)
+ FunctionCommandsLayout.addWidget(self.DefaultsButton,8,0)
+ spacer8_2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ FunctionCommandsLayout.addItem(spacer8_2,8,1)
+
+ self.copyButtonGroup = QButtonGroup(self.FunctionCommands,"copyButtonGroup")
+ self.copyButtonGroup.setColumnLayout(0,Qt.Vertical)
+ self.copyButtonGroup.layout().setSpacing(6)
+ self.copyButtonGroup.layout().setMargin(11)
+ copyButtonGroupLayout = QGridLayout(self.copyButtonGroup.layout())
+ copyButtonGroupLayout.setAlignment(Qt.AlignTop)
+
+ self.radioButton21 = QRadioButton(self.copyButtonGroup,"radioButton21")
+ self.radioButton21.setEnabled(1)
+ self.radioButton21.setChecked(1)
+
+ copyButtonGroupLayout.addMultiCellWidget(self.radioButton21,0,0,0,1)
+
+ self.radioButton22 = QRadioButton(self.copyButtonGroup,"radioButton22")
+ self.radioButton22.setChecked(0)
+
+ copyButtonGroupLayout.addWidget(self.radioButton22,1,0)
+
+ self.MakeCopiesCommand = QLineEdit(self.copyButtonGroup,"MakeCopiesCommand")
+ self.MakeCopiesCommand.setEnabled(1)
+
+ copyButtonGroupLayout.addWidget(self.MakeCopiesCommand,1,1)
+
+ FunctionCommandsLayout.addMultiCellWidget(self.copyButtonGroup,6,6,0,1)
+ spacer49 = QSpacerItem(20,51,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ FunctionCommandsLayout.addItem(spacer49,7,0)
self.TabWidget.insertTab(self.FunctionCommands,QString.fromLatin1(""))
SettingsDialog_baseLayout.addMultiCellWidget(self.TabWidget,0,0,0,2)
self.languageChange()
- self.resize(QSize(627,481).expandedTo(self.minimumSizeHint()))
+ self.resize(QSize(548,618).expandedTo(self.minimumSizeHint()))
self.clearWState(Qt.WState_Polished)
self.connect(self.pushButton31,SIGNAL("clicked()"),self.reject)
@@ -291,6 +352,11 @@ class SettingsDialog_base(QDialog):
self.connect(self.autoRefreshCheckBox,SIGNAL("toggled(bool)"),self.radioButton1.setEnabled)
self.connect(self.autoRefreshCheckBox,SIGNAL("toggled(bool)"),self.radioButton2.setEnabled)
self.connect(self.refreshScopeButtonGroup,SIGNAL("clicked(int)"),self.refreshScopeButtonGroup_clicked)
+ self.connect(self.printButtonGroup,SIGNAL("clicked(int)"),self.printButtonGroup_clicked)
+ self.connect(self.scanButtonGroup,SIGNAL("clicked(int)"),self.scanButtonGroup_clicked)
+ self.connect(self.faxButtonGroup,SIGNAL("clicked(int)"),self.faxButtonGroup_clicked)
+ self.connect(self.pcardButtonGroup,SIGNAL("clicked(int)"),self.pcardButtonGroup_clicked)
+ self.connect(self.copyButtonGroup,SIGNAL("clicked(int)"),self.copyButtonGroup_clicked)
self.setTabOrder(self.TabWidget,self.pushButton30)
self.setTabOrder(self.pushButton30,self.pushButton31)
@@ -313,7 +379,7 @@ class SettingsDialog_base(QDialog):
self.autoRefreshCheckBox.setText(self.__tr("Enable device auto refresh"))
self.CleaningLevel.setTitle(self.__tr("Auto Interval"))
self.textLabel1_4.setText(self.__tr("Refresh every:"))
- self.textLabel1_3.setText(self.__tr("minutes"))
+ self.textLabel1_3.setText(self.__tr("seconds"))
self.refreshScopeButtonGroup.setTitle(self.__tr("Device(s) to Refresh "))
self.radioButton1.setText(self.__tr("Only currently selected device"))
self.radioButton2.setText(self.__tr("All devices"))
@@ -329,13 +395,23 @@ class SettingsDialog_base(QDialog):
self.textLabel3.setText(self.__tr("<i>Note: This should generally be your email address.</i>"))
self.TabWidget.changeTab(self.EmailAlerts,self.__tr("Email Alerts"))
self.textLabel3_2_2_2.setText(self.__tr("<b>Configure what commands to run for device functions</b>"))
- self.textLabel1_2.setText(self.__tr("Print Command:"))
- self.textLabel1_2_2.setText(self.__tr("Scan Command:"))
- self.textLabel1_2_3_3.setText(self.__tr("Access Photo Cards Command:"))
- self.textLabel1_2_3.setText(self.__tr("Send Fax Command:"))
- self.textLabel1_2_3_2.setText(self.__tr("Make Copies Command:"))
+ self.pcardButtonGroup.setTitle(self.__tr("Access Photo Cards"))
+ self.radioButton19.setText(self.__tr("Built-in access photo cards function"))
+ self.radioButton20.setText(self.__tr("External command:"))
+ self.faxButtonGroup.setTitle(self.__tr("Send PC Fax"))
+ self.radioButton17.setText(self.__tr("Built-in send PC fax function"))
+ self.radioButton18.setText(self.__tr("External command:"))
+ self.scanButtonGroup.setTitle(self.__tr("Scan"))
+ self.radioButton15.setText(self.__tr("Built-in scan function"))
+ self.radioButton16.setText(self.__tr("External scan command:"))
+ self.printButtonGroup.setTitle(self.__tr("Print"))
+ self.radioButton13.setText(self.__tr("Built-in print function"))
+ self.radioButton14.setText(self.__tr("External command:"))
self.DefaultsButton.setText(self.__tr("Set Defaults"))
- self.TabWidget.changeTab(self.FunctionCommands,self.__tr("Function Commands"))
+ self.copyButtonGroup.setTitle(self.__tr("Make Copies"))
+ self.radioButton21.setText(self.__tr("Built-in make copies function"))
+ self.radioButton22.setText(self.__tr("External command:"))
+ self.TabWidget.changeTab(self.FunctionCommands,self.__tr("Functions (Advanced)"))
def PrintCmdChangeButton_clicked(self):
@@ -377,5 +453,20 @@ class SettingsDialog_base(QDialog):
def refreshScopeButtonGroup_clicked(self,a0):
print "SettingsDialog_base.refreshScopeButtonGroup_clicked(int): Not implemented yet"
+ def printButtonGroup_clicked(self,a0):
+ print "SettingsDialog_base.printButtonGroup_clicked(int): Not implemented yet"
+
+ def scanButtonGroup_clicked(self,a0):
+ print "SettingsDialog_base.scanButtonGroup_clicked(int): Not implemented yet"
+
+ def faxButtonGroup_clicked(self,a0):
+ print "SettingsDialog_base.faxButtonGroup_clicked(int): Not implemented yet"
+
+ def pcardButtonGroup_clicked(self,a0):
+ print "SettingsDialog_base.pcardButtonGroup_clicked(int): Not implemented yet"
+
+ def copyButtonGroup_clicked(self,a0):
+ print "SettingsDialog_base.copyButtonGroup_clicked(int): Not implemented yet"
+
def __tr(self,s,c = None):
return qApp.translate("SettingsDialog_base",s,c)
diff --git a/ui/settingsdialog_base.ui b/ui/settingsdialog_base.ui
index 2f5c194e5..600748b21 100644
--- a/ui/settingsdialog_base.ui
+++ b/ui/settingsdialog_base.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>627</width>
- <height>481</height>
+ <width>548</width>
+ <height>618</height>
</rect>
</property>
<property name="caption">
@@ -175,10 +175,10 @@
<number>60</number>
</property>
<property name="minValue">
- <number>1</number>
+ <number>5</number>
</property>
<property name="value">
- <number>1</number>
+ <number>6</number>
</property>
</widget>
<widget class="QLabel">
@@ -186,7 +186,7 @@
<cstring>textLabel1_3</cstring>
</property>
<property name="text">
- <string>minutes</string>
+ <string>seconds</string>
</property>
</widget>
</hbox>
@@ -457,7 +457,7 @@
<cstring>FunctionCommands</cstring>
</property>
<attribute name="title">
- <string>Function Commands</string>
+ <string>Functions (Advanced)</string>
</attribute>
<grid>
<property name="name">
@@ -485,134 +485,176 @@
<string>&lt;b&gt;Configure what commands to run for device functions&lt;/b&gt;</string>
</property>
</widget>
- <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <widget class="QButtonGroup" row="5" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>textLabel1_2</cstring>
+ <cstring>pcardButtonGroup</cstring>
</property>
- <property name="text">
- <string>Print Command:</string>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout8</cstring>
+ <property name="title">
+ <string>Access Photo Cards</string>
</property>
- <hbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLineEdit">
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>PrintCommand</cstring>
+ <cstring>radioButton19</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Built-in access photo cards function</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
</property>
</widget>
- </hbox>
- </widget>
- <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel1_2_2</cstring>
- </property>
- <property name="text">
- <string>Scan Command:</string>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout9</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLineEdit">
+ <widget class="QRadioButton" row="1" column="0">
<property name="name">
- <cstring>ScanCommand</cstring>
+ <cstring>radioButton20</cstring>
+ </property>
+ <property name="text">
+ <string>External command:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
</property>
</widget>
- </hbox>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>AccessPCardCommand</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget class="QLabel" row="6" column="0" rowspan="1" colspan="2">
+ <widget class="QButtonGroup" row="4" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>textLabel1_2_3_3</cstring>
+ <cstring>faxButtonGroup</cstring>
</property>
- <property name="text">
- <string>Access Photo Cards Command:</string>
- </property>
- </widget>
- <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout10</cstring>
+ <property name="title">
+ <string>Send PC Fax</string>
</property>
- <hbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLineEdit">
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>AccessPCardCommand</cstring>
+ <cstring>radioButton17</cstring>
+ </property>
+ <property name="text">
+ <string>Built-in send PC fax function</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton18</cstring>
+ </property>
+ <property name="text">
+ <string>External command:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>SendFaxCommand</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
</property>
</widget>
- </hbox>
+ </grid>
</widget>
- <widget class="QLabel" row="8" column="0" rowspan="1" colspan="2">
+ <widget class="QButtonGroup" row="3" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>textLabel1_2_3</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Send Fax Command:</string>
+ <cstring>scanButtonGroup</cstring>
</property>
- </widget>
- <widget class="QLayoutWidget" row="9" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout11</cstring>
+ <property name="title">
+ <string>Scan</string>
</property>
- <hbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLineEdit">
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>SendFaxCommand</cstring>
+ <cstring>radioButton15</cstring>
</property>
<property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Built-in scan function</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton16</cstring>
+ </property>
+ <property name="text">
+ <string>External scan command:</string>
+ </property>
+ <property name="checked">
<bool>true</bool>
</property>
</widget>
- </hbox>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>ScanCommand</cstring>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget class="QLabel" row="10" column="0" rowspan="1" colspan="2">
+ <widget class="QButtonGroup" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>textLabel1_2_3_2</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>Make Copies Command:</string>
+ <cstring>printButtonGroup</cstring>
</property>
- </widget>
- <widget class="QLayoutWidget" row="11" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>layout12</cstring>
+ <property name="title">
+ <string>Print</string>
</property>
- <hbox>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLineEdit">
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>MakeCopiesCommand</cstring>
+ <cstring>radioButton13</cstring>
</property>
- <property name="enabled">
+ <property name="text">
+ <string>Built-in print function</string>
+ </property>
+ <property name="checked">
<bool>true</bool>
</property>
</widget>
- </hbox>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton14</cstring>
+ </property>
+ <property name="text">
+ <string>External command:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>PrintCommand</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
</widget>
- <widget class="QPushButton" row="13" column="0">
+ <widget class="QPushButton" row="8" column="0">
<property name="name">
<cstring>DefaultsButton</cstring>
</property>
@@ -623,7 +665,7 @@
<string>Set Defaults</string>
</property>
</widget>
- <spacer row="13" column="1">
+ <spacer row="8" column="1">
<property name="name">
<cstring>spacer8_2</cstring>
</property>
@@ -635,14 +677,60 @@
</property>
<property name="sizeHint">
<size>
- <width>471</width>
+ <width>20</width>
<height>20</height>
</size>
</property>
</spacer>
- <spacer row="12" column="0">
+ <widget class="QButtonGroup" row="6" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>spacer9</cstring>
+ <cstring>copyButtonGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Make Copies</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>radioButton21</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Built-in make copies function</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>radioButton22</cstring>
+ </property>
+ <property name="text">
+ <string>External command:</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>MakeCopiesCommand</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="7" column="0">
+ <property name="name">
+ <cstring>spacer49</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
@@ -653,7 +741,7 @@
<property name="sizeHint">
<size>
<width>20</width>
- <height>81</height>
+ <height>51</height>
</size>
</property>
</spacer>
@@ -747,6 +835,36 @@
<receiver>SettingsDialog_base</receiver>
<slot>refreshScopeButtonGroup_clicked(int)</slot>
</connection>
+ <connection>
+ <sender>printButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>printButtonGroup_clicked(int)</slot>
+ </connection>
+ <connection>
+ <sender>scanButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>scanButtonGroup_clicked(int)</slot>
+ </connection>
+ <connection>
+ <sender>faxButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>faxButtonGroup_clicked(int)</slot>
+ </connection>
+ <connection>
+ <sender>pcardButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>pcardButtonGroup_clicked(int)</slot>
+ </connection>
+ <connection>
+ <sender>copyButtonGroup</sender>
+ <signal>clicked(int)</signal>
+ <receiver>SettingsDialog_base</receiver>
+ <slot>copyButtonGroup_clicked(int)</slot>
+ </connection>
</connections>
<tabstops>
<tabstop>TabWidget</tabstop>
@@ -762,6 +880,9 @@
<tabstop>MakeCopiesCommand</tabstop>
<tabstop>DefaultsButton</tabstop>
</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">settingsdialog_base.ui.h</include>
+</includes>
<slots>
<slot>PrintCmdChangeButton_clicked()</slot>
<slot>ScanCmdChangeButton_clicked()</slot>
@@ -776,6 +897,11 @@
<slot>EmailTestButton_clicked()</slot>
<slot>autoRefreshCheckBox_clicked()</slot>
<slot>refreshScopeButtonGroup_clicked( int )</slot>
+ <slot>printButtonGroup_clicked( int )</slot>
+ <slot>scanButtonGroup_clicked( int )</slot>
+ <slot>faxButtonGroup_clicked( int )</slot>
+ <slot>pcardButtonGroup_clicked( int )</slot>
+ <slot>copyButtonGroup_clicked( int )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/ui/setupform.py b/ui/setupform.py
index 718186f75..6e52a012c 100644
--- a/ui/setupform.py
+++ b/ui/setupform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,12 +19,19 @@
# Author: Don Welch
# Std Lib
-import sys, socket, re, gzip
+import sys
+import socket
+import re
+import gzip
+import time
+import os.path, os
+import operator
# Local
from base.g import *
from base import msg, device, utils, service
from prnt import cups
+from installer import core_install
try:
from fax import fax
@@ -40,7 +47,16 @@ from setupform_base import SetupForm_base
from setupsettings import SetupSettings
from setupmanualfind import SetupManualFind
-nickname_pat = re.compile(r'''\*NickName:\s*\"(.*)"''', re.MULTILINE)
+def restart_cups():
+ if os.path.exists('/etc/init.d/cups'):
+ return '/etc/init.d/cups restart'
+
+ elif os.path.exists('/etc/init.d/cupsys'):
+ return '/etc/init.d/cupsys restart'
+
+ else:
+ return 'killall -HUP cupsd'
+
class DeviceListViewItem(QListViewItem):
def __init__(self, parent, device_uri, mq, c1='', c2='', c3='', c4=''):
@@ -60,19 +76,18 @@ class PrinterNameValidator(QValidator):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
-
+ input = unicode(input)
+
if not input:
return QValidator.Acceptable, pos
- elif input[pos-1] in ' #/':
+ elif input[pos-1] in u"""~`!@#$%^&*()-=+[]{}()\\/,.<>?'\";:|""":
return QValidator.Invalid, pos
- elif input != utils.printable(input):
- return QValidator.Invalid, pos
-
- elif len(input) > 50:
- 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
else:
return QValidator.Acceptable, pos
@@ -84,42 +99,67 @@ class PhoneNumValidator(QValidator):
QValidator.__init__(self, parent, name)
def validate(self, input, pos):
- input = str(input)
+ input = unicode(input)
+
if not input:
return QValidator.Acceptable, pos
- elif input[pos-1] not in '0123456789-(+) ':
- return QValidator.Invalid, pos
- elif len(input) > 50:
+
+ elif input[pos-1] not in u'0123456789-(+) ':
return QValidator.Invalid, pos
+
else:
- return QValidator.Acceptable, pos
+ return QValidator.Acceptable, pos
class SetupForm(SetupForm_base):
- def __init__(self, parent=None, name=None, modal=0, fl=0):
+ def __init__(self, bus, param, jd_port=1, username='', parent=None, name=None, modal=0, fl=0):
SetupForm_base.__init__(self, parent, name, modal, fl)
+ self.start_page = self.ConnectionPage
+ self.first_page = True
+ self.username = username
+
+ if bus is None:
+ self.bus = 'usb'
+ else:
+ self.bus = bus
+ self.start_page = self.ProbedDevicesPage
+
+ if not prop.par_build:
+ self.parRadioButton.setEnabled(False)
+
+ if not prop.net_build:
+ self.netRadioButton.setEnabled(False)
+
+ if not prop.par_build and not prop.net_build:
+ self.bus = 'usb'
+ self.start_page = self.ProbedDevicesPage
+
+ self.param = param
+ self.jd_port = jd_port
+
+ if self.param:
+ # Validate param...
+ device_uri, sane_uri, fax_uri = device.makeURI(self.param, self.jd_port)
+
+ if device_uri:
+ self.device_uri = device_uri
+ self.start_page = self.PPDPage
+
+ else:
+ self.FailureUI(self.__tr("<b>Device not found.</b> <p>Please make sure your printer is properly connected and powered-on."))
+
icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
self.setIcon(icon)
- self.hpiod_sock = None
try:
- self.hpiod_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.hpiod_sock.connect((prop.hpiod_host, prop.hpiod_port))
- except socket.error:
- log.error("Unable to connect to hpiod.")
- raise Error(ERROR_UNABLE_TO_CONTACT_SERVICE)
-
- self.hpssd_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- try:
- self.hpssd_sock.connect((prop.hpssd_host, prop.hpssd_port))
- except socket.error:
- print "Unable to connect to HPLIP I/O (hpssd)."
+ self.hpssd_sock = service.startup()
+ except Error:
+ log.error("Unable to connect to HPLIP I/O (hpssd).")
raise Error(ERROR_UNABLE_TO_CONTACT_SERVICE)
self.connectionTypeButtonGroup.setButton(0)
- self.bus = 'usb'
self.device_uri = ''
self.mq = {}
self.prev_page = None
@@ -132,14 +172,17 @@ class SetupForm(SetupForm_base):
self.search = ''
self.ttl = 4
self.timeout = 5
- self.printer_name_ok = False
- self.fax_name_ok = False
+ self.printer_name_ok = True
+ self.fax_name_ok = True
self.fax_number = ''
+ self.fax_name = ''
+ self.printer_fax_names_same = False
self.fax_name_company = ''
self.fax_location = ''
self.fax_desc = ''
self.print_test_page = True
self.printerNameLineEdit.setValidator(PrinterNameValidator(self.printerNameLineEdit))
+ self.faxNameLineEdit.setValidator(PrinterNameValidator(self.faxNameLineEdit))
self.faxNumberLineEdit.setValidator(PhoneNumValidator(self.faxNumberLineEdit))
self.setTitleFont(QFont("Helvetica", 16))
self.setBackEnabled(self.FinishedPage, False)
@@ -149,13 +192,21 @@ class SetupForm(SetupForm_base):
self.setHelpEnabled(self.PPDPage, False)
self.setHelpEnabled(self.PrinterNamePage, False)
self.setHelpEnabled(self.FinishedPage, False)
+
+ self.faxNameLineEdit.setMaxLength(50)
+ self.printerNameLineEdit.setMaxLength(50)
- QToolTip.add(self.searchFiltersPushButton2,
+ QToolTip.add(self.searchFiltersPushButton2,
self.__tr('Current: Filter: "%2" Search: "%3" TTL: %4 Timeout: %5s').arg(self.filter).arg(self.search or '').arg(self.ttl).arg(self.timeout))
def showPage(self, page):
orig_page = page
+
+ if self.first_page:
+ page = self.start_page
+ self.first_page = False
+
log.debug("%s %s %s" % ("*"*20, "showPage(%s)" % page.name(), "*"*20))
try:
@@ -170,10 +221,37 @@ class SetupForm(SetupForm_base):
devices_found = self.updateProbedDevicesPage()
elif page is self.PPDPage: # ProbedDevicesPage --> PPDPage
- self.updatePPDPage()
+ if self.param:
+ device_uri, sane_uri, fax_uri = device.makeURI(self.param, self.jd_port)
+
+ if device_uri:
+ self.device_uri = device_uri
+
+ back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
+ self.bus = bus
+ self.mq = device.queryModelByURI(self.device_uri)
+
+ norm_model = device.normalizeModelName(model).lower()
+
+ if self.mq.get('plugin', 0):
+
+ plugin_lib = self.mq.get("plugin-library")
+ fw_download = self.mq.get("fw-download")
+
+ self.core = core_install.CoreInstall()
+ if not self.core.check_for_plugin(norm_model):
+
+ from pluginform import PluginForm
+ plugin_form = PluginForm(self.core, norm_model, self.device_uri, plugin_lib, fw_download)
+ ok = plugin_form.exec_loop()
+ if not ok:
+ self.reject()
+ return
+
+ else:
+ log.debug("Plugin support already installed")
- if len(self.ppd_list) == 0:
- pass # TODO:
+ self.updatePPDPage()
elif page is self.PrinterNamePage:
self.setDefaultPrinterName()
@@ -193,6 +271,7 @@ class SetupForm(SetupForm_base):
else:
self.setup_fax = False
+ self.fax_name_ok = True
self.defaultFaxNamePushButton.setEnabled(False)
self.faxCheckBox.setEnabled(False)
self.faxNameLineEdit.setEnabled(False)
@@ -208,18 +287,22 @@ class SetupForm(SetupForm_base):
self.lineEdit3.setText(self.desc)
self.lineEdit4.setText(self.ppd_file)
+ #log.debug("Restarting CUPS...")
+ #status, output = utils.run(restart_cups())
+ #log.debug("Restart CUPS returned: exit=%d output=%s" % (status, output))
+
self.setupPrinter()
if self.setup_fax:
self.setupFax()
self.readwriteFaxInformation(False)
- self.lineEdit5.setText(self.fax_name)
- self.lineEdit6.setText(self.fax_number)
+ self.lineEdit5.setText(self.fax_number)
+ self.lineEdit6.setText(self.fax_name)
self.lineEdit7.setText(self.fax_name_company)
self.lineEdit8.setText(self.fax_location)
self.lineEdit9.setText(self.fax_desc)
-
+
self.faxGroupBox.setEnabled(True)
else:
@@ -238,7 +321,7 @@ class SetupForm(SetupForm_base):
if page is self.ProbedDevicesPage: # ConnectionPage --> ProbedDevicesPage/EnterIPPage/DeviceNotFoundPage
if not devices_found:
- self.FailureUI(self.__tr("<b>No devices found.</b><p>Please make sure your printer is properly connected and powered-on."))
+ self.FailureUI(self.__tr("<b>No devices found.</b><p>Please make sure your printer is properly connected and powered-on."))
#
@@ -322,30 +405,35 @@ class SetupForm(SetupForm_base):
self.probedDevicesListView.addColumn(self.__tr("Device URI"))
if devices is None:
- fields, data, result_code = \
- msg.xmitMessage(self.hpssd_sock,
- "ProbeDevicesFiltered",
- None,
- {
- 'bus' : self.bus,
- 'timeout' : self.timeout,
- 'ttl' : self.ttl,
- 'format' : 'cups',
- 'filter' : self.filter,
- 'search': self.search,
- })
-
- devices = data.splitlines()
+ FILTER_MAP = {'print' : None,
+ 'none' : None,
+ 'scan': 'scan-type',
+ 'copy': 'copy-type',
+ 'pcard': 'pcard-type',
+ 'fax': 'fax-type',
+ }
+
+ filter_dict = {}
+ for f in self.filter.split(","):
+ if f in FILTER_MAP:
+ filter_dict[FILTER_MAP[f]] = (operator.gt, 0)
+ else:
+ filter_dict[f] = (operator.gt, 0)
+
+ #print filter_dict
+
+ devices = device.probeDevices(self.bus, self.timeout, self.ttl, filter_dict, self.search)
+
self.probeHeadingTextLabel.setText(self.__tr("%1 device(s) found on the %1:").arg(len(devices)).arg(io_str))
else:
if self.bus == 'net':
self.probeHeadingTextLabel.setText(self.__tr("%1 device(s) found on the %1 at address %2:").arg(len(devices)).arg(io_str).arg(param))
- elif self.bus == 'usb':
+ elif self.bus == 'usb':
self.probeHeadingTextLabel.setText(self.__tr("%1 device(s) found on the %1 at ID %2:").arg(len(devices)).arg(io_str).arg(param))
- elif self.bus == 'par':
+ elif self.bus == 'par':
self.probeHeadingTextLabel.setText(self.__tr("%1 device(s) found on the %1 device node ID %2:").arg(len(devices)).arg(io_str).arg(param))
log.debug(devices)
@@ -353,24 +441,19 @@ class SetupForm(SetupForm_base):
if devices:
row = 0
for d in devices:
- x = self.probe_pat.search(d)
- device_uri = x.group(1) # uri
- model = x.group(2) # model
- c3 = x.group(3) # ex. model
- name = x.group(4) # name
- back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(device_uri)
+ back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(d)
mq = {}
model_ui = device.normalizeModelUIName(model)
if self.bus == 'usb':
- i = DeviceListViewItem(self.probedDevicesListView, device_uri, mq, model_ui, serial, device_uri)
+ i = DeviceListViewItem(self.probedDevicesListView, d, mq, model_ui, serial, d)
elif self.bus == 'net':
- i = DeviceListViewItem(self.probedDevicesListView, device_uri, mq, model_ui, host, name, device_uri)
+ i = DeviceListViewItem(self.probedDevicesListView, d, mq, model_ui, host, devices[d][2], d)
elif self.bus == 'par':
- i = DeviceListViewItem(self.probedDevicesListView, device_uri, mq, model_ui, dev_file, device_uri)
+ i = DeviceListViewItem(self.probedDevicesListView, d, mq, model_ui, dev_file, d)
row += 1
@@ -393,19 +476,8 @@ class SetupForm(SetupForm_base):
def updateModelQuery(self, item):
if not item.mq:
- back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
-
- mq, data, result_code = \
- msg.xmitMessage(self.hpssd_sock,
- "ModelQuery",
- None,
- {
- 'model' : model,
- })
-
- item.mq = mq
- self.mq = mq
-
+ item.mq = device.queryModelByURI(self.device_uri)
+ self.mq = item.mq
else:
self.mq = item.mq
@@ -428,7 +500,7 @@ class SetupForm(SetupForm_base):
if dlg.exec_loop() == QDialog.Accepted:
QApplication.setOverrideCursor(QApplication.waitCursor)
- cups_uri, sane_uri, fax_uri = device.makeuri(self.hpiod_sock, self.hpssd_sock, dlg.param)
+ cups_uri, sane_uri, fax_uri = device.makeURI(dlg.param)
if cups_uri:
back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(cups_uri)
@@ -440,7 +512,7 @@ class SetupForm(SetupForm_base):
name = ''
QApplication.restoreOverrideCursor()
- self.updateProbedDevicesPage(['%s "%s" "%s" "%s"' % (cups_uri, model, model, name)], dlg.param)
+ self.updateProbedDevicesPage({cups_uri: (model, model, name)}, dlg.param)
else:
QApplication.restoreOverrideCursor()
self.updateProbedDevicesPage([], dlg.param)
@@ -451,42 +523,32 @@ class SetupForm(SetupForm_base):
def updatePPDPage(self, ppds=None):
QApplication.setOverrideCursor(QApplication.waitCursor)
- back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
- log.debug("Searching for PPDs in: %s" % sys_cfg.dirs.ppd)
+ try:
+ back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
+ except Error:
+ self.FailureUI(self.__tr("<b>Device not found or invalid HPLIP device.</b><p>If you specified a USB ID, IP address, or other parameter, please re-check it and try again."))
+ self.close()
+ sys.exit()
if ppds is None or not ppds:
- ppds = []
-
- for f in utils.walkFiles(sys_cfg.dirs.ppd, pattern="HP*ppd*;hp*ppd*", abs_paths=True):
- ppds.append(f)
+ ppds = cups.getSystemPPDs()
default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
stripped_model = default_model.lower().replace('hp-', '').replace('hp_', '')
-
- self.ppd_list = cups.getPPDFile(stripped_model, ppds)
- log.debug(self.ppd_list)
- self.ppdListView.clear()
-
- if self.ppd_list:
- for ppd in self.ppd_list:
- if ppd.endswith('.gz'):
- nickname = gzip.GzipFile(ppd, 'r').read(4096)
- else:
- nickname = file(ppd, 'r').read(4096)
- try:
- desc = nickname_pat.search(nickname).group(1)
- except AttributeError:
- desc = self.__tr("ERROR: No description available. Is this a valid PPD file?")
+ self.ppd_dict = cups.getPPDFile(stripped_model, ppds)
+ log.debug(self.ppd_dict)
+ self.ppdListView.clear()
- PPDListViewItem(self.ppdListView, ppd, desc)
+ if self.ppd_dict:
+ for ppd in self.ppd_dict:
+ PPDListViewItem(self.ppdListView, ppd, self.ppd_dict[ppd])
- if self.ppd_list:
- i = self.ppdListView.firstChild()
- self.ppdListView.setCurrentItem(i)
- self.ppdListView.setSelected(i, True)
- self.ppd_file = self.ppdListView.currentItem().ppd_file
- log.debug(self.ppd_file)
+ i = self.ppdListView.firstChild()
+ self.ppdListView.setCurrentItem(i)
+ self.ppdListView.setSelected(i, True)
+ self.ppd_file = self.ppdListView.currentItem().ppd_file
+ log.debug(self.ppd_file)
else:
self.FailureUI(self.__tr('<b>PPD not file found.</b><p>An appropriate PPD file could not be found. Please check your HPLIP install, use <i>Select Other...</i>, or download one from linuxprinting.org.'))
@@ -502,7 +564,7 @@ class SetupForm(SetupForm_base):
ppd_file = unicode(QFileDialog.getOpenFileName(sys_cfg.dirs.ppd, "PPD Files (*.ppd *.ppd.gz);;All Files (*)", self, "open file dialog", "Choose a PPD file"))
if ppd_file and os.path.exists(ppd_file):
- self.updatePPDPage([ppd_file])
+ self.updatePPDPage({ppd_file: cups.getPPDDescription(ppd_file)})
else:
self.updatePPDPage()
@@ -510,14 +572,16 @@ class SetupForm(SetupForm_base):
self.updatePPDPage()
-
#
# PRINTER/FAX INFORMATION PAGE
#
def setDefaultPrinterName(self):
- installed_print_devices = device.getSupportedCUPSDevices(['hp'])
- log.debug(installed_print_devices)
+ self.installed_print_devices = device.getSupportedCUPSDevices(['hp'])
+ #self.installed_print_devices = device.getSupportedCUPSDevices('*')
+ 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, port = device.parseDeviceURI(self.device_uri)
default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
@@ -525,70 +589,105 @@ class SetupForm(SetupForm_base):
printer_name = default_model
# Check for duplicate names
- if self.device_uri in installed_print_devices and \
- printer_name in installed_print_devices[self.device_uri]:
+ if self.device_uri in self.installed_print_devices and \
+ printer_name in self.installed_print_devices[self.device_uri]:
i = 2
while True:
t = printer_name + "_%d" % i
- if t not in installed_print_devices[self.device_uri]:
+ if 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.printerNameLineEdit.setPaletteBackgroundColor(self.bg)
self.defaultPrinterNamePushButton.setEnabled(False)
self.printer_name = printer_name
- def printerNameLineEdit_textChanged(self,a0):
- self.printer_name = str(a0)
- self.defaultPrinterNamePushButton.setEnabled(True)
- installed_print_devices = device.getSupportedCUPSDevices(['hp'])
-
- if not self.printer_name or (self.device_uri in installed_print_devices and \
- self.printer_name in installed_print_devices[self.device_uri]):
- self.setNextEnabled(self.PrinterNamePage, False)
- self.printer_name_ok = False
-
- if not self.printer_name:
- QToolTip.add(self.printerNameLineEdit, self.__tr('You must enter a name for the printer.'))
- else:
- QToolTip.add(self.printerNameLineEdit, self.__tr('A printer already exists with this name. Please choose a different name.'))
-
- self.printerNameLineEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
-
- else:
+
+ def setEditErrors(self):
+ if self.printer_name_ok:
self.printerNameLineEdit.setPaletteBackgroundColor(self.bg)
self.printer_name_ok = True
+
if self.fax_name_ok:
self.setNextEnabled(self.PrinterNamePage, True)
QToolTip.remove(self.printerNameLineEdit)
+
+ else:
+ self.printerNameLineEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+ self.setNextEnabled(self.PrinterNamePage, False)
+
+ if self.fax_name_ok:
+ self.fax_name_ok = True
+ self.faxNameLineEdit.setPaletteBackgroundColor(self.bg)
+ if self.printer_name_ok:
+ self.setNextEnabled(self.PrinterNamePage, True)
+
+ QToolTip.remove(self.faxNameLineEdit)
+
+ else:
+ self.faxNameLineEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
+ self.setNextEnabled(self.PrinterNamePage, False)
+
+
+ def printerNameLineEdit_textChanged(self,a0):
+ self.printer_name = str(a0)
+ self.defaultPrinterNamePushButton.setEnabled(True)
+
+ self.printer_name_ok = True
+
if not self.printer_name:
+ QToolTip.add(self.printerNameLineEdit, self.__tr('You must enter a name for the printer.'))
self.printer_name_ok = False
- self.setNextEnabled(self.PrinterNamePage, False)
+
+ elif self.fax_name == self.printer_name:
+ s = self.__tr('The printer name and fax name must be different. Please choose different names.')
+ QToolTip.add(self.faxNameLineEdit, s)
+ QToolTip.add(self.printerNameLineEdit, 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:
+ QToolTip.add(self.printerNameLineEdit,
+ 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("textChanged(const QString&)"),
+ (self.faxNameLineEdit.text(),))
+
+ self.setEditErrors()
+
def printerLocationLineEdit_textChanged(self, a0):
- self.location = str(a0)
+ self.location = unicode(a0)
def printerDescriptionLineEdit_textChanged(self,a0):
- self.desc = str(a0)
+ self.desc = unicode(a0)
def faxLocationLineEdit_textChanged(self,a0):
- self.fax_location = str(a0)
+ self.fax_location = unicode(a0)
def faxDescriptionLineEdit_textChanged(self,a0):
- self.fax_desc = str(a0)
-
+ self.fax_desc = unicode(a0)
+
def defaultPrinterNamePushButton_clicked(self):
self.setDefaultPrinterName()
self.defaultPrinterNamePushButton.setEnabled(False)
def setDefaultFaxName(self):
- installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
- log.debug(installed_fax_devices)
+ self.installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
+ log.debug(self.installed_fax_devices)
self.fax_uri = self.device_uri.replace('hp:', 'hpfax:')
@@ -598,12 +697,13 @@ class SetupForm(SetupForm_base):
fax_name = default_model + "_fax"
# Check for duplicate names
- if self.fax_uri in installed_fax_devices and \
- fax_name in installed_fax_devices[self.fax_uri]:
+ if self.fax_uri in self.installed_fax_devices and \
+ fax_name in self.installed_fax_devices[self.fax_uri]:
+ #if fax_name in self.installed_queues or fax_name == self.printer_name:
i = 2
while True:
t = fax_name + "_%d" % i
- if t not in installed_fax_devices[self.fax_uri]:
+ if t not in self.installed_fax_devices[self.fax_uri]:
fax_name += "_%d" % i
break
i += 1
@@ -613,42 +713,47 @@ class SetupForm(SetupForm_base):
self.faxNameLineEdit.setPaletteBackgroundColor(self.bg)
self.defaultFaxNamePushButton.setEnabled(False)
self.fax_name = fax_name
+ #self.fax_name_error = False
def faxNameLineEdit_textChanged(self, a0):
- self.fax_name = str(a0)
+ self.fax_name = unicode(a0)
self.defaultFaxNamePushButton.setEnabled(True)
-
- installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
-
- if not self.fax_name or (self.fax_uri in installed_fax_devices and \
- self.fax_name in installed_fax_devices[self.fax_uri]):
- self.setNextEnabled(self.PrinterNamePage, False)
- self.fax_name_ok = False
+
+ self.fax_name_ok = True
+
+ if not self.fax_name:
+ QToolTip.add(self.faxNameLineEdit, 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.')
+ QToolTip.add(self.faxNameLineEdit, s)
+ QToolTip.add(self.printerNameLineEdit, 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:
+ QToolTip.add(self.faxNameLineEdit,
+ 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
- if not self.fax_name:
- QToolTip.add(self.faxNameLineEdit, self.__tr('You must enter a fax name.'))
- else:
- QToolTip.add(self.faxNameLineEdit, self.__tr('A fax already exists with this name. Please choose a different name.'))
+ self.printerNameLineEdit.emit(SIGNAL("textChanged(const QString&)"),
+ (self.printerNameLineEdit.text(),))
- self.faxNameLineEdit.setPaletteBackgroundColor(QColor(0xff, 0x99, 0x99))
- else:
- self.fax_name_ok = True
- self.faxNameLineEdit.setPaletteBackgroundColor(self.bg)
-
- if self.printer_name_ok:
- self.setNextEnabled(self.PrinterNamePage, True)
+ self.setEditErrors()
- QToolTip.remove(self.faxNameLineEdit)
-
- if not self.fax_name:
- self.fax_name_ok = False
- self.setNextEnabled(self.PrinterNamePage, False)
def faxNumberLineEdit_textChanged(self, a0):
- self.fax_number = str(a0)
+ self.fax_number = unicode(a0)
def faxNameCoLineEdit_textChanged(self, a0):
- self.fax_name_company = str(a0)
+ self.fax_name_company = unicode(a0)
def faxCheckBox_clicked(self):
pass
@@ -672,44 +777,67 @@ class SetupForm(SetupForm_base):
d = fax.FaxDevice(self.fax_uri)
- try:
- d.open()
- except Error:
- self.FailureUI(self.__tr("Unable to communicate with the device. Please check the device and try again."))
- else:
+ while True:
try:
- tries = 0
- ok = True
+ 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.caption(),
+ 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
+ while True:
+ tries += 1
+
+ try:
+ if read:
+ self.fax_number = d.getPhoneNum()
+ self.fax_name_company = 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.caption(),
+ error_text,
+ QMessageBox.Retry | QMessageBox.Default,
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+
+
+ time.sleep(5)
+ ok = False
+
+ if tries > 12:
+ break
- try:
- if read:
- self.fax_number = d.getPhoneNum()
- self.fax_name_company = d.getStationName()
else:
- d.setStationName(self.fax_name_company)
- d.setPhoneNum(self.fax_number)
-
- except Error:
- self.FailureUI(self.__tr("<b>Device I/O Error</b><p>Could not communicate with device. Device may be busy."))
- time.sleep(5)
- ok = False
-
- if tries > 12:
+ ok = True
break
- else:
- ok = True
- break
+ finally:
+ d.close()
- finally:
- d.close()
+ if ok and read:
+ self.faxNumberLineEdit.setText(self.fax_number)
+ self.faxNameCoLineEdit.setText(self.fax_name_company)
- if ok and read:
- self.faxNumberLineEdit.setText(self.fax_number)
- self.faxNameCoLineEdit.setText(self.fax_name_company)
+ break
finally:
QApplication.restoreOverrideCursor()
@@ -721,14 +849,21 @@ class SetupForm(SetupForm_base):
def setupPrinter(self):
QApplication.setOverrideCursor(QApplication.waitCursor)
- cups.addPrinter(self.printer_name, self.device_uri, self.location, self.ppd_file, self.desc)
+ #if self.ppd_file.startswith("foomatic:"):
+ if not os.path.exists(self.ppd_file): # assume foomatic: or some such
+ status, status_str = cups.addPrinter(self.printer_name, self.device_uri,
+ self.location, '', self.ppd_file, self.desc)
+ else:
+ status, status_str = cups.addPrinter(self.printer_name, self.device_uri,
+ self.location, self.ppd_file, '', self.desc)
- installed_print_devices = device.getSupportedCUPSDevices(['hp'])
+ log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
+ self.installed_print_devices = device.getSupportedCUPSDevices(['hp'])
- log.debug(installed_print_devices)
+ log.debug(self.installed_print_devices)
- if self.device_uri not in installed_print_devices or \
- self.printer_name not in installed_print_devices[self.device_uri]:
+ if self.device_uri not in self.installed_print_devices or \
+ self.printer_name not in self.installed_print_devices[self.device_uri]:
self.FailureUI(self.__tr("<b>Printer queue setup failed.</b><p>Please restart CUPS and try again."))
else:
@@ -754,14 +889,14 @@ class SetupForm(SetupForm_base):
QApplication.restoreOverrideCursor()
return
- cups.addPrinter(self.fax_name, self.fax_uri, self.fax_location, fax_ppd, self.fax_desc)
-
- installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
+ status, status_str = cups.addPrinter(self.fax_name, self.fax_uri, self.fax_location, fax_ppd, '', self.fax_desc)
+ log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
+ self.installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
- log.debug(installed_fax_devices)
+ log.debug(self.installed_fax_devices)
- if self.fax_uri not in installed_fax_devices or \
- self.fax_name not in installed_fax_devices[self.fax_uri]:
+ if self.fax_uri not in self.installed_fax_devices or \
+ self.fax_name not in self.installed_fax_devices[self.fax_uri]:
self.FailureUI(self.__tr("<b>Fax queue setup failed.</b><p>Please restart CUPS and try again."))
else:
@@ -796,20 +931,27 @@ class SetupForm(SetupForm_base):
self.FailureUI(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()
- self.hpiod_sock.close()
self.hpssd_sock.close()
+ if self.username:
+ import pwd
+ user_path = pwd.getpwnam(self.username)[5]
+ user_config_file = os.path.join(user_path, '.hplip.conf')
+
+ if os.path.exists(user_config_file):
+ cfg = Config(user_config_file)
+ cfg.last_used.device_uri = self.device_uri
+
QWizard.accept(self)
def reject(self):
- self.hpiod_sock.close()
self.hpssd_sock.close()
QWizard.reject(self)
def FailureUI(self, error_text):
- log.error(str(error_text))
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", ""))
QMessageBox.critical(self,
self.caption(),
error_text,
diff --git a/ui/setupform_base.py b/ui/setupform_base.py
index 0cabb79dc..e41e8f51a 100644
--- a/ui/setupform_base.py
+++ b/ui/setupform_base.py
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'ui/setupform_base.ui'
#
-# Created: Wed Sep 27 09:51:56 2006
-# by: The PyQt User Interface Compiler (pyuic) 3.15.1
+# Created: Thu Sep 20 11:45:16 2007
+# by: The PyQt User Interface Compiler (pyuic) 3.17
#
# WARNING! All changes made in this file will be lost!
@@ -30,17 +30,17 @@ class SetupForm_base(QWizard):
connectionTypeButtonGroupLayout = QGridLayout(self.connectionTypeButtonGroup.layout())
connectionTypeButtonGroupLayout.setAlignment(Qt.AlignTop)
- self.radioButton1 = QRadioButton(self.connectionTypeButtonGroup,"radioButton1")
+ self.usbRadioButton = QRadioButton(self.connectionTypeButtonGroup,"usbRadioButton")
- connectionTypeButtonGroupLayout.addWidget(self.radioButton1,0,0)
+ connectionTypeButtonGroupLayout.addWidget(self.usbRadioButton,0,0)
- self.radioButton2 = QRadioButton(self.connectionTypeButtonGroup,"radioButton2")
+ self.netRadioButton = QRadioButton(self.connectionTypeButtonGroup,"netRadioButton")
- connectionTypeButtonGroupLayout.addWidget(self.radioButton2,1,0)
+ connectionTypeButtonGroupLayout.addWidget(self.netRadioButton,1,0)
- self.radioButton3 = QRadioButton(self.connectionTypeButtonGroup,"radioButton3")
+ self.parRadioButton = QRadioButton(self.connectionTypeButtonGroup,"parRadioButton")
- connectionTypeButtonGroupLayout.addWidget(self.radioButton3,2,0)
+ connectionTypeButtonGroupLayout.addWidget(self.parRadioButton,2,0)
ConnectionPageLayout.addMultiCellWidget(self.connectionTypeButtonGroup,1,1,0,1)
spacer12 = QSpacerItem(20,120,QSizePolicy.Minimum,QSizePolicy.Expanding)
@@ -386,10 +386,10 @@ class SetupForm_base(QWizard):
self.setTabOrder(self.faxNumberLineEdit,self.faxNameCoLineEdit)
self.setTabOrder(self.faxNameCoLineEdit,self.faxLocationLineEdit)
self.setTabOrder(self.faxLocationLineEdit,self.faxDescriptionLineEdit)
- self.setTabOrder(self.faxDescriptionLineEdit,self.radioButton1)
- self.setTabOrder(self.radioButton1,self.radioButton2)
- self.setTabOrder(self.radioButton2,self.radioButton3)
- self.setTabOrder(self.radioButton3,self.searchFiltersPushButton2)
+ self.setTabOrder(self.faxDescriptionLineEdit,self.usbRadioButton)
+ self.setTabOrder(self.usbRadioButton,self.netRadioButton)
+ self.setTabOrder(self.netRadioButton,self.parRadioButton)
+ self.setTabOrder(self.parRadioButton,self.searchFiltersPushButton2)
self.setTabOrder(self.searchFiltersPushButton2,self.probedDevicesListView)
self.setTabOrder(self.probedDevicesListView,self.searchFiltersPushButton)
self.setTabOrder(self.searchFiltersPushButton,self.manualFindPushButton)
@@ -414,9 +414,9 @@ class SetupForm_base(QWizard):
def languageChange(self):
self.setCaption(self.__tr("HP Device Manger - Printer Setup Wizard"))
self.connectionTypeButtonGroup.setTitle(self.__tr("Connection (I/O) Type"))
- self.radioButton1.setText(self.__tr("Universal Serial Bus (USB)"))
- self.radioButton2.setText(self.__tr("Network/Ethernet/Wireless (direct connection or JetDirect)"))
- self.radioButton3.setText(self.__tr("Parallel Port (LPT)"))
+ self.usbRadioButton.setText(self.__tr("Universal Serial Bus (USB)"))
+ self.netRadioButton.setText(self.__tr("Network/Ethernet/Wireless (direct connection or JetDirect)"))
+ self.parRadioButton.setText(self.__tr("Parallel Port (LPT)"))
self.searchFiltersPushButton2.setText(self.__tr("Advanced..."))
self.setTitle(self.ConnectionPage,self.__tr("Choose Connection Type"))
self.searchFiltersPushButton.setText(self.__tr("Advanced..."))
@@ -428,7 +428,7 @@ class SetupForm_base(QWizard):
self.ppdListView.header().setLabel(1,self.__tr("Description"))
self.otherPPDPushButton.setText(self.__tr("Select Other..."))
self.ppdDefaultsPushButton.setText(self.__tr("Defaults"))
- self.textLabel1_5.setText(self.__tr("Please chose the PPD file (by name and description) that most closely matches your printer. <i>Note: The model name of the printer may vary somehwat from the PPD file name, for example, a Deskjet 5550 may have a PPD file with the model name of Deskjet_5500_series.</i>"))
+ self.textLabel1_5.setText(self.__tr("Please chose the PPD file (by name and description) that most closely matches your printer. <i>Note: The model name of the printer may vary somewhat from the PPD file name, for example, a Deskjet 5550 may have a PPD file with the model name of Deskjet_5500_series.</i>"))
self.setTitle(self.PPDPage,self.__tr("Select/Confirm PPD File"))
self.groupBox4.setTitle(self.__tr("Printer Information"))
self.defaultPrinterNamePushButton.setText(self.__tr("Default"))
diff --git a/ui/setupform_base.ui b/ui/setupform_base.ui
index ed746673a..328ff9586 100644
--- a/ui/setupform_base.ui
+++ b/ui/setupform_base.ui
@@ -39,7 +39,7 @@
</property>
<widget class="QRadioButton" row="0" column="0">
<property name="name">
- <cstring>radioButton1</cstring>
+ <cstring>usbRadioButton</cstring>
</property>
<property name="text">
<string>Universal Serial Bus (USB)</string>
@@ -47,7 +47,7 @@
</widget>
<widget class="QRadioButton" row="1" column="0">
<property name="name">
- <cstring>radioButton2</cstring>
+ <cstring>netRadioButton</cstring>
</property>
<property name="text">
<string>Network/Ethernet/Wireless (direct connection or JetDirect)</string>
@@ -55,7 +55,7 @@
</widget>
<widget class="QRadioButton" row="2" column="0">
<property name="name">
- <cstring>radioButton3</cstring>
+ <cstring>parRadioButton</cstring>
</property>
<property name="text">
<string>Parallel Port (LPT)</string>
@@ -259,7 +259,7 @@
<cstring>textLabel1_5</cstring>
</property>
<property name="text">
- <string>Please chose the PPD file (by name and description) that most closely matches your printer. &lt;i&gt;Note: The model name of the printer may vary somehwat from the PPD file name, for example, a Deskjet 5550 may have a PPD file with the model name of Deskjet_5500_series.&lt;/i&gt;</string>
+ <string>Please chose the PPD file (by name and description) that most closely matches your printer. &lt;i&gt;Note: The model name of the printer may vary somewhat from the PPD file name, for example, a Deskjet 5550 may have a PPD file with the model name of Deskjet_5500_series.&lt;/i&gt;</string>
</property>
<property name="alignment">
<set>WordBreak|AlignVCenter</set>
@@ -910,9 +910,9 @@
<tabstop>faxNameCoLineEdit</tabstop>
<tabstop>faxLocationLineEdit</tabstop>
<tabstop>faxDescriptionLineEdit</tabstop>
- <tabstop>radioButton1</tabstop>
- <tabstop>radioButton2</tabstop>
- <tabstop>radioButton3</tabstop>
+ <tabstop>usbRadioButton</tabstop>
+ <tabstop>netRadioButton</tabstop>
+ <tabstop>parRadioButton</tabstop>
<tabstop>searchFiltersPushButton2</tabstop>
<tabstop>probedDevicesListView</tabstop>
<tabstop>searchFiltersPushButton</tabstop>
@@ -934,9 +934,6 @@
<tabstop>lineEdit8</tabstop>
<tabstop>lineEdit9</tabstop>
</tabstops>
-<includes>
- <include location="local" impldecl="in implementation">setupform_base.ui.h</include>
-</includes>
<slots>
<slot>connectionTypeButtonGroup_clicked( int )</slot>
<slot>probedDevicesListView_currentChanged( QListViewItem * )</slot>
diff --git a/ui/setupmanualfind.py b/ui/setupmanualfind.py
index d81d557e1..407208052 100644
--- a/ui/setupmanualfind.py
+++ b/ui/setupmanualfind.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -29,30 +29,29 @@ class SetupManualFind(SetupManualFind_base):
SetupManualFind_base.__init__(self, parent, name, modal, fl)
self.bus = bus
self.param = ''
-
+
if self.bus == 'net':
self.findHeadingText.setText(self.__tr("""Please enter the printer's network hostname or IP address."""))
self.hintTextLabel.setText(self.__tr("""<i>(IPv4 address "a.b.c.d" or "hostname".)</i>"""))
self.findTextLabel.setText(self.__tr("""Hostname or IP Address:"""))
-
+
elif self.bus == 'usb':
self.findHeadingText.setText(self.__tr("""Please enter the USB ID for the printer."""))
self.hintTextLabel.setText(self.__tr("""<i>("xxx:yyy" where xxx is the USB bus ID and yyy is the USB device ID. The ':' and all leading zeroes must be present. Use 'lsusb' to determine this information.)</i>"""))
self.findTextLabel.setText(self.__tr("""USB ID:"""))
self.findLineEdit.setInputMask("000:000;0")
-
+
elif self.bus == 'par':
self.findHeadingText.setText(self.__tr("""Please enter the filesystem device node for the printer."""))
self.hintTextLabel.setText(self.__tr(""" <i>("/dev/parportX", X=0,1,2,...)</i>"""))
self.findTextLabel.setText(self.__tr("""Device Node:"""))
def findLineEdit_textChanged(self,a0):
- self.param = str(a0)
-
+ self.param = unicode(a0)
+
if self.bus == 'usb':
bus, dev = self.param.split(':')
self.param = ''.join(['0'*(3-len(bus)), bus, ':', '0'*(3-len(dev)), dev])
-
-
+
def __tr(self,s,c = None):
return qApp.translate("SetupManualFind_base",s,c)
diff --git a/ui/setupsettings.py b/ui/setupsettings.py
index e2b0d5edf..95f185276 100644
--- a/ui/setupsettings.py
+++ b/ui/setupsettings.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -28,12 +28,12 @@ from setupsettings_base import SetupSettings_base
class SetupSettings(SetupSettings_base):
def __init__(self, bus, filter, search, ttl, timeout, parent=None, name=None, modal=0, fl = 0):
SetupSettings_base.__init__(self, parent, name, modal, fl)
-
+
self.filter = filter
self.search = search
self.ttl = ttl
self.timeout = timeout
-
+
if 'none' in filter:
self.filterButtonGroup.setButton(0)
else:
@@ -42,13 +42,19 @@ class SetupSettings(SetupSettings_base):
self.scanCheckBox.setChecked('scan' in filter)
self.pcardCheckBox.setChecked('pcard' in filter)
self.copyCheckBox.setChecked('copy' in filter)
-
+
self.searchTermLineEdit.setText(self.search)
-
+
self.ttlSpinBox.setValue(self.ttl)
self.timeoutSpinBox.setValue(self.timeout)
-
+ if not prop.net_build:
+ self.ttlSpinBox.setEnabled(False)
+ self.timeoutSpinBox.setEnabled(False)
+ self.groupBox3.setEnabled(False)
+ self.textLabel7.setEnabled(False)
+ self.textLabel8.setEnabled(False)
+
def faxCheckBox_toggled(self,a0):
self.updateFilter()
@@ -63,9 +69,9 @@ class SetupSettings(SetupSettings_base):
def filterButtonGroup_clicked(self, a0):
self.updateFilter(a0)
-
+
def searchTermLineEdit_textChanged(self, a0):
- self.search = str(a0)
+ self.search = unicode(a0)
def ttlSpinBox_valueChanged(self, a0):
self.ttl = a0
@@ -74,34 +80,34 @@ class SetupSettings(SetupSettings_base):
def timeoutSpinBox_valueChanged(self, a0):
self.timeout = a0
log.debug(self.timeout)
-
+
def updateFilter(self, id=-1):
if id == 0:
self.filter = 'none'
-
+
else:
filters = []
-
+
if self.faxCheckBox.isChecked():
filters.append('fax')
-
+
if self.scanCheckBox.isChecked():
filters.append('scan')
-
+
if self.pcardCheckBox.isChecked():
filters.append('pcard')
-
+
if self.copyCheckBox.isChecked():
filters.append('copy')
-
+
if not filters:
filters.append('none')
-
+
self.filter = ','.join(filters)
-
+
log.debug(self.filter)
-
-
+
+
def defaultsPushButton_clicked(self):
self.filterButtonGroup.setButton(0)
self.updateFilter(0)
diff --git a/ui/unloadform.py b/ui/unloadform.py
index 5ce41b8d4..144a5abec 100644
--- a/ui/unloadform.py
+++ b/ui/unloadform.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2001-2006 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-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
@@ -19,54 +19,48 @@
# Author: Don Welch
#
+# Std Lib
+import os, os.path
+import operator
+# Local
from base.g import *
-from base import utils, device, msg
+from base import utils, device
from prnt import cups
-from pcard import photocard
-
-import sys
-import os, os.path
-import socket
+# Qt
from qt import *
+from scrollunload import ScrollUnloadView
-from unloadform_base import UnloadForm_base
-from imagepropertiesdlg import ImagePropertiesDlg
-
-progress_dlg = None
-
-class IconViewItem(QIconViewItem):
- def __init__(self, parent, dirname, fname, path, pixmap, mime_type, mime_subtype, size, exif_info={}):
- QIconViewItem.__init__(self, parent, fname, pixmap)
- self.mime_type = mime_type
- self.mime_subtype = mime_subtype
- self.path = path
- self.dirname = dirname
- self.filename = fname
- self.exif_info = exif_info
- self.size = size
- self.thumbnail_set = False
-
-
-
-class UnloadForm(UnloadForm_base):
+class UnloadForm(QMainWindow):
def __init__(self, bus='usb,par', device_uri=None, printer_name=None,
parent=None, name=None, fl=0):
- UnloadForm_base.__init__(self,parent,name,fl)
+ QMainWindow.__init__(self,parent,name,fl)
+
self.pc = None
self.device_uri = device_uri
self.printer_name = printer_name
self.init_failed = False
+ icon = QPixmap(os.path.join(prop.image_dir, 'HPmenu.png'))
+ self.setIcon(icon)
+
+ self.setCentralWidget(QWidget(self,"qt_central_widget"))
+ self.FormLayout = QGridLayout(self.centralWidget(),1,1,11,6,"FormLayout")
+
+ self.languageChange()
+
+ self.resize(QSize(600,480).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+
if self.device_uri and self.printer_name:
log.error("You may not specify both a printer (-p) and a device (-d).")
self.device_uri, self.printer_name = None, None
if not self.device_uri and not self.printer_name:
- probed_devices = device.probeDevices(bus=bus, filter='pcard')
+ probed_devices = device.probeDevices(bus=bus, filter={'pcard-type': (operator.eq, 1)})
cups_printers = cups.getPrinters()
log.debug(probed_devices)
log.debug(cups_printers)
@@ -84,11 +78,11 @@ class UnloadForm(UnloadForm_base):
if x == 0:
from nodevicesform import NoDevicesForm
- self.failure(self.__tr("<p><b>No devices found that support photo card access.</b><p>Please make sure your device is properly installed and try again."))
+ self.FailureUI(self.__tr("<p><b>No devices found that support photo card access.</b><p>Please make sure your device is properly installed and try again."))
self.init_failed = True
elif x == 1:
- log.info(utils.bold("Using device: %s" % devices[0][0]))
+ log.info(log.bold("Using device: %s" % devices[0][0]))
self.device_uri = devices[0][0]
else:
@@ -99,447 +93,52 @@ class UnloadForm(UnloadForm_base):
else:
self.init_failed = True
- QTimer.singleShot(0, self.initialUpdate)
+ self.UnloadView = ScrollUnloadView(False, self.centralWidget(), self, "UnloadView")
+ self.FormLayout.addWidget(self.UnloadView,0,0)
- def initialUpdate(self):
- if self.init_failed:
- self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
- return
+ if not self.init_failed:
+ try:
+ self.cur_device = device.Device(device_uri=self.device_uri,
+ printer_name=self.printer_name,
+ hpssd_sock=None)
+ except Error, e:
+ log.error("Invalid device URI or printer name.")
+ self.FailureUI("<b>Invalid device URI or printer name.</b><p>Please check the parameters to hp-print and try again.")
+ self.init_failed = True
+
+ else:
+ self.device_uri = self.cur_device.device_uri
+ user_cfg.last_used.device_uri = self.device_uri
+
+ log.debug(self.device_uri)
+
+ self.statusBar().message(self.device_uri)
- QApplication.setOverrideCursor(QApplication.waitCursor)
-
- try:
- self.pc = photocard.PhotoCard(None, self.device_uri, self.printer_name)
- except Error, e:
- log.error("An error occured: %s" % e[0])
- self.failure(self.__tr("<p><b>Unable to mount photocard.</b><p>Could not connect to device."))
- self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
- return
- if self.pc.device.device_uri is None and self.printer_name:
- log.error("Printer '%s' not found." % self.printer_name)
- self.failure(self.__tr("<p><b>Unable to mount photocard.</b><p>Device not found."))
- self.cleanup(EVENT_PCARD_JOB_FAIL)
- return
+ QTimer.singleShot(0, self.initialUpdate)
- if self.pc.device.device_uri is None and self.device_uri:
- log.error("Malformed/invalid device-uri: %s" % self.device_uri)
- self.failure(self.__tr("<p><b>Unable to mount photocard.</b><p>Malformed/invalid device-uri."))
- self.cleanup(EVENT_PCARD_JOB_FAIL)
- return
- try:
- self.pc.mount()
- except Error:
- log.error("Unable to mount photo card on device. Check that device is powered on and photo card is correctly inserted.")
- self.failure(self.__tr("<p><b>Unable to mount photocard.</b><p>Check that device is powered on and photo card is correctly inserted."))
- self.pc.umount()
- self.cleanup(EVENT_PCARD_UNABLE_TO_MOUNT)
+ def initialUpdate(self):
+ if self.init_failed:
+ self.close()
return
- self.pc.device.sendEvent(EVENT_START_PCARD_JOB)
-
- disk_info = self.pc.info()
- self.pc.write_protect = disk_info[8]
-
- if self.pc.write_protect:
- log.warning("Photo card is write protected.")
-
- log.info("Photocard on device %s mounted" % self.pc.device_uri)
-
- if not self.pc.write_protect:
- log.info("DO NOT REMOVE PHOTO CARD UNTIL YOU EXIT THIS PROGRAM")
-
- self.unload_dir = os.path.normpath(os.path.expanduser('~'))
- os.chdir(self.unload_dir)
- self.UnloadDirectoryEdit.setText(self.unload_dir)
-
- self.unload_list = self.pc.get_unload_list()
- self.DeviceText.setText(self.pc.device.device_uri)
-
- self.image_icon_map = {'tiff' : 'tif.png',
- 'bmp' : 'bmp.png',
- 'jpeg' : 'jpg.png',
- 'gif' : 'gif.png',
- 'unknown' : 'unknown.png',
- }
- self.video_icon_map = {'unknown' : 'movie.png',
- 'mpeg' : 'mpg.png',
- }
-
- self.total_number = 0
- self.total_size = 0
-
- self.removal_option = 0
-
- self.UpdateStatusBar()
+ self.UnloadView.onDeviceChange(self.cur_device)
- if self.pc.write_protect:
- self.FileRemovalGroup.setEnabled(False)
- self.LeaveAllRadio.setEnabled(False)
- self.RemoveSelectedRadio.setEnabled(False)
- self.RemoveAllRadio.setEnabled(False)
-
- # Item map disambiguates between files of the same
- # name that are on the pcard in more than one location
- self.item_map = {}
-
- QApplication.restoreOverrideCursor()
-
- self.load_icon_view(first_load=True)
-
- def closeEvent(self, event):
- if self.pc is not None:
- self.pc.device.sendEvent(EVENT_END_PCARD_JOB)
-
- event.accept()
-
-
- def CancelButton_clicked(self):
- self.cleanup()
-
-
- def cleanup(self, error=0):
- if self.pc is not None:
- if error > 0:
- self.pc.device.sendEvent(error, typ='error')
-
- self.close()
-
-
- def success(self):
- QMessageBox.information(self,
- self.caption(),
- self.__tr("<p><b>The operation completed successfully.</b>"),
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton)
-
- def failure(self, error_text):
+ def FailureUI(self, error_text):
+ log.error(unicode(error_text).replace("<b>", "").replace("</b>", "").replace("<p>", " "))
QMessageBox.critical(self,
self.caption(),
error_text,
QMessageBox.Ok,
QMessageBox.NoButton,
QMessageBox.NoButton)
-
-
- def load_icon_view(self, first_load):
- QApplication.setOverrideCursor(QApplication.waitCursor)
- self.first_load = first_load
-
- if first_load:
- self.IconView.clear()
-
- self.num_items = len(self.unload_list)
-
- self.pb = QProgressBar()
- self.pb.setTotalSteps(self.num_items)
- self.statusBar().addWidget(self.pb)
- self.pb.show()
-
- self.item_num = 0
- self.load_timer = QTimer(self, "ScanTimer")
- self.connect(self.load_timer, SIGNAL('timeout()'), self.continue_load_icon_view)
- self.load_timer.start(0)
-
- def continue_load_icon_view(self):
-
- if self.item_num == self.num_items:
- self.load_timer.stop()
- self.disconnect(self.load_timer, SIGNAL('timeout()'), self.continue_load_icon_view)
- self.load_timer = None
- del self.load_timer
-
- self.pb.hide()
- self.statusBar().removeWidget(self.pb)
-
- self.IconView.adjustItems()
- QApplication.restoreOverrideCursor()
- return
-
- f = self.unload_list[self.item_num]
-
- self.item_num += 1
- path, size = f[0], f[1]
-
- self.pb.setProgress(self.item_num)
-
- typ, subtyp = self.pc.classify_file(path).split('/')
-
- if not self.first_load and typ == 'image' and subtyp == 'jpeg':
-
- exif_info = self.pc.get_exif_path(path)
-
- if len(exif_info) > 0:
-
- if 'JPEGThumbnail' in exif_info:
- pixmap = QPixmap()
- pixmap.loadFromData(exif_info['JPEGThumbnail'], "JPEG")
-
- self.resizePixmap(pixmap)
-
- del exif_info['JPEGThumbnail']
- dname, fname=os.path.split(path)
- x = self.item_map[fname]
-
- if len(x) == 1:
- item = self.IconView.findItem(fname, 0)
- else:
- i = x.index(path)
- if i == 0:
- item = self.IconView.findItem(fname, 0)
- else:
- item = self.IconView.findItem(fname + " (%d)" % (i+1), 0)
-
- if item is not None:
- item.setPixmap(pixmap)
- item.thumbnail_set = True
-
- return
-
- #elif 'TIFFThumbnail' in exif_info:
- # can't handle TIFF in Qt?
- # del exif_info['TIFFThumbnail']
- # if first_load:
- # IconViewItem( self.IconView, filename,
- # QPixmap( os.path.join( prop.image_dir, 'tif.png' ) ),
- # typ, subtyp, size, exif_info )
- # else:
- # pass
-
- # continue
-
-
- elif self.first_load:
- if typ == 'image':
- f = os.path.join(prop.image_dir, self.image_icon_map.get(subtyp, 'unknown.png'))
- elif typ == 'video':
- f = os.path.join(prop.image_dir, self.video_icon_map.get(subtyp, 'movie.png'))
- elif typ == 'audio':
- f = os.path.join(prop.image_dir, 'sound.png')
- else:
- f = os.path.join(prop.image_dir, 'unknown.png')
-
- dirname, fname=os.path.split(path)
- num = 1
- try:
- self.item_map[fname]
- except:
- self.item_map[fname] = [path]
- else:
- self.item_map[fname].append(path)
- num = len(self.item_map[fname])
-
- if num == 1:
- IconViewItem(self.IconView, dirname, fname, path, QPixmap(f),
- typ, subtyp, size)
- else:
- IconViewItem(self.IconView, dirname, fname + " (%d)" % num,
- path, QPixmap(f), typ, subtyp, size)
-
-
- def resizePixmap(self, pixmap):
- w, h = pixmap.width(), pixmap.height()
-
- if h > 128 or w > 128:
- ww, hh = w - 128, h - 128
- if ww >= hh:
- pixmap.resize(128, int(float((w-ww))/w*h))
- else:
- pixmap.resize(int(float((h-hh))/h*w), 128)
-
-
-
- def UpdateStatusBar(self):
- if self.total_number == 0:
- self.statusBar().message(self.__tr("No files selected"))
- elif self.total_number == 1:
- self.statusBar().message(self.__tr("1 file selected, %s" % utils.format_bytes(self.total_size, True)))
- else:
- self.statusBar().message(self.__tr("%d files selected, %s" % (self.total_number, utils.format_bytes(self.total_size, True))))
-
- def SelectAllButton_clicked(self):
- self.IconView.selectAll(1)
-
- def SelectNoneButton_clicked(self):
- self.IconView.selectAll(0)
-
- def IconView_doubleClicked(self, a0):
- #self.Display( a0 )
- pass
-
- def UnloadDirectoryBrowseButton_clicked(self):
- old_dir = self.unload_dir
- self.unload_dir = unicode(QFileDialog.getExistingDirectory(self.unload_dir, self))
-
- if not len(self.unload_dir):
- return
- elif not utils.is_path_writable(self.unload_dir):
- self.failure(self.__tr("<p><b>The unload directory path you entered is not valid.</b><p>The directory must exist and you must have write permissions."))
- self.unload_dir = old_dir
- else:
- self.UnloadDirectoryEdit.setText(self.unload_dir)
- os.chdir(self.unload_dir)
-
- def UnloadButton_clicked(self):
- was_cancelled = False
- self.unload_dir = unicode(self.UnloadDirectoryEdit.text())
- dir_error = False
-
- try:
- os.chdir(self.unload_dir)
- except OSError:
- log.error("Directory not found: %s" % self.unload_dir)
- dir_error = True
-
- if dir_error or not utils.is_path_writable(self.unload_dir):
- self.failure(self.__tr("<p><b>The unload directory path is not valid.</b><p>Please enter a new path and try again."))
- return
-
- unload_list = []
- i = self.IconView.firstItem()
- total_size = 0
- while i is not None:
-
- if i.isSelected():
- unload_list.append((i.path, i.size, i.mime_type, i.mime_subtype))
- total_size += i.size
- i = i.nextItem()
-
- if total_size == 0:
- self.failure(self.__tr("<p><b>No files are selected to unload.</b><p>Please select one or more files to unload and try again."))
- return
-
- global progress_dlg
- progress_dlg = QProgressDialog(self.__tr("Unloading Files..."), self.__tr("Cancel"),
- total_size, self, 'progress', True)
- progress_dlg.setMinimumDuration(0)
- progress_dlg.show()
-
- if self.removal_option == 0:
- total_size, total_time, was_cancelled = \
- self.pc.unload(unload_list, self.UpdateUnloadProgressDlg, None, True)
-
- elif self.removal_option == 1: # remove selected
- total_size, total_time, was_cancelled = \
- self.pc.unload(unload_list, self.UpdateUnloadProgressDlg, None, False)
-
- else: # remove all
- total_size, total_time, was_cancelled = \
- self.pc.unload(unload_list, self.UpdateUnloadProgressDlg, None, False)
- # TODO: Remove remainder of files
-
- progress_dlg.close()
-
- self.pc.device.sendEvent(EVENT_PCARD_FILES_TRANSFERED)
-
- if was_cancelled:
- self.failure(self.__tr("<b>Unload cancelled at user request.</b>"))
- else:
- self.success()
-
-
- def UpdateUnloadProgressDlg(self, src, trg, size):
- global progress_dlg
- progress_dlg.setProgress(progress_dlg.progress() + size)
- progress_dlg.setLabelText(src)
- qApp.processEvents()
-
- return progress_dlg.wasCancelled()
-
- def IconView_rightButtonClicked(self, item, pos):
- popup = QPopupMenu(self)
- popup.insertItem("Properties", self.PopupProperties)
-
- if item is not None and \
- item.mime_type == 'image' and \
- item.mime_subtype == 'jpeg' and \
- not item.thumbnail_set:
-
- popup.insertItem("Show Thumbnail", self.showThumbNail)
- popup.popup(pos)
-
-
- def PopupDisplay(self):
- self.Display(self.IconView.currentItem())
-
- def PopupProperties(self):
- self.Properties(self.IconView.currentItem())
-
- def showThumbNail(self):
- item = self.IconView.currentItem()
- exif_info = self.pc.get_exif_path(item.path)
-
- if len(exif_info) > 0:
- if 'JPEGThumbnail' in exif_info:
- pixmap = QPixmap()
- pixmap.loadFromData(exif_info['JPEGThumbnail'], "JPEG")
- self.resizePixmap(pixmap)
- del exif_info['JPEGThumbnail']
- item.setPixmap(pixmap)
-
- self.IconView.adjustItems()
-
- else:
- self.failure(self.__tr("<p><b>No thumbnail found in image.</b>"))
-
- item.thumbnail_set = True
-
- def Display(self, item):
- pass
- # cp over file (does this even make sense to do this at this point?)
- # display with imagemagick?
-
- def Properties(self, item):
- if item is not None:
- if not item.exif_info:
- item.exif_info = self.pc.get_exif_path(item.path)
-
- ImagePropertiesDlg(item.filename, item.dirname,
- '/'.join([item.mime_type, item.mime_subtype]),
- utils.format_bytes(item.size, True),
- item.exif_info, self).exec_loop()
-
-
-
- def IconView_selectionChanged(self):
- self.total_number = 0
- self.total_size = 0
- i = self.IconView.firstItem()
-
- while i is not None:
-
- if i.isSelected():
- self.total_number += 1
- self.total_size += i.size
-
- i = i.nextItem()
-
- self.UpdateStatusBar()
-
-
- def IconView_clicked(self,a0,a1):
- pass
-
- def IconView_clicked(self,a0):
- pass
-
- def IconView_currentChanged(self,a0):
- pass
-
- def FileRemovalGroup_clicked(self, a0):
- self.removal_option = a0
-
- def ShowThumbnailsButton_clicked(self):
- self.ShowThumbnailsButton.setEnabled(False)
- self.load_icon_view(first_load=False)
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Unload Photo Card"))
def __tr(self,s,c = None):
return qApp.translate("UnloadForm",s,c)
-
-
diff --git a/ui/unloadform_base.py b/ui/unloadform_base.py
deleted file mode 100644
index b8003f720..000000000
--- a/ui/unloadform_base.py
+++ /dev/null
@@ -1,261 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file '/home/dwelch/linux-imaging-and-printing/src/ui/unloadform_base.ui'
-#
-# Created: Fri Apr 1 14:51:29 2005
-# by: The PyQt User Interface Compiler (pyuic) 3.14.1
-#
-# WARNING! All changes made in this file will be lost!
-
-
-import sys
-from qt import *
-
-
-class UnloadForm_base(QMainWindow):
- def __init__(self,parent = None,name = None,fl = 0):
- QMainWindow.__init__(self,parent,name,fl)
- self.statusBar()
-
- if not name:
- self.setName("UnloadForm_base")
-
-
- self.setCentralWidget(QWidget(self,"qt_central_widget"))
- UnloadForm_baseLayout = QGridLayout(self.centralWidget(),1,1,11,6,"UnloadForm_baseLayout")
-
- self.groupBox2 = QGroupBox(self.centralWidget(),"groupBox2")
- self.groupBox2.setColumnLayout(0,Qt.Vertical)
- self.groupBox2.layout().setSpacing(6)
- self.groupBox2.layout().setMargin(11)
- groupBox2Layout = QGridLayout(self.groupBox2.layout())
- groupBox2Layout.setAlignment(Qt.AlignTop)
-
- self.DeviceText = QLabel(self.groupBox2,"DeviceText")
-
- groupBox2Layout.addWidget(self.DeviceText,0,0)
-
- UnloadForm_baseLayout.addMultiCellWidget(self.groupBox2,0,0,0,2)
-
- self.UnloadButton = QPushButton(self.centralWidget(),"UnloadButton")
-
- UnloadForm_baseLayout.addWidget(self.UnloadButton,4,2)
- spacer1 = QSpacerItem(211,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- UnloadForm_baseLayout.addItem(spacer1,4,0)
-
- self.CancelButton = QPushButton(self.centralWidget(),"CancelButton")
-
- UnloadForm_baseLayout.addWidget(self.CancelButton,4,1)
-
- self.groupBox3 = QGroupBox(self.centralWidget(),"groupBox3")
- self.groupBox3.setColumnLayout(0,Qt.Vertical)
- self.groupBox3.layout().setSpacing(6)
- self.groupBox3.layout().setMargin(11)
- groupBox3Layout = QGridLayout(self.groupBox3.layout())
- groupBox3Layout.setAlignment(Qt.AlignTop)
-
- self.UnloadDirectoryEdit = QLineEdit(self.groupBox3,"UnloadDirectoryEdit")
-
- groupBox3Layout.addWidget(self.UnloadDirectoryEdit,0,0)
-
- self.UnloadDirectoryBrowseButton = QPushButton(self.groupBox3,"UnloadDirectoryBrowseButton")
-
- groupBox3Layout.addWidget(self.UnloadDirectoryBrowseButton,0,1)
-
- UnloadForm_baseLayout.addMultiCellWidget(self.groupBox3,2,2,0,2)
-
- self.FileRemovalGroup = QButtonGroup(self.centralWidget(),"FileRemovalGroup")
- self.FileRemovalGroup.setColumnLayout(0,Qt.Vertical)
- self.FileRemovalGroup.layout().setSpacing(6)
- self.FileRemovalGroup.layout().setMargin(11)
- FileRemovalGroupLayout = QGridLayout(self.FileRemovalGroup.layout())
- FileRemovalGroupLayout.setAlignment(Qt.AlignTop)
-
- self.LeaveAllRadio = QRadioButton(self.FileRemovalGroup,"LeaveAllRadio")
- self.LeaveAllRadio.setChecked(1)
-
- FileRemovalGroupLayout.addWidget(self.LeaveAllRadio,0,0)
-
- self.RemoveSelectedRadio = QRadioButton(self.FileRemovalGroup,"RemoveSelectedRadio")
-
- FileRemovalGroupLayout.addWidget(self.RemoveSelectedRadio,1,0)
-
- self.RemoveAllRadio = QRadioButton(self.FileRemovalGroup,"RemoveAllRadio")
- self.RemoveAllRadio.setEnabled(0)
-
- FileRemovalGroupLayout.addWidget(self.RemoveAllRadio,2,0)
-
- UnloadForm_baseLayout.addMultiCellWidget(self.FileRemovalGroup,3,3,0,2)
-
- self.groupBox1 = QGroupBox(self.centralWidget(),"groupBox1")
- self.groupBox1.setColumnLayout(0,Qt.Vertical)
- self.groupBox1.layout().setSpacing(6)
- self.groupBox1.layout().setMargin(11)
- groupBox1Layout = QGridLayout(self.groupBox1.layout())
- groupBox1Layout.setAlignment(Qt.AlignTop)
-
- self.IconView = QIconView(self.groupBox1,"IconView")
- self.IconView.setResizePolicy(QIconView.AutoOneFit)
- self.IconView.setSelectionMode(QIconView.Multi)
- self.IconView.setResizeMode(QIconView.Adjust)
- self.IconView.setMaxItemWidth(200)
- self.IconView.setAutoArrange(0)
- self.IconView.setItemsMovable(1)
-
- groupBox1Layout.addMultiCellWidget(self.IconView,0,0,0,3)
-
- self.SelectAllButton = QPushButton(self.groupBox1,"SelectAllButton")
-
- groupBox1Layout.addWidget(self.SelectAllButton,1,0)
-
- self.SelectNoneButton = QPushButton(self.groupBox1,"SelectNoneButton")
-
- groupBox1Layout.addWidget(self.SelectNoneButton,1,1)
-
- self.ShowThumbnailsButton = QPushButton(self.groupBox1,"ShowThumbnailsButton")
-
- groupBox1Layout.addWidget(self.ShowThumbnailsButton,1,3)
- spacer2 = QSpacerItem(360,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
- groupBox1Layout.addItem(spacer2,1,2)
-
- UnloadForm_baseLayout.addMultiCellWidget(self.groupBox1,1,1,0,2)
-
-
-
- self.MenuBar = QMenuBar(self,"MenuBar")
-
-
-
- self.languageChange()
-
- self.resize(QSize(689,661).expandedTo(self.minimumSizeHint()))
- self.clearWState(Qt.WState_Polished)
-
- self.connect(self.SelectAllButton,SIGNAL("clicked()"),self.SelectAllButton_clicked)
- self.connect(self.SelectNoneButton,SIGNAL("clicked()"),self.SelectNoneButton_clicked)
- self.connect(self.IconView,SIGNAL("doubleClicked(QIconViewItem*)"),self.IconView_doubleClicked)
- self.connect(self.UnloadDirectoryBrowseButton,SIGNAL("clicked()"),self.UnloadDirectoryBrowseButton_clicked)
- self.connect(self.UnloadButton,SIGNAL("clicked()"),self.UnloadButton_clicked)
- self.connect(self.IconView,SIGNAL("rightButtonClicked(QIconViewItem*,const QPoint&)"),self.IconView_rightButtonClicked)
- self.connect(self.FileRemovalGroup,SIGNAL("clicked(int)"),self.FileRemovalGroup_clicked)
- self.connect(self.IconView,SIGNAL("clicked(QIconViewItem*)"),self.IconView_clicked)
- self.connect(self.IconView,SIGNAL("selectionChanged()"),self.IconView_selectionChanged)
- self.connect(self.ShowThumbnailsButton,SIGNAL("clicked()"),self.ShowThumbnailsButton_clicked)
- self.connect(self.CancelButton,SIGNAL("clicked()"),self.CancelButton_clicked)
-
-
- def languageChange(self):
- self.setCaption(self.__tr("HP Device Manager - Unload Files from Photo Card"))
- self.groupBox2.setTitle(self.__tr("Device:"))
- self.DeviceText.setText(QString.null)
- self.UnloadButton.setText(self.__tr("Unload Selected Files"))
- self.CancelButton.setText(self.__tr("Close"))
- self.groupBox3.setTitle(self.__tr("Unload Directory:"))
- self.UnloadDirectoryBrowseButton.setText(self.__tr("Browse..."))
- self.FileRemovalGroup.setTitle(self.__tr("File Removal:"))
- self.LeaveAllRadio.setText(self.__tr("Leave all files on photo card"))
- self.RemoveSelectedRadio.setText(self.__tr("Remove selected files"))
- self.RemoveAllRadio.setText(self.__tr("Remove all files"))
- self.groupBox1.setTitle(self.__tr("Select Files to Unload from Photo Card:"))
- self.SelectAllButton.setText(self.__tr("Select All"))
- self.SelectNoneButton.setText(self.__tr("Select None"))
- self.ShowThumbnailsButton.setText(self.__tr("Show Thumbnails"))
-
-
- def fileNew(self):
- print "UnloadForm_base.fileNew(): Not implemented yet"
-
- def fileOpen(self):
- print "UnloadForm_base.fileOpen(): Not implemented yet"
-
- def fileSave(self):
- print "UnloadForm_base.fileSave(): Not implemented yet"
-
- def fileSaveAs(self):
- print "UnloadForm_base.fileSaveAs(): Not implemented yet"
-
- def filePrint(self):
- print "UnloadForm_base.filePrint(): Not implemented yet"
-
- def fileExit(self):
- print "UnloadForm_base.fileExit(): Not implemented yet"
-
- def editUndo(self):
- print "UnloadForm_base.editUndo(): Not implemented yet"
-
- def editRedo(self):
- print "UnloadForm_base.editRedo(): Not implemented yet"
-
- def editCut(self):
- print "UnloadForm_base.editCut(): Not implemented yet"
-
- def editCopy(self):
- print "UnloadForm_base.editCopy(): Not implemented yet"
-
- def editPaste(self):
- print "UnloadForm_base.editPaste(): Not implemented yet"
-
- def editFind(self):
- print "UnloadForm_base.editFind(): Not implemented yet"
-
- def helpIndex(self):
- print "UnloadForm_base.helpIndex(): Not implemented yet"
-
- def helpContents(self):
- print "UnloadForm_base.helpContents(): Not implemented yet"
-
- def helpAbout(self):
- print "UnloadForm_base.helpAbout(): Not implemented yet"
-
- def SelectAllButton_clicked(self):
- print "UnloadForm_base.SelectAllButton_clicked(): Not implemented yet"
-
- def SelectNoneButton_clicked(self):
- print "UnloadForm_base.SelectNoneButton_clicked(): Not implemented yet"
-
- def IconView_doubleClicked(self,a0):
- print "UnloadForm_base.IconView_doubleClicked(QIconViewItem*): Not implemented yet"
-
- def UnloadDirectoryBrowseButton_clicked(self):
- print "UnloadForm_base.UnloadDirectoryBrowseButton_clicked(): Not implemented yet"
-
- def UnloadButton_clicked(self):
- print "UnloadForm_base.UnloadButton_clicked(): Not implemented yet"
-
- def IconView_rightButtonClicked(self,a0,a1):
- print "UnloadForm_base.IconView_rightButtonClicked(QIconViewItem*,const QPoint&): Not implemented yet"
-
- def FileRemovalGroup_clicked(self,a0):
- print "UnloadForm_base.FileRemovalGroup_clicked(int): Not implemented yet"
-
- def IconView_selectionChanged(self,a0):
- print "UnloadForm_base.IconView_selectionChanged(QIconViewItem*): Not implemented yet"
-
- def IconView_clicked(self,a0,a1):
- print "UnloadForm_base.IconView_clicked(QIconViewItem*,const QPoint&): Not implemented yet"
-
- def IconView_clicked(self,a0):
- print "UnloadForm_base.IconView_clicked(QIconViewItem*): Not implemented yet"
-
- def IconView_currentChanged(self,a0):
- print "UnloadForm_base.IconView_currentChanged(QIconViewItem*): Not implemented yet"
-
- def IconView_selectionChanged(self):
- print "UnloadForm_base.IconView_selectionChanged(): Not implemented yet"
-
- def ShowThumbnailsButton_clicked(self):
- print "UnloadForm_base.ShowThumbnailsButton_clicked(): Not implemented yet"
-
- def CancelButton_clicked(self):
- print "UnloadForm_base.CancelButton_clicked(): Not implemented yet"
-
- def __tr(self,s,c = None):
- return qApp.translate("UnloadForm_base",s,c)
-
-if __name__ == "__main__":
- a = QApplication(sys.argv)
- QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
- w = UnloadForm_base()
- a.setMainWidget(w)
- w.show()
- a.exec_loop()
diff --git a/ui/unloadform_base.ui b/ui/unloadform_base.ui
deleted file mode 100644
index 67ae950cc..000000000
--- a/ui/unloadform_base.ui
+++ /dev/null
@@ -1,334 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>UnloadForm_base</class>
-<widget class="QMainWindow">
- <property name="name">
- <cstring>UnloadForm_base</cstring>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>689</width>
- <height>661</height>
- </rect>
- </property>
- <property name="caption">
- <string>HP Device Manager - Unload Files from Photo Card</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>groupBox2</cstring>
- </property>
- <property name="title">
- <string>Device:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>DeviceText</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QPushButton" row="4" column="2">
- <property name="name">
- <cstring>UnloadButton</cstring>
- </property>
- <property name="text">
- <string>Unload Selected Files</string>
- </property>
- </widget>
- <spacer row="4" column="0">
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>211</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton" row="4" column="1">
- <property name="name">
- <cstring>CancelButton</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>groupBox3</cstring>
- </property>
- <property name="title">
- <string>Unload Directory:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLineEdit" row="0" column="0">
- <property name="name">
- <cstring>UnloadDirectoryEdit</cstring>
- </property>
- </widget>
- <widget class="QPushButton" row="0" column="1">
- <property name="name">
- <cstring>UnloadDirectoryBrowseButton</cstring>
- </property>
- <property name="text">
- <string>Browse...</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QButtonGroup" row="3" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>FileRemovalGroup</cstring>
- </property>
- <property name="title">
- <string>File Removal:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0">
- <property name="name">
- <cstring>LeaveAllRadio</cstring>
- </property>
- <property name="text">
- <string>Leave all files on photo card</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0">
- <property name="name">
- <cstring>RemoveSelectedRadio</cstring>
- </property>
- <property name="text">
- <string>Remove selected files</string>
- </property>
- </widget>
- <widget class="QRadioButton" row="2" column="0">
- <property name="name">
- <cstring>RemoveAllRadio</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Remove all files</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>groupBox1</cstring>
- </property>
- <property name="title">
- <string>Select Files to Unload from Photo Card:</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QIconView" row="0" column="0" rowspan="1" colspan="4">
- <property name="name">
- <cstring>IconView</cstring>
- </property>
- <property name="resizePolicy">
- <enum>AutoOneFit</enum>
- </property>
- <property name="selectionMode">
- <enum>Multi</enum>
- </property>
- <property name="resizeMode">
- <enum>Adjust</enum>
- </property>
- <property name="maxItemWidth">
- <number>200</number>
- </property>
- <property name="autoArrange">
- <bool>false</bool>
- </property>
- <property name="itemsMovable">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="0">
- <property name="name">
- <cstring>SelectAllButton</cstring>
- </property>
- <property name="text">
- <string>Select All</string>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>SelectNoneButton</cstring>
- </property>
- <property name="text">
- <string>Select None</string>
- </property>
- </widget>
- <widget class="QPushButton" row="1" column="3">
- <property name="name">
- <cstring>ShowThumbnailsButton</cstring>
- </property>
- <property name="text">
- <string>Show Thumbnails</string>
- </property>
- </widget>
- <spacer row="1" column="2">
- <property name="name">
- <cstring>spacer2</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>360</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </grid>
- </widget>
- </grid>
-</widget>
-<menubar>
- <property name="name">
- <cstring>MenuBar</cstring>
- </property>
-</menubar>
-<toolbars>
-</toolbars>
-<connections>
- <connection>
- <sender>SelectAllButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>SelectAllButton_clicked()</slot>
- </connection>
- <connection>
- <sender>SelectNoneButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>SelectNoneButton_clicked()</slot>
- </connection>
- <connection>
- <sender>IconView</sender>
- <signal>doubleClicked(QIconViewItem*)</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>IconView_doubleClicked(QIconViewItem*)</slot>
- </connection>
- <connection>
- <sender>UnloadDirectoryBrowseButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>UnloadDirectoryBrowseButton_clicked()</slot>
- </connection>
- <connection>
- <sender>UnloadButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>UnloadButton_clicked()</slot>
- </connection>
- <connection>
- <sender>IconView</sender>
- <signal>rightButtonClicked(QIconViewItem*,const QPoint&amp;)</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>IconView_rightButtonClicked(QIconViewItem*,const QPoint&amp;)</slot>
- </connection>
- <connection>
- <sender>FileRemovalGroup</sender>
- <signal>clicked(int)</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>FileRemovalGroup_clicked(int)</slot>
- </connection>
- <connection>
- <sender>IconView</sender>
- <signal>clicked(QIconViewItem*)</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>IconView_clicked(QIconViewItem*)</slot>
- </connection>
- <connection>
- <sender>IconView</sender>
- <signal>selectionChanged()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>IconView_selectionChanged()</slot>
- </connection>
- <connection>
- <sender>ShowThumbnailsButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>ShowThumbnailsButton_clicked()</slot>
- </connection>
- <connection>
- <sender>CancelButton</sender>
- <signal>clicked()</signal>
- <receiver>UnloadForm_base</receiver>
- <slot>CancelButton_clicked()</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in implementation">unloadform_base.ui.h</include>
-</includes>
-<slots>
- <slot>fileNew()</slot>
- <slot>fileOpen()</slot>
- <slot>fileSave()</slot>
- <slot>fileSaveAs()</slot>
- <slot>filePrint()</slot>
- <slot>fileExit()</slot>
- <slot>editUndo()</slot>
- <slot>editRedo()</slot>
- <slot>editCut()</slot>
- <slot>editCopy()</slot>
- <slot>editPaste()</slot>
- <slot>editFind()</slot>
- <slot>helpIndex()</slot>
- <slot>helpContents()</slot>
- <slot>helpAbout()</slot>
- <slot>SelectAllButton_clicked()</slot>
- <slot>SelectNoneButton_clicked()</slot>
- <slot>IconView_doubleClicked( QIconViewItem * )</slot>
- <slot>UnloadDirectoryBrowseButton_clicked()</slot>
- <slot>UnloadButton_clicked()</slot>
- <slot>IconView_rightButtonClicked( QIconViewItem *, const QPoint &amp; )</slot>
- <slot>FileRemovalGroup_clicked( int )</slot>
- <slot>IconView_selectionChanged( QIconViewItem * )</slot>
- <slot>IconView_clicked( QIconViewItem *, const QPoint &amp; )</slot>
- <slot>IconView_clicked( QIconViewItem * )</slot>
- <slot>IconView_currentChanged( QIconViewItem * )</slot>
- <slot>IconView_selectionChanged()</slot>
- <slot>ShowThumbnailsButton_clicked()</slot>
- <slot>CancelButton_clicked()</slot>
-</slots>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
diff --git a/ui/waitform.py b/ui/waitform.py
index 2eece99c3..e2104f013 100644
--- a/ui/waitform.py
+++ b/ui/waitform.py
@@ -1,4 +1,23 @@
# -*- 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
+#
import sys
from qt import *
@@ -17,11 +36,11 @@ class WaitForm(WaitForm_base):
if seconds == 0:
self.wait_timer.start(10)
else:
- self.wait_timer.start(1000)
+ self.wait_timer.start(seconds*1000)
if message is not None:
self.setMessage(message)
-
+
self.cancelPushButton.setEnabled(cancel_func is not None)
self.cancel_func = cancel_func
self.canceled = False
@@ -34,14 +53,11 @@ class WaitForm(WaitForm_base):
self.wait_timer.stop()
self.close()
-
def setMessage(self, message):
self.textLabel3.setText(message)
-
def cancelPushButton_clicked(self):
self.canceled = True
if self.cancel_func is not None:
self.cancel_func()
self.cancelPushButton.setEnabled(False)
-