PLCOpenEditor.py
changeset 587 98445f90f45d
parent 586 9aa96a36cf33
child 599 4bb7b132e15d
equal deleted inserted replaced
586:9aa96a36cf33 587:98445f90f45d
   273 def GetShortcutKeyCallbackFunction(viewer_function):
   273 def GetShortcutKeyCallbackFunction(viewer_function):
   274     def ShortcutKeyFunction(self, event):
   274     def ShortcutKeyFunction(self, event):
   275         control = self.FindFocus()
   275         control = self.FindFocus()
   276         if control.GetName() in ["Viewer", "TextViewer"]:
   276         if control.GetName() in ["Viewer", "TextViewer"]:
   277             getattr(control.Parent, viewer_function)()
   277             getattr(control.Parent, viewer_function)()
       
   278         elif isinstance(control, wx.stc.StyledTextCtrl):
       
   279             getattr(control, viewer_function)()
   278         elif isinstance(control, wx.TextCtrl):
   280         elif isinstance(control, wx.TextCtrl):
   279             control.ProcessEvent(event)
   281             control.ProcessEvent(event)
   280     return ShortcutKeyFunction
   282     return ShortcutKeyFunction
   281 
   283 
   282 def GetParentName(tree, item, parent_type):
   284 def GetParentName(tree, item, parent_type):
   316                 event(self, id, function)
   318                 event(self, id, function)
   317             else:
   319             else:
   318                 event(self, function)
   320                 event(self, function)
   319     
   321     
   320     def _init_coll_MenuBar_Menus(self, parent):
   322     def _init_coll_MenuBar_Menus(self, parent):
   321         parent.Append(menu=self.FileMenu, title=_(u'File'))
   323         parent.Append(menu=self.FileMenu, title=_(u'&File'))
   322         parent.Append(menu=self.EditMenu, title=_(u'Edit'))
   324         parent.Append(menu=self.EditMenu, title=_(u'&Edit'))
   323         parent.Append(menu=self.DisplayMenu, title=_(u'Display'))
   325         parent.Append(menu=self.DisplayMenu, title=_(u'&Display'))
   324         parent.Append(menu=self.HelpMenu, title=_(u'Help'))
   326         parent.Append(menu=self.HelpMenu, title=_(u'&Help'))
   325 
   327 
   326     def _init_coll_FileMenu_Items(self, parent):
   328     def _init_coll_FileMenu_Items(self, parent):
   327         pass
   329         pass
   328     
   330     
   329     def _init_coll_EditMenu_Items(self, parent):
   331     def _init_coll_EditMenu_Items(self, parent):
  1060     OnCopyMenu = GetShortcutKeyCallbackFunction("Copy")
  1062     OnCopyMenu = GetShortcutKeyCallbackFunction("Copy")
  1061     OnPasteMenu = GetShortcutKeyCallbackFunction("Paste")
  1063     OnPasteMenu = GetShortcutKeyCallbackFunction("Paste")
  1062 
  1064 
  1063     def OnSelectAllMenu(self, event):
  1065     def OnSelectAllMenu(self, event):
  1064         control = self.FindFocus()
  1066         control = self.FindFocus()
  1065         if control.GetName() in ["Viewer", "TextViewer"]:
  1067         if control.GetName() == "Viewer":
  1066             control.Parent.SelectAll()
  1068             control.Parent.SelectAll()
       
  1069         elif isinstance(control, wx.stc.StyledTextCtrl):
       
  1070             control.SelectAll()
  1067         elif isinstance(control, wx.TextCtrl):
  1071         elif isinstance(control, wx.TextCtrl):
  1068             control.SetSelection(0, control.GetLastPosition())
  1072             control.SetSelection(0, control.GetLastPosition())
  1069         elif isinstance(control, wx.ComboBox):
  1073         elif isinstance(control, wx.ComboBox):
  1070             control.SetMark(0, control.GetLastPosition() + 1)
  1074             control.SetMark(0, control.GetLastPosition() + 1)
  1071     
  1075