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, app, mw): self.app = app self.mw = mw wx.Menu.__init__(self) self.empty_item = wx.MenuItem(self, wal.new_id(), _('Empty')) if not wal.is_wx3(): 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 __init__(self, app, mw): self.app = app self.mw = mw wx.Menu.__init__(self) self.empty_item = wx.MenuItem(self, wal.new_id(), _("Empty")) if not wal.is_wx3(): 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)