def DebugPinInfo(pinID, value): nodeID = interface.GetNodeIDByPinID(pinID) sNodeDisplayName = interface.GetNodeAttr(nodeID, bddefine.NodeAttrName.DISPLAYNAME) sPinDisplayName = interface.GetPinAttr(pinID, bddefine.PinAttrName.DISPLAYNAME) misc.Debug("%s-%s: %s\t%s" % (sNodeDisplayName, sPinDisplayName, value, type(value)))
def __init__(self, pinID, parent=None): super(CTypeButton, self).__init__(parent) self.m_PinID = pinID self.m_NodeID = interface.GetNodeIDByPinID(pinID) self.m_GraphicID = interface.GetGraphicIDByNodeID(self.m_NodeID) self.m_IsInputPin = interface.IsInputPin(pinID) self.m_Center = None self._InitUI() GetUIMgr().AddPinBtnUI(pinID, self)
def UpdatePosition(self): startPinUI = GetUIMgr().GetPinBtnUI(self.m_StartPinID) nodeID = interface.GetNodeIDByPinID(self.m_StartPinID) nodeUI = GetUIMgr().GetNodeUI(nodeID) if startPinUI: self.m_StartPoint = startPinUI.GetScenePos() if self.m_EndPinID: endPinUI = GetUIMgr().GetPinBtnUI(self.m_EndPinID) self.m_EndPoint = endPinUI.GetScenePos() else: self.m_EndPoint = nodeUI.scene().GetMouseScenePos(QCursor.pos()) self.prepareGeometryChange() self.RecalculateShapeAndBount()
def contextMenuEvent(self, event): super(CPinUI, self).contextMenuEvent(event) lstLineID = interface.GetAllLineByPin(self.m_PinID) menu = QMenu() for lineID in lstLineID: oPinID = interface.GetLineOtherPin(lineID, self.m_PinID) sPinDisplayName = interface.GetPinAttr(oPinID, bddefine.PinAttrName.DISPLAYNAME) nodeID = interface.GetNodeIDByPinID(oPinID) sNodeDisplayName = interface.GetNodeAttr(nodeID, bddefine.NodeAttrName.DISPLAYNAME) sMsg = "删除与\"%s\"-\"%s\"的连线" % (sNodeDisplayName, sPinDisplayName) func = functor.Functor(interface.DelLine, lineID) menu.addAction(sMsg, func) menu.exec_(QCursor.pos()) event.accept()
def __init__(self, pinID, parent=None): super(CPinUI, self).__init__(parent) self.m_PinID = pinID self.m_NodeID = interface.GetNodeIDByPinID(pinID) self.m_GraphicID = interface.GetGraphicIDByNodeID(self.m_NodeID) self.m_Btn = None self.m_Label = None self.m_HLayout = None self.m_DefaultWidget = None # 默认值控件 self._InitUI() self.SetIcon() self.SetText() self.ShowDefaultWidget() GetUIMgr().AddPinUI(pinID, self)
def S_FocusItem(self, oModelIndex): """ oModelIndex QModelIndex self.model() QStandardItemModel """ item = self.m_Tree.model().itemFromIndex(oModelIndex) if not item: return iItemType, ID = item.GetInfo() if iItemType == define.SearchTreeItemType.GRAPHIC: GetSignal().UI_FOCUS_GRAPHIC.emit(self.m_BPID, ID) else: if iItemType == define.SearchTreeItemType.PIN: ID = interface.GetNodeIDByPinID(ID) graphicID = interface.GetGraphicIDByNodeID(ID) GetSignal().UI_FOCUS_NODE.emit(graphicID, ID)
def RunInputFlow(self, inputPin, bNext=False): """输入流引脚永远只有一个""" if self.m_Statue & BLUEPRINT_STOP: return nodeID = interface.GetNodeIDByPinID(inputPin) if not bNext and nodeID in g_BreakPoint: self.m_Statue = BLUEPRINT_DEBUG_PAUSE while True: if self.m_Statue == BLUEPRINT_STOP: return if self.m_Statue == BLUEPRINT_RUNING: break time.sleep(0.5) func = GetPinFunc(inputPin) if func: sNodeDisplayName = interface.GetNodeAttr( nodeID, bddefine.NodeAttrName.DISPLAYNAME) misc.Debug("开始运行'%s'节点" % sNodeDisplayName) func()
def GetPinFunc(pinID): nodeID = interface.GetNodeIDByPinID(pinID) pinName = interface.GetPinAttr(pinID, bddefine.PinAttrName.NAME) dFunc = interface.GetNodeFuncInfo(nodeID) func = dFunc.get(pinName, None) return func