Skip to content

Commit 16ea88e

Browse files
committed
Replaced bad if statement
Used a set of "ids", then did "if event.GetId() in ids"
1 parent 022be8f commit 16ea88e

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

tmpNote.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

44
import wx
@@ -276,25 +276,15 @@ def menu_bar(self):
276276
editmenu.AppendSeparator()
277277
editmenu.Append(wx.ID_CUT, 'Cut\tCtrl+X', 'Cut selection from file.')
278278
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_CUT)
279-
editmenu.Append(wx.ID_COPY, '&Copy\tCtrl+C',
280-
'Copy selection from file.')
281-
self.Bind(
282-
wx.EVT_MENU,
283-
self.cut_copy_paste_del_sel_event,
284-
id=wx.ID_COPY
285-
)
286-
editmenu.Append(wx.ID_PASTE, '&Paste\tCtrl+V',
287-
'Paste clipboard into file.')
288-
self.Bind(
289-
wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_PASTE
290-
)
279+
editmenu.Append(wx.ID_COPY, '&Copy\tCtrl+C', 'Copy selection from file.')
280+
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_COPY)
281+
editmenu.Append(wx.ID_PASTE, '&Paste\tCtrl+V', 'Paste clipboard into file.')
282+
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_PASTE)
291283
editmenu.Append(wx.ID_DELETE, 'Delete', 'Delete the selected text.')
292-
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event,
293-
id=wx.ID_DELETE)
284+
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_DELETE)
294285
editmenu.AppendSeparator()
295286
editmenu.Append(wx.ID_SELECTALL, 'Select All', 'Select all text.')
296-
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event,
297-
id=wx.ID_SELECTALL)
287+
self.Bind(wx.EVT_MENU, self.cut_copy_paste_del_sel_event, id=wx.ID_SELECTALL)
298288

299289
# findmenu = wx.Menu()
300290
# menubar.Append(findmenu, 'F&ind')
@@ -1072,10 +1062,8 @@ def close_all_action(self):
10721062
def cut_copy_paste_del_sel_event(self, event):
10731063
"""Event requesting cut, copy, paste, delete, or select all text."""
10741064

1075-
if event.GetId() == (
1076-
wx.ID_CUT or wx.ID_COPY or wx.ID_PASTE or wx.ID_DELETE or
1077-
wx.ID_SELECTALL
1078-
):
1065+
ids = set((wx.ID_CUT, wx.ID_COPY, wx.ID_PASTE, wx.ID_DELETE, wx.ID_SELECTALL))
1066+
if event.GetId() in ids:
10791067
self.cut_copy_paste_del_sel_action(event)
10801068
else:
10811069
event.Skip()
@@ -1084,7 +1072,6 @@ def cut_copy_paste_del_sel_action(self, event):
10841072
"""Cut, copy, paste, delete, or select all text."""
10851073

10861074
self.show_notebook_if_not_shown()
1087-
10881075
text = self.FindFocus()
10891076
if text is not None:
10901077
if event.GetId() == wx.ID_CUT:

0 commit comments

Comments
 (0)