1
# -*- coding: utf-8 -*-
3
# (c) Copyright 2001-2015 HP Development Company, L.P.
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
from base import device, utils, maint
28
#from prnt import cups
29
from base.codes import *
30
from .ui_utils import *
33
from PyQt4.QtCore import *
34
from PyQt4.QtGui import *
37
from .linefeedcaldialog_base import Ui_Dialog
38
from .deviceuricombobox import DEVICEURICOMBOBOX_TYPE_FAX_ONLY
41
class LineFeedCalDialog(QDialog, Ui_Dialog):
42
def __init__(self, parent, device_uri):
43
QDialog.__init__(self, parent)
45
self.device_uri = device_uri
47
QTimer.singleShot(0, self.updateUi)
51
# connect signals/slots
52
self.connect(self.CancelButton, SIGNAL("clicked()"), self.CancelButton_clicked)
53
self.connect(self.CalibrateButton, SIGNAL("clicked()"), self.CalibrateButton_clicked)
54
self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_noDevices"), self.DeviceUriComboBox_noDevices)
55
self.connect(self.DeviceComboBox, SIGNAL("DeviceUriComboBox_currentChanged"), self.DeviceUriComboBox_currentChanged)
56
self.DeviceComboBox.setFilter({'linefeed-cal-type': (operator.gt, 0)})
59
self.setWindowIcon(QIcon(load_pixmap('hp_logo', '128x128')))
62
self.DeviceComboBox.setInitialDevice(self.device_uri)
66
self.DeviceComboBox.updateUi()
67
self.LoadPaper.setButtonName(self.__tr("Calibrate"))
68
self.LoadPaper.updateUi()
71
def DeviceUriComboBox_currentChanged(self, device_uri):
72
self.device_uri = device_uri
76
def DeviceUriComboBox_noDevices(self):
77
FailureUI(self, self.__tr("""<b>No devices that support line feed calibration found.</b><p>Click <i>OK</i> to exit.</p>"""))
81
def CancelButton_clicked(self):
85
def CalibrateButton_clicked(self):
90
d = device.Device(self.device_uri)
95
linefeed_type = d.linefeed_cal_type
102
if d.isIdleAndNoError():
103
if linefeed_type == LINEFEED_CAL_TYPE_OJ_K550: # 1
104
maint.linefeedCalType1(d, lambda : True)
106
elif linefeed_type == LINEFEED_CAL_TYPE_OJ_PRO_L7XXX: # 2
107
maint.linefeedCalType2(d, lambda : True)
122
def __tr(self,s,c = None):
123
return qApp.translate("LineFeedCalDialog",s,c)