Пример #1
0
 def OnData(self, x, y, d):
     view.testWin.RemoveHighlightDT()
     self.onHL = self.left = False
     self.GetData()
     id = int(self.do.GetDataHere())
     d,other = self.WhereToDrop(x, y, d)
     if d != wx.DragNone and other:
         obj,item = other
         g.Presenter.setData(item)
         comp = Manager.findById(id)
         mouseState = wx.GetMouseState()
         forceSibling = mouseState.ControlDown()
         forceInsert = mouseState.ShiftDown()
         g.Presenter.updateCreateState(forceSibling, forceInsert)
         if not g.Presenter.checkCompatibility(comp):
             return wx.DragNone
         item = g.Presenter.create(comp)
         node = view.tree.GetPyData(item)
         parentItem = view.tree.GetItemParent(item)
         parentNode = view.tree.GetPyData(parentItem)
         parentComp = Manager.getNodeComp(parentNode)
         # If pos if not set by default and parent is not a sizer, set pos to
         # drop coordinates
         if 'pos' in comp.attributes and not comp.getAttribute(node, 'pos') \
                and parentComp.isContainer() and \
                not parentComp.isSizer():
             # Calc relative coords
             rect = view.testWin.FindObjectRect(parentItem)
             x -= rect[0].x
             y -= rect[0].y
             comp.addAttribute(node, 'pos', '%d,%d' % (x, y))
             g.Presenter.setData(item)
         view.frame.SetStatusText('Object created')
     return d
Пример #2
0
 def OnData(self, x, y, d):
     view.testWin.RemoveHighlightDT()
     self.onHL = self.left = False
     self.GetData()
     id = int(self.do.GetDataHere())
     d, other = self.WhereToDrop(x, y, d)
     if d != wx.DragNone and other:
         obj, item = other
         g.Presenter.setData(item)
         comp = Manager.findById(id)
         mouseState = wx.GetMouseState()
         forceSibling = mouseState.ControlDown()
         forceInsert = mouseState.ShiftDown()
         g.Presenter.updateCreateState(forceSibling, forceInsert)
         if not g.Presenter.checkCompatibility(comp):
             return wx.DragNone
         item = g.Presenter.create(comp)
         node = view.tree.GetPyData(item)
         parentItem = view.tree.GetItemParent(item)
         parentNode = view.tree.GetPyData(parentItem)
         parentComp = Manager.getNodeComp(parentNode)
         # If pos if not set by default and parent is not a sizer, set pos to
         # drop coordinates
         if 'pos' in comp.attributes and not comp.getAttribute(node, 'pos') \
                and parentComp.isContainer() and \
                not parentComp.isSizer():
             # Calc relative coords
             rect = view.testWin.FindObjectRect(parentItem)
             x -= rect[0].x
             y -= rect[0].y
             comp.addAttribute(node, 'pos', '%d,%d' % (x, y))
             g.Presenter.setData(item)
         view.frame.SetStatusText('Object created')
     return d
 def OnComponentReplace(self, evt):
     '''Hadnler for creating new elements.'''
     comp = Manager.findById(evt.GetId() - ID.SHIFT)
     item = self.tree.GetSelection()
     index = self.tree.ItemFullIndex(item)
     oldComp = Presenter.comp
     oldNode = Presenter.replace(comp)
     g.undoMan.RegisterUndo(undo.UndoReplace(index, oldComp, oldNode))
Пример #4
0
 def OnComponentReplace(self, evt):
     '''Hadnler for creating new elements.'''
     comp = Manager.findById(evt.GetId() - ID.SHIFT)
     item = self.tree.GetSelection()
     index = self.tree.ItemFullIndex(item)
     oldComp = Presenter.comp
     oldNode = Presenter.replace(comp)
     g.undoMan.RegisterUndo(undo.UndoReplace(index, oldComp, oldNode))
Пример #5
0
 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)
Пример #6
0
 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 OnComponentCreate(self, evt):
     '''Hadnler for creating new elements.'''
     state = self.tree.GetFullState()  # state just before
     comp = Manager.findById(evt.GetId())
     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))
Пример #8
0
 def OnComponentCreate(self, evt):
     '''Hadnler for creating new elements.'''
     state = self.tree.GetFullState() # state just before
     comp = Manager.findById(evt.GetId())
     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))
Пример #9
0
 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)
Пример #10
0
 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)