def __init__(self, parent, cms, palette=None, onclick=None): self.cms = cms self.callback = onclick wal.VPanel.__init__(self, parent) if wal.is_wx3(): self.pack((172, 1)) options = wal.ExpandedPanel(self, _('Palette preview:')) changer = wal.HToggleKeeper(options, PREVIEW_MODES, MODE_ICON, MODE_NAME, on_change=self.set_mode) options.pack(changer) self.pack(options, fill=True) border = wal.VPanel(self, border=True) if wal.is_wx3(): color = wal.GRAY if wal.is_gtk(): color = wal.UI_COLORS['pressed_border'] border.set_bg(color) self.pack(border, expand=True, fill=True) self.win = ScrolledPalette(border, self.cms, onclick=self.select_color) if wal.is_wx3(): if wal.is_gtk(): inner_border = wal.VPanel(self) inner_border.pack(self.win, expand=True, fill=True) border.pack(inner_border, expand=True, fill=True, padding_all=1) else: border.pack(self.win, expand=True, fill=True, padding_all=1) else: border.pack(self.win, expand=True, fill=True) changer.set_mode(AUTO_MODE) if palette: self.draw_palette(palette)
def __init__(self, parent, app): self.app = app wal.VPanel.__init__(self, parent) self.pack((1, 1)) self.palette = Palette(self.panel, self.app, hpal=False, on_left_click=self.app.proxy.fill_selected, on_right_click=self.app.proxy.stroke_selected, onmin=self.left_enable, onmax=self.right_enable) native = False if wal.is_gtk(): native = True tip = _('Scroll palette to top') self.left_but = wal.ImageButton(self.panel, icons.ARROW_TOP, tooltip=tip, decoration_padding=4, native=native, onclick=self.palette.scroll_start, repeat=True) self.pack(self.left_but) tip = _('Empty pattern') self.no_color = wal.ImageLabel(self.panel, icons.NO_COLOR, tooltip=tip, onclick=self.set_no_fill, onrightclick=self.set_no_stroke) self.pack(self.no_color) self.pack(self.palette, expand=True, padding=1) tip = _('Scroll palette to bottom') self.right_but = wal.ImageButton(self.panel, icons.ARROW_BOTTOM, tooltip=tip, decoration_padding=4, native=native, onclick=self.palette.scroll_end, repeat=True) self.pack(self.right_but)
def __init__(self, app, parent): self.app = app self.parent = parent wal.HPanel.__init__(self, parent) native = False if wal.is_gtk(): native = True callback = self.app.proxy.goto_start self.start_but = wal.ImageButton(self.panel, icons.PD_PM_ARROW_START, tooltip=_('Go to fist page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.start_but) callback = self.app.proxy.previous_page self.prev_but = wal.ImageButton(self.panel, icons.PD_PM_ARROW_LEFT, tooltip=_('Go to previous page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.prev_but) self.page_txt = wal.Label(self.panel, text=' ', fontsize=FONTSIZE[0]) self.pack(self.page_txt) callback = self.app.proxy.next_page self.next_but = wal.ImageButton(self.panel, icons.PD_PM_ARROW_RIGHT, tooltip=_('Go to next page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.next_but) callback = self.app.proxy.goto_end self.end_but = wal.ImageButton(self.panel, icons.PD_PM_ARROW_END, tooltip=_('Go to last page'), decoration_padding=4, native=native, onclick=callback) self.pack(self.end_but) self.pack(wal.VLine(self.panel), fill=True, padding=4) events.connect(events.NO_DOCS, self.hide_monitor) events.connect(events.DOC_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) events.connect(events.PAGE_CHANGED, 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(self): panel = wal.HPanel(self) self.pack(panel, padding=5, fill=True) label = wal.Label(panel, _("Insert:")) panel.pack(label, padding=5) self.page_num = wal.FloatSpin(panel, 1, (1, 100), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_num, padding=5) label = wal.Label(panel, _("page(s)")) panel.pack(label, padding=5) panel = wal.HPanel(self) self.pack(panel, padding=5) margin = 0 if not wal.is_gtk(): margin = 3 panel.pack((5, 5)) vpanel = wal.VPanel(panel) panel.pack(vpanel, padding=5) self.before_opt = wal.Radiobutton(vpanel, _('Before'), group=True) vpanel.pack(self.before_opt, padding=margin, fill=True) self.after_opt = wal.Radiobutton(vpanel, _('After')) vpanel.pack(self.after_opt, padding=margin, fill=True) self.after_opt.set_value(True) label = wal.Label(panel, _("page No.:")) panel.pack(label, padding=5) pages = self.presenter.get_pages() page_num = len(pages) current_page = pages.index(self.presenter.active_page) + 1 self.page_index = wal.FloatSpin(panel, current_page, (1, page_num), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_index, padding=5)
def apply_changes(self): config.new_doc_on_start = self.newdoc.get_value() config.make_backup = self.backup.get_value() config.make_export_backup = self.expbackup.get_value() config.history_size = self.hist_size.get_value() config.history_list_size = self.hist_menu_size.get_value() config.show_stub_buttons = self.stub_buttons.get_value() config.make_font_cache_on_start = self.fcache.get_value() if not config.is_mac(): config.spin_overlay = self.spin_overlay.get_value() if wal.is_gtk(): config.spin_sep = self.spin_sep.get_value() if wal.is_unity(): config.ubuntu_global_menu = self.ubuntu_gm.get_value() config.ubuntu_scrollbar_overlay = self.ubuntu_overlay.get_value()
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 restore_defaults(self): defaults = config.get_defaults() self.newdoc.set_value(defaults['new_doc_on_start']) self.backup.set_value(defaults['make_backup']) self.expbackup.set_value(defaults['make_export_backup']) self.hist_size.set_value(defaults['history_size']) self.hist_menu_size.set_value(defaults['history_list_size']) self.stub_buttons.set_value(defaults['show_stub_buttons']) self.fcache.set_value(defaults['make_font_cache_on_start']) if not config.is_mac(): self.spin_overlay.set_value(defaults['spin_overlay']) if wal.is_gtk(): self.spin_sep.set_value(defaults['spin_sep']) if wal.is_unity(): self.ubuntu_gm.set_value(defaults['ubuntu_global_menu']) self.ubuntu_overlay.set_value(defaults['ubuntu_scrollbar_overlay'])
def build(self): panel = wal.HPanel(self) self.pack(panel, padding=5, fill=True) label = wal.Label(panel, _("Insert:")) panel.pack(label, padding=5) self.page_num = wal.FloatSpin(panel, 1, (1, 100), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_num, padding=5) label = wal.Label(panel, _("page(s)")) panel.pack(label, padding=5) panel = wal.HPanel(self) self.pack(panel, padding=5) margin = 0 if not wal.is_gtk():margin = 3 panel.pack((5, 5)) vpanel = wal.VPanel(panel) panel.pack(vpanel, padding=5) self.before_opt = wal.Radiobutton(vpanel, _('Before'), group=True) vpanel.pack(self.before_opt, padding=margin, fill=True) self.after_opt = wal.Radiobutton(vpanel, _('After')) vpanel.pack(self.after_opt, padding=margin, fill=True) self.after_opt.set_value(True) label = wal.Label(panel, _("page No.:")) panel.pack(label, padding=5) pages = self.presenter.get_pages() page_num = len(pages) current_page = pages.index(self.presenter.active_page) + 1 self.page_index = wal.FloatSpin(panel, current_page, (1, page_num), 1, 0, width=5, spin_overlay=config.spin_overlay) panel.pack(self.page_index, padding=5)
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): txt = _('Create new document on start') self.newdoc = wal.Checkbox(self, txt, config.new_doc_on_start) self.pack(self.newdoc, align_center=False, start_padding=5) if wal.is_msw(): self.pack((5, 5)) txt = _('Make backup on document save') self.backup = wal.Checkbox(self, txt, config.make_backup) self.pack(self.backup, align_center=False) if wal.is_msw(): self.pack((5, 5)) txt = _('Make backup on export') self.expbackup = wal.Checkbox(self, txt, config.make_export_backup) self.pack(self.expbackup, align_center=False) if wal.is_msw(): self.pack((5, 5)) grid = wal.GridPanel(self, rows=2, cols=3, hgap=5, vgap=3) grid.pack(wal.Label(grid, _('History log size:'))) self.hist_size = wal.IntSpin(grid, config.history_size, (10, 1000)) grid.pack(self.hist_size) grid.pack(wal.Label(grid, _('records'))) grid.pack(wal.Label(grid, _('History menu size:'))) self.hist_menu_size = wal.IntSpin(grid, config.history_list_size, (5, 20)) grid.pack(self.hist_menu_size) grid.pack(wal.Label(grid, _('records'))) self.pack(grid, align_center=False, padding=5) if wal.is_msw(): self.pack((5, 5)) txt = _('Make font cache on start') self.fcache = wal.Checkbox(self, txt, config.make_font_cache_on_start) self.pack(self.fcache, align_center=False) if wal.is_msw(): self.pack((5, 5)) txt = _('Show quick access buttons') self.stub_buttons = wal.Checkbox(self, txt, config.show_stub_buttons) self.pack(self.stub_buttons, align_center=False) if wal.is_msw(): self.pack((5, 5)) if not config.is_mac(): txt = _('Use overlay for spinbox widgets (*)') self.spin_overlay = wal.Checkbox(self, txt, config.spin_overlay) self.pack(self.spin_overlay, align_center=False) if wal.is_gtk(): txt = _('Separate spin in spinbox widgets (*)') self.spin_sep = wal.Checkbox(self, txt, config.spin_sep) self.pack(self.spin_sep, align_center=False) if wal.is_unity(): txt = _('Unity related features') self.pack(wal.Label(grid, txt, fontsize=2, fontbold=True), start_padding=10) self.pack(wal.HLine(self), fill=True, padding=2) txt = _('Use Unity Global Menu (*)') self.ubuntu_gm = wal.Checkbox(self, txt, config.ubuntu_global_menu) self.pack(self.ubuntu_gm, align_center=False) txt = _('Allow overlay for scrollbars (*)') self.ubuntu_overlay = wal.Checkbox(self, txt, config.ubuntu_scrollbar_overlay) self.pack(self.ubuntu_overlay, align_center=False) if not config.is_mac(): self.pack(wal.HPanel(self), expand=True, fill=True) txt = _('(*) - These options require application restart') self.pack(wal.Label(grid, txt, fontsize=-1), align_center=False) self.built = True