Bug forbidding copy, cut, paste and F2 on grid cells fixed
authorlbessard
Fri, 18 Jul 2008 14:41:32 +0200
changeset 223 ea857c3a0427
parent 222 8ce5c2635976
child 224 e5bf78b847e1
Bug forbidding copy, cut, paste and F2 on grid cells fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Fri Jul 18 14:34:06 2008 +0200
+++ b/PLCOpenEditor.py	Fri Jul 18 14:41:32 2008 +0200
@@ -312,15 +312,15 @@
     def _init_coll_HelpMenu_Items(self, parent):
         AppendMenu(parent, help='', id=wx.ID_HELP, 
             kind=wx.ITEM_NORMAL, text=u'PLCOpenEditor\tF1')
-        AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
-              kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
+        #AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
+        #      kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
         #AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
         #      kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
         if self.ModeSolo:
             AppendMenu(parent, help='', id=wx.ID_ABOUT,
                   kind=wx.ITEM_NORMAL, text=u'About')
         self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP)
-        self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS)
+        #self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS)
         self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
 
     def _init_utils(self):
@@ -975,30 +975,27 @@
         event.Skip()
 
     def OnCutMenu(self, event):
-        selected = self.GetPageSelection()
-        if selected != -1:
-            try:
-                self.GetPage(selected).Cut()
-            except:
-                pass
+        control = self.FindFocus()
+        if isinstance(control, Viewer):
+            control.Cut()
+        else:
+            control.ProcessEvent(event)
         event.Skip()
     
     def OnCopyMenu(self, event):
-        selected = self.GetPageSelection()
-        if selected != -1:
-            try:
-                self.GetPage(selected).Copy()
-            except:
-                pass
+        control = self.FindFocus()
+        if isinstance(control, Viewer):
+            control.Copy()
+        else:
+            control.ProcessEvent(event)
         event.Skip()
     
     def OnPasteMenu(self, event):
-        selected = self.GetPageSelection()
-        if selected != -1:
-            try:
-                self.GetPage(selected).Paste()
-            except:
-                pass
+        control = self.FindFocus()
+        if isinstance(control, Viewer):
+            control.Paste()
+        else:
+            control.ProcessEvent(event)
         event.Skip()
     
     def OnDeleteMenu(self, event):
@@ -2066,7 +2063,7 @@
     
     def OnPLCOpenEditorMenu(self, event):
         wx.MessageBox("No documentation available.\nComing soon.")
-        event.Skip()
+        #event.Skip()
         
     def OnPLCOpenMenu(self, event):
         open_pdf(os.path.join(CWD, "plcopen", "TC6_XML_V101.pdf"))