summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2016-01-04 16:38:03 +0100
committerDidier Raboud <odyx@debian.org>2016-01-04 16:38:03 +0100
commitb901b91090696cc3a5447f439c8c1a55a4fd64a3 (patch)
treea36c1bd06a7144cfbd5dcd41b03aff053a18e2a8 /ui
parent6cc1a3ce7490e293a1e571d73fc7ff39342213e2 (diff)
Imported Upstream version 0.9.5
Diffstat (limited to 'ui')
-rw-r--r--ui/align10form.py81
-rw-r--r--ui/align10form_base.py148
-rw-r--r--ui/align10form_base.ui291
-rw-r--r--ui/devmgr4.py128
-rw-r--r--ui/faxaddrbookform.py207
-rw-r--r--ui/printerform.py94
-rw-r--r--ui/unloadform.py10
7 files changed, 714 insertions, 245 deletions
diff --git a/ui/align10form.py b/ui/align10form.py
new file mode 100644
index 000000000..a7a2eac4c
--- /dev/null
+++ b/ui/align10form.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2001-2004 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
+#
+
+from base.g import *
+import os.path
+from qt import *
+from align10form_base import Align10Form_Base
+
+class Align10Form(Align10Form_Base):
+ def __init__(self, pattern, 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' ) ) )
+ if pattern == 1:
+ self.controls = { 'A' : (True, 23),
+ 'B' : (True, 9),
+ 'C' : (True, 9),
+ 'D' : (False, 0),
+ 'E' : (False, 0),
+ 'F' : (False, 0),
+ 'G' : (False, 0),
+ 'H' : (False, 0),}
+ elif pattern == 2:
+ self.controls = { 'A' : (True, 23),
+ 'B' : (True, 17),
+ 'C' : (True, 23),
+ 'D' : (True, 23),
+ 'E' : (True, 9),
+ 'F' : (True, 9),
+ 'G' : (True, 9),
+ 'H' : (True, 9),}
+
+ elif pattern == 3:
+ self.controls = { 'A' : (True, 23),
+ 'B' : (True, 9),
+ 'C' : (True, 23),
+ 'D' : (True, 23),
+ 'E' : (True, 9),
+ 'F' : (True, 9),
+ 'G' : (True, 9),
+ 'H' : (True, 9),}
+
+ 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:
+ if not self.controls[line][0]:
+ ret.append(0)
+ else:
+ exec('selected = str(self.comboBox%s.currentText())' % line)
+ try:
+ selected = int(selected[1:])
+ except ValueError:
+ selected = 0
+ ret.append(selected)
+
+ return ret
+
diff --git a/ui/align10form_base.py b/ui/align10form_base.py
new file mode 100644
index 000000000..2d5c21b5b
--- /dev/null
+++ b/ui/align10form_base.py
@@ -0,0 +1,148 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'align10form_base.ui'
+#
+# Created: Wed Aug 10 21:07:52 2005
+# by: The PyQt User Interface Compiler (pyuic) 3.14.1
+#
+# WARNING! All changes made in this file will be lost!
+
+
+from qt import *
+
+
+class Align10Form_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("Align10Form_base")
+
+
+ Align10Form_baseLayout = QGridLayout(self,1,1,11,6,"Align10Form_baseLayout")
+
+ self.textLabel2 = QLabel(self,"textLabel2")
+
+ Align10Form_baseLayout.addMultiCellWidget(self.textLabel2,0,0,0,2)
+
+ layout2 = QGridLayout(None,1,1,0,6,"layout2")
+
+ self.comboBoxF = QComboBox(0,self,"comboBoxF")
+
+ layout2.addWidget(self.comboBoxF,5,1)
+
+ self.textLabel1_2 = QLabel(self,"textLabel1_2")
+
+ layout2.addWidget(self.textLabel1_2,1,0)
+
+ self.textLabel1_6 = QLabel(self,"textLabel1_6")
+
+ layout2.addWidget(self.textLabel1_6,5,0)
+
+ self.comboBoxD = QComboBox(0,self,"comboBoxD")
+
+ layout2.addWidget(self.comboBoxD,3,1)
+
+ self.comboBoxE = QComboBox(0,self,"comboBoxE")
+
+ layout2.addWidget(self.comboBoxE,4,1)
+
+ self.textLabel1_3 = QLabel(self,"textLabel1_3")
+
+ layout2.addWidget(self.textLabel1_3,2,0)
+
+ self.textLabel1_4 = QLabel(self,"textLabel1_4")
+
+ layout2.addWidget(self.textLabel1_4,3,0)
+
+ self.comboBoxC = QComboBox(0,self,"comboBoxC")
+
+ layout2.addWidget(self.comboBoxC,2,1)
+
+ self.comboBoxA = QComboBox(0,self,"comboBoxA")
+
+ layout2.addWidget(self.comboBoxA,0,1)
+
+ self.comboBoxH = QComboBox(0,self,"comboBoxH")
+
+ layout2.addWidget(self.comboBoxH,7,1)
+
+ self.textLabel1_7 = QLabel(self,"textLabel1_7")
+
+ layout2.addWidget(self.textLabel1_7,6,0)
+
+ self.textLabel1 = QLabel(self,"textLabel1")
+
+ layout2.addWidget(self.textLabel1,0,0)
+
+ self.textLabel1_5 = QLabel(self,"textLabel1_5")
+
+ layout2.addWidget(self.textLabel1_5,4,0)
+
+ self.textLabel1_8 = QLabel(self,"textLabel1_8")
+
+ layout2.addWidget(self.textLabel1_8,7,0)
+
+ self.comboBoxB = QComboBox(0,self,"comboBoxB")
+
+ layout2.addWidget(self.comboBoxB,1,1)
+
+ self.comboBoxG = QComboBox(0,self,"comboBoxG")
+
+ layout2.addWidget(self.comboBoxG,6,1)
+
+ Align10Form_baseLayout.addMultiCellLayout(layout2,0,1,4,5)
+ spacer2 = QSpacerItem(20,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ Align10Form_baseLayout.addItem(spacer2,0,3)
+ spacer3 = QSpacerItem(20,41,QSizePolicy.Minimum,QSizePolicy.Expanding)
+ Align10Form_baseLayout.addItem(spacer3,2,5)
+
+ self.pushButton1 = QPushButton(self,"pushButton1")
+
+ Align10Form_baseLayout.addWidget(self.pushButton1,3,5)
+
+ self.pushButton2 = QPushButton(self,"pushButton2")
+
+ Align10Form_baseLayout.addMultiCellWidget(self.pushButton2,3,3,3,4)
+ spacer1 = QSpacerItem(320,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ Align10Form_baseLayout.addMultiCell(spacer1,3,3,0,2)
+ spacer5 = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ Align10Form_baseLayout.addItem(spacer5,1,0)
+
+ self.Icon = QLabel(self,"Icon")
+ self.Icon.setSizePolicy(QSizePolicy(QSizePolicy.Fixed,QSizePolicy.Fixed,0,0,self.Icon.sizePolicy().hasHeightForWidth()))
+ self.Icon.setMinimumSize(QSize(192,93))
+ self.Icon.setMaximumSize(QSize(192,93))
+ self.Icon.setScaledContents(1)
+
+ Align10Form_baseLayout.addWidget(self.Icon,1,1)
+ spacer4 = QSpacerItem(60,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
+ Align10Form_baseLayout.addMultiCell(spacer4,1,1,2,3)
+
+ self.languageChange()
+
+ self.resize(QSize(520,326).expandedTo(self.minimumSizeHint()))
+ self.clearWState(Qt.WState_Polished)
+
+ self.connect(self.pushButton1,SIGNAL("clicked()"),self.accept)
+ self.connect(self.pushButton2,SIGNAL("clicked()"),self.reject)
+
+
+ def languageChange(self):
+ self.setCaption(self.__tr("HP Device Manager - Alignment"))
+ self.textLabel2.setText(self.__tr("Examine the page that was printed. Several rows of boxes, each made up of thin lines, appear on the printed page.<p>\n"
+"For each row, select the label representing the box in which the shorter inner lines are the most aligned with the longer outer lines.."))
+ self.textLabel1_2.setText(self.__tr("<b><font face=\"Courier\">B:</font></b>"))
+ self.textLabel1_6.setText(self.__tr("<b><font face=\"Courier\">F:</font></b>"))
+ self.textLabel1_3.setText(self.__tr("<b><font face=\"Courier\">C:</font></b>"))
+ self.textLabel1_4.setText(self.__tr("<b><font face=\"Courier\">D:</font></b>"))
+ self.textLabel1_7.setText(self.__tr("<b><font face=\"Courier\">G:</font></b>"))
+ self.textLabel1.setText(self.__tr("<b><font face=\"Courier\">A:</font></b>"))
+ self.textLabel1_5.setText(self.__tr("<b><font face=\"Courier\">E:</font></b>"))
+ self.textLabel1_8.setText(self.__tr("<b><font face=\"Courier\">H:</font></b>"))
+ self.pushButton1.setText(self.__tr("Next >"))
+ self.pushButton2.setText(self.__tr("Cancel"))
+
+
+ def __tr(self,s,c = None):
+ return qApp.translate("Align10Form_Base",s,c)
diff --git a/ui/align10form_base.ui b/ui/align10form_base.ui
new file mode 100644
index 000000000..6f7a95f5f
--- /dev/null
+++ b/ui/align10form_base.ui
@@ -0,0 +1,291 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>Align10Form_Base</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>Align10Form_base</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>520</width>
+ <height>326</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>HP Device Manager - Alignment</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Examine the page that was printed. Several rows of boxes, each made up of thin lines, appear on the printed page.&lt;p&gt;
+For each row, select the label representing the box in which the shorter inner lines are the most aligned with the longer outer lines..</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="4" rowspan="2" colspan="2">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="5" column="1">
+ <property name="name">
+ <cstring>comboBoxF</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;B:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel1_6</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;F:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="3" column="1">
+ <property name="name">
+ <cstring>comboBoxD</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="4" column="1">
+ <property name="name">
+ <cstring>comboBoxE</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;C:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_4</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;D:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>comboBoxC</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>comboBoxA</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="7" column="1">
+ <property name="name">
+ <cstring>comboBoxH</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel1_7</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;G:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;A:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel1_5</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;E:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel1_8</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;&lt;font face="Courier"&gt;H:&lt;/font&gt;&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>comboBoxB</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="6" column="1">
+ <property name="name">
+ <cstring>comboBoxG</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="0" column="3">
+ <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>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="5">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="3" column="5">
+ <property name="name">
+ <cstring>pushButton1</cstring>
+ </property>
+ <property name="text">
+ <string>Next &gt;</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="3" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>pushButton2</cstring>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <spacer row="3" column="0" rowspan="1" colspan="3">
+ <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>320</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="1" column="1">
+ <property name="name">
+ <cstring>Icon</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>192</width>
+ <height>93</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>192</width>
+ <height>93</height>
+ </size>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="1" column="2" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>60</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>pushButton1</sender>
+ <signal>clicked()</signal>
+ <receiver>Align10Form_base</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>pushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>Align10Form_base</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/ui/devmgr4.py b/ui/devmgr4.py
index 6a493f391..5aaa6f0e0 100644
--- a/ui/devmgr4.py
+++ b/ui/devmgr4.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
#
-# $Revision: 1.84 $
-# $Date: 2005/07/19 23:22:45 $
+# $Revision: 1.92 $
+# $Date: 2005/08/25 21:30:27 $
# $Author: dwelch $
#
#
@@ -51,6 +51,7 @@ 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
# Misc forms
from loadpaperform import LoadPaperForm
@@ -333,7 +334,7 @@ class devmgr4(DevMgr4_base):
if not self.auto_refresh:
self.autoRefresh.toggle()
- self.update_called = False
+ #self.update_called = False
self.cur_device_uri = '' # Device URI
self.devices = {} # { Device_URI : device.Device(), ... }
@@ -432,10 +433,10 @@ class devmgr4(DevMgr4_base):
def UpdateDevice(self, check_state=True):
log.debug(utils.bold("Update: %s %s %s" % ("*"*20, self.cur_device_uri, "*"*20)))
- self.update_called = True
+ #self.update_called = True
self.setCaption("%s - HP Device Manager" % self.cur_device.model_ui)
- if self.cur_device.supported and check_state:
+ if self.cur_device.supported and check_state and not self.rescanning:
try:
self.cur_device.open()
self.cur_device.queryDevice()
@@ -443,20 +444,24 @@ class devmgr4(DevMgr4_base):
except Error, e:
log.warn(e.msg)
- 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)
+ 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)
+ icon = self.CreatePixmap()
+ self.DeviceList.currentItem().setPixmap(icon)
- if not self.rescanning: # and self.cur_device.supported:
+ if not self.rescanning:
self.UpdateHistory()
self.UpdateTabs()
def CreatePixmap(self):
- pix = QPixmap(self.cur_device.icon_file)
+ try:
+ pix = QPixmap(self.cur_device.icon_file)
+ except AttributeError:
+ pix = QPixmap(os.path.join(prop.image_dir, 'default_printer.png'))
+
error_state = self.cur_device.error_state
icon = QPixmap(pix.width(), pix.height())
p = QPainter(icon)
@@ -728,14 +733,17 @@ class devmgr4(DevMgr4_base):
self.cur_device.error_state = ERROR_STATE_ERROR
self.cur_device.status_code = STATUS_UNKNOWN
else:
- self.cur_device.last_event = self.cur_device.hist[-1]
- #print self.cur_device.last_event
+ try:
+ self.cur_device.last_event = self.cur_device.hist[-1]
+ except IndexError:
+ self.cur_device.last_event = None
+ self.cur_device.error_state = ERROR_STATE_ERROR
+ self.cur_device.status_code = STATUS_UNKNOWN
+
def UpdateStatusTab(self):
self.StatusHistoryList.clear()
- #self.UpdateHistory()
-
for x in self.cur_device.hist:
job_id = x[9]
code = x[11]
@@ -758,9 +766,9 @@ class devmgr4(DevMgr4_base):
if status_pix is not None:
i.setPixmap(0, status_pix)
-
- self.StatusText.setText(self.cur_device.last_event[12])
- self.StatusText2.setText(self.cur_device.last_event[13])
+ if self.cur_device.last_event is not None:
+ self.StatusText.setText(self.cur_device.last_event[12])
+ self.StatusText2.setText(self.cur_device.last_event[13])
if self.cur_device.error_state == ERROR_STATE_CLEAR:
self.StatusIcon.clear()
@@ -771,8 +779,9 @@ class devmgr4(DevMgr4_base):
elif self.cur_device.error_state == ERROR_STATE_WARNING:
self.StatusIcon.setPixmap(QPixmap(os.path.join(prop.image_dir, "warning.png")))
+ # TODO: Different icon overlay for laser
elif self.cur_device.error_state == ERROR_STATE_LOW_SUPPLIES:
- self.StatusIcon.setPixmap(QPixmap(os.path.join(prop.image_dir, "warning.png")))
+ self.StatusIcon.setPixmap(QPixmap(os.path.join(prop.image_dir, "inkdrop.png")))
elif self.cur_device.error_state == ERROR_STATE_ERROR:
self.StatusIcon.setPixmap(QPixmap(os.path.join(prop.image_dir, "error.png")))
@@ -808,7 +817,8 @@ class devmgr4(DevMgr4_base):
AGENT_KIND_TONER_CARTRIDGE,
AGENT_KIND_MAINT_KIT,
AGENT_KIND_ADF_KIT,
- AGENT_KIND_INT_BATTERY):
+ AGENT_KIND_INT_BATTERY,
+ AGENT_KIND_DRUM_KIT,):
x = QListViewItem(self.SuppliesList,
agent_desc,
@@ -1054,46 +1064,47 @@ class devmgr4(DevMgr4_base):
def AioUI1(self):
dlg = AlignType6Form1(self)
return dlg.exec_loop() == QDialog.Accepted
-## return True, dlg.print_page # Next >
-## else:
-## return False, False # Printpage
+
def AioUI2(self):
AlignType6Form2(self).exec_loop()
+ def Align10UI(self, pattern):
+ dlg = Align10Form(pattern, self)
+ dlg.exec_loop()
+ return dlg.getValues()
+
def AlignPensButton_clicked(self):
d = self.cur_device
ok = False;
align_type = d.align_type
-
+
log.debug(utils.bold("Align: %s %s (type=%d) %s" % ("*"*20, self.cur_device_uri, align_type, "*"*20)))
- if align_type == 1: # Auto
+ if align_type == ALIGN_TYPE_AUTO:
ok = maint.AlignType1(d, self.LoadPaperUI)
- elif align_type == 2: # 8xx
+ elif align_type == ALIGN_TYPE_8XX:
ok = maint.AlignType2(d, self.LoadPaperUI, self.AlignmentNumberUI,
self.BothPensRequiredUI)
- elif align_type == 3: #9xx
+ elif align_type in (ALIGN_TYPE_9XX,ALIGN_TYPE_9XX_NO_EDGE_ALIGN):
ok = maint.AlignType3(d, self.LoadPaperUI, self.AlignmentNumberUI,
self.PaperEdgeUI, align_type)
- elif align_type in [4, 5, 7]: # LIDIL 0.3.8, LIDIL 0.4.3, xBow VIP
+ elif align_type in (ALIGN_TYPE_LIDIL_0_3_8, ALIGN_TYPE_LIDIL_0_4_3, ALIGN_TYPE_LIDIL_VIP):
ok = maint.AlignxBow(d, align_type, self.LoadPaperUI, self.AlignmentNumberUI,
self.PaperEdgeUI, self.InvalidPenUI, self.ColorAdjUI)
- elif align_type == 6: # xBow AiO
+ elif align_type == ALIGN_TYPE_LIDIL_AIO:
ok = maint.AlignType6(d, self.AioUI1, self.AioUI2, self.LoadPaperUI)
- elif align_type == 8: # 450
+ elif align_type == ALIGN_TYPE_DESKJET_450:
ok = maint.AlignType8(d, self.LoadPaperUI, self.AlignmentNumberUI)
+
+ elif align_type == ALIGN_TYPE_LBOW:
+ ok = maint.AlignType10(d, self.LoadPaperUI, self.Align10UI)
- elif align_type == 9: #9xx without edge alignment
- ok = maint.AlignType3(d, self.LoadPaperUI, self.AlignmentNumberUI,
- self.PaperEdgeUI, align_type)
-
- #d.close()
def ColorAdjUI(self, line, maximum=0):
@@ -1133,33 +1144,26 @@ class devmgr4(DevMgr4_base):
ok = False
log.debug(utils.bold("Color-cal: %s %s (type=%d) %s" % ("*"*20, self.cur_device_uri, color_cal_type, "*"*20)))
- if color_cal_type == 1: # 450
+ if color_cal_type == COLOR_CAL_TYPE_DESKJET_450:
ok = maint.colorCalType1(d, self.LoadPaperUI, self.ColorCalUI,
self.PhotoPenRequiredUI)
- elif color_cal_type == 2: # BIJ1200, ...
+ elif color_cal_type == COLOR_CAL_TYPE_MALIBU_CRICK:
ok = maint.colorCalType2(d, self.LoadPaperUI, self.ColorCalUI2,
self.InvalidPenUI)
- elif color_cal_type == 3: # PS8750, DJ57xx
+ elif color_cal_type == COLOR_CAL_TYPE_STRINGRAY_LONGBOW_TORNADO:
ok = maint.colorCalType3(d, self.LoadPaperUI, self.ColorAdjUI,
self.PhotoPenRequiredUI2)
- elif color_cal_type == 4:
+ elif color_cal_type == COLOR_CAL_TYPE_CONNERY:
ok = maint.colorCalType4(d, self.LoadPaperUI, self.ColorCalUI4,
self.WaitUI)
- #d.close()
-
def PrintTestPageButton_clicked(self):
- d = self.cur_device
if self.LoadPaperUI():
-
- d.printParsedGzipPostscript(
- os.path.join(prop.home_dir, 'data', 'ps', 'testpage.ps.gz'))
-
- #d.close()
+ self.cur_device.printTestPage()
def CleanUI1(self):
@@ -1183,20 +1187,20 @@ class devmgr4(DevMgr4_base):
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)))
-
- if clean_type == 1: # PCL
+
+ 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 == 2: # LIDIL
+ 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 == 3: # PCL alignment with Printout
+ 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,
@@ -1220,14 +1224,14 @@ class devmgr4(DevMgr4_base):
def OpenEmbeddedBrowserButton_clicked(self):
- import webbrowser
- url = "http://%s" % self.cur_device.host
- log.debug("URL = %s" % url)
- webbrowser.open_new(url)
-
-
- def AdvancedInfoButton_clicked(self):
- AdvancedInfoForm(self.cur_device, self, None, 0, 1).exec_loop()
+ browsers = ['firefox', 'mozilla', 'konqueror', 'galeon', 'skipstone']
+ for b in browsers:
+ if utils.which(b):
+ os.system("%s http://%s &" % (b, self.cur_device.host))
+ break
+ else:
+ self.FailureUI(self.__tr("<p><b>Unable to load page in browser.</b><p>To load the page manually, lauch a browser and enter the location (URL): http://%s" % self.cur_device.host ))
+
def PrintButton_clicked(self):
@@ -1291,11 +1295,11 @@ class devmgr4(DevMgr4_base):
def deviceSettingsButton_clicked(self):
- self.cur_device.device_settings_ui(self.cur_device)
+ self.cur_device.device_settings_ui(self.cur_device, self)
def setupDevice_activated(self):
- self.cur_device.device_settings_ui(self.cur_device)
+ self.cur_device.device_settings_ui(self.cur_device, self)
def faxSetupWizardButton_clicked(self):
diff --git a/ui/faxaddrbookform.py b/ui/faxaddrbookform.py
index 62c78d86c..86ccbb53c 100644
--- a/ui/faxaddrbookform.py
+++ b/ui/faxaddrbookform.py
@@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-
#
-# $Revision: 1.3 $
-# $Date: 2005/07/11 21:39:15 $
+# $Revision: 1.4 $
+# $Date: 2005/07/28 16:54:39 $
# $Author: dwelch $
#
@@ -28,7 +28,8 @@
import sys, os, os.path
from base.g import *
-from base import kirbybase, utils
+from base import utils
+from fax import fax
from qt import *
from faxaddrbookform_base import FaxAddrBookForm_base
@@ -38,54 +39,8 @@ from faxaddrbookgroupeditform_base import FaxAddrBookGroupEditForm_base
# globals
db = None # kirbybase instance
-fab = None # path to hplip.fab database table file
-
-def GetEntryByRecno( recno ):
- return AddressBookEntry( db.select( fab, ['recno'], [recno] )[0] )
-
-def AllRecords():
- return db.select( fab, ['recno'], ['*'] )
-
-
-def AllRecordEntries():
- return [ AddressBookEntry(rec) for rec in db.select( fab, ['recno'], ['*'] ) ]
-
-
-def GroupEntries( group ):
- return [ abe.name for abe in AllRecordEntries() if group in abe.group_list ]
-
-
-def AllGroups():
- temp = {}
- for abe in AllRecordEntries():
-
- for g in abe.group_list:
- temp.setdefault( g )
-
- return temp.keys()
-
-
-def UpdateGroupEntries( group_name, member_entries ):
- for entry in AllRecordEntries():
-
- if entry.name in member_entries: # membership indicated
-
- if not group_name in entry.group_list: # entry already member of group
- # add it
- entry.group_list.append( group_name )
- db.update( fab, ['recno'], [entry.recno], [','.join( entry.group_list)], ['groups'] )
- else:
-
- if group_name in entry.group_list: # remove from entry
- entry.group_list.remove( group_name )
- db.update( fab, ['recno'], [entry.recno], [','.join( entry.group_list)], ['groups'] )
-
-def DeleteGroup( group_name ):
- for entry in AllRecordEntries():
- if group_name in entry.group_list:
- entry.group_list.remove( group_name )
- db.update( fab, ['recno'], [entry.recno], [','.join( entry.group_list)], ['groups'] )
+# **************************************************************************** #
class AddressBookItem( QListViewItem ):
@@ -102,28 +57,6 @@ class AddressBookItem( QListViewItem ):
self.setText( 6, abe.notes )
-
-
-class AddressBookEntry( object ):
- def __init__( self, rec=None ):
- if rec is not None:
- rec = [ x or '' for x in rec ]
- self.recno, self.name, \
- self.title, self.firstname, self.lastname, \
- self.fax, self.groups, self.notes = rec
- self.group_list = []
-
- if len( self.groups ):
-
- for g in self.groups.split( ',' ):
- self.group_list.append( g.strip() )
-
- def __str__( self ):
- return "Recno=%d\nName=%s\nTitle=%s\nFirst=%s\nLast=%s\nFax=%s\nGroups=%s\nNotes=%s\n" % \
- ( self.recno, self.name, self.title, self.firstname,
- self.lastname, self.fax, self.group_list, self.notes )
-
-
class GroupValidator( QValidator ):
def __init__( self, parent=None, name=None):
QValidator.__init__( self, parent, name )
@@ -133,7 +66,8 @@ class GroupValidator( QValidator ):
return QValidator.Invalid, pos
else:
return QValidator.Acceptable, pos
-
+
+
class PhoneNumValidator( QValidator ):
def __init__( self, parent=None, name=None):
QValidator.__init__( self, parent, name )
@@ -146,6 +80,7 @@ class PhoneNumValidator( QValidator ):
else:
return QValidator.Acceptable, pos
+# **************************************************************************** #
class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
@@ -153,9 +88,9 @@ class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
FaxAddrBookGroupEditForm_base.__init__(self,parent,name,modal,fl)
self.edit_mode = False
self.okButton.setEnabled( True )
- self.all_groups = AllGroups()
+ self.all_groups = db.AllGroups()
self.groupnameEdit.setValidator( GroupValidator( self.groupnameEdit ) )
-
+
def setDlgData( self, group_name ):
self.edit_mode = True
self.groupnameEdit.setText( group_name )
@@ -165,7 +100,7 @@ class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
def setEntries( self, group_name='' ):
self.entriesListView.clear()
- all_entries = AllRecordEntries()
+ all_entries = db.AllRecordEntries()
for e in all_entries:
i = QCheckListItem( self.entriesListView, e.name, QCheckListItem.CheckBox )
@@ -222,6 +157,7 @@ class FaxAddrBookGroupEditForm(FaxAddrBookGroupEditForm_base):
self.okButton.setEnabled( True )
+# **************************************************************************** #
class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
@@ -239,13 +175,13 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
def UpdateList( self ):
self.groupListView.clear()
first_rec = None
- all_groups = AllGroups()
+ all_groups = db.AllGroups()
if len( all_groups ):
for group in all_groups:
- i = QListViewItem( self.groupListView, group,
- ', '.join( GroupEntries( group ) ) )
+ i = QListViewItem(self.groupListView, group,
+ ', '.join(db.GroupEntries(group)))
if first_rec is None:
first_rec = i
@@ -266,7 +202,7 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
dlg.setEntries()
if dlg.exec_loop() == QDialog.Accepted:
group_name, entries = dlg.getDlgData()
- UpdateGroupEntries( group_name, entries )
+ db.UpdateGroupEntries(group_name, entries)
self.UpdateList()
def editButton_clicked( self ):
@@ -275,19 +211,19 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
dlg.setDlgData( group_name )
if dlg.exec_loop() == QDialog.Accepted:
group_name, entries = dlg.getDlgData()
- UpdateGroupEntries( group_name, entries )
+ db.UpdateGroupEntries(group_name, entries)
self.UpdateList()
def deleteButton_clicked( self ):
- x = QMessageBox.critical( self,
+ x = QMessageBox.critical( self,
self.caption(),
"<b>Annoying Confirmation: Are you sure you want to delete this group?</b>" ,
- QMessageBox.Yes,
- QMessageBox.No | QMessageBox.Default,
+ QMessageBox.Yes,
+ QMessageBox.No | QMessageBox.Default,
QMessageBox.NoButton )
if x == QMessageBox.Yes:
- DeleteGroup( str( self.current.text(0) ) )
+ db.DeleteGroup(str(self.current.text(0)))
self.UpdateList()
@@ -313,10 +249,10 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
popup.popup( pos )
def __tr(self,s,c = None):
- return qApp.translate("FAB",s,c)
-
+ return qApp.translate("FAB",s,c)
+# **************************************************************************** #
class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
@@ -325,7 +261,7 @@ class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
FaxAddrBookEditForm_base.__init__(self,parent,name,modal,fl)
self.recno = -1
self.faxEdit.setValidator( PhoneNumValidator( self.faxEdit ) )
-
+
def setDlgData( self, abe ):
self.recno = abe.recno
self.titleEdit.setText( abe.title )
@@ -340,31 +276,30 @@ class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
def setGroups( self, entry_groups=[] ):
self.groupListView.clear()
- for g in AllGroups():
+ for g in db.AllGroups():
i = QCheckListItem( self.groupListView, g, QCheckListItem.CheckBox )
if g in entry_groups:
i.setState( QCheckListItem.On )
def getDlgData( self ):
- in_groups = []
+ in_groups = []
i = self.groupListView.firstChild()
while i is not None:
if i.isOn():
- in_groups.append( str( i.text() ) )
+ in_groups.append(str(i.text()))
i = i.itemBelow()
- return 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 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())))
def firstnameEdit_textChanged(self,a0):
@@ -381,11 +316,11 @@ class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
if ok and len( new_group_name ):
new_group_name = str( new_group_name )
- abe = GetEntryByRecno( self.recno )
+ abe = db.GetEntryByRecno(self.recno)
if new_group_name not in abe.group_list:
abe.group_list.append( new_group_name )
- db.update( fab, ['recno'], [self.recno], [','.join(abe.group_list)], ['groups'] )
+ db.update(['recno'], [self.recno], [','.join(abe.group_list)], ['groups'])
self.setGroups( abe.group_list )
@@ -408,9 +343,9 @@ class FaxAddrBookEditForm(FaxAddrBookEditForm_base):
def __tr(self,s,c = None):
- return qApp.translate("FAB",s,c)
-
+ return qApp.translate("FAB",s,c)
+# **************************************************************************** #
class FaxAddrBookForm(FaxAddrBookForm_base):
@@ -420,41 +355,26 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
icon = QPixmap( os.path.join( prop.image_dir, 'HPmenu.png' ) )
self.setIcon( icon )
- global fab, db
- fab = os.path.expanduser( '~/.hplip.fab' )
- db = kirbybase.KirbyBase()
+ global db
+ db = fax.FaxAddressBook()
self.init_problem = False
self.current = None
- if not os.path.exists( fab ):
- log.debug( "Creating new fax address book: %s" % fab )
- db.create( fab, [ 'name:str',
- 'title:str',
- 'firstname:str',
- 'lastname:str',
- 'fax:str',
- 'groups:str',# comma sep list of group names
- 'notes:str',
- ]
- )
- else:
- log.debug( "Opening fax address book: %s" % fab )
-
try:
- invalids = db.validate( fab )
- except:
+ invalids = db.validate()
+ except:
invalids = True
if invalids:
- log.error( "Fax address book file is invalid: %s" % fab )
+ 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." % fab ) )
+ self.FailureUI( self.__tr("<b>Fax address book file %s is invalid.</b><p>Please check the file for problems." % db.filename()) )
self.init_problem = True
- db.pack( fab )
+ db.pack()
self.all_groups = []
@@ -472,14 +392,13 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
def UpdateList( self ):
self.addressListView.clear()
first_rec = None
- all_entries = AllRecordEntries()
+ all_entries = db.AllRecordEntries()
log.debug( "Number of records is: %d" % len(all_entries) )
if len( all_entries ) > 0:
for abe in all_entries:
- #log.debug( abe )
- i = AddressBookItem( self.addressListView, abe )
+ i = AddressBookItem(self.addressListView, abe)
if first_rec is None:
first_rec = i
@@ -504,29 +423,29 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
dlg.setGroups()
dlg.groupsButton2.setEnabled( False )
if dlg.exec_loop() == QDialog.Accepted:
- db.insert( fab, dlg.getDlgData() )
+ db.insert(dlg.getDlgData())
self.UpdateList()
def CurrentRecordEntry( self ):
- return AddressBookEntry( db.select( fab, ['recno'], [self.current.recno] )[0] )
+ return fax.AddressBookEntry(db.select(['recno'], [self.current.recno] )[0])
def editButton_clicked(self):
dlg = FaxAddrBookEditForm( self )
dlg.setDlgData( self.CurrentRecordEntry() )
if dlg.exec_loop() == QDialog.Accepted:
- db.update( fab, ['recno'], [self.current.recno], dlg.getDlgData() )
+ db.update(['recno'], [self.current.recno], dlg.getDlgData())
self.UpdateList()
def deleteButton_clicked(self):
- x = QMessageBox.critical( 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.Yes,
+ QMessageBox.No | QMessageBox.Default,
QMessageBox.NoButton )
if x == QMessageBox.Yes:
- db.delete( fab, ['recno'], [self.current.recno] )
+ db.delete(['recno'], [self.current.recno])
self.UpdateList()
@@ -553,22 +472,22 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
def FailureUI( self, error_text ):
- QMessageBox.critical( self,
+ QMessageBox.critical( self,
self.caption(),
error_text,
- QMessageBox.Ok,
- QMessageBox.NoButton,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
QMessageBox.NoButton )
def WarningUI( self, msg ):
- QMessageBox.warning( self,
+ QMessageBox.warning( self,
self.caption(),
msg,
- QMessageBox.Ok,
- QMessageBox.NoButton,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
QMessageBox.NoButton )
def __tr(self,s,c = None):
- return qApp.translate("FAB",s,c)
+ return qApp.translate("FAB",s,c)
diff --git a/ui/printerform.py b/ui/printerform.py
index 068ba43a4..43ac750e6 100644
--- a/ui/printerform.py
+++ b/ui/printerform.py
@@ -1,4 +1,29 @@
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
+#
+# $Revision: 1.7 $
+# $Date: 2005/07/21 17:32:37 $
+# $Author: dwelch $
+#
+#
+# (c) Copyright 2001-2005 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
+
from qt import *
from printerform_base import PrinterForm_base
@@ -27,6 +52,7 @@ class PrinterForm(PrinterForm_base):
PrinterForm_base.__init__(self,parent,name,modal,fl)
self.device_uri = device_uri
self.printer_name = printer_name
+ print device_uri, printer_name
self.file_list = []
self.auto_duplex_button_group = 0
self.orientation_button_group = 0
@@ -35,10 +61,10 @@ class PrinterForm(PrinterForm_base):
self.pageRangeEdit.setValidator( RangeValidator( self.pageRangeEdit ) )
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/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" ),
@@ -69,7 +95,7 @@ class PrinterForm(PrinterForm_base):
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 )
@@ -117,7 +143,7 @@ class PrinterForm(PrinterForm_base):
self.device_uri = p.device_uri
break
else:
- self.FailureUI( self.__tr( "<b>Unknown printer name.</b><p>Run 'lpstat -a' or 'hp-probe' for a list of printers." ) )
+ self.FailureUI( self.__tr( "<b>Unknown printer name.</b><p>Run 'lpstat -a' or 'hp-probe' for a list of printers." ) )
self.close()
return
@@ -133,9 +159,9 @@ class PrinterForm(PrinterForm_base):
self.printerNameComboBox.insertItem( p )
self.dev = device.Device( self.device_uri )
-
+
self.UpdatePrinterStatus()
-
+
if self.printer_name is None:
self.printerNameComboBox.setCurrentItem(0)
elif self.printer_name in self.cups_printers:
@@ -188,36 +214,36 @@ class PrinterForm(PrinterForm_base):
self.printPushButton.setEnabled( non_empty_file_list )
def addFileButton_clicked(self):
- ##s = str( QFileDialog.getOpenFileName( os.path.expanduser("~"), "All files (*.*)", self,
+ ##s = str( QFileDialog.getOpenFileName( os.path.expanduser("~"), "All files (*.*)", self,
## "openfile", self.caption() ) )
- ##if s:
+ ##if s:
## self.addFile( s )
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()
-
+ 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:
@@ -231,7 +257,7 @@ class PrinterForm(PrinterForm_base):
del self.file_list[index]
break
index += 1
-
+
self.UpdateFileList()
@@ -246,17 +272,17 @@ class PrinterForm(PrinterForm_base):
def UpdatePrinterInfo( self ):
for p in self.printer_list:
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()
@@ -312,7 +338,7 @@ class PrinterForm(PrinterForm_base):
if collate and copies > 1:
cmd = ' '.join( [ cmd, '-o Collate=True' ] )
- if t in [ "application/x-cshell",
+ if t in [ "application/x-cshell",
"application/x-perl",
"application/x-python",
"application/x-shell",
@@ -345,7 +371,7 @@ class PrinterForm(PrinterForm_base):
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
@@ -358,28 +384,28 @@ class PrinterForm(PrinterForm_base):
def SuccessUI( self ):
- QMessageBox.information( self,
+ QMessageBox.information( self,
self.caption(),
self.__tr( "<p><b>The operation completed successfully.</b>" ),
- QMessageBox.Ok,
- QMessageBox.NoButton,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
QMessageBox.NoButton )
def FailureUI( self, error_text ):
- QMessageBox.critical( self,
+ QMessageBox.critical( self,
self.caption(),
error_text,
- QMessageBox.Ok,
- QMessageBox.NoButton,
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
QMessageBox.NoButton )
def WarningUI( self, msg ):
- QMessageBox.warning( self,
+ QMessageBox.warning( self,
self.caption(),
msg,
- QMessageBox.Ok,
- QMessageBox.NoButton,
- QMessageBox.NoButton )
+ QMessageBox.Ok,
+ QMessageBox.NoButton,
+ QMessageBox.NoButton )
def __tr(self,s,c = None):
diff --git a/ui/unloadform.py b/ui/unloadform.py
index 9ccccce8f..a87631df7 100644
--- a/ui/unloadform.py
+++ b/ui/unloadform.py
@@ -1,12 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# $Revision: 1.26 $
-# $Date: 2005/07/18 15:54:53 $
+# $Revision: 1.27 $
+# $Date: 2005/07/21 17:32:37 $
# $Author: dwelch $
#
#
-# (c) Copyright 2001-2004 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2001-2005 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
@@ -59,7 +59,7 @@ class IconViewItem(QIconViewItem):
class UnloadForm(UnloadForm_base):
- def __init__(self, bus='usb', device_uri=None, printer_name=None,
+ 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)
@@ -97,7 +97,7 @@ class UnloadForm(UnloadForm_base):
self.init_failed = True
elif x == 1:
- log.info("Using device: %s" % devices[0][0])
+ log.info(utils.bold("Using device: %s" % devices[0][0]))
self.device_uri = devices[0][0]
else: