def __init__(self, *args, **kwds): # begin wxGlade: FindPanel.__init__ bp.ButtonPanel.__init__(self, *args, **kwds) self.search_ctrl = wx.SearchCtrl(self, -1, style=wx.TE_PROCESS_ENTER) self.case_sensitive_chk = wx.CheckBox(self, -1, _("Case sensitive")) self.__set_properties() # end wxGlade btn = bp.ButtonInfo(self, bmp=images.fileclose.Bitmap, shortHelp=_("Close the find panel")) btn.SetTextAlignment(bp.BP_BUTTONTEXT_ALIGN_RIGHT) self.AddButton(btn) self.close_id = btn.Id self.AddControl(self.search_ctrl, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3) btn = bp.ButtonInfo(self, bmp=images.down.Bitmap, text=_("Next"), shortHelp=_("Find next occurence of the text")) btn.SetTextAlignment(bp.BP_BUTTONTEXT_ALIGN_RIGHT) self.AddButton(btn) self.next_id = btn.Id btn = bp.ButtonInfo(self, bmp=images.up.Bitmap, text=_("Previous"), shortHelp=_("Find previous occurence of the text")) btn.SetTextAlignment(bp.BP_BUTTONTEXT_ALIGN_RIGHT) self.AddButton(btn) self.previous_id = btn.Id # btn = bp.ButtonInfo(self, bmp=images.pencil.Bitmap, kind=wx.ITEM_CHECK, text=_("Highlight all"), shortHelp=_("Highlight all occurences of the text")) # btn.SetTextAlignment(bp.BP_BUTTONTEXT_ALIGN_RIGHT) # self.AddButton(btn) # self.highlight_id = btn.GetId() self.AddControl(self.case_sensitive_chk, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 3) btn.SetTextAlignment(bp.BP_BUTTONTEXT_ALIGN_RIGHT) self.DoLayout()
def ask_note_name(self): dlg = wx.TextEntryDialog(self, _('Enter the note name:'), _('Note name'), '') name = '' if dlg.ShowModal() == wx.ID_OK: name = dlg.GetValue() dlg.Destroy() return name
def __set_properties(self): # begin wxGlade: OpenDialog.__set_properties self.SetTitle(_("Open note")) self.SetSize((300, 300)) # end wxGlade self.ok_btn.SetDefault() if self.matching_lst.Count: self.matching_lst.SetSelection(0)
def __init__(self, error, tb, *args, **kwds): self.REQUEST_REPORT_TXT = _("If you think this may be a bug, please report it. Thank you.") self.REPORT_INSTRUCTIONS_TXT = _("Please copy the error information below and click the link in order to report this error.") error_msg = _('An error has ocurred:') + '\n' error_msg += error error_details = tb error_details += '\n%s %s' % (meta.APPNAME, meta.VERSION) # begin wxGlade: ErrorDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME wx.Dialog.__init__(self, *args, **kwds) self.error_bmp = wx.StaticBitmap(self, -1, wx.NullBitmap) self.error_lbl = wx.StaticText(self, -1, error_msg) self.feedback_lbl = wx.StaticText(self, -1, self.REQUEST_REPORT_TXT) self.traceback_txt = wx.TextCtrl(self, -1, error_details, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_NOHIDESEL) self.copy_btn = wx.Button(self, -1, _("&Copy error information")) self.report_link = hl.HyperLinkCtrl(self, -1, _('Report error'), URL=meta.REPORT_URL) self.report_btn = wx.Button(self, -1, _("&Report error")) self.ok_btn = wx.Button(self, wx.ID_OK, _("&OK")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_report_click, self.report_btn) self.Bind(wx.EVT_BUTTON, self.on_copy_click, self.copy_btn) self.Bind(wx.EVT_BUTTON, self.on_ok_click, self.ok_btn)
def __init__(self, parent, notes_names): notes_names.sort(key=alphanum_key) # begin wxGlade: OpenDialog.__init__ wx.Dialog.__init__(self, parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME) self.select_lbl = wx.StaticText(self, -1, _("Select a note to open:")) self.filter_txt = wx.TextCtrl(self, -1, "") self.matching_lst = wx.ListBox(self, -1, choices=notes_names) self.ok_btn = wx.Button(self, wx.ID_OK, _("&OK")) self.cancel_btn = wx.Button(self, wx.ID_CANCEL, _("&Cancel")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_filter_text, self.filter_txt) self.Bind(wx.EVT_BUTTON, self.on_ok_click, id=wx.ID_OK) # end wxGlade self.filter_txt.Bind(wx.EVT_KEY_DOWN, self.on_filter_key_down) self.notes_names = notes_names
def __set_properties(self): # begin wxGlade: ErrorDialog.__set_properties self.SetTitle(_("Error")) # end wxGlade self.traceback_txt.Show(False) self.copy_btn.Show(False) self.report_link.Show(False) bmp = wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_MESSAGE_BOX, (32, 32)) self.error_bmp.SetBitmap(bmp) self.traceback_txt.SetSelection(-1, -1) self.ok_btn.SetDefault() self.ok_btn.SetFocus()
def __set_properties(self): # begin wxGlade: OptionsDialog.__set_properties self.SetTitle(_("Options")) # end wxGlade if self.options.key_code is None or self.options.modifiers is None: self.hotkey.Clear() else: self.hotkey.SetHotkey(self.options.key_code, self.options.modifiers, False) font = wx.NORMAL_FONT if self.options.font: font = wx.FontFromNativeInfoString(self.options.font) if not font.Ok(): font = wx.NORMAL_FONT self.font = font
def __init__(self, parent, options): self.options = options # begin wxGlade: OptionsDialog.__init__ style = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.THICK_FRAME wx.Dialog.__init__(self, parent, style=style) self.main_notebook = wx.Notebook(self, -1, style=0) self.view_pane = wx.Panel(self.main_notebook, -1) self.font_lbl = wx.StaticText(self.view_pane, -1, _("Font")) self.current_font_lbl = wx.StaticText(self.view_pane, -1, "Super long dummy font name 10") self.font_btn = wx.Button(self.view_pane, -1, _("Change...")) self.hotkey_lbl = wx.StaticText(self.view_pane, -1, _("Hotkey")) self.hotkey = HotkeyCtrl(self.view_pane, -1) self.btn_ok = wx.Button(self, wx.ID_OK, "") self.btn_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.on_font_change_click, self.font_btn) self.Bind(wx.EVT_BUTTON, self.on_ok_click, self.btn_ok) self.Bind(wx.EVT_BUTTON, self.on_cancel_click, self.btn_cancel) # end wxGlade self._set_font(self.font)
def __do_layout(self): # begin wxGlade: OptionsDialog.__do_layout main_sizer = wx.BoxSizer(wx.VERTICAL) std_diag_sizer = wx.StdDialogButtonSizer() view_sizer = wx.BoxSizer(wx.VERTICAL) font_sizer = wx.BoxSizer(wx.HORIZONTAL) view_sizer.Add(self.font_lbl, 0, wx.LEFT|wx.RIGHT|wx.TOP, 5) font_sizer.Add(self.current_font_lbl, 1, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 10) font_sizer.Add(self.font_btn, 0, wx.ALIGN_CENTER_VERTICAL, 0) view_sizer.Add(font_sizer, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 5) view_sizer.Add(self.hotkey_lbl, 0, wx.LEFT|wx.RIGHT|wx.TOP, 5) view_sizer.Add(self.hotkey, 1, wx.ALL, 5) self.view_pane.SetSizer(view_sizer) self.main_notebook.AddPage(self.view_pane, _("View")) main_sizer.Add(self.main_notebook, 1, wx.ALL|wx.EXPAND, 5) std_diag_sizer.AddButton(self.btn_ok) std_diag_sizer.AddButton(self.btn_cancel) std_diag_sizer.Realize() main_sizer.Add(std_diag_sizer, 0, wx.ALL|wx.EXPAND, 5) self.SetSizer(main_sizer) main_sizer.Fit(self) self.Layout() # end wxGlade self.main_sizer = main_sizer
def _get_commands(self): commands = [] note_cat = CommandCategory(_("&Note")) note_cat.append( Command( 10001, _("&New..."), _("Create a new note"), self.control.notes.create_new, [Shortcut(wx.ACCEL_CTRL, ord("N"))], ) ) note_cat.append( Command( 10005, _("&Open..."), _("Open a previously created note"), self.control.notes.open_note, [Shortcut(wx.ACCEL_CTRL, ord("O"))], ) ) note_cat.append( Command( 10002, _("&Close"), _("Close the opened note"), self.control.notes.close_current, [Shortcut(wx.ACCEL_CTRL, ord("W"))], ) ) note_cat.append( Command( 10006, _("Move &right"), _("Moved the opened note to the right"), partial(pub.sendMessage, "note.move_right"), [Shortcut(wx.ACCEL_CTRL | wx.ACCEL_SHIFT, wx.WXK_PAGEDOWN)], ) ) note_cat.append( Command( 10007, _("Move &left"), _("Moved the opened note to the left"), partial(pub.sendMessage, "note.move_left"), [Shortcut(wx.ACCEL_CTRL | wx.ACCEL_SHIFT, wx.WXK_PAGEUP)], ) ) note_cat.append(None) note_cat.append( Command( 10003, _("O&ptions..."), _("Open the application options"), self.control.open_options, [Shortcut(wx.ACCEL_NORMAL, wx.WXK_F4)], ) ) note_cat.append(None) note_cat.append( Command( 10004, _("&Quit"), _("Quit the application"), self.control.quit, [Shortcut(wx.ACCEL_CTRL, ord("Q"))] ) ) commands.append(note_cat) edit_cat = CommandCategory(_("&Edit")) edit_cat.append( Command( 30001, _("&Find"), _("Find some text in the current note"), self.control.find, [Shortcut(wx.ACCEL_CTRL, ord("F"))], ) ) edit_cat.append( Command( 30002, _("&Delete line"), _("Delete the current line"), partial(pub.sendMessage, "note.edit.delete_line"), [Shortcut(wx.ACCEL_CTRL, ord("D"))], ) ) edit_cat.append( Command( 30003, _("Du&plicate lines"), _("Duplicate (below) the current line or the selected lines below"), partial(pub.sendMessage, "note.edit.duplicate_lines"), [Shortcut(wx.ACCEL_ALT | wx.ACCEL_SHIFT, wx.WXK_DOWN)], ) ) edit_cat.append( Command( 30004, _("Cop&y lines"), _("Copy (above) the current line or the selected lines below"), partial(pub.sendMessage, "note.edit.copy_lines"), [Shortcut(wx.ACCEL_ALT | wx.ACCEL_SHIFT, wx.WXK_UP)], ) ) edit_cat.append( Command( 30005, _("Move lines do&wn"), _("Move the current line or the selected lines down"), partial(pub.sendMessage, "note.edit.move_lines_down"), [Shortcut(wx.ACCEL_ALT, wx.WXK_DOWN)], ) ) edit_cat.append( Command( 30006, _("Move lines &up"), _("Move the current line or the selected lines up"), partial(pub.sendMessage, "note.edit.move_lines_up"), [Shortcut(wx.ACCEL_ALT, wx.WXK_UP)], ) ) commands.append(edit_cat) program_cat = CommandCategory(_("&Program"), hidden=True) program_cat.append( Command( 20001, _("&Hide"), _("Minimize the program to the notification area"), self.control.hide, [Shortcut(wx.ACCEL_NORMAL, wx.WXK_ESCAPE)], ) ) commands.append(program_cat) return commands