本文整理汇总了Python中device.Device.get_printers方法的典型用法代码示例。如果您正苦于以下问题:Python Device.get_printers方法的具体用法?Python Device.get_printers怎么用?Python Device.get_printers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.get_printers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import get_printers [as 别名]
def run(self, filename=None):
builder = Gtk.Builder()
builder.add_from_file(os.path.join(APP_DIR,'ui','inkcut.ui'))
window = builder.get_object('inkcut')
# Save any widgets needed later into groups
self.add_widgets(builder,'job-dependent',['toolbutton3','toolbutton5','toolbutton6','box21','box9','box11','box3','box15','box25','box28','plot-order','box17','menu-file-print-preview','menu-file-print','menu-edit-undo','menu-edit-redo','gtk-zoom-fit','gtk-zoom-in','gtk-zoom-out','menu-file-save-as','menu-file-save'])
self.add_widgets(builder,'inkcut',['inkcut','devices','statusbar','preview','scale-lock-box','scale-x-label','spinner'])
self.add_widgets(builder,'graphic-properties',['graphic-width','graphic-height','graphic-scale-x','graphic-scale-y','graphic-scale-lock','graphic-rotation','graphic-rotate-to-save','graphic-weedline-enable','graphic-weedline-padding'])
self.add_widgets(builder,'plot-properties',['plot-width','plot-height','plot-copies','plot-weedline-enable','plot-weedline-padding','plot-col-spacing','plot-row-spacing','plot-position-x','plot-position-y','plot-feed','plot-feed-distance'])
self.add_widgets(builder,'material',['materials'])
# Connect signals and invoke any UI setup
builder.connect_signals(self)
model = ['0 Degrees Clockwise','90 Degrees Clockwise','180 Degrees Clockwise','270 Degrees Clockwise']
combobox = builder.get_object('graphic-rotation')
self.set_model_from_list(combobox,model)
combobox.set_active(0)
model = ['One Copy at a Time','Best Tracking','Shortest Path']
combobox = builder.get_object('plot-order')
self.set_model_from_list(combobox,model)
combobox.set_active(0)
# Based on SQL Table: id, name, cost, width, length, margin_top, margin_right, margin_bottom, margin_left, velocity, force, color
active = 0
materials = Gtk.ListStore(int,str)
for m in self.session.query(Material).all():
materials.append([m.id,m.name])
if m.id == int(config.get('Inkcut','default_device')):
active = len(materials)
combobox = self.get_widget('material','materials')
combobox.set_model(materials)
cell = Gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.add_attribute(cell, 'text', 1)
combobox.set_active(active)
model = []
device_active_index = 0
for device in Device.get_printers():
name = device.name
if device.id == int(config.get('Inkcut','default_device')):
name += " (default)"
device_active_index = len(model)
model.append(name)
log.info(name)
combobox = builder.get_object('devices')
self.set_model_from_list(combobox,model)
combobox.set_active(device_active_index)
# Init Accelerators
accel_group = builder.get_object('accelgroup1')
for action in builder.get_object('actiongroup1').list_actions():
action.set_accel_group(accel_group)
action.connect_accelerator()
window.add_accel_group(accel_group)
# Show the widgets
self._update_sensitivity()
window.show_all()
self.flash("",indicator=False)
# Fix!
self._flags['block_callbacks']=False
self.add_window(window,'inkcut')
self.on_graphic_scale_lock_toggled(self.get_widget('graphic-properties','graphic-scale-lock'))
# From command line arguments
if filename is not None and os.path.isfile(filename):
self.create_job(filename)
Gtk.main()