当前位置: 首页>>代码示例>>Python>>正文


Python Link.from_box_side方法代码示例

本文整理汇总了Python中link.Link.from_box_side方法的典型用法代码示例。如果您正苦于以下问题:Python Link.from_box_side方法的具体用法?Python Link.from_box_side怎么用?Python Link.from_box_side使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在link.Link的用法示例。


在下文中一共展示了Link.from_box_side方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: show_arbiter_masters

# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import from_box_side [as 别名]
    def show_arbiter_masters(self):
        if len(self.arbiter_boxes) > 0:
            return
        print "show_arbiter_masters()"
        count = self.s.module_arbiter_count(self.box_name)
        print "%d arbiters" % count

        #print "Add %d arbiter boxes" % num_m

        #setup the start position for the case where there is only one master
        position = QPointF(self.pos())
        rect = QRectF(self.rect)
        arb_x = position.x() + rect.width() + ARB_MASTER_HORIZONTAL_SPACING
        arb_y = position.y() + rect.height() / 2
        arb_y -= (count - 1) * ARB_MASTER_VERTICAL_SPACING
        arb_y -= ((count - 1) * ARB_MASTER_RECT.height()) / 2

        arb_pos = QPointF(arb_x, arb_y)

        #for i in range(0, len(self.arbiter_masters)):
        for name in self.s.arbiter_master_names(self.box_name):
            #print "Add Arbiter %s" % self.arbiter_masters[i]
            arb_rect = QRectF(ARB_MASTER_RECT)

            #am = ArbiterMaster(name = self.arbiter_masters[i], 
            am = ArbiterMaster(name = name, 
                               position = arb_pos,
                               y_pos = position.y(),
                               scene = self.scene(),
                               slave = self)

            #am.movable(False)

            self.arbiter_boxes.append(am)
            al = Link(self, am, self.scene(), lt.arbiter_master)
            al.from_box_side(st.right)
            al.to_box_side(st.left)

            al.en_bezier_connections(True)
            self.links[am] = al

            #Progress the position
            arb_pos = QPointF(arb_pos.x(), arb_pos.y() + arb_rect.height() + ARB_MASTER_VERTICAL_SPACING)

        self.update_links()
开发者ID:CospanDesign,项目名称:nysa-gui,代码行数:47,代码来源:peripheral_slave.py

示例2: arbiter_master_selected

# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import from_box_side [as 别名]
    def arbiter_master_selected(self, arbiter_master):
        self.dbg = True
        if self.dbg: print "PS: arbiter_master_selected()"
        if self.ignore_selection:
            return

        self.ignore_selection = True
        self.s.clearSelection()
        #Maybe this is to remove other arbiter masters!
        self.remove_arbiter_masters()
        position = QPointF(self.pos())
        rect = QRectF(self.rect)
        arb_x = position.x() + rect.width() + ARB_MASTER_HORIZONTAL_SPACING
        arb_y = position.y() + (rect.height() / 2)  - (ARB_MASTER_ACT_RECT.height() / 2)

        arb_pos = QPointF(arb_x, arb_y)
        #print "Adding arbiter master"
        am = ArbiterMaster(name = arbiter_master,
                           position = arb_pos,
                           y_pos = arb_y,
                           scene = self.scene(),
                           slave = self)

        am.set_activate(True)
        am.update_view()
        self.arbiter_boxes.append(am)
        al = Link(self, am, self.scene(), lt.arbiter_master)
        al.from_box_side(st.right)
        al.to_box_side(st.left)

        al.en_bezier_connections(True)
        self.links[am] = al

        #print "update links"
        self.update_links()
        self.ignore_selection = False
        self.s.invalidate(self.s.sceneRect())
        self.dbg = True
开发者ID:CospanDesign,项目名称:nysa-gui,代码行数:40,代码来源:peripheral_slave.py


注:本文中的link.Link.from_box_side方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。