def update_bmp(self, *args): mode = self.align_keeper.get_mode() if self.other_side.get_value(): bmp = get_icon(TEXT_ALIGN_PICS_OTHERSIDE[mode], size=wal.DEF_SIZE) else: bmp = get_icon(TEXT_ALIGN_PICS[mode], size=wal.DEF_SIZE) self.bmp.set_bitmap(bmp)
def update_icons(self): self.icons_dict[True] = [ get_icon(self.icons_dict[True][0], size=wal.DEF_SIZE), self.icons_dict[True][1]] self.icons_dict[False] = [ get_icon(self.icons_dict[False][0], size=wal.DEF_SIZE), self.icons_dict[False][1]]
def __init__(self, parent, printer): self.printer = printer wal.LabeledPanel.__init__(self, parent, _('Print mode')) grid = wal.GridPanel(self, 2, 2, 5, 5) self.mono_opt = wal.Radiobutton(grid, _('Monochrome'), group=True, onclick=self.update) icon = get_icon(icons.PD_PRINTMODE_MONO, size=wal.DEF_SIZE) self.mono_bmp = wal.Bitmap(grid, icon) grid.pack(self.mono_bmp) grid.pack(self.mono_opt) self.color_opt = wal.Radiobutton(grid, _('Color'), onclick=self.update) icon = get_icon(icons.PD_PRINTMODE_COLOR, size=wal.DEF_SIZE) self.color_bmp = wal.Bitmap(grid, icon) grid.pack(self.color_bmp) grid.pack(self.color_opt) self.color_opt.set_value(True) self.pack(grid, padding_all=10, align_center=False) hpanel = wal.HPanel(self) self.cs_lbl = wal.Label(hpanel, _('Color space:')) hpanel.pack(self.cs_lbl, padding=5) self.cs_combo = wal.Combolist(hpanel, items=CS) hpanel.pack(self.cs_combo) self.pack(hpanel) self.pack((5, 5)) self.set_data()
def update_icons(self): self.icons_dict[True] = [get_icon(self.icons_dict[True][0], size=const.DEF_SIZE), self.icons_dict[True][1]] self.icons_dict[False] = [get_icon(self.icons_dict[False][0], size=const.DEF_SIZE), self.icons_dict[False][1]]
def __init__(self, presenter): self.presenter = presenter self.eventloop = presenter.eventloop self.dc = self.presenter.app.mw.mdi.corner Painter.__init__(self) if not BITMAPS: BITMAPS[sk2const.DOC_ORIGIN_CENTER] = get_icon(icons.ORIGIN_CENTER) BITMAPS[sk2const.DOC_ORIGIN_LL] = get_icon(icons.ORIGIN_LL) BITMAPS[sk2const.DOC_ORIGIN_LU] = get_icon(icons.ORIGIN_LU) self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.changes) self.changes()
def __init__(self, parent, stops, size=(418, 10), onchange=None, onmove=None): self.stops = stops self.callback = onchange self.callback2 = onmove wal.VPanel.__init__(self, parent) wal.SensitiveCanvas.__init__(self, True) self.pack(size) self.bmp_knob = get_icon(icons.SLIDER_KNOB, size=wal.DEF_SIZE) self.bmp_knob_s = get_icon(icons.SLIDER_KNOB_SEL, size=wal.DEF_SIZE) self.bmp_stop = get_icon(icons.SLIDER_STOP, size=wal.DEF_SIZE) self.bmp_stop_s = get_icon(icons.SLIDER_STOP_SEL, size=wal.DEF_SIZE)
def __init__(self, parent, printer, printout): self.printer = printer self.printout = printout self.icons = { '00':get_icon(icons.PD_PRINT_COPIES_00, size=wal.DEF_SIZE), '10':get_icon(icons.PD_PRINT_COPIES_10, size=wal.DEF_SIZE), '01':get_icon(icons.PD_PRINT_COPIES_01, size=wal.DEF_SIZE), '11':get_icon(icons.PD_PRINT_COPIES_11, size=wal.DEF_SIZE), } FLabeledPanel.__init__(self, parent, _('Copies')) self.copies_changed() prn_events.connect(prn_events.PRINTER_CHANGED, self.on_printer_change) prn_events.connect(prn_events.PRINTOUT_MODIFIED, self.copies_changed)
def __init__(self, parent, printer, printout): self.printer = printer self.printout = printout self.icons = { '00': get_icon(icons.PD_PRINT_COPIES_00, size=wal.DEF_SIZE), '10': get_icon(icons.PD_PRINT_COPIES_10, size=wal.DEF_SIZE), '01': get_icon(icons.PD_PRINT_COPIES_01, size=wal.DEF_SIZE), '11': get_icon(icons.PD_PRINT_COPIES_11, size=wal.DEF_SIZE), } FLabeledPanel.__init__(self, parent, _('Copies')) self.copies_changed() prn_events.connect(prn_events.PRINTER_CHANGED, self.on_printer_change) prn_events.connect(prn_events.PRINTOUT_MODIFIED, self.copies_changed)
def __init__(self, parent, cms, border=False, onclick=None): self.cms = cms self.parent = parent self.callback = onclick wal.ScrolledPanel.__init__(self, parent, border) wal.SensitiveCanvas.__init__(self, True) sb = wal.ScrollBar(self) self.sb_width = sb.get_size()[0] sb.destroy() self.large_sel = get_icon(icons.PD_LARGE_SEL_PALETTE, size=wal.DEF_SIZE) self.small_sel = get_icon(icons.PD_SMALL_SEL_PALETTE, size=wal.DEF_SIZE) self.width = (self.cell_width - 1) * self.cell_in_line + 3 + self.sb_width self.set_size((self.width, -1)) self.set_bg(wal.WHITE)
def __init__(self, parent, printer, app): self.app = app self.printer = printer wal.LabeledPanel.__init__(self, parent, _('Orientation')) hpanel = wal.HPanel(self) vpanel = wal.VPanel(hpanel) self.port_opt = wal.Radiobutton(vpanel, _('Portrait'), group=True, onclick=self.update) vpanel.pack(self.port_opt, align_center=False) vpanel.pack((5, 5)) self.land_opt = wal.Radiobutton(vpanel, _('Landscape'), onclick=self.update) vpanel.pack(self.land_opt, align_center=False) hpanel.pack(vpanel) icon_name = icons.PD_PRINTORIENT_PORTRAIT if self.printer.page_orientation == uc2const.LANDSCAPE: icon_name = icons.PD_PRINTORIENT_LANDSCAPE self.land_opt.set_value(True) icon = get_icon(icon_name, size=wal.DEF_SIZE) self.orient_icon = wal.Bitmap(hpanel, icon) hpanel.pack(self.orient_icon, padding=10) self.pack(hpanel, fill=True, expand=True, padding_all=10)
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 mode = sk2const.DOC_ORIGIN_LL wal.Bitmap.__init__(self, parent, get_icon(ORIGIN_ICONS[mode], size=wal.DEF_SIZE)) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update)
def __init__(self, presenter, parent): self.presenter = presenter self.eventloop = presenter.eventloop HPanel.__init__(self, parent) size = config.ruler_size if not BITMAPS: BITMAPS[DOC_ORIGIN_CENTER] = get_icon(icons.ORIGIN_CENTER) BITMAPS[DOC_ORIGIN_LL] = get_icon(icons.ORIGIN_LL) BITMAPS[DOC_ORIGIN_LU] = get_icon(icons.ORIGIN_LU) self.add((size, size)) self.SetBackgroundColour(wx.WHITE) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.changes) self.Bind(wx.EVT_LEFT_UP, self.left_click) events.connect(events.CONFIG_MODIFIED, self.check_config) self.changes()
def __init__(self, parent, size=20, onchange=None): wal.VPanel.__init__(self, parent) wal.SensitiveCanvas.__init__(self, check_move=True) self.pack((256 + 8, size + 10)) self.knob = get_icon(icons.SLIDER_KNOB, size=wal.DEF_SIZE) if onchange: self.callback = onchange
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.panel.pack((5, 5)) self.shaping_keeper = wal.HToggleKeeper(self.panel, SHAPING_MODES, SHAPING_MODE_ICONS, SHAPING_MODE_NAMES, self.on_mode_change) self.panel.pack(self.shaping_keeper) self.panel.pack(wal.HLine(self.panel), fill=True, padding=3) self.shaping_panel = wal.VPanel(self.panel) self.panels = {} for item in SHAPING_MODES: panel = SHAPING_CLASSES[item](self.shaping_panel, self.app) panel.hide() self.panels[item] = panel self.panel.pack(self.shaping_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): self.app = parent.app wx.Panel.__init__(self, parent) self.SetBackgroundColour(wal.DARK_GRAY) self.bmp = get_icon(icons.CAIRO_BANNER, size=wal.DEF_SIZE) self.bmp_size = self.bmp.GetSize() action = self.app.actions[wal.ID_NEW] tooltip = action.get_descr_text() self.new_btn = StubButton(self, icons.PD_STUB_NEW, action, tooltip) action = self.app.actions[wal.ID_OPEN] tooltip = action.get_descr_text() self.open_btn = StubButton(self, icons.PD_STUB_OPEN, action, tooltip) action = self.app.actions[pdids.ID_VIEW_LOG] tooltip = _('Open Recent') self.recent_btn = StubButton(self, icons.PD_STUB_RECENT, action, tooltip) self.recent_btn.set_active(self.app.history.is_history()) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_SIZE, self._on_resize, self) events.connect(events.HISTORY_CHANGED, self.check_history) events.connect(events.CONFIG_MODIFIED, self.update)
def __init__(self, parent, app): self.app = app mode = sk2_const.DOC_ORIGIN_LL wal.Bitmap.__init__(self, parent, get_icon(ORIGIN_ICONS[mode], size=wal.DEF_SIZE)) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.panel.pack(wal.Label(self.panel, _('Layers'), fontbold=True), padding=3) self.panel.pack(wal.HLine(self.panel), fill=True) pnl = wal.HPanel(self.panel) self.layer_new = wal.ImageButton(pnl, icons.PD_LAYER_NEW, tooltip=_('Create new layer'), onclick=self.new_layer) self.layer_to_bottom = wal.ImageButton( pnl, icons.PD_LOWER_TO_BOTTOM, tooltip=_('Move layer to bottom'), onclick=self.lower_layer_to_bottom) self.layer_lower = wal.ImageButton(pnl, icons.PD_LOWER, tooltip=_('Move layer down'), onclick=self.lower_layer) self.layer_raise = wal.ImageButton(pnl, icons.PD_RAISE, tooltip=_('Move layer up'), onclick=self.raise_layer) self.layer_to_top = wal.ImageButton(pnl, icons.PD_RAISE_TO_TOP, tooltip=_('Move layer to top'), onclick=self.raise_layer_to_top) self.layer_delete = wal.ImageButton(pnl, icons.PD_LAYER_DELETE, tooltip=_('Delete layer'), onclick=self.delete_layer) self.layer_edit = wal.ImageButton(pnl, icons.PD_EDIT, tooltip=_('Rename layer'), onclick=self.rename_layer) pnl.pack(self.layer_new) pnl.pack(self.layer_to_bottom) pnl.pack(self.layer_lower) pnl.pack(self.layer_raise) pnl.pack(self.layer_to_top) pnl.pack(self.layer_delete) pnl.pack(self.layer_edit) self.panel.pack(pnl) bmp = [make_artid(item) for item in BITMAPS] pnl = wal.VPanel(self.panel, border=True) self.viewer = wal.LayerList(pnl, self.get_data(), bmp, on_select=self.update, on_change=self.changed, on_double_click=self.rename_layer) pnl.pack(self.viewer, fill=True, expand=True) self.panel.pack(pnl, padding_all=3, fill=True, expand=True) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) events.connect(events.PAGE_CHANGED, self.update) self.update()
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, parent, size=20, onchange=None): wal.VPanel.__init__(self, parent) wal.SensitiveDrawableWidget.__init__(self, check_move=True) self.set_double_buffered() self.pack((256 + 8, size + 10)) self.knob = get_icon(icons.SLIDER_KNOB, size=wal.DEF_SIZE) if onchange: self.callback = onchange
def __init__(self, parent): size = config.ruler_size wal.HPanel.__init__(self, parent) wal.Canvas.__init__(self) self.pack((size, size)) self.set_bg(wal.WHITE) self.icon = get_icon(icons.ORIGIN_LL) self.set_double_buffered()
def __init__(self, app, dlg, fmt_config=None): wal.VPanel.__init__(self, dlg) self.fmt_config = fmt_config self.app = app self.dlg = dlg if self.icon_id:self.icon = get_icon(self.icon_id) if not self.title: self.title = self.name self.pack(wal.Label(self, self.title, fontsize=3, fontbold=True)) self.pack(wal.HLine(self), fill=True, padding=5)
def build(self): grid = wal.GridPanel(self.cont, 2, 3, 5, 5) self.mono_opt = wal.Radiobutton(grid, _('Monochrome'), group=True, onclick=self.update) icon = get_icon(icons.PD_PRINTMODE_MONO, size=wal.DEF_SIZE) self.mono_bmp = wal.Bitmap(grid, icon) grid.pack(SPACER) grid.pack(self.mono_bmp) grid.pack(self.mono_opt) self.color_opt = wal.Radiobutton(grid, _('Color'), onclick=self.update) icon = get_icon(icons.PD_PRINTMODE_COLOR, size=wal.DEF_SIZE) self.color_bmp = wal.Bitmap(grid, icon) grid.pack(SPACER) grid.pack(self.color_bmp) grid.pack(self.color_opt) self.cont.pack(grid, align_center=False)
def __init__(self, parent, selected_font='Sans', onchange=None): self.fonts = libpango.FAMILIES_LIST if not self.fonts: libpango.update_fonts() bitmaps, maxsize = generate_fontnames(self.fonts) samples = generate_fontsamples(self.fonts) if not selected_font in self.fonts: selected_font = 'Sans' value = self.fonts.index(selected_font) icon = get_icon(icons.PD_FONT, size=wal.DEF_SIZE) wal.FontBitmapChoice.__init__(self, parent, value, maxsize, bitmaps, samples, icon, onchange)
def __init__(self, parent, selected_font='Sans', onchange=None): self.fonts = libpango.get_fonts()[0] if not FONTNAME_CACHE: generate_fontname_cache(self.fonts) generate_fontsample_cache(self.fonts) if not selected_font in self.fonts: selected_font = 'Sans' value = self.fonts.index(selected_font) icon = get_icon(icons.PD_FONT, size=wal.DEF_SIZE) wal.FontBitmapChoice.__init__(self, parent, value, MAXSIZE, self.fonts, FONTNAME_CACHE, FONTSAMPLE_CACHE, icon, onchange) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, parent): wal.HPanel.__init__(self, parent) icon = get_icon(icons.PD_ZOOM, size=wal.SIZE_16) self.pack(wal.Bitmap(self, icon, on_left_click=self.show_menu)) self.label = wal.Label(self, '10000%', fontsize=FONTSIZE[0]) self.label.set_min_width(70 if wal.IS_MAC else 55) self.label.set_tooltip(_('Zoom level')) self.pack(self.label, padding=2) self.pack(wal.PLine(self.panel), fill=True, padding=3) self.zoom_menu = ZoomMenu(parent.mw)
def __init__(self, mw): self.app = mw.app self.bmp = get_icon(icons.CAIRO_BANNER, size=wal.DEF_SIZE) wal.StubPanel.__init__(self, mw) bg = wal.DARK_GRAY self.set_bg(bg) items = ((wal.ID_NEW, icons.PD_STUB_NEW), (wal.ID_OPEN, icons.PD_STUB_OPEN), (pdids.ID_VIEW_LOG, icons.PD_STUB_RECENT)) for pid, icon in items: action = self.app.actions[pid] tooltip = _('Open Recent') if pid == pdids.ID_VIEW_LOG \ else action.get_descr_text() icon = get_icon(icon, size=wal.DEF_SIZE) self.buttons.append(wal.StubBtn(self, bg, icon, action, tooltip)) self.buttons[-1].set_active(self.app.history.is_history()) events.connect(events.HISTORY_CHANGED, self.check_history) events.connect(events.CONFIG_MODIFIED, self.update)
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 build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.apanel = AlignPanel(self.panel, self.app) self.panel.pack(self.apanel, fill=True, padding_all=5) self.dpanel = DistributePanel(self.panel, self.app) self.panel.pack(self.dpanel, fill=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 __init__(self, parent, selected_font='Sans', onchange=None): self.fonts = libpango.get_fonts()[0] if not FONTNAME_CACHE: generate_fontname_cache(self.fonts) generate_fontsample_cache(self.fonts) if selected_font not in self.fonts: selected_font = 'Sans' value = self.fonts.index(selected_font) icon = get_icon(icons.PD_FONT, size=wal.DEF_SIZE) wal.FontBitmapChoice.__init__(self, parent, value, MAXSIZE, self.fonts, FONTNAME_CACHE, FONTSAMPLE_CACHE, icon, onchange) events.connect(events.CONFIG_MODIFIED, self.check_config)
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.config = Iconizer_Config() 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, parent, printer, app): self.app = app self.printer = printer wal.VPanel.__init__(self, parent) hpanel = wal.HPanel(self) icon_name = icons.PD_PRINTER_LASER if self.printer.is_color(): icon_name = icons.PD_PRINTER_INKJET icon = get_icon(icon_name, size=wal.DEF_SIZE) hpanel.pack(wal.Bitmap(hpanel, icon), padding=10) self.prnmode_panel = PrintModePanel(hpanel, self.printer) hpanel.pack(self.prnmode_panel, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) self.paper_panel = PaperPanel(self, self.printer, self.app) self.pack(self.paper_panel, fill=True) self.pack((5, 5)) hpanel = wal.HPanel(self) self.orient_panel = OrientPanel(hpanel, self.printer, self.app) hpanel.pack(self.orient_panel, fill=True, expand=True) hpanel.pack((5, 5)) self.margins_panel = MarginsPanel(hpanel, self.printer, self.app) hpanel.pack(self.margins_panel, fill=True, expand=True) self.pack(hpanel, fill=True, expand=True) text = _("Note: To adjust specific printer options " "you could " "use system configuration tools like 'system-config-printer'") label = wal.Label(self, text, fontsize=-2) if wal.IS_MSW: label.wrap(380) label.set_enable(False) self.pack(label, fill=True, padding_all=5, align_center=False) self.panels = [ self.prnmode_panel, self.paper_panel, self.orient_panel, self.margins_panel ]
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, parent, icon, action, tooltip=''): self.action = action wx.Panel.__init__(self, parent) self.SetBackgroundColour(wal.DARK_GRAY) self.icon = get_icon(icon, size=wal.DEF_SIZE) self._set_bmp() self.SetSize(self.icon.GetSize()) if tooltip: self.SetToolTipString(tooltip) self.timer = wx.Timer(self) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_ENTER_WINDOW, self._mouse_over, self) self.Bind(wx.EVT_LEFT_DOWN, self._mouse_down, self) self.Bind(wx.EVT_LEFT_UP, self._mouse_up, self) self.Bind(wx.EVT_TIMER, self._on_timer) self.Bind(wx.EVT_LEAVE_WINDOW, self._on_win_leave, self)
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 __init__(self, parent, printer, app): self.app = app self.printer = printer wal.VPanel.__init__(self, parent) hpanel = wal.HPanel(self) icon_name = icons.PD_PRINTER_LASER if self.printer.is_color(): icon_name = icons.PD_PRINTER_INKJET icon = get_icon(icon_name, size=wal.DEF_SIZE) hpanel.pack(wal.Bitmap(hpanel, icon), padding=10) self.prnmode_panel = PrintModePanel(hpanel, self.printer) hpanel.pack(self.prnmode_panel, fill=True, expand=True) self.pack(hpanel, fill=True) self.pack((5, 5)) self.paper_panel = PaperPanel(self, self.printer, self.app) self.pack(self.paper_panel, fill=True) self.pack((5, 5)) hpanel = wal.HPanel(self) self.orient_panel = OrientPanel(hpanel, self.printer, self.app) hpanel.pack(self.orient_panel, fill=True, expand=True) hpanel.pack((5, 5)) self.margins_panel = MarginsPanel(hpanel, self.printer, self.app) hpanel.pack(self.margins_panel, fill=True, expand=True) self.pack(hpanel, fill=True, expand=True) text = _("Note: To adjust specific printer options " "you could " "use system configuration tools like 'system-config-printer'") label = wal.Label(self, text, fontsize=-2) if wal.is_msw(): label.wrap(380) label.set_enable(False) self.pack(label, fill=True, padding_all=5, align_center=False) self.panels = [self.prnmode_panel, self.paper_panel, self.orient_panel, self.margins_panel]
def build_ui(self): self.icon = get_icon(PLUGIN_ICON) self.panel.pack(wal.Label(self.panel, _('Layers'), fontbold=True), padding=3) self.panel.pack(wal.HLine(self.panel), fill=True) pnl = wal.HPanel(self.panel) self.layer_new = wal.ImageButton(pnl, icons.PD_LAYER_NEW, tooltip=_('Create new layer'), onclick=self.new_layer) self.layer_to_bottom = wal.ImageButton(pnl, icons.PD_LOWER_TO_BOTTOM, tooltip=_('Layer to bottom'), onclick=self.lower_layer_to_bottom) self.layer_lower = wal.ImageButton(pnl, icons.PD_LOWER, tooltip=_('Lower layer'), onclick=self.lower_layer) self.layer_raise = wal.ImageButton(pnl, icons.PD_RAISE, tooltip=_('Raise layer'), onclick=self.raise_layer) self.layer_to_top = wal.ImageButton(pnl, icons.PD_RAISE_TO_TOP, tooltip=_('Layer to top'), onclick=self.raise_layer_to_top) self.layer_delete = wal.ImageButton(pnl, icons.PD_LAYER_DELETE, tooltip=_('Delete layer'), onclick=self.delete_layer) self.layer_edit = wal.ImageButton(pnl, icons.PD_EDIT, tooltip=_('Rename layer'), onclick=self.rename_layer) pnl.pack(self.layer_new) pnl.pack(self.layer_to_bottom) pnl.pack(self.layer_lower) pnl.pack(self.layer_raise) pnl.pack(self.layer_to_top) pnl.pack(self.layer_delete) pnl.pack(self.layer_edit) self.panel.pack(pnl) bmp = [] for item in BITMAPS: bmp.append(make_artid(item)) pnl = wal.VPanel(self.panel, border=True) self.viewer = wal.LayerList(pnl, self.get_data(), bmp, on_select=self.update, on_change=self.changed, on_double_click=self.rename_layer) pnl.pack(self.viewer, fill=True, expand=True) self.panel.pack(pnl, padding_all=3, fill=True, expand=True) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) self.update()
def draw_color(self): if self.color is None: return if not self.color: self.draw_empty_pattern() return w, h = self.get_size() if self.color[2] < 1.0: self.set_gc_stroke() self.set_gc_fill(self.cms.get_rgba_color255(self.color)) self.gc_draw_rect(0, 0, w, h) else: self.set_stroke() self.set_fill(self.cms.get_rgb_color255(self.color)) self.draw_rect(0, 0, w, h) if self.color[1] in [REG_COLOR, REG_SPOT_COLOR]: if not self.reg_icon: self.reg_icon = get_icon(icons.REG_SIGN, size=wal.DEF_SIZE) x = (w - 19) / 2 y = (h - 19) / 2 self.draw_bitmap(self.reg_icon, x, y)
def __init__(self, parent, printer, app): self.app = app self.printer = printer wal.VPanel.__init__(self, parent) hpanel = wal.HPanel(self) icon = get_icon(icons.PD_PRINTER_PDF, size=wal.DEF_SIZE) hpanel.pack(wal.Bitmap(hpanel, icon), padding=5) self.prnmode_panel = GenModePanel(hpanel, self.printer) hpanel.pack(self.prnmode_panel, fill=True, expand=True) self.pack(hpanel, fill=True) self.page_panel = PagePanel(self, self.printer, self.app) self.pack(self.page_panel, fill=True) self.doc_info = DocInfoPanel(self, self.printer, self.app) self.pack(self.doc_info, fill=True, expand=True) self.panels = [self.prnmode_panel, self.page_panel, self.doc_info]
def update(self): icon_name = icons.PD_PRINTORIENT_PORTRAIT if self.land_opt.get_value(): icon_name = icons.PD_PRINTORIENT_LANDSCAPE icon = get_icon(icon_name, size=wal.DEF_SIZE) self.orient_icon.set_bitmap(icon)
def load_bmp(self): if self.side_flag: return get_icon(POS_PICS_OTHERSIDE[self.mode], size=wal.DEF_SIZE) return get_icon(POS_PICS[self.mode], size=wal.DEF_SIZE)
def update(self, *args): if self.app.current_doc: mode = self.app.current_doc.methods.get_doc_origin() self.set_bitmap(get_icon(ORIGIN_ICONS[mode], size=wal.DEF_SIZE))