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


Python DockGroup.get_parent方法代码示例

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


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

示例1: test_placement_below

# 需要导入模块: from etkdocking import DockGroup [as 别名]
# 或者: from etkdocking.DockGroup import get_parent [as 别名]
    def test_placement_below(self):

        g1, g2 = DockGroup(), DockGroup()

        docklayout.add_new_group_below(self.group, g1)

        paned = g1.get_parent()
        assert isinstance(paned, DockPaned), paned
        assert self.group.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g1

        docklayout.add_new_group_below(self.group, g2)
        assert self.group.get_parent() is paned
        assert g2.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g2
        assert paned.get_nth_item(2) is g1
开发者ID:dieterv,项目名称:etk.docking,代码行数:20,代码来源:test_docklayout.py

示例2: PlacementTest

# 需要导入模块: from etkdocking import DockGroup [as 别名]
# 或者: from etkdocking.DockGroup import get_parent [as 别名]
class PlacementTest(unittest.TestCase):

    def setUp(self):
        self.layout = DockLayout()
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.frame = DockFrame()
        self.group = DockGroup()

        self.layout.add(self.frame)
        self.window.add(self.frame)
        self.frame.add(self.group)

    def test_placement_left(self):

        g1, g2 = DockGroup(), DockGroup()

        docklayout.add_new_group_left(self.group, g1)

        paned = g1.get_parent()
        assert isinstance(paned, DockPaned), paned
        assert self.group.get_parent() is paned
        assert paned.get_nth_item(0) is g1
        assert paned.get_nth_item(1) is self.group

        docklayout.add_new_group_left(self.group, g2)
        assert self.group.get_parent() is paned
        assert g2.get_parent() is paned
        assert paned.get_nth_item(0) is g1
        assert paned.get_nth_item(1) is g2
        assert paned.get_nth_item(2) is self.group

    def test_placement_right(self):

        g1, g2 = DockGroup(), DockGroup()

        docklayout.add_new_group_right(self.group, g1)

        paned = g1.get_parent()
        assert isinstance(paned, DockPaned), paned
        assert self.group.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g1

        docklayout.add_new_group_right(self.group, g2)
        assert self.group.get_parent() is paned
        assert g2.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g2
        assert paned.get_nth_item(2) is g1


    def test_placement_above(self):

        g1, g2 = DockGroup(), DockGroup()

        docklayout.add_new_group_above(self.group, g1)

        paned = g1.get_parent()
        assert isinstance(paned, DockPaned), paned
        assert self.group.get_parent() is paned
        assert paned.get_nth_item(0) is g1
        assert paned.get_nth_item(1) is self.group

        docklayout.add_new_group_above(self.group, g2)
        assert self.group.get_parent() is paned
        assert g2.get_parent() is paned
        assert paned.get_nth_item(0) is g1
        assert paned.get_nth_item(1) is g2
        assert paned.get_nth_item(2) is self.group

    def test_placement_below(self):

        g1, g2 = DockGroup(), DockGroup()

        docklayout.add_new_group_below(self.group, g1)

        paned = g1.get_parent()
        assert isinstance(paned, DockPaned), paned
        assert self.group.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g1

        docklayout.add_new_group_below(self.group, g2)
        assert self.group.get_parent() is paned
        assert g2.get_parent() is paned
        assert paned.get_nth_item(0) is self.group
        assert paned.get_nth_item(1) is g2
        assert paned.get_nth_item(2) is g1
开发者ID:dieterv,项目名称:etk.docking,代码行数:90,代码来源:test_docklayout.py


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