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, 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, 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 __init__(self, parent, icon, tooltip='', border_side=RIGHT, onclick=None): self.icon = wx.ArtProvider.GetBitmap(icon) self.callback = onclick self.tooltip = tooltip self.border_side = border_side HPanel.__init__(self, parent) width = self.icon.GetSize()[0] + SCROLL_PADDING * 2 self.add((width, PANEL_HEIGHT)) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_LEFT_DOWN, self._on_left_down, self) self.Bind(wx.EVT_LEFT_UP, self._on_left_up, self) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.do_action)
def __init__(self, parent, doc, active=True): self.doc = doc self.parent = parent self.active = active self.text = self.doc.doc_name self.icon = wx.ArtProvider.GetBitmap(icons.DOCUMENT_ICON) self.close_but = wx.ArtProvider.GetBitmap(icons.PD_CLOSE_BUTTON_ACTIVE) self.inactive_close_but = wx.ArtProvider.GetBitmap(icons.PD_CLOSE_BUTTON) HPanel.__init__(self, parent) self.add((self.get_best_width(), TAB_HEIGHT)) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_MOTION, self._on_move, self) self.Bind(wx.EVT_LEFT_DOWN, self._on_left_down, self) self.Bind(wx.EVT_LEFT_UP, self._on_left_up, self) self.Bind(wx.EVT_LEAVE_WINDOW, self._on_win_leave, self)
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, doc, active=True): self.doc = doc self.parent = parent self.active = active self.text = self.doc.doc_name self.icon = wx.ArtProvider.GetBitmap(icons.DOCUMENT_ICON) self.close_but = wx.ArtProvider.GetBitmap(icons.PD_CLOSE_BUTTON_ACTIVE) self.inactive_close_but = wx.ArtProvider.GetBitmap( icons.PD_CLOSE_BUTTON) HPanel.__init__(self, parent) self.add((self.get_best_width(), TAB_HEIGHT)) self.Bind(wx.EVT_PAINT, self._on_paint, self) self.Bind(wx.EVT_MOTION, self._on_move, self) self.Bind(wx.EVT_LEFT_DOWN, self._on_left_down, self) self.Bind(wx.EVT_LEFT_UP, self._on_left_up, self) self.Bind(wx.EVT_LEAVE_WINDOW, self._on_win_leave, self)
def __init__(self, parent): HPanel.__init__(self, parent) self.left_scroll = TabScroller(self, icons.ARROW_LEFT, tooltip=_('Scroll tabs right'), onclick=self.scroll_left) self.add(self.left_scroll, 0, ALL | EXPAND) self.tabs_bg = TabsBgPanel(self) self.add(self.tabs_bg, 1, ALL | EXPAND) self.doc_tabs = DocTabs(self.tabs_bg, self.update_panel) self.tabs_bg.add(self.doc_tabs, 0, ALL | EXPAND) self.doc_tabs.SetPosition((0, 0)) self.right_scroll = TabScroller(self, icons.ARROW_RIGHT, tooltip=_('Scroll tabs left'), border_side=LEFT, onclick=self.scroll_right) self.add(self.right_scroll, 0, ALL | EXPAND) self.Bind(wx.EVT_SIZE, self.resize, self)
def __init__(self, parent): HPanel.__init__(self, parent) self.Bind(wx.EVT_PAINT, self._on_paint, self)
def __init__(self, parent, callback=None): HPanel.__init__(self, parent) self.callback = callback self.doc_tabs = [] self.add((PANEL_MARGIN, PANEL_HEIGHT)) self.Bind(wx.EVT_PAINT, self._on_paint, self)