def build(self): grid = wal.GridPanel(self, rows=5, cols=2, hgap=5, vgap=5) grid.add_growable_col(1) grid.pack(wal.Label(grid, _('Text filler:'))) self.filler = wal.Entry(grid, config.font_preview_text) grid.pack(self.filler, fill=True) grid.pack(wal.Label(grid, _('Font size:'))) self.fontsize = wal.IntSpin(grid, config.font_preview_size, (5, 50)) grid.pack(self.fontsize) grid.pack(wal.Label(grid, _('Font color:'))) self.fontcolor = wal.ColorButton(grid, config.font_preview_color) grid.pack(self.fontcolor) grid.pack(wal.Label(grid, _('Selection color:'))) color = self.fontcolor.val255_to_dec(wal.UI_COLORS['selected_text_bg']) self.selcolor = wal.ColorButton(grid, color) grid.pack(self.selcolor) grid.pack(wal.Label(grid, _('Preview width:'))) self.pwidth = wal.IntSpin(grid, config.font_preview_width, (100, 1000)) grid.pack(self.pwidth) self.pack(grid, align_center=False, fill=True, padding=5) self.built = True
def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) hbox = wal.HBox(self) self.pack(hbox) self.cb1 = wal.ColorButton(hbox, (0, 0, 0), 'Select foreground', cmd=self.callback) hbox.pack(self.cb1, padding=30) self.cb2 = wal.ColorButton(hbox, (1, 1, 1), 'Select background', cmd=self.callback) hbox.pack(self.cb2, padding=30)
def build(self): self.pack((5, 5)) vpanel = wal.VPanel(self) hpanel = wal.HPanel(vpanel) hpanel.pack(wal.Label(hpanel, _('Guide color:'))) hpanel.pack((10, 5)) self.color = self.doc.methods.get_guide_rgb_color() self.guide_color_btn = wal.ColorButton(hpanel, self.color[:3], onchange=self.on_change) hpanel.pack(self.guide_color_btn) hpanel.pack((10, 5)) hpanel.pack( CBMiniPalette(hpanel, colors=GUIDE_COLORS, onclick=self.change_color)) vpanel.pack(hpanel, fill=True, align_center=False) val = self.doc.methods.is_guide_visible() self.show_guide_check = wal.Checkbox(vpanel, _('Show guides on canvas'), val) vpanel.pack(self.show_guide_check, align_center=False, padding=5) self.pack((10, 10)) self.preview = GuidePreview(vpanel, deepcopy(self.color)) vpanel.pack(self.preview, fill=True, expand=True) self.pack(vpanel, fill=True, expand=True, padding_all=5)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.config = IconizerConfig() config_dir = self.app.appdata.app_config_dir config_file = os.path.join(config_dir, 'iconizer_config.xml') self.config.load(config_file) self.panel.pack((5, 5)) hpanel = wal.HPanel(self.panel) hpanel.pack(wal.Label(hpanel, _('Background:'))) self.bg_color_btn = wal.ColorButton(hpanel, self.config.bg_color, onchange=self.update, silent=False) hpanel.pack((5, 5)) hpanel.pack(self.bg_color_btn) self.panel.pack(hpanel, padding=5) self.pallete = CBMiniPalette(self.panel, COLORS, onclick=self.bg_color_btn.set_value) self.panel.pack(self.pallete) self.panel.pack((10, 10)) self.viewer = ImageViewer(self.panel, self.config.bg_color) self.panel.pack(self.viewer) self.panel.pack((10, 10)) check_panel = wal.VPanel(self.panel) self.border_check = wal.Checkbox(check_panel, _('Show image border'), value=self.config.draw_border, onclick=self.update) check_panel.pack(self.border_check, align_center=False) self.sel_check = wal.Checkbox(check_panel, _('Draw selected only'), value=self.config.draw_selected, onclick=self.update) check_panel.pack(self.sel_check, align_center=False) self.panel.pack(check_panel) self.apply_btn = wal.Button(self.panel, _('Save image'), onclick=self.apply_action) self.panel.pack(self.apply_btn, fill=True, padding_all=5) self.panel.pack((5, 5)) self.panel.pack(wal.HLine(self.panel), fill=True) events.connect(events.DOC_CHANGED, self.update) events.connect(events.SELECTION_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update)
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.page_format = self.doc.methods.get_default_page_format() self.formats = [ _('Custom'), ] + uc2const.PAGE_FORMAT_NAMES self.pack((5, 10)) # --- hpanel = wal.HPanel(self) hpanel.pack((5, 5)) label = wal.Label(hpanel, _('Default page:')) hpanel.pack(label) hpanel.pack((5, 5)) self.page_combo = wal.Combolist(self, items=self.formats, onchange=self.page_combo_changed) index = 0 state = True if self.page_format[0] in uc2const.PAGE_FORMAT_NAMES: index = self.formats.index(self.page_format[0]) state = False self.page_combo.set_active(index) hpanel.pack(self.page_combo) hpanel.pack((15, 5)) self.orient_keeper = wal.HToggleKeeper(self, ORIENTS, ORIENTS_ICONS, ORIENTS_NAMES, on_change=self.orient_changed) self.orient_keeper.set_mode(self.page_format[2]) hpanel.pack(self.orient_keeper) self.pack(hpanel, fill=True) self.pack((5, 5)) # --- w, h = self.page_format[1] hpanel = wal.HPanel(self) dx = label.get_size()[0] + 10 hpanel.pack((dx, 5)) self.page_width = UnitSpin(self.app, hpanel, w, onchange=self.page_spin_changed) hpanel.pack(self.page_width) hpanel.pack(get_bmp(self, icons.CTX_W_ON_H), padding=5) self.page_height = UnitSpin(self.app, hpanel, h, onchange=self.page_spin_changed) hpanel.pack(self.page_height) hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5) self.page_width.set_enable(state) self.page_height.set_enable(state) self.pack(hpanel, fill=True) self.pack(wal.HLine(self), padding_all=5, fill=True) # --- hpanel = wal.HPanel(self) hpanel.pack((5, 5)) self.desktop_bg = self.doc.methods.get_desktop_bg() grid = wal.GridPanel(hpanel, 3, 3, 5, 5) grid.add_growable_col(2) grid.pack(wal.Label(hpanel, _('Desktop:'))) self.desktop_color_btn = wal.ColorButton(hpanel, self.desktop_bg) grid.pack(self.desktop_color_btn) grid.pack(CBMiniPalette(grid, onclick=self.desktop_color_btn.set_value)) self.page_fill = self.doc.methods.get_page_fill() if self.page_fill[0] == FILL_SOLID: color1 = self.page_fill[1] color2 = [1.0, 1.0, 1.0] else: color1 = self.page_fill[1][0] color2 = self.page_fill[1][1] grid.pack(wal.Label(hpanel, _('Page:'))) self.page_color1_btn = wal.ColorButton(hpanel, color1) grid.pack(self.page_color1_btn) grid.pack(CBMiniPalette(grid, onclick=self.page_color1_btn.set_value)) grid.pack((5, 5)) self.page_color2_btn = wal.ColorButton(hpanel, color2) grid.pack(self.page_color2_btn) self.colors2 = CBMiniPalette(grid, onclick=self.page_color2_btn.set_value) grid.pack(self.colors2) if not self.page_fill[0] == FILL_PATTERN: self.page_color2_btn.set_enable(False) self.colors2.set_enable(False) hpanel.pack(grid, fill=True) hpanel.pack((5, 5)) self.pack(hpanel, fill=True) # --- vpanel = wal.VPanel(self) if wal.IS_MSW: vpanel.pack((5, 5)) self.pattern_check = wal.Checkbox(vpanel, _('Use pattern for page fill'), self.page_fill[0] == FILL_PATTERN, onclick=self.pattern_check_changed) vpanel.pack(self.pattern_check, align_center=False) if wal.IS_MSW: vpanel.pack((5, 5)) self.border_flag = self.doc.methods.get_page_border() self.border_check = wal.Checkbox(vpanel, _('Show page border'), self.border_flag) vpanel.pack(self.border_check, align_center=False) self.pack(vpanel, fill=True, padding_all=5)
def build(self): self.pack(wal.Label(self, _('Size (px):'), fontbold=True)) grid = wal.GridPanel(self, rows=3, cols=4, hgap=10, vgap=5) # Ruler size grid.pack(wal.Label(grid, _('Ruler:'))) self.ruler_size = wal.IntSpin(grid, config.ruler_size, (15, 30), onchange=self.update_ruler) grid.pack(self.ruler_size) # Ruler font size grid.pack(wal.Label(grid, _('Ruler font:'))) self.ruler_font_size = wal.IntSpin(grid, config.ruler_font_size, (5, 8), onchange=self.update_ruler) grid.pack(self.ruler_font_size) # Small tick size grid.pack(wal.Label(grid, _('Small tick:'))) self.ruler_small_tick = wal.IntSpin(grid, config.ruler_small_tick, (2, 30), onchange=self.update_ruler) grid.pack(self.ruler_small_tick) # Large tick size grid.pack(wal.Label(grid, _('Large tick:'))) self.ruler_large_tick = wal.IntSpin(grid, config.ruler_large_tick, (2, 30), onchange=self.update_ruler) grid.pack(self.ruler_large_tick) self.pack(grid, padding_all=10) self.pack(wal.Label(self, _('Text shift (px):'), fontbold=True)) grid = wal.GridPanel(self, rows=1, cols=4, hgap=10, vgap=5) # Vertical text shift grid.pack(wal.Label(grid, _('Vertical:'))) self.ruler_text_vshift = wal.IntSpin(grid, config.ruler_text_vshift, (0, 30), onchange=self.update_ruler) grid.pack(self.ruler_text_vshift) # Horizontal text shift grid.pack(wal.Label(grid, _('Horizontal:'))) self.ruler_text_hshift = wal.IntSpin(grid, config.ruler_text_hshift, (0, 30), onchange=self.update_ruler) grid.pack(self.ruler_text_hshift) self.pack(grid, padding_all=10) grid = wal.GridPanel(self, hgap=15, vgap=5) # Ruler bg color grid.pack(wal.Label(grid, _('Ruler background color:'))) self.bg_btn = wal.ColorButton(grid, config.ruler_bg, onchange=self.update_ruler) grid.pack(self.bg_btn) # Ruler fg color grid.pack(wal.Label(grid, _('Ruler mark color:'))) self.fg_btn = wal.ColorButton(grid, config.ruler_fg, onchange=self.update_ruler) grid.pack(self.fg_btn) self.pack(grid, padding_all=15) # Testing ruler self.pack(wal.Label(self, _('Testing ruler:'), fontbold=True), padding_all=10) panel = wal.HPanel(self) panel.add((360, 1)) panel.set_bg(wal.UI_COLORS['dark_shadow']) self.pack(panel) self.ruler = RulerTest(self, self) self.pack(self.ruler) self.built = True
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()
def __init__(self, master, app, dlg): PrefsTab.__init__(self, master, app, dlg) self.get_config_vals() #Rendering intents frame self.intents = uc2const.INTENTS.keys() self.intents.sort() self.intents_names = [] for item in self.intents: self.intents_names.append(uc2const.INTENTS[item]) intent_frame = wal.Frame(self, ' ' + _('Rendering intents') + ' ') tab = gtk.Table(2, 2, False) tab.set_row_spacings(5) tab.set_col_spacings(10) tab.set_border_width(5) label = wal.Label(tab, _('Display/RGB intent:')) tab.attach(label, 0, 1, 0, 1, gtk.SHRINK, gtk.SHRINK) self.rgb_intent_combo = wal.ComboBoxText(tab, self.intents_names, cmd=self.update_vals) self.rgb_intent_combo.set_active(config.cms_rgb_intent) tab.attach(self.rgb_intent_combo, 1, 2, 0, 1, gtk.SHRINK, gtk.SHRINK) label = wal.Label(tab, _('Printer/CMYK intent:')) tab.attach(label, 0, 1, 1, 2, gtk.SHRINK, gtk.SHRINK) self.cmyk_intent_combo = wal.ComboBoxText(tab, self.intents_names, cmd=self.update_vals) self.cmyk_intent_combo.set_active(config.cms_cmyk_intent) tab.attach(self.cmyk_intent_combo, 1, 2, 1, 2, gtk.SHRINK, gtk.SHRINK) intent_frame.add(tab) self.pack(intent_frame) #Printer simulation printer_frame = wal.Frame(self) txt = _('Simulate Printer on the Screen') self.printer_check = wal.CheckButton(printer_frame, txt, True, self.update_vals) printer_frame.set_label_widget(self.printer_check) vbox = wal.VBox(printer_frame) vbox.set_border_width(10) printer_frame.add(vbox) txt = _('Show colors that are out of the printer gamut') self.gamut_check = wal.CheckButton(vbox, txt, cmd=self.update_vals) vbox.pack(self.gamut_check, True, True) hbox = wal.HBox(printer_frame) self.alarm_label = wal.Label(hbox, 'Alarm color:') hbox.pack(self.alarm_label, padding=5) self.cb = wal.ColorButton(hbox, self.alarmcodes, _('Select alarm color'), cmd=self.update_vals) hbox.pack(self.cb, padding=5) vbox.pack(hbox, True, True) txt = _('Separation for SPOT colors') self.spot_check = wal.CheckButton(vbox, txt, cmd=self.update_vals) vbox.pack(self.spot_check, padding=5) self.pack(printer_frame) #Flags txt = _('Use Blackpoint Compensation') self.bpc_check = wal.CheckButton(self, txt, cmd=self.update_vals) self.pack(self.bpc_check, padding=5) txt = _('Use Black preserving transforms') self.bpt_check = wal.CheckButton(self, txt, cmd=self.update_vals) self.pack(self.bpt_check) self.update_widgets()
def build(self): GenericPrefsPlugin.build(self) self.test_ruler = TestRuler(self) tab = gtk.Table(1, 1, False) tab.set_row_spacings(5) tab.set_col_spacings(10) tab.set_border_width(5) #--- Ruler size al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Ruler size (px):'))) tab.attach(al, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK) self.size_spin = wal.SpinButtonInt(tab, config.ruler_size, (15, 30), cmd=self.test_ruler.redraw, check_enter=False) al = gtk.Alignment(0.0, 0.5) al.add(self.size_spin) tab.attach(al, 1, 2, 0, 1, gtk.FILL, gtk.SHRINK) #--- Ruler font size al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Ruler font size (px):'))) tab.attach(al, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK) self.fsize_spin = wal.SpinButtonInt(tab, config.ruler_font_size, (5, 8), cmd=self.test_ruler.redraw, check_enter=False) al = gtk.Alignment(0.0, 0.5) al.add(self.fsize_spin) tab.attach(al, 1, 2, 1, 2, gtk.FILL, gtk.SHRINK) #--- Background color al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Ruler background color:'))) tab.attach(al, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK) self.bgcolor = wal.ColorButton(tab, config.ruler_bgcolor, cmd=self.test_ruler.redraw) al = gtk.Alignment(0.0, 0.5) al.add(self.bgcolor) tab.attach(al, 1, 2, 2, 3, gtk.FILL, gtk.SHRINK) #--- Foreground color al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Ruler tick color:'))) tab.attach(al, 0, 1, 3, 4, gtk.FILL, gtk.SHRINK) self.fgcolor = wal.ColorButton(tab, config.ruler_fgcolor, cmd=self.test_ruler.redraw) al = gtk.Alignment(0.0, 0.5) al.add(self.fgcolor) tab.attach(al, 1, 2, 3, 4, gtk.FILL, gtk.SHRINK) #--- Small tick size al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Small tick size (px):'))) tab.attach(al, 0, 1, 4, 5, gtk.FILL, gtk.SHRINK) self.stick_spin = wal.SpinButtonInt(tab, config.ruler_small_tick, (1, 30), cmd=self.test_ruler.redraw, check_enter=False) al = gtk.Alignment(0.0, 0.5) al.add(self.stick_spin) tab.attach(al, 1, 2, 4, 5, gtk.FILL, gtk.SHRINK) #--- Large tick size al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Large tick size (px):'))) tab.attach(al, 0, 1, 5, 6, gtk.FILL, gtk.SHRINK) self.ltick_spin = wal.SpinButtonInt(tab, config.ruler_text_tick, (1, 30), cmd=self.test_ruler.redraw, check_enter=False) al = gtk.Alignment(0.0, 0.5) al.add(self.ltick_spin) tab.attach(al, 1, 2, 5, 6, gtk.FILL, gtk.SHRINK) #--- Text mark shift al = gtk.Alignment(1.0, 0.5) al.add(gtk.Label(_('Text mark shift (px):'))) tab.attach(al, 0, 1, 6, 7, gtk.FILL, gtk.SHRINK) self.tmshift_spin = wal.SpinButtonInt(tab, config.ruler_text_shift, (-30, 30), cmd=self.test_ruler.redraw, check_enter=False) al = gtk.Alignment(0.0, 0.5) al.add(self.tmshift_spin) tab.attach(al, 1, 2, 6, 7, gtk.FILL, gtk.SHRINK) self.pack_start(tab, False, False, 0) #--- Testing ruler al = wal.DecorLabel(self, _('Testing ruler:'), bold=True) self.pack_start(al, False, False, 20) self.pack_start(gtk.HSeparator(), False, False, 0) self.pack_start(self.test_ruler, False, False, 0)