def __init__(self, mw): if not config.statusbar_fontsize: FONTSIZE[0] = wal.get_system_fontsize() self.mw = mw wal.HPanel.__init__(self, mw) self.pack((5, 20)) self.mouse_info = MouseMonitor(self.mw.app, self) self.pack(self.mouse_info) self.mouse_info.hide() self.snap_monitor = SnapMonitor(self.mw.app, self) self.pack(self.snap_monitor) self.page_info = PageMonitor(self.mw.app, self) self.pack(self.page_info) self.page_info.hide() info_panel = wal.HPanel(self) info_panel.pack(get_bmp(info_panel, icons.PD_APP_STATUS)) info_panel.pack((5, 3)) self.info = wal.Label(info_panel, text='', fontsize=FONTSIZE[0]) info_panel.pack(self.info) self.pack(info_panel, expand=True) self.clr_monitor = ColorMonitor(self.mw.app, self) self.pack(self.clr_monitor) self.clr_monitor.hide() events.connect(events.APP_STATUS, self._on_event)
def __init__(self, parent, app, cms, onleftclick=None, onrightclick=None, onmin=None, onmax=None): self.app = app self.cms = cms self.onleftclick = onleftclick self.onrightclick = onrightclick self.onmin = onmin self.onmax = onmax HPanel.__init__(self, parent) self.set_palette(app.palettes.palette_in_use.model.colors) self.cell_width = config.palette_hcell_width self.cell_height = config.palette_hcell_height self.pack((self.cell_width, self.cell_height)) self.tooltipwin = PaletteToolTip(self) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_SIZE, self._on_resize, self) self.Bind(wx.EVT_MOUSEWHEEL, self._on_scroll, self) self.Bind(wx.EVT_MOTION, self._on_move, self) if onrightclick: self.Bind(wx.EVT_RIGHT_UP, self._on_right_click, self) if onleftclick: self.Bind(wx.EVT_LEFT_UP, self._on_left_click, self) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self._on_timer) self.SetDoubleBuffered(True) events.connect(events.CONFIG_MODIFIED, self.config_update) events.connect(events.CMS_CHANGED, self.refresh)
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, action_id, callback, channels=[], validator=None, checker=None, callable_args=[], validator_args=[], checker_args=[]): self.action_id = action_id self.is_acc = action_id in resources.ACC_KEYS if self.is_acc: self.acc_entry, self.global_accs = resources.get_accentry_by_id( self.action_id) if not self.acc_entry: self.is_acc = False self.is_icon = action_id in resources.ART_IDS self.callback = callback self.channels = channels self.validator = validator self.checker = checker self.callable_args = callable_args self.validator_args = validator_args self.checker_args = checker_args self.widgets = [] self.menuitem = [] if channels: for channel in channels: events.connect(channel, self.receiver)
def __init__(self, app, parent, val=0.0, step=1.0, onchange=None, onenter=None, can_be_negative=False): self.app = app self.insp = app.insp self.point_value = val self.ucallback = onchange val_range = (0.0, 100000.0) if can_be_negative: val_range = (-100000.0, 100000.0) if self.insp.is_doc(): self.units = app.current_doc.model.doc_units val = self.point_value * point_dict[self.units] FloatSpin.__init__(self, parent, val, val_range, step=step, width=5, onchange=self.update_point_value, onenter=onenter, spin_overlay=config.spin_overlay) events.connect(events.DOC_MODIFIED, self.update_units) events.connect(events.DOC_CHANGED, self.update_units) self._set_digits(unit_accuracy[self.units]) self.set_value(self.point_value * point_dict[self.units])
def __init__(self, app, master): wal.HBox.__init__(self, master) self.app = app self.insp = app.inspector self.start = wal.ImgButton(self, rc.IMG_PAGER_START, cmd=self.first_page, flat=True) self.pack(self.start) self.left = wal.ImgButton(self, rc.IMG_PAGER_PREV, cmd=self.prev_page, flat=True) self.pack(self.left) self.label = wal.DecorLabel(self) self.pack(self.label, False, False, 5) self.right = wal.ImgButton(self, rc.IMG_PAGER_NEXT, cmd=self.next_page, flat=True) self.pack(self.right) self.end = wal.ImgButton(self, rc.IMG_PAGER_END, cmd=self.last_page, flat=True) self.pack(self.end) self.pack(wal.VLine(self)) self.update_pager() events.connect(events.DOC_CHANGED, self.update_pager) events.connect(events.DOC_MODIFIED, self.update_pager)
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 __init__(self, action_id, callback, channels=[], validator=None, checker=None, callable_args=[], validator_args=[], checker_args=[]): self.action_id = action_id self.is_acc = resources.ACC_KEYS.has_key(action_id) if self.is_acc: self.acc_entry, self.global_accs = resources.get_accentry_by_id(self.action_id) if not self.acc_entry: self.is_acc = False self.is_icon = resources.ART_IDS.has_key(action_id) self.callback = callback self.channels = channels self.validator = validator self.checker = checker self.callable_args = callable_args self.validator_args = validator_args self.checker_args = checker_args self.widgets = [] self.menuitem = [] if channels: for channel in channels: events.connect(channel, self.receiver)
def __init__(self, presenter, parent, style=HORIZONTAL): self.presenter = presenter self.eventloop = presenter.eventloop self.style = style HPanel.__init__(self, parent) if not VFONT: load_font() size = config.ruler_size self.add((size, size)) self.default_cursor = self.GetCursor() if self.style == HORIZONTAL: self.guide_cursor = self.presenter.app.cursors[modes.HGUIDE_MODE] else: self.guide_cursor = self.presenter.app.cursors[modes.VGUIDE_MODE] self.SetBackgroundColour(wx.WHITE) self.SetDoubleBuffered(True) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_LEFT_DOWN, self.mouse_down) self.Bind(wx.EVT_LEFT_UP, self.mouse_up) self.Bind(wx.EVT_MOTION, self.mouse_move) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.capture_lost) self.eventloop.connect(self.eventloop.VIEW_CHANGED, self.repaint) events.connect(events.CONFIG_MODIFIED, self.check_config) if is_mac(): self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self._repaint_after) self.timer.Start(50)
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, style=HORIZONTAL): self.presenter = presenter self.eventloop = presenter.eventloop self.style = style HPanel.__init__(self, parent) if not VFONT: load_font() size = config.ruler_size self.add((size, size)) self.default_cursor = self.GetCursor() if self.style == HORIZONTAL: self.guide_cursor = self.presenter.app.cursors[modes.HGUIDE_MODE] else: self.guide_cursor = self.presenter.app.cursors[modes.VGUIDE_MODE] self.SetBackgroundColour(wx.WHITE) self.set_double_buffered() self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_LEFT_DOWN, self.mouse_down) self.Bind(wx.EVT_LEFT_UP, self.mouse_up) self.Bind(wx.EVT_MOTION, self.mouse_move) self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.capture_lost) self.eventloop.connect(self.eventloop.VIEW_CHANGED, self.repaint) events.connect(events.CONFIG_MODIFIED, self.check_config) if wal.is_msw(): self.SetDoubleBuffered(True) if is_mac(): self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self._repaint_after) self.timer.Start(50)
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 = [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) self.update()
def __init__( self, app, parent, val=0.0, step=1.0, onchange=None, onenter=None, can_be_negative=False): StaticUnitSpin.__init__( self, app, parent, val, step, onchange, onenter, can_be_negative) events.connect(events.DOC_MODIFIED, self.update_units) events.connect(events.DOC_CHANGED, self.update_units)
def __init__(self, master, callback): self.callback = callback wal.SpinButton.__init__(self, master, cmd=self._update_point_value, check_focus=True) self.update_increment() events.connect(events.CONFIG_MODIFIED, self._update_spin)
def __init__(self, app, parent, draw_top=True): self.app = app wal.HTabPanel.__init__(self, parent, draw_top=draw_top, painter_index=config.tab_style) self.ctx_menu = ContextMenu(app, self, ITEMS) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, master, app): self.app = app size = (-1, config.hpalette_cell_vertical) wal.CairoCanvas.__init__(self, master, size, has_tooltip=True) self.position = 0 self.max_pos = 0 self.max_position() events.connect(events.CMS_CHANGED, self.repaint_request)
def __init__(self, app, parent, draw_top=True): self.app = app wal.HTabPanel.__init__(self, parent, draw_top=draw_top, painter_index=config.tab_style) self.ctx_menu = ContextMenu(app, self, ITEMS) self.set_drop_target(wal.FileDropHandler(self, self.drop_file)) events.connect(events.CONFIG_MODIFIED, self.check_config)
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, app, mw): self.app = app self.mw = mw self.timer = wal.CanvasTimer(mw, 1000) self.mw.bind_timer(self.on_timer) self.socket = os.path.join(self.app.appdata.app_config_dir, 'socket') self.lock = os.path.join(self.app.appdata.app_config_dir, 'lock') events.connect(events.CONFIG_MODIFIED, self.check_config) if config.app_server: self.timer.start() with fsutils.uopen(self.lock, 'wb') as fp: fp.write('\n')
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 __init__(self, app, parent, draw_top=True): wal.DocTabs.__init__(self, parent, draw_top=draw_top, painter=config.tab_style) ITEMS = [ wal.ID_CLOSE, pdids.ID_CLOSE_OTHERS, wal.ID_CLOSE_ALL, None, wal.ID_NEW, wal.ID_OPEN, None, wal.ID_SAVE, wal.ID_SAVEAS, pdids.ID_SAVE_SEL, pdids.ID_SAVEALL, None, pdids.ID_IMPORT, pdids.ID_EXPORT, None, wal.ID_PRINT, None, wal.ID_PROPERTIES ] self.ctx_menu = ContextMenu(app, self, ITEMS) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, parent, app, hpal=True, on_left_click=None, on_right_click=None, onmin=None, onmax=None): self.hpal = hpal self.app = app self.cell_sizes = [] self.onmin = onmin self.onmax = onmax self.on_left_click = on_left_click self.on_right_click = on_right_click wal.VPanel.__init__(self, parent) wal.SensitiveCanvas.__init__(self, True) self.set_palette_size() events.connect(events.CONFIG_MODIFIED, self.config_update) events.connect(events.CMS_CHANGED, self.palette_refresh)
def __init__(self, app, master): self.app = app wal.HBox.__init__(self, master) self.set_border_width(2) self.pager = PagerWidget(self.app, self) self.pack(self.pager, padding=5) self.msg_label = wal.DecorLabel(self) self.pack(self.msg_label) self.cmw = ColorMonitorWidget(self.app, self) self.pack(self.cmw, end=True) events.connect(events.APP_STATUS, self.show_message)
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, docarea): gtk.DrawingArea.__init__(self) if not BITMAPS:load_bitmaps() self.docarea = docarea self.presenter = docarea.presenter self.eventloop = self.presenter.eventloop self.origin = self.presenter.model.doc_origin self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK) size = config.ruler_size self.set_size_request(size, size) self.connect(const.EVENT_EXPOSE, self.repaint) self.connect(const.EVENT_BUTTON_RELEASE, self.click_event) self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.check_coords) events.connect(events.CONFIG_MODIFIED, self.check_config)
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 __init__(self, mw): gtk.VBox.__init__(self) self.mw = mw self.app = mw.app self.nb = gtk.Notebook() self.nb.connect('switch-page', self.change_plugin) self.nb.set_property('scrollable', True) self.nb.set_tab_pos(gtk.POS_RIGHT) self.pack_start(self.nb, True, True, 0) self.set_size_request(200, -1) self.build_dict() events.connect(events.NO_DOCS, self.no_docs) events.connect(events.DOC_CHANGED, self.doc_changed)
def __init__(self, presenter, vertical=True): self.presenter = presenter self.eventloop = presenter.eventloop self.vertical = vertical Painter.__init__(self) mdi = self.presenter.app.mw.mdi self.dc = mdi.vruler if vertical else mdi.hruler if not VFONT: load_font(config.ruler_fg) self.default_cursor = self.dc.get_cursor() if not self.vertical: self.guide_cursor = self.presenter.app.cursors[modes.HGUIDE_MODE] else: self.guide_cursor = self.presenter.app.cursors[modes.VGUIDE_MODE] self.eventloop.connect(self.eventloop.VIEW_CHANGED, self.dc.refresh) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, docarea): gtk.DrawingArea.__init__(self) if not BITMAPS: load_bitmaps() self.docarea = docarea self.presenter = docarea.presenter self.eventloop = self.presenter.eventloop self.origin = self.presenter.model.doc_origin self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK) size = config.ruler_size self.set_size_request(size, size) self.connect(const.EVENT_EXPOSE, self.repaint) self.connect(const.EVENT_BUTTON_RELEASE, self.click_event) self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.check_coords) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, app, parent, val=0.0, step=1.0, onchange=None, onenter=None, can_be_negative=False): self.app = app self.insp = app.insp self.point_value = val self.ucallback = onchange val_range = (0.0, 100000.0) if can_be_negative:val_range = (-100000.0, 100000.0) if self.insp.is_doc(): self.units = app.current_doc.model.doc_units val = self.point_value * point_dict[self.units] FloatSpin.__init__(self, parent, val, val_range, step=step, width=5, onchange=self.update_point_value, onenter=onenter, spin_overlay=config.spin_overlay) events.connect(events.DOC_MODIFIED, self.update_units) events.connect(events.DOC_CHANGED, self.update_units) self._set_digits(unit_accuracy[self.units]) self.set_value(self.point_value * point_dict[self.units])
def __init__(self, app, mw): self.app = app self.mw = mw wx.Menu.__init__(self) self.empty_item = wx.MenuItem(self, wx.NewId(), _('Empty')) self.empty_item.Enable(False) self.items.append(self.AppendSeparator()) action = self.app.actions[pdids.ID_CLEAR_LOG] menuitem = ActionMenuItem(self.mw, self, action) self.AppendItem(menuitem) self.items.append(menuitem) self.persistent_items += self.items self.rebuild() events.connect(events.HISTORY_CHANGED, self.rebuild)
def build(self): spacer = gtk.VBox() self.add(spacer) self.set_border_width(5) doc_model = self.app.current_doc.doc_presenter.model self.listmodel = ObjectTreeModel(doc_model) self.treeview = gtk.TreeView() self.column = gtk.TreeViewColumn() self.column.set_title(_('Document Object Model')) render_pixbuf = gtk.CellRendererPixbuf() self.column.pack_start(render_pixbuf, expand=False) self.column.add_attribute(render_pixbuf, 'pixbuf', 0) render_text = gtk.CellRendererText() self.column.pack_start(render_text, expand=True) self.column.add_attribute(render_text, 'text', 1) self.treeview.append_column(self.column) self.column1 = gtk.TreeViewColumn() render_text = gtk.CellRendererText() self.column1.pack_start(render_text, expand=False) self.column1.add_attribute(render_text, 'text', 2) self.column1.add_attribute(render_text, 'foreground', 3) self.treeview.append_column(self.column1) self.treeview.connect('cursor-changed', self.view_object) self.scrolledwindow = gtk.ScrolledWindow() self.scrolledwindow.add(self.treeview) self.scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) self.scrolledwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) spacer.pack_end(self.scrolledwindow, True) self.treeview.set_model(self.listmodel) self.treeview.set_rules_hint(True) self.treeview.set_enable_tree_lines(True) self.expand_all() self.loaded = True events.connect(events.DOC_CHANGED, self.update_view) events.connect(events.DOC_MODIFIED, self.update_view)
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 __init__(self, docarea, orient): gtk.DrawingArea.__init__(self) if not VFONT: load_font() self.docarea = docarea self.app = docarea.app self.mw = docarea.app.mw self.orient = orient self.presenter = docarea.presenter self.eventloop = self.presenter.eventloop self.doc = self.presenter.model self.origin = self.presenter.model.doc_origin self.units = self.presenter.model.doc_units self.positions = None size = config.ruler_size if self.orient: self.set_size_request(size, -1) else: self.set_size_request(-1, size) self.default_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) if self.orient == HORIZONTAL: self.guide_cursor = self.app.cursors[modes.HGUIDE_MODE] else: self.guide_cursor = self.app.cursors[modes.VGUIDE_MODE] self.set_property(const.PROP_CAN_FOCUS, True) self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_RELEASE_MASK) self.pointer = [] self.draw_guide = False self.connect(const.EVENT_EXPOSE, self.repaint) self.connect(const.EVENT_BUTTON_PRESS, self.mouse_down) self.connect(const.EVENT_MOUSE_MOTION, self.mouse_move) self.connect(const.EVENT_BUTTON_RELEASE, self.mouse_up) self.eventloop.connect(self.eventloop.VIEW_CHANGED, self.repaint) self.eventloop.connect(self.eventloop.DOC_MODIFIED, self.check_doc) events.connect(events.CONFIG_MODIFIED, self.check_config)
def __init__(self, app, mw): self.app = app self.mw = mw wal.Menu.__init__(self) self.empty_item = wal.MenuItem(self, wal.new_id(), _('Empty')) if not wal.IS_WX3: self.empty_item.set_enable(False) self.items.append(self.append_separator()) action = self.app.actions[pdids.ID_CLEAR_LOG] menuitem = ActionMenuItem(self.mw, self, action) self.append_item(menuitem) self.items.append(menuitem) self.persistent_items += self.items self.rebuild() events.connect(events.HISTORY_CHANGED, self.rebuild)
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 __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) 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, master, app): self.app = app wal.NoteBook.__init__(self, master) self.set_property('scrollable', True) events.connect(events.DOC_CHANGED, self.doc_changed) events.connect(events.DOC_MODIFIED, self.doc_modified) events.connect(events.DOC_SAVED, self.doc_saved)
def __init__(self, app, parent): self.app = app self.insp = app.insp wal.HPanel.__init__(self, parent) spacer = (5, 30) self.add(spacer) for item in PLUGINS: self.plugins_dict[item.name] = item events.connect(events.NO_DOCS, self.rebuild) events.connect(events.DOC_CHANGED, self.rebuild) events.connect(events.SELECTION_CHANGED, self.rebuild) events.connect(events.MODE_CHANGED, self.rebuild) self.rebuild()
def __init__(self, app, master): wal.HidableHBox.__init__(self, master) self.app = app self.insp = app.inspector self.fill_label = FillLabel(self.app, self) self.pack(self.fill_label, padding=5) self.fill_swatch = ColorSwatch(self.app, FILL_SWATCH) self.pack(self.fill_swatch) self.outline_label = OutlineLabel(self.app, self) self.pack(self.outline_label, padding=5) self.outline_swatch = ColorSwatch(self.app, OUTLINE_SWATCH) self.pack(self.outline_swatch) events.connect(events.NO_DOCS, self.update) events.connect(events.DOC_CHANGED, self.update) events.connect(events.SELECTION_CHANGED, self.update) events.connect(events.DOC_MODIFIED, self.update) events.connect(events.CMS_CHANGED, 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, app): self.app = app wal.VPanel.__init__(self, parent) self.pack((25, 25)) self.stroke = AlphaColorSwatch(self, app.default_cms, [], border='news', onclick=self.stroke_click) self.stroke.set_position((5, 5)) self.fill = FillSwatch(self, app.default_cms, [], border='news', onclick=self.fill_click) self.fill.set_position((0, 0)) events.connect(events.DOC_CHANGED, self.doc_changed) events.connect(events.DOC_MODIFIED, self.doc_changed) events.connect(events.NO_DOCS, self.no_docs)
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, app, parent): self.app = app wal.HPanel.__init__(self, parent) self.pack(get_bmp(self.panel, icons.PD_MOUSE_MONITOR)) width = 100 if wal.is_mac(): width = 130 self.pointer_txt = wal.Label(self.panel, text=' ', fontsize=FONTSIZE[0]) self.pointer_txt.SetMinSize((width, -1)) self.pack(self.pointer_txt) self.pack(wal.VLine(self.panel), fill=True, padding=2) events.connect(events.MOUSE_STATUS, self.set_value) events.connect(events.NO_DOCS, self.hide_monitor) events.connect(events.DOC_CHANGED, self.doc_changed)
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, app, master): wal.HBox.__init__(self, master) self.app = app self.insp = self.app.inspector self.set_border_width(3) for item in PLUGINS: plg = item(self.app, self) self.plugins_dict[plg.name] = plg events.connect(events.NO_DOCS, self.rebuild) events.connect(events.DOC_CHANGED, self.rebuild) events.connect(events.SELECTION_CHANGED, self.rebuild) self.rebuild()
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, app, parent): self.app = app self.parent = parent wal.HPanel.__init__(self, parent) self.image_txt = wal.Label(self, text=_('Image type: '), fontsize=FONTSIZE[0]) self.pack(self.image_txt, padding=4) self.fill_txt = wal.Label(self, text=_('Fill:'), fontsize=FONTSIZE[0]) self.pack(self.fill_txt) self.fill_swatch = SB_FillSwatch(self, self.app, self.fill_txt, onclick=self.app.proxy.fill_dialog) self.pack(self.fill_swatch, padding=2) self.pack((5, 5)) self.stroke_txt = wal.Label(self, text=_('Stroke:'), fontsize=FONTSIZE[0]) self.pack(self.stroke_txt) self.stroke_swatch = SB_StrokeSwatch(self, self.app, self.stroke_txt, onclick=self.app.proxy.stroke_dialog) self.pack(self.stroke_swatch, padding=2) self.pack((5, 5)) self.Layout() events.connect(events.SELECTION_CHANGED, self.update) events.connect(events.DOC_CHANGED, self.update) events.connect(events.NO_DOCS, self.update)