def OnComponentTool(self, evt): '''Hadnler for creating new elements.''' comp = Manager.findById(evt.GetId()) # Check compatibility if Presenter.checkCompatibility(comp): g.undoMan.RegisterUndo(undo.UndoGlobal()) # !!! TODO if comp.groups[0] == 'component': node = Model.createComponentNode('Component') Presenter.create(comp, node) else: Presenter.create(comp) evt.Skip()
def OnComponentTool(self, evt): '''Hadnler for creating new elements.''' comp = Manager.findById(evt.GetId()) # Check compatibility if Presenter.checkCompatibility(comp): state = self.tree.GetFullState() # state just before if comp.groups[0] == 'component': node = Model.createComponentNode('Component') item = Presenter.create(comp, node) else: item = Presenter.create(comp) itemIndex = self.tree.ItemFullIndex(item) g.undoMan.RegisterUndo(undo.UndoPasteCreate(itemIndex, state)) evt.Skip()