def __init__(self, parent): wal.HPanel.__init__(self, parent) panel = wal.LabeledPanel(self, text='LabeledPanel') self.pack(panel, fill=True, expand=True, padding_all=10) panel.pack(wal.Label(panel, 'Internal widget'))
def build(self): self.pack((5, 5)) hpanel = wal.HPanel(self) vp = wal.LabeledPanel(hpanel, text=_('Document units')) names = [] for item in unit_names: names.append(unit_full_names[item]) self.units_combo = wal.Combolist(vp, items=names) self.units = self.doc.methods.get_doc_units() self.units_combo.set_active(unit_names.index(self.units)) vp.pack(self.units_combo, padding_all=15, fill=True) hpanel.pack(vp, expand=True, fill=True) hpanel.pack((10, 10)) vp = wal.LabeledPanel(hpanel, text=_('Document origin')) self.origin = self.doc.methods.get_doc_origin() self.origin_keeper = wal.HToggleKeeper(vp, ORIGINS, ORIGIN_ICONS, ORIGIN_NAMES) self.origin_keeper.set_mode(self.origin) vp.pack(self.origin_keeper, padding_all=5) hpanel.pack(vp, fill=True) self.pack(hpanel, fill=True, padding_all=5) data = [[_('Unit'), _('Value in points')]] for item in uc2const.unit_names: name = uc2const.unit_full_names[item] value = _('%s points') % str(uc2const.unit_dict[item]) data.append([name, value]) vp = wal.VPanel(self) vp.set_bg(wal.UI_COLORS['border']) slist = wal.ReportList(vp, data) vp.pack(slist, expand=True, fill=True, padding_all=1) self.pack(vp, expand=True, fill=True, padding_all=5) self.pack((5, 5))
def build(self): self.pack((5, 5)) self.geom = self.doc.methods.get_grid_values() hpanel = wal.HPanel(self) txt = _('Grid origin') origin_panel = wal.LabeledPanel(hpanel, text=txt) grid = wal.GridPanel(origin_panel, 2, 3, 5, 5) grid.pack(wal.Label(grid, 'X:')) self.x_val = UnitSpin(self.app, grid, self.geom[0]) grid.pack(self.x_val) grid.pack(StaticUnitLabel(self.app, grid)) grid.pack(wal.Label(grid, 'Y:')) self.y_val = UnitSpin(self.app, grid, self.geom[1]) grid.pack(self.y_val) grid.pack(StaticUnitLabel(self.app, grid)) origin_panel.pack(grid, padding_all=5) hpanel.pack(origin_panel, padding_all=5, fill=True, expand=True) txt = _('Grid frequency') freq_panel = wal.LabeledPanel(hpanel, text=txt) grid = wal.GridPanel(origin_panel, 2, 3, 5, 5) grid.pack(wal.Label(grid, 'dX:')) self.dx_val = UnitSpin(self.app, grid, self.geom[2]) grid.pack(self.dx_val) grid.pack(StaticUnitLabel(self.app, grid)) grid.pack(wal.Label(grid, 'dY:')) self.dy_val = UnitSpin(self.app, grid, self.geom[3]) grid.pack(self.dy_val) grid.pack(StaticUnitLabel(self.app, grid)) freq_panel.pack(grid, padding_all=5) hpanel.pack(freq_panel, padding_all=5, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) color_panel = wal.HPanel(self) color_panel.pack((10, 10)) vpanel = wal.VPanel(color_panel) hpanel = wal.HPanel(vpanel) hpanel.pack(wal.Label(hpanel, _('Grid color:'))) hpanel.pack((10, 5)) self.color = self.doc.methods.get_grid_rgba_color() self.grid_color_btn = wal.ColorButton(hpanel, self.color[:3], onchange=self.on_change) hpanel.pack(self.grid_color_btn) vpanel.pack(hpanel, fill=True) hpanel = wal.HPanel(vpanel) hpanel.pack(wal.Label(hpanel, _('Grid opacity:'))) hpanel.pack((10, 5)) self.alpha_spin = wal.FloatSpin(hpanel, self.color[3] * 100.0, range_val=(0.0, 100.0), onchange=self.on_spin_change, onenter=self.on_spin_change) hpanel.pack(self.alpha_spin) hpanel.pack(wal.Label(hpanel, '%'), padding=3) vpanel.pack(hpanel, fill=True, padding=5) self.alpha_slider = wal.Slider(vpanel, int(self.color[3] * 100.0), range_val=(0, 100), onchange=self.on_slider_change) vpanel.pack(self.alpha_slider, fill=True, padding=5) val = self.doc.methods.is_grid_visible() self.show_grid_check = wal.Checkbox(vpanel, _('Show grid on canvas'), val) vpanel.pack(self.show_grid_check, fill=True, padding=5) color_panel.pack(vpanel) color_panel.pack((10, 10)) preview_panel = wal.VPanel(color_panel) preview_panel.pack(wal.Label(hpanel, _('Grid preview:'))) preview_panel.pack((5, 5)) self.grid_preview = GridPreview(preview_panel, self.color) preview_panel.pack(self.grid_preview, fill=True, expand=True) color_panel.pack(preview_panel, fill=True, expand=True) color_panel.pack((10, 10)) self.pack(color_panel, fill=True)
def build(self): self.nb = wal.Notebook(self) # ========Palette options pal_opt = wal.VPanel(self.nb) pal_opt.pack((10, 10)) grid = wal.GridPanel(self, hgap=5, vgap=5) grid.add_growable_col(1) txt = _('Current palette:') grid.pack(wal.Label(grid, txt)) pal_list = self.get_palette_list() self.pal = wal.Combolist(grid, items=pal_list, onchange=self.change_palette) current_palette = self.get_current_palette() current_palette_name = current_palette.model.name self.pal.set_active(pal_list.index(current_palette_name)) grid.pack(self.pal, fill=True) txt = _('Palette orientation:') grid.pack(wal.Label(grid, txt)) self.pal_orient = wal.Combolist(grid, items=PAL_ORIENT) self.pal_orient.set_active(config.palette_orientation) grid.pack(self.pal_orient) pal_opt.pack(grid, fill=True, padding_all=5) btm_panel = wal.HPanel(pal_opt) pal_opt.pack(btm_panel, expand=True, fill=True) cell_panel = wal.VPanel(btm_panel) btm_panel.pack(cell_panel, expand=True, fill=True, padding_all=5) # === txt = _('Vertical palette') vcell_panel = wal.LabeledPanel(cell_panel, text=txt) grid = wal.GridPanel(vcell_panel, cols=4, hgap=5, vgap=2) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell width:'))) self.vcell_width = wal.IntSpin(grid, config.palette_vcell_width, (10, 20)) self.vcell_width.set_enable(False) grid.pack(self.vcell_width) grid.pack(wal.Label(grid, _('px'))) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell height:'))) self.vcell_height = wal.IntSpin(grid, config.palette_vcell_height, (10, 100)) grid.pack(self.vcell_height) grid.pack(wal.Label(grid, _('px'))) vcell_panel.pack(grid, align_center=False, padding_all=5) cell_panel.pack(vcell_panel, fill=True) # === txt = _('Horizontal palette') hcell_panel = wal.LabeledPanel(cell_panel, text=txt) grid = wal.GridPanel(hcell_panel, cols=4, hgap=5, vgap=2) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell width:'))) self.hcell_width = wal.IntSpin(grid, config.palette_hcell_width, (10, 100)) grid.pack(self.hcell_width) grid.pack(wal.Label(grid, _('px'))) grid.pack((15, 1)) grid.pack(wal.Label(grid, _('Cell height:'))) self.hcell_height = wal.IntSpin(grid, config.palette_hcell_height, (10, 20)) self.hcell_height.set_enable(False) grid.pack(self.hcell_height) grid.pack(wal.Label(grid, _('px'))) hcell_panel.pack(grid, align_center=False, padding_all=5) cell_panel.pack(hcell_panel, fill=True, padding=5) # === txt = _('Expand short palettes') self.expand = wal.Checkbox(cell_panel, txt, config.palette_expand) cell_panel.pack(self.expand, align_center=False) self.palviewer = PaletteViewer(btm_panel, self.app.default_cms, current_palette) btm_panel.pack(self.palviewer, fill=True, padding_all=5) self.nb.add_page(pal_opt, _('Palette options')) # ========Palette management self.nb.add_page(PaletteManager(self.app, self, self.nb), _('Palette management')) self.pack(self.nb, expand=True, fill=True) self.built = True
def __init__(self, parent, dlg, new_stroke): self.dlg = dlg self.app = dlg.app self.stroke = new_stroke wal.VPanel.__init__(self, parent) self.pack((30, 30)) p = wal.HPanel(self) p.pack(wal.Label(p, _('Stroke width:')), padding=5) self.width_spin = UnitSpin(self.app, p, self.stroke[1], step=0.1) p.pack(self.width_spin) p.pack(StaticUnitLabel(self.app, p), padding=5) self.pack(p) self.pack((20, 20)) p = wal.HPanel(self) p.pack(wal.Label(p, _('Dashes:')), padding=5) self.dashes = DashChoice(p, self.stroke[3]) p.pack(self.dashes) txt = _('Edit dash pattern') p.pack(wal.ImageButton(p, icons.PD_EDIT, tooltip=txt, flat=False, onclick=self.edit_dash), padding=5) self.pack(p) grid = wal.GridPanel(self, vgap=15, hgap=15) caps_p = wal.LabeledPanel(grid, _('Caps:')) self.caps = CapChoice(caps_p, self.stroke[4]) caps_p.pack(self.caps, align_center=False, padding_all=10) grid.pack(caps_p) join_p = wal.LabeledPanel(grid, _('Join:')) self.join = JoinChoice(join_p, self.stroke[5]) join_p.pack(self.join, align_center=False, padding_all=10) grid.pack(join_p) self.pack(grid, padding_all=10) p = wal.HPanel(self) p.pack(wal.Label(p, _('Miter limit:')), padding=5) self.miter_limit = wal.FloatSpin(p, self.stroke[6], range_val=(0.0, 1000.0), digits=5) p.pack(self.miter_limit) self.pack(p) p = wal.HPanel(self) self.behind = wal.NumCheckbox(p, _('Behind fill'), self.stroke[7]) p.pack(self.behind) p.pack((30, 10)) self.scalable = wal.NumCheckbox(p, _('Scalable stroke'), self.stroke[8]) p.pack(self.scalable) self.pack(p, padding=10)
def build(self): self.printsys = self.get_printsys() self.prn_list = self.printsys.get_printer_names() if self.prn_list: self.active_printer = self.printsys.get_default_printer() hpanel = wal.HPanel(self) hpanel.pack(wal.Label(hpanel, _('Printer:'))) hpanel.pack((5, 5)) self.prn_combo = wal.Combolist(hpanel, items=self.prn_list, onchange=self.set_data) hpanel.pack(self.prn_combo, fill=True, expand=True) index = self.prn_list.index(self.active_printer.get_name()) self.prn_combo.set_active(index) self.pack(hpanel, fill=True, padding_all=5) self.pack((10, 10)) # ---Panels self.insp = self.app.insp units = uc2const.UNIT_MM if self.insp.is_doc(): units = self.app.current_doc.model.doc_units units_text = uc2const.unit_short_names[units] # ---Shift panel shifts = self.active_printer.shifts hpanel = wal.HPanel(self) txt = _('Printing shift') + ' (%s)' % units_text spanel = wal.LabeledPanel(hpanel, text=txt) spanel.pack((1, 1), expand=True) grid = wal.GridPanel(spanel, 2, 2, 5, 5) grid.pack(wal.Label(grid, _('Horizontal shift:'))) self.hshift = StaticUnitSpin(self.app, grid, shifts[0], can_be_negative=True, onchange=self.save_data, onenter=self.save_data) grid.pack(self.hshift) grid.pack(wal.Label(grid, _('Vertical shift:'))) self.vshift = StaticUnitSpin(self.app, grid, shifts[1], can_be_negative=True, onchange=self.save_data, onenter=self.save_data) grid.pack(self.vshift) spanel.pack(grid, padding_all=5) spanel.pack((1, 1), expand=True) hpanel.pack(spanel, fill=True, expand=True) hpanel.pack((5, 5)) # ---Margin panel txt = _('Printing margins') + ' (%s)' % units_text mpanel = wal.LabeledPanel(hpanel, text=txt) mpanel.pack((5, 5)) mrgs = self.active_printer.margins self.top_spin = StaticUnitSpin(self.app, mpanel, mrgs[0], onchange=self.save_data, onenter=self.save_data) mpanel.pack(self.top_spin) mpanel.pack((5, 5)) hp = wal.HPanel(self) self.left_spin = StaticUnitSpin(self.app, hp, mrgs[3], onchange=self.save_data, onenter=self.save_data) hp.pack(self.left_spin) hp.pack((5, 5)) self.right_spin = StaticUnitSpin(self.app, hp, mrgs[1], onchange=self.save_data, onenter=self.save_data) hp.pack(self.right_spin) mpanel.pack(hp) mpanel.pack((5, 5)) self.bottom_spin = StaticUnitSpin(self.app, mpanel, mrgs[2], onchange=self.save_data, onenter=self.save_data) mpanel.pack(self.bottom_spin) mpanel.pack((10, 10)) # --- hpanel.pack(mpanel, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((10, 10)) # ---Calibration page text = _("To measure actual print area and vertical/horizontal " "printing shift, just print the calibration page on " "A4/Letter paper.") label = wal.Label(self, text) label.wrap(470) self.pack(label, fill=True, padding_all=5, align_center=False) self.a4_calibrate_btn = wal.Button( self, _('Print A4 calibration page'), onclick=self.print_calibration_a4) self.pack(self.a4_calibrate_btn) self.pack((5, 5)) self.letter_calibrate_btn = wal.Button( self, _('Print Letter calibration page'), onclick=self.print_calibration_letter) self.pack(self.letter_calibrate_btn) self.pack((5, 5)) else: self.pack((5, 5), expand=True) self.pack(get_bmp(self, icons.PD_NO_PRINTERS), padding=10) self.pack(wal.Label(self, _('No printers found'))) self.pack((10, 10)) self.pack((5, 5), expand=True) self.built = True
def __init__(self, parent, dlg, new_stroke): self.dlg = dlg self.app = dlg.app self.stroke = new_stroke wal.VPanel.__init__(self, parent) hp = wal.HPanel(self) width_p = wal.LabeledPanel(hp, _('Width:')) p = wal.HPanel(width_p) self.width_spin = UnitSpin(self.app, p, self.stroke[1], step=0.1) p.pack(self.width_spin) p.pack((5, 5)) p.pack(StaticUnitLabel(self.app, p)) width_p.pack(p, padding_all=5) hp.pack(width_p, fill=True) hp.pack((5, 5)) arrow_p = wal.LabeledPanel(hp, _('Markers:')) p = wal.HPanel(arrow_p) end, start = [], [] if self.stroke[9]: end, start = self.stroke[9] self.end_arrow = ArrowChoice(p, arrow=end, end=True) self.end_arrow.set_arrow(end) p.pack(self.end_arrow) p.pack((5, 5)) self.start_arrow = ArrowChoice(p, arrow=start) self.start_arrow.set_arrow(start) p.pack(self.start_arrow) arrow_p.pack(p) hp.pack(arrow_p, expand=True, fill=True) self.pack(hp, fill=True, padding_all=10) p = wal.HPanel(self) p.pack(wal.Label(p, _('Dashes:')), padding=5) self.dashes = DashChoice(p, self.stroke[3]) p.pack(self.dashes) txt = _('Edit dash pattern') p.pack(wal.ImageButton(p, icons.PD_EDIT, art_size=wal.SIZE_16, tooltip=txt, flat=False, onclick=self.edit_dash), padding=5) self.pack(p) grid = wal.GridPanel(self, rows=1, cols=3, vgap=15, hgap=15) grid.add_growable_col(2) caps_p = wal.LabeledPanel(grid, _('Caps:')) self.caps = CapChoice(caps_p, self.stroke[4]) caps_p.pack(self.caps, align_center=False, padding_all=10) grid.pack(caps_p) join_p = wal.LabeledPanel(grid, _('Join:')) self.join = JoinChoice(join_p, self.stroke[5]) join_p.pack(self.join, align_center=False, padding_all=10) grid.pack(join_p) opt_p = wal.LabeledPanel(grid, _('Options:')) p = wal.HPanel(opt_p) p.pack(wal.Label(p, _('Miter limit:')), padding=5) self.miter_limit = wal.FloatSpin(p, self.stroke[6], range_val=(0.0, 1000.0), digits=5) p.pack(self.miter_limit) opt_p.pack(p, align_center=False, padding_all=10) p = wal.VPanel(opt_p) self.behind = wal.NumCheckbox(p, _('Behind fill'), self.stroke[7]) p.pack(self.behind, align_center=False) self.scalable = wal.NumCheckbox(p, _('Scalable stroke'), self.stroke[8]) p.pack(self.scalable, align_center=False, padding=10) opt_p.pack(p, align_center=False, padding_all=10) grid.pack(opt_p, fill=True) self.pack(grid, padding_all=10, fill=True) self.layout()
def __init__(self, parent, prefpanel): CmsTab.__init__(self, parent, prefpanel) self.intents = INTENTS.keys() self.intents.sort() self.intents_names = [] for item in self.intents: self.intents_names.append(INTENTS[item]) panel = wal.VPanel(self.panel) # Intents panel int_panel = wal.LabeledPanel(panel, _('Rendering intents')) grid = wal.GridPanel(int_panel, vgap=5, hgap=5) grid.pack(wal.Label(grid, _('Display/RGB intent:'))) self.display = wal.Combolist(grid, items=self.intents_names) self.display.set_active(self.intents.index(config.cms_rgb_intent)) grid.pack(self.display) grid.pack(wal.Label(grid, _('Printer/CMYK intent:'))) self.printer = wal.Combolist(grid, items=self.intents_names) self.printer.set_active(self.intents.index(config.cms_cmyk_intent)) grid.pack(self.printer) int_panel.pack(grid, align_center=False, padding_all=10) panel.pack(int_panel, fill=True) # Simulate printer panel txt = _('Simulate printer on the screen') self.simulate_check = wal.Checkbox(panel, txt, config.cms_proofing, onclick=self.activate_simulation) sm_panel = wal.LabeledPanel(panel, widget=self.simulate_check) txt = _("Highlight colors that are outside of the printer's gamut") self.outcolors_check = wal.Checkbox(sm_panel, txt, config.cms_gamutcheck, onclick=self.activate_outcolors) sm_panel.pack(self.outcolors_check, align_center=False, padding_all=5) clrpanel = wal.HPanel(sm_panel) clrpanel.pack((20, 1)) self.alarm_label = wal.Label(clrpanel, _('Highlight color:')) clrpanel.pack(self.alarm_label, padding=5) self.color_btn = wal.ColorButton(clrpanel, config.cms_alarmcodes) clrpanel.pack(self.color_btn) sm_panel.pack(clrpanel, align_center=False, padding_all=2) txt = _('Separation for SPOT colors') self.separation_check = wal.Checkbox(sm_panel, txt, config.cms_proof_for_spot, onclick=self.activate_outcolors) sm_panel.pack(self.separation_check, align_center=False, padding_all=5) panel.pack(sm_panel, fill=True, padding=5) # Bottom checks txt = _('Use Blackpoint Compensation') self.bpc_check = wal.Checkbox(panel, txt, config.cms_bpc_flag) panel.pack(self.bpc_check, align_center=False) if wal.IS_MSW: panel.pack((5, 5)) txt = _('Use Black preserving transforms') self.bpt_check = wal.Checkbox(panel, txt, config.cms_bpt_flag) panel.pack(self.bpt_check, align_center=False) self.panel.pack(panel, fill=True, padding_all=5) self.activate_simulation()