def OnPasteSibling(self, evt): '''ID.PASTE_SIBLING handler.''' forceSibling = True state = wx.GetMouseState() forceInsert = state.ShiftDown() g.Presenter.updateCreateState(forceSibling, forceInsert) g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO Presenter.paste()
def OnCmdPaste(self, evt): '''ID.PASTE handler (for Edit menu and shortcuts).''' state = wx.GetMouseState() forceSibling = state.AltDown() forceInsert = state.ShiftDown() g.Presenter.updateCreateState(forceSibling, forceInsert) g.undoMan.RegisterUndo(undo.UndoGlobal()) Presenter.paste()
def OnComponentCreate(self, evt): '''Hadnler for creating new elements.''' comp = Manager.findById(evt.GetId()) g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO if comp.groups[0] == 'component': node = Model.createComponentNode('Component') Presenter.create(comp, node) else: Presenter.create(comp)
def OnDelete(self, evt): '''wx.ID_DELETE handler.''' if len(self.tree.GetSelections()) == 1: item = self.tree.GetSelection() index = self.tree.ItemFullIndex(item) node = Presenter.delete(self.tree.GetSelection()) g.undoMan.RegisterUndo(undo.UndoCutDelete(index, node)) else: g.undoMan.RegisterUndo(undo.UndoGlobal()) Presenter.deleteMany(self.tree.GetSelections())
def OnToolPaste(self, evt): '''frame.ID_TOOL_PASTE handler.''' state = wx.GetMouseState() # Ctrl+click does not work with tools on Mac, Alt+click often # bound to window move on wxGTK if wx.Platform == '__WXMAC__': forceSibling = state.AltDown() else: forceSibling = state.ControlDown() forceInsert = state.ShiftDown() g.Presenter.updateCreateState(forceSibling, forceInsert) g.undoMan.RegisterUndo(undo.UndoGlobal()) Presenter.paste()
def OnMoveRight(self, evt): self.inIdle = True g.undoMan.RegisterUndo(undo.UndoGlobal()) Presenter.moveRight() self.inIdle = False
def OnMenuPaste(self, evt): '''wx.ID_PASTE handler (for XMLTreeMenu).''' g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO Presenter.paste()
def OnCut(self, evt): '''wx.ID_CUT handler.''' g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO Presenter.cut()
def OnComponentReplace(self, evt): '''Hadnler for creating new elements.''' comp = Manager.findById(evt.GetId() - ID.SHIFT) g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO Presenter.replace(comp)