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) txt = _('Make backup on document save') self.backup = wal.Checkbox(self, txt, config.make_backup) self.pack(self.backup, align_center=False) txt = _('Make backup on export') self.expbackup = wal.Checkbox(self, txt, config.make_export_backup) self.pack(self.expbackup, align_center=False) 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), spin_overlay=config.spin_overlay) 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), spin_overlay=config.spin_overlay) grid.pack(self.hist_menu_size) grid.pack(wal.Label(grid, _('records'))) self.pack(grid, align_center=False, padding=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 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 config.is_ubuntu(): txt = _('Ubuntu 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
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() if not config.is_mac(): config.spin_overlay = self.spin_overlay.get_value() if config.is_ubuntu(): config.ubuntu_global_menu = self.ubuntu_gm.get_value() config.ubuntu_scrollbar_overlay = self.ubuntu_overlay.get_value()
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']) if not config.is_mac(): self.spin_overlay.set_value(defaults['spin_overlay']) if config.is_ubuntu(): self.ubuntu_gm.set_value(defaults['ubuntu_global_menu']) self.ubuntu_overlay.set_value(defaults['ubuntu_scrollbar_overlay'])
def __init__(self, mw, parent, action): self.mw = mw self.parent = parent self.action = action action_id = action.action_id text = self.action.get_menu_text() if self.action.is_acc: text += '\t' + self.action.get_shortcut_text() wx.MenuItem.__init__(self, parent, action_id, text=text) if not config.is_mac() and self.action.is_icon: bmp = self.action.get_icon(config.menu_size, wx.ART_MENU) if bmp: self.SetBitmap(bmp) self.action.register_as_menuitem(self) self.mw.Bind(wx.EVT_MENU, self.action.do_call, id=action_id) if self.action.is_toggle(): self.SetCheckable(True)