home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.5)
-
- from base.g import *
- from base import utils
- from prnt import cups
- from qt import *
- from scrollview import ScrollView
- import os.path as os
- import 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:
- current_options = dict(cups.getOptions())
- if not self.is_fax:
- self.addGroupHeading('basic', self._ScrollPrintSettingsView__tr('Basic'))
- log.debug('Group: Basic')
- current = current_options.get('orientation-requested', '3')
- self.addItem('basic', 'orientation-requested', self._ScrollPrintSettingsView__tr('Page Orientation'), cups.PPD_UI_PICKONE, current, [
- ('3', self._ScrollPrintSettingsView__tr('Portrait')),
- ('4', self._ScrollPrintSettingsView__tr('Landscape')),
- ('5', self._ScrollPrintSettingsView__tr('Reverse landscape')),
- ('6', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Duplex (Print on both sides of the page)'), cups.PPD_UI_PICKONE, current, [
- ('one-sided', self._ScrollPrintSettingsView__tr('Single sided')),
- ('two-sided-long-edge', self._ScrollPrintSettingsView__tr('Two sided (long edge)')),
- ('two-sided-short-edge', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Output Order (Print last page first)'), cups.PPD_UI_PICKONE, current, [
- ('normal', self._ScrollPrintSettingsView__tr('Normal (Print first page first)')),
- ('reverse', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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)
- if 'pagesize' in o.lower() and 'custom' in c.lower():
- log.debug('Skipped.')
- continue
-
- (choice_text, marked) = cups.getChoice(g, o, c)
- choice_text = choice_text.decode('utf-8')
- 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)
-
-
- self.addGroupHeading('nup', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Pages per Sheet'), cups.PPD_UI_PICKONE, current, [
- ('1', self._ScrollPrintSettingsView__tr('1 sheet per page')),
- ('2', self._ScrollPrintSettingsView__tr('2 sheets per page')),
- ('4', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Layout'), cups.PPD_UI_PICKONE, current, [
- ('btlr', self._ScrollPrintSettingsView__tr('Bottom to top, left to right')),
- ('btrl', self._ScrollPrintSettingsView__tr('Bottom to top, right to left')),
- ('lrbt', self._ScrollPrintSettingsView__tr('Left to right, bottom to top')),
- ('lrtb', self._ScrollPrintSettingsView__tr('Left to right, top to bottom')),
- ('rlbt', self._ScrollPrintSettingsView__tr('Right to left, bottom to top')),
- ('rltb', self._ScrollPrintSettingsView__tr('Right to left, top to bottom')),
- ('tblr', self._ScrollPrintSettingsView__tr('Top to bottom, left to right')),
- ('tbrl', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Printed Border Around Each Page'), cups.PPD_UI_PICKONE, current, [
- ('double', self._ScrollPrintSettingsView__tr('Two thin borders')),
- ('double-thick', self._ScrollPrintSettingsView__tr('Two thick borders')),
- ('none', self._ScrollPrintSettingsView__tr('No border')),
- ('single', self._ScrollPrintSettingsView__tr('One thin border')),
- ('single-thick', self._ScrollPrintSettingsView__tr('One thick border'))], 'none')
- log.debug(' Option: page-border')
- log.debug(' Current value: %s' % current)
- if not self.is_fax:
- self.addGroupHeading('adjustment', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Gamma'), cups.UI_SPINNER, current, (1, 10000), 1000)
-
- self.addGroupHeading('image', self._ScrollPrintSettingsView__tr('Image Printing'))
- current = current_options.get('fitplot', 'false')
- self.addItem('image', 'fitplot', self._ScrollPrintSettingsView__tr('Fit to page'), cups.PPD_UI_BOOLEAN, current, [], 0)
- current = current_options.get('position', 'center')
- self.addItem('image', 'position', self._ScrollPrintSettingsView__tr('Position on Page'), cups.PPD_UI_PICKONE, current, [
- ('center', self._ScrollPrintSettingsView__tr('Centered')),
- ('top', self._ScrollPrintSettingsView__tr('Top')),
- ('left', self._ScrollPrintSettingsView__tr('Left')),
- ('right', self._ScrollPrintSettingsView__tr('Right')),
- ('top-left', self._ScrollPrintSettingsView__tr('Top left')),
- ('top-right', self._ScrollPrintSettingsView__tr('Top right')),
- ('bottom', self._ScrollPrintSettingsView__tr('Bottom')),
- ('bottom-left', self._ScrollPrintSettingsView__tr('Bottom left')),
- ('bottom-right', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Scaling (relative to page)'), cups.UI_SPINNER, current, (1, 800), 100, suffix = ' %')
- self.addGroupHeading('misc', self._ScrollPrintSettingsView__tr('Miscellaneous'))
- log.debug('Group: Misc')
- current = int(utils.to_bool(current_options.get('prettyprint', '0')))
- self.addItem('misc', 'prettyprint', self._ScrollPrintSettingsView__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'
-
- self.addItem('misc', 'job-sheets', self._ScrollPrintSettingsView__tr('Banner Pages'), cups.UI_BANNER_JOB_SHEETS, (start, end), [
- ('none', self._ScrollPrintSettingsView__tr('No banner page')),
- ('classified', self._ScrollPrintSettingsView__tr('Classified')),
- ('confidential', self._ScrollPrintSettingsView__tr('Confidential')),
- ('secret', self._ScrollPrintSettingsView__tr('Secret')),
- ('standard', self._ScrollPrintSettingsView__tr('Standard')),
- ('topsecret', self._ScrollPrintSettingsView__tr('Top secret')),
- ('unclassified', self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Mirror Printing'), cups.PPD_UI_BOOLEAN, current, [], 0)
- log.debug(' Option: mirror')
- log.debug(' Current value: %s' % current)
- except Exception:
- e = None
- log.exception()
- finally:
- cups.closePPD()
- self.loading = False
-
-
-
- def optionComboBox_activated(self, a):
- a = str(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
- continue
-
- for c, t in sender.other.choices:
- if t == sender.other.currentText():
- end = c
- break
- continue
-
- 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
- continue
-
- 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 None
-
- if c is not None:
- if choice.lower() == 'fromprintoutmode':
- c.setEnabled(True)
- QToolTip.remove(c)
- a = str(c.currentText())
- link_choice = None
- for x, t in c.choices:
- if t == a:
- link_choice = x
- break
- continue
-
- if link_choice is not None and link_choice.lower() == c.default.lower():
- c.pushbutton.setEnabled(False)
- else:
- c.pushbutton.setEnabled(True)
- else:
- c.setEnabled(False)
- QToolTip.add(c, self._ScrollPrintSettingsView__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
- continue
-
- 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
- continue
-
- 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:
- 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._ScrollPrintSettingsView__tr('On'))
- offRadioButton.setText(self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Off')
- if default:
- x = self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__tr('Set to default value of "%1".').arg(x))
- defaultPushButton.setText('Default')
- elif typ == cups.PPD_UI_PICKONE:
- 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._ScrollPrintSettingsView__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:
- 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._ScrollPrintSettingsView__tr('Set to default value of "%1".').arg(default))
- elif typ == cups.UI_BANNER_JOB_SHEETS:
- 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._ScrollPrintSettingsView__tr('Start:'))
- endTextLabel.setText(self._ScrollPrintSettingsView__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._ScrollPrintSettingsView__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('DevMgr4', s, c)
-
-
-