16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
# Authors: Don Welch, Yashwant Kumar Sahu
320
320
#print "updateUi(%s, %s)" % (cur_device, cur_printer)
321
321
self.cur_device = cur_device
322
322
self.cur_printer = cur_printer
324
324
while self.count():
325
325
self.removeItem(0)
327
327
self.loading = True
328
328
cups.resetOptions()
329
329
cups.openPPD(self.cur_printer)
355
356
self.job_options['pagerange'] = current
357
358
# page set (COMBO/PICKONE)
358
current = current_options.get('pageset', '')
359
current = current_options.get('pageset', 'all')
359
360
self.addControlRow("pageset", self.__tr("Page Set"),
360
361
cups.PPD_UI_PICKONE, current,
361
[('all', self.__tr("All pages")),
362
('even', self.__tr("Even pages")),
363
('odd', self.__tr("Odd pages"))], 'all', job_option=True)
362
[('all', self.__tr("AllPages")),
363
('even', self.__tr("Even")),
364
('odd', self.__tr("Odd"))], 'all', job_option=True)
365
366
self.job_options['pageset'] = current
366
367
# if current == u'even':
517
518
choice_data.append((c, choice_text))
520
if o.lower() == 'outputmode':
521
if value is not None:
522
cur_outputmode = value
524
cur_outputmode = defchoice
519
526
self.addControlRow(o, option_text, ui, value, choice_data, defchoice, read_only)
521
528
self.endControlGroup()
769
776
log.debug(" Current value: %s" % current)
771
778
self.endControlGroup()
783
quality_attr_name = "OutputModeDPI"
784
cur_outputmode_dpi = cups.findPPDAttribute(quality_attr_name, cur_outputmode)
785
if cur_outputmode_dpi is not None:
786
log.debug("Adding Group: Summary outputmode is : %s" % cur_outputmode)
787
log.debug("Adding Group: Summary outputmode dpi is : %s" % unicode (cur_outputmode_dpi))
788
self.beginControlGroup("sumry", self.__tr("Summary"))
789
self.addControlRow("colorinput", self.__tr('Color Input / Black Render'),
790
cups.UI_INFO, unicode (cur_outputmode_dpi), [], read_only)
791
self.addControlRow("quality", self.__tr('Print Quality'),
792
cups.UI_INFO, cur_outputmode, [], read_only)
793
self.endControlGroup()
794
log.debug("End adding Group: Summary")
773
797
self.job_storage_enable = self.cur_device.mq.get('job-storage', JOB_STORAGE_DISABLE) == JOB_STORAGE_ENABLE
987
1011
self.connect(DefaultButton, SIGNAL("clicked()"), self.DefaultButton_clicked)
1012
self.connect(ComboBox, SIGNAL("currentIndexChanged(const QString &)"), self.ComboBox_indexChanged)
988
1013
self.connect(ComboBox, SIGNAL("highlighted(const QString &)"), self.ComboBox_highlighted)
990
1015
control = ComboBox
1395
1420
self.connect(self.JobStorageExistingDefaultButton, SIGNAL("clicked()"),
1396
1421
self.JobStorageExistingDefaultButton_clicked)
1423
elif typ == cups.UI_INFO:
1424
HBoxLayout = QHBoxLayout()
1425
HBoxLayout.setObjectName("HBoxLayout")
1427
OptionName = QLabel(self.widget)
1428
OptionName.setObjectName("OptionLabel")
1429
HBoxLayout.addWidget(OptionName)
1430
OptionName.setText(text)
1432
SpacerItem = QSpacerItem(20, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
1433
HBoxLayout.addItem(SpacerItem)
1435
if text == 'Print Quality':
1436
self.PQValueLabel = QLabel(self.widget)
1437
self.PQValueLabel.setObjectName("PQValueLabel")
1438
HBoxLayout.addWidget(self.PQValueLabel)
1439
self.PQValueLabel.setText(value)
1440
elif text == 'Color Input / Black Render':
1441
self.PQColorInputLabel = QLabel(self.widget)
1442
self.PQColorInputLabel.setObjectName("PQColorInputLabel")
1443
HBoxLayout.addWidget(self.PQColorInputLabel)
1444
self.PQColorInputLabel.setText(value)
1446
OptionValue = QLabel(self.widget)
1447
OptionValue.setObjectName("OptionValue")
1448
HBoxLayout.addWidget(OptionValue)
1449
OptionValue.setText(value)
1451
self.gridlayout.addLayout(HBoxLayout, self.row, 0, 1, 1)
1399
1454
log.error("Invalid UI value: %s/%s" % (self.group, option))
1540
1595
self.setPrinterOption(sender.option, "false")
1597
def ComboBox_indexChanged(self, currentItem):
1598
sender = self.sender()
1599
currentItem = unicode(currentItem)
1600
# Checking for summary control
1601
labelPQValaue = getattr(self, 'PQValueLabel', None)
1602
labelPQColorInput = getattr(self, 'PQColorInputLabel', None)
1603
# When output mode combo item is changed, we need to update the summary information
1604
if currentItem is not None and sender.option == 'OutputMode' and labelPQValaue is not None and labelPQColorInput is not None:
1605
# Setting output mode
1606
self.PQValueLabel.setText(currentItem)
1608
# Getting DPI custom attributefrom the PPD
1609
# Setting color input
1610
quality_attr_name = "OutputModeDPI"
1611
cups.openPPD(self.cur_printer)
1612
outputmode_dpi = cups.findPPDAttribute(quality_attr_name, currentItem)
1613
log.debug("Outputmode changed, setting outputmode_dpi: %s" % outputmode_dpi)
1615
self.PQColorInputLabel.setText(outputmode_dpi)
1617
log.debug("Outputmode changed, setting value outputmode: %s" % currentItem)
1543
1619
def DefaultButton_clicked(self):
1544
1620
sender = self.sender()