def OnPasteAs(self, event): """Clipboard paste as event handler""" data = self.main_window.clipboard.get_clipboard() key = self.main_window.grid.actions.cursor with undo.group(_("Paste As...")): self.main_window.actions.paste_as(key, data) self.main_window.grid.ForceRefresh() event.Skip()
def OnCut(self, event): """Clipboard cut event handler""" entry_line = \ self.main_window.entry_line_panel.entry_line_panel.entry_line if wx.Window.FindFocus() != entry_line: selection = self.main_window.grid.selection with undo.group(_("Cut")): data = self.main_window.actions.cut(selection) self.main_window.clipboard.set_clipboard(data) self.main_window.grid.ForceRefresh() else: entry_line.Cut() event.Skip()
def OnPaste(self, event): """Clipboard paste event handler""" data = self.main_window.clipboard.get_clipboard() focus = self.main_window.FindFocus() if isinstance(focus, wx.TextCtrl): # Paste into TextCtrl if in focus focus.WriteText(data) else: # We got a grid selection key = self.main_window.grid.actions.cursor with undo.group(_("Paste")): self.main_window.actions.paste(key, data) self.main_window.grid.ForceRefresh() event.Skip()