def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) self.hbox = wal.HidableHBox(self) self.pack(self.hbox) size = (50, 50) self.hbox.pack(wal.ColorPlate(self.hbox, size, bg=wal.BLACK), True, True) self.hbox.set_visible(True) hbox = wal.HBox(self) self.pack(hbox, True, True) self.vbox = wal.HidableVBox(hbox) self.vbox.pack(wal.ColorPlate(self.hbox, size, bg=wal.GRAY), True, True) self.vbox.set_visible(True) hbox.pack(self.vbox) vbox = wal.VBox(hbox) hbox.pack(vbox, end=True) vbox.pack(wal.Button(vbox, 'Test HBox', cmd=self.test_hbox)) vbox.pack(wal.Button(vbox, 'Test VBox', cmd=self.test_vbox))
def build(self): self.set_profiles() vp = wal.VPanel(self.panel) vp.set_bg(wal.UI_COLORS['border']) self.viewer = wal.SimpleList(vp, self.pf_list, on_select=self.selection_changed) vp.pack(self.viewer, expand=True, fill=True, padding_all=1) self.panel.pack(vp, expand=True, fill=True, padding_all=5) btn_box = wal.VPanel(self.panel) self.panel.pack(btn_box, fill=True, padding_all=5) self.import_btn = wal.Button(btn_box, _('Import'), onclick=self.import_profile) btn_box.pack(self.import_btn, fill=True, end_padding=5) self.remove_btn = wal.Button(btn_box, _('Remove'), onclick=self.remove_profile) btn_box.pack(self.remove_btn, fill=True, end_padding=5) self.info_btn = wal.Button(btn_box, _('Info'), onclick=self.profile_info) btn_box.pack(self.info_btn, fill=True, end_padding=5) self.viewer.set_active(0)
def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) but = wal.Button(self, 'Test button', cmd=self.test) self.pack(but, padding=10) but = wal.Button(self, 'Test button', cmd=self.test, flat=True) self.pack(but, padding=10)
def __init__(self, app, prefpanel, parent): self.app = app self.prefpanel = prefpanel wal.HPanel.__init__(self, parent) data = self.get_palette_list() self.pal_list = wal.SimpleList(self, data, on_select=self.change_palette) self.pack(self.pal_list, expand=True, fill=True, padding_all=5) self.pal_viewer = PaletteViewer(self, self.app.default_cms) self.pack(self.pal_viewer, fill=True, padding_all=5) btn_box = wal.VPanel(self) self.pack(btn_box, fill=True, padding_all=5) btn_box.pack(wal.Button(btn_box, _('Import'), onclick=self.import_palette), fill=True, end_padding=5) btn_box.pack(wal.Button(btn_box, _('Export'), onclick=self.export_palette), fill=True, end_padding=5) self.remove_btn = wal.Button(btn_box, _('Remove'), onclick=self.remove_palette) btn_box.pack(self.remove_btn, fill=True, end_padding=5) self.edit_btn = wal.Button(btn_box, _('Edit info'), onclick=self.edit_info) btn_box.pack(self.edit_btn, fill=True, end_padding=5) btn_box.pack(wal.VPanel(btn_box), fill=True, expand=True) btn_box.pack(wal.ImageButton(btn_box, icons.PD_DOWNLOAD48, tooltip=_('Download more palettes'), flat=False, onclick=self.download_more), fill=True, end_padding=5) # btn_box.pack(CollectionButton(btn_box, self.app, self, # self.prefpanel.dlg), fill=True, end_padding=5) self.update_palette_list()
def __init__(self): wal.MainWindow.__init__(self) self.set_size(SIZE) self.pack(wal.Button(self, 'Just a button'), padding=10) self.pack(wal.Button(self, 'Default button', default=True), padding=10) self.pack(wal.Button(self, 'Button with callback', onclick=self.on_click), padding=10) self.pack(wal.Button(self, 'Button with tooltip', tooltip='Button tooltip'), padding=10) btn = wal.Button(self, 'Disabled button') btn.set_enable(False) self.pack(btn, padding=10)
def set_dialog_buttons(self): wal.OkCancelDialog.set_dialog_buttons(self) title = _('Restore defaults') self.redo_btn = wal.Button(self.left_button_box, title, onclick=self.restore_defaults) self.left_button_box.pack(self.redo_btn)
def __init__(self, parent, app): self.app = app wal.LabeledPanel.__init__(self, parent, _('Align')) self.pack((5, 5)) self.pack(wal.Label(self, _('Relative to:'))) self.source = wal.Combolist(self, items=SOURCE_NAMES, onchange=self.update) self.pack(self.source, padding_all=5, fill=True) self.pack((5, 5)) self.halign = wal.HToggleKeeper(self, H_ALIGN_MODES, H_ALIGN_MODE_ICONS, H_ALIGN_MODE_NAMES, on_change=self.update, allow_none=True) self.pack(self.halign) self.halign.set_mode(ALIGN_CENTER) self.valign = wal.HToggleKeeper(self, V_ALIGN_MODES, V_ALIGN_MODE_ICONS, V_ALIGN_MODE_NAMES, on_change=self.update, allow_none=True) self.pack(self.valign, padding_all=5) self.valign.set_mode(ALIGN_CENTER) self.group = wal.Checkbox(self, _('Selection as group'), True, onclick=self.update) self.pack(self.group, padding_all=5) self.apply_btn = wal.Button(self, _('Apply'), onclick=self.action) self.pack(self.apply_btn, padding_all=5, fill=True)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) panel = wal.VPanel(self.panel) panel.pack(wal.Label(panel, _('Text position on circle')), padding_all=5) self.bmp = PositionSwitch(panel) panel.pack(self.bmp, padding_all=5) self.other_side = wal.Checkbox(panel, _('Place on other side'), onclick=self.update_bmp) panel.pack(self.other_side, padding=5) self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action) panel.pack(self.apply_btn, padding=5, fill=True) self.panel.pack(panel, fill=True, padding_all=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) self.update()
def __init__(self, parent, app): self.app = app wal.LabeledPanel.__init__(self, parent, _('Distribute')) self.pack((5, 5)) self.hdistrib = wal.HToggleKeeper(self, H_DISTRIBUTE_MODES, H_DISTRIBUTE_MODE_ICONS, H_DISTRIBUTE_MODE_NAMES, on_change=self.update, allow_none=True) self.pack(self.hdistrib) self.hdistrib.set_mode(DISTRIBUTE_HCENTER) self.vdistrib = wal.HToggleKeeper(self, V_DISTRIBUTE_MODES, V_DISTRIBUTE_MODE_ICONS, V_DISTRIBUTE_MODE_NAMES, on_change=self.update, allow_none=True) self.pack(self.vdistrib, padding_all=5) self.vdistrib.set_mode(DISTRIBUTE_VCENTER) self.apply_btn = wal.Button(self, _('Apply'), onclick=self.action) self.pack(self.apply_btn, padding_all=5, fill=True)
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 __init__(self): wal.MainWindow.__init__(self) wal.registry_aliases("_Don't save") self.set_size(300, 200) rb0 = wal.Button(self, 'Info', cmd=self.callback0) rb1 = wal.Button(self, 'Warning', cmd=self.callback1) rb2 = wal.Button(self, 'Error', cmd=self.callback2) rb3 = wal.Button(self, 'Info with details', cmd=self.callback3) rb4 = wal.Button(self, 'Warning with details', cmd=self.callback4) rb5 = wal.Button(self, 'Error with details', cmd=self.callback5) rb6 = wal.Button(self, 'Ask for save', cmd=self.callback6) rb7 = wal.Button(self, 'Yes-No', cmd=self.callback7) rb8 = wal.Button(self, 'Yes-No-Cancel', cmd=self.callback8) self.pack_all((rb0, rb1, rb2, rb3, rb4, rb5, rb6, rb7, rb8), padding=10)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) panel = wal.VPanel(self.panel) self.transform_keeper = wal.HToggleKeeper(panel, TRANSFORM_MODES, TRANSFORM_MODE_ICONS, TRANSFORM_MODE_NAMES, self.on_mode_change) panel.pack(self.transform_keeper) panel.pack(wal.HLine(panel), fill=True, padding=3) self.transform_panel = wal.VPanel(panel) self.transforms = {} for item in TRANSFORM_MODES: transf = TRANSFORM_CLASSES[item](self.transform_panel, self.app, self.on_reset) transf.hide() self.transforms[item] = transf panel.pack(self.transform_panel, fill=True) hpanel = wal.HPanel(panel) self.oi = OrientationIndicator(hpanel, onchange=self.on_orient_change) hpanel.pack(self.oi) hpanel.pack((10, 10)) hpanel.pack(OriginIndicator(hpanel, self.app)) panel.pack(hpanel, padding_all=10) self.apply_copy_btn = wal.Button(panel, _('Apply to copy'), onclick=self.action_copy) panel.pack(self.apply_copy_btn, fill=True) self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action) panel.pack(self.apply_btn, padding=3, fill=True) panel.pack(wal.HLine(panel), fill=True) self.panel.pack(panel, fill=True, expand=True, padding_all=5) events.connect(events.DOC_CHANGED, self.update) events.connect(events.SELECTION_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) self.update()
def set_dialog_buttons(self): PrnProsDialog.set_dialog_buttons(self) self.import_btn = wal.Button( self.left_button_box, _('Set metainfo'), tooltip=_('Set metainfo from current document'), onclick=self.main_panel.doc_info.import_data) self.left_button_box.pack(self.import_btn) self.import_btn.set_enable(self.main_panel.doc_info.is_metadata())
def __init__(self, app, parent, title): self.app = app size = config.docprops_dlg_size wal.OkCancelDialog.__init__(self, parent, title, size, resizable=True, add_line=False) self.info_btn = wal.Button(self.button_box, _('Statistics...'), tooltip=_("Document info"), onclick=self.on_info, default=True) self.left_button_box.pack(self.info_btn, padding=2) self.set_minsize(config.docprops_dlg_minsize)
def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) self.area = wal.HidableVArea(self) self.area.pack(wal.ColorPlate(self.area, bg=wal.GRAY), True, True) self.pack(self.area, True, True) self.area.set_visible(True) self.pack(wal.Button(self, 'Test HidableArea', cmd=self.test_area), end=True)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) panel = wal.VPanel(self.panel) panel.pack(wal.Label(panel, _('Text position on path')), padding_all=5) hp = wal.HPanel(panel) hp.pack(wal.Label(hp, _('Base point:'))) self.base_point = wal.FloatSpin(hp, value=50.0, range_val=(0.0, 100.0), step=1.0) hp.pack(self.base_point, padding=5) hp.pack(wal.Label(hp, _('%'))) panel.pack(hp, padding=5) self.align_keeper = wal.HToggleKeeper(panel, TEXT_ALIGNS, TEXT_ALIGN_ICONS, TEXT_ALIGN_TEXTS, on_change=self.update_bmp) panel.pack(self.align_keeper) self.align_keeper.set_mode(TEXT_ALIGNS[1]) border = wal.VPanel(panel) color = wal.GRAY if wal.is_gtk(): color = wal.UI_COLORS['pressed_border'] border.set_bg(color) self.pic_panel = wal.VPanel(border) self.pic_panel.set_bg(wal.WHITE) self.bmp = get_bmp(self.pic_panel, TEXT_ALIGN_PICS[TEXT_ALIGNS[1]]) self.pic_panel.pack(self.bmp, padding_all=5) border.pack(self.pic_panel, padding_all=1) panel.pack(border, padding=10) self.other_side = wal.Checkbox(panel, _('Place on other side'), onclick=self.update_bmp) panel.pack(self.other_side, padding=5) self.apply_btn = wal.Button(panel, _('Apply'), onclick=self.action) panel.pack(self.apply_btn, padding=5, fill=True) self.panel.pack(panel, fill=True, padding_all=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) self.update()
def __init__(self): wal.MainWindow.__init__(self) self.set_size(300, 200) self.box.set_border_width(10) hb = wal.HBox(self) hb.pack(wal.Button(hb, stock=wal.STOCK_ADD, cmd=self.add_cmd)) hb.pack(wal.Button(hb, stock=wal.STOCK_REMOVE, cmd=self.remove_cmd)) self.pack(hb) self.db = wal.DocBook(self, self.switch_cmd, self.close_cmd, wal.STOCK_FILE) self.dt = [ TestDoc(self.db, wal.GRAY, 'GRAY'), TestDoc(self.db, wal.WHITE, 'WHITE'), TestDoc(self.db, wal.BLACK, 'BLACK'), TestDoc(self.db, wal.BLUE, 'BLUE'), TestDoc(self.db, wal.GREEN, 'GREEN'), ] self.docs = [] self.pack(self.db, True, True)
def build(self): plist = self.printsys.get_printer_names() self.prn_list = wal.Combolist(self.cont, items=plist, onchange=self.on_printer_change) self.prn_list.set_active(plist.index(self.printer.get_name())) self.cont.pack(self.prn_list, fill=True, expand=True) self.cont.pack(SPACER) hpanel = wal.HPanel(self.cont) hpanel.pack((1, 1), fill=True, expand=True) self.print_btn = wal.Button(hpanel, _('Print'), onclick=self.dlg.on_print) hpanel.pack(self.print_btn) self.cont.pack(hpanel, fill=True) self.ready_flag = True
def __init__(self, parent, app): wal.VPanel.__init__(self, parent) self.app = app self.pack(wal.Label(self, SHAPING_MODE_NAMES[self.pid], fontbold=True)) self.pic_panel = wal.VPanel(self, border=True) self.pic_panel.set_bg(wal.WHITE) self.bmp = get_bmp(self.pic_panel, SHAPING_MODE_PICS[self.pid]) self.pic_panel.pack(self.bmp, padding_all=5) self.pack(self.pic_panel, padding=10) self.del_check = wal.Checkbox(self, _('Delete originals')) self.pack(self.del_check) txt = _('Apply') if self.pid == TRIM_MODE: txt = _('Apply to...') self.apply_btn = wal.Button(self, txt, onclick=self.action) self.pack(self.apply_btn, fill=True, padding_all=5)
def __init__(self, parent): wal.VPanel.__init__(self, parent) exp = wal.ExpandedPanel(self, 'Test options') self.pack(exp, fill=True) exp.pack(wal.Button(exp, 'Test button')) data = [] root = wal.TreeElement('root') prov = wx.ArtProvider_GetBitmap icon = prov(wx.ART_CDROM, wx.ART_OTHER, wal.SIZE_16) root.icon = icon for item in range(5): el = wal.TreeElement('Element %d' % item) root.childs.append(el) data.append(root) data.append(root) self.tree = wal.TreeWidget(self, data, on_select=self.selected) self.pack(self.tree, expand=True, fill=True, padding=2) self.tree.expand_all()
def __init__(self, parent, app): wal.VPanel.__init__(self, parent) self.app = app self.pack(wal.Label(self, SHAPING_MODE_NAMES[self.pid], fontbold=True)) border = wal.VPanel(self) color = wal.GRAY if wal.is_gtk():color = wal.UI_COLORS['pressed_border'] border.set_bg(color) self.pic_panel = wal.VPanel(border) self.pic_panel.set_bg(wal.WHITE) self.bmp = get_bmp(self.pic_panel, SHAPING_MODE_PICS[self.pid]) self.pic_panel.pack(self.bmp, padding_all=5) border.pack(self.pic_panel, padding_all=1) self.pack(border, padding=10) self.del_check = wal.Checkbox(self, _('Delete originals')) self.pack(self.del_check) txt = _('Apply') if self.pid == TRIM_MODE: txt = _('Apply to...') self.apply_btn = wal.Button(self, txt, onclick=self.action) self.pack(self.apply_btn, fill=True, padding_all=5)
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) 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) hpanel.pack(self.orient_keeper) hpanel.pack((5, 5)) self.as_current = wal.Button(hpanel, ' %s ' % _('As current page'), onclick=self.set_as_current) hpanel.pack(self.as_current) self.pack(hpanel, fill=True) self.pack((5, 5)) # --- hpanel = wal.HPanel(self) dx = label.get_size()[0] + 10 hpanel.pack((dx, 5)) self.page_width = UnitSpin(self.app, hpanel, 0, 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, 0, onchange=self.page_spin_changed) hpanel.pack(self.page_height) hpanel.pack(StaticUnitLabel(self.app, hpanel), padding=5) self.pack(hpanel, fill=True) self.pack(wal.HLine(self), padding_all=5, fill=True) self.set_page_format(self.page_format) # --- COLORS hpanel = wal.HPanel(self) hpanel.pack((5, 5)) grid = wal.GridPanel(hpanel, 3, 3, 5, 5) grid.add_growable_col(2) grid.pack(wal.Label(grid, _('Desktop:'))) self.desktop_bg = self.doc.methods.get_desktop_bg() self.desktop_color_btn = wal.ColorButton(grid, 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(grid, _('Page:'))) self.page_color1_btn = wal.ColorButton(grid, 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(grid, 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 set_dialog_buttons(self): wal.OkCancelDialog.set_dialog_buttons(self) self.clear_btn = wal.Button(self.left_button_box, _('Clear log'), onclick=self.clear_history) self.left_button_box.pack(self.clear_btn)
def __init__(self, parent, app): self.app = app wal.LabeledPanel.__init__(self, parent, 'Flattering') self.apply_btn = wal.Button(self, _('Apply'), onclick=self.action) self.pack(self.apply_btn, padding_all=5, fill=True)
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, cms, stops, onchange=None): self.dlg = dlg self.cms = cms self.stops = deepcopy(stops) if onchange: self.callback = onchange wal.VPanel.__init__(self, parent) self.pack((5, 5)) self.viewer = GradientViewer(self, self.cms, self.stops, onclick=self.insert_stop) self.pack(self.viewer) self.stop_editor = StopsEditor(self, self.stops, onchange=self.set_selected_stop, onmove=self.change_stop_position) self.pack(self.stop_editor) self.pack((5, 5)) hpanel = wal.HPanel(self) self.stop_panel = StopPanel(hpanel, self.dlg, self.cms, self.stops, onposition=self.change_stop_position, oncolor=self.update_colors) hpanel.pack((5, 5)) hpanel.pack(self.stop_panel) hpanel.pack((5, 5)) vpanel = wal.VPanel(hpanel) selpanel = wal.HPanel(vpanel) txt = _('Select first stop') self.go_first = wal.ImageButton(selpanel, icons.PD_GOTO_FIRST, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.select_first) selpanel.pack(self.go_first, padding=5) txt = _('Select previous stop') self.go_prev = wal.ImageButton(selpanel, icons.PD_GO_BACK, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.select_prev) selpanel.pack(self.go_prev, padding=5) txt = _('Select next stop') self.go_next = wal.ImageButton(selpanel, icons.PD_GO_FORWARD, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.select_next) selpanel.pack(self.go_next, padding=5) txt = _('Select last stop') self.go_last = wal.ImageButton(selpanel, icons.PD_GOTO_LAST, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.select_last) selpanel.pack(self.go_last, padding=5) vpanel.pack(selpanel) bpanel = wal.HPanel(vpanel) txt = _('Add stop') self.add_button = wal.ImageButton(bpanel, icons.PD_ADD, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.add_stop) bpanel.pack(self.add_button, padding=5) txt = _('Delete selected stop') self.del_button = wal.ImageButton(bpanel, icons.PD_REMOVE, wal.SIZE_16, tooltip=txt, flat=False, onclick=self.delete_selected) bpanel.pack(self.del_button) txt = _('Reverse gradient') bpanel.pack(wal.Button(vpanel, _('Reverse'), tooltip=txt, onclick=self.reverse_gradient), padding=15) vpanel.pack(bpanel, padding=5) txt = _('Keep gradient vector') self.keep_vector = wal.Checkbox(vpanel, txt, True) vpanel.pack(self.keep_vector) hpanel.pack(vpanel, fill=True, expand=True, padding=5) self.pack(hpanel, fill=True) self.update()