本文整理汇总了Python中component.Manager.findById方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.findById方法的具体用法?Python Manager.findById怎么用?Python Manager.findById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类component.Manager
的用法示例。
在下文中一共展示了Manager.findById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnData
# 需要导入模块: from component import Manager [as 别名]
# 或者: from component.Manager import findById [as 别名]
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: OnComponentReplace
# 需要导入模块: from component import Manager [as 别名]
# 或者: from component.Manager import findById [as 别名]
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))
示例3: OnComponentCreate
# 需要导入模块: from component import Manager [as 别名]
# 或者: from component.Manager import findById [as 别名]
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)
示例4: OnComponentCreate
# 需要导入模块: from component import Manager [as 别名]
# 或者: from component.Manager import findById [as 别名]
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))
示例5: OnComponentReplace
# 需要导入模块: from component import Manager [as 别名]
# 或者: from component.Manager import findById [as 别名]
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)