diff --git a/tmpNote.py b/tmpNote.py index cadfec6..32057e3 100755 --- a/tmpNote.py +++ b/tmpNote.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # -*- coding: utf-8 -*- import wx @@ -276,25 +276,27 @@ def menu_bar(self): editmenu.AppendSeparator() editmenu.Append(wx.ID_CUT, 'Cut\tCtrl+X', 'Cut selection from file.') self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_CUT) - editmenu.Append(wx.ID_COPY, '&Copy\tCtrl+C', - 'Copy selection from file.') + editmenu.Append( + wx.ID_COPY, '&Copy\tCtrl+C', 'Copy selection from file.' + ) self.Bind( - wx.EVT_MENU, - self.cut_copy_paste_del_sel_event, - id=wx.ID_COPY + wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_COPY + ) + editmenu.Append( + wx.ID_PASTE, '&Paste\tCtrl+V', 'Paste clipboard into file.' ) - editmenu.Append(wx.ID_PASTE, '&Paste\tCtrl+V', - 'Paste clipboard into file.') self.Bind( wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_PASTE ) editmenu.Append(wx.ID_DELETE, 'Delete', 'Delete the selected text.') - self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, - id=wx.ID_DELETE) + self.Bind( + wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_DELETE + ) editmenu.AppendSeparator() editmenu.Append(wx.ID_SELECTALL, 'Select All', 'Select all text.') - self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, - id=wx.ID_SELECTALL) + self.Bind( + wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_SELECTALL + ) # findmenu = wx.Menu() # menubar.Append(findmenu, 'F&ind') @@ -1072,10 +1074,10 @@ def close_all_action(self): def cut_copy_paste_del_sel_event(self, event): """Event requesting cut, copy, paste, delete, or select all text.""" - if event.GetId() == ( - wx.ID_CUT or wx.ID_COPY or wx.ID_PASTE or wx.ID_DELETE or - wx.ID_SELECTALL - ): + ids = set(( + wx.ID_CUT, wx.ID_COPY, wx.ID_PASTE, wx.ID_DELETE, wx.ID_SELECTALL + )) + if event.GetId() in ids: self.cut_copy_paste_del_sel_action(event) else: event.Skip() @@ -1084,7 +1086,6 @@ def cut_copy_paste_del_sel_action(self, event): """Cut, copy, paste, delete, or select all text.""" self.show_notebook_if_not_shown() - text = self.FindFocus() if text is not None: if event.GetId() == wx.ID_CUT: