當前位置: 首頁>>代碼示例>>Python>>正文


Python DockGroup.insert_item方法代碼示例

本文整理匯總了Python中etk.docking.DockGroup.insert_item方法的典型用法代碼示例。如果您正苦於以下問題:Python DockGroup.insert_item方法的具體用法?Python DockGroup.insert_item怎麽用?Python DockGroup.insert_item使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在etk.docking.DockGroup的用法示例。


在下文中一共展示了DockGroup.insert_item方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_add_signal

# 需要導入模塊: from etk.docking import DockGroup [as 別名]
# 或者: from etk.docking.DockGroup import insert_item [as 別名]
    def test_add_signal(self):
        events = []
        item_in = []
        item_in_after = []
        def event_handler(self, w):
            events.append(w)
            item_in.append(w in self.items)

        def event_handler_after(self, w):
            item_in_after.append(w in self.items)


        dockgroup = DockGroup()
        dockgroup.connect('add', event_handler)
        dockgroup.connect_after('add', event_handler_after)

        dockitem1 = DockItem()
        dockgroup.add(dockitem1)
        self.assertEquals([dockitem1], events)
        self.assertEquals([True], item_in)
        self.assertEquals([True], item_in_after)

        dockitem2 = DockItem()
        dockgroup.insert_item(dockitem2)
        self.assertEquals([dockitem1], events)
        self.assertEquals([True], item_in)
        self.assertEquals([True], item_in_after)
開發者ID:ReadonShaw,項目名稱:etk.docking,代碼行數:29,代碼來源:test_dockgroup.py

示例2: test_item_added_signal

# 需要導入模塊: from etk.docking import DockGroup [as 別名]
# 或者: from etk.docking.DockGroup import insert_item [as 別名]
    def test_item_added_signal(self):
        add_events = []
        item_added_events = []

        def on_add(self, widget):
            add_events.append(widget)

        def on_item_added(dockgroup, child):
            item_added_events.append(child)

        dockitem1 = DockItem()
        dockitem2 = DockItem()
        dockgroup = DockGroup()
        dockgroup.connect('add', on_add)
        dockgroup.connect('item-added', on_item_added)
        dockgroup.add(dockitem1)
        dockgroup.insert_item(dockitem2)

        self.assertTrue(dockitem1 in item_added_events)
        self.assertTrue(dockitem1 in add_events)
        self.assertTrue(dockitem2 in item_added_events)
        self.assertFalse(dockitem2 in add_events)

        dockitem2.destroy()
        dockitem1.destroy()
        dockgroup.destroy()
開發者ID:ReadonShaw,項目名稱:etk.docking,代碼行數:28,代碼來源:test_dockgroup.py

示例3: test_insert_item

# 需要導入模塊: from etk.docking import DockGroup [as 別名]
# 或者: from etk.docking.DockGroup import insert_item [as 別名]
    def test_insert_item(self):
        dockitem1 = DockItem()
        dockitem2 = DockItem()
        dockitem3 = DockItem()
        dockgroup = DockGroup()
        dockgroup.insert_item(dockitem1, None)
        dockgroup.insert_item(dockitem2, 0)
        dockgroup.insert_item(dockitem3, 1)

        self.assertTrue(dockgroup.get_nth_item(0) is dockitem2)
        self.assertTrue(dockgroup.get_nth_item(1) is dockitem3)
        self.assertTrue(dockgroup.get_nth_item(2) is dockitem1)

        dockitem1.destroy()
        dockitem2.destroy()
        dockitem3.destroy()
        dockgroup.destroy()
開發者ID:ReadonShaw,項目名稱:etk.docking,代碼行數:19,代碼來源:test_dockgroup.py

示例4: create_item

# 需要導入模塊: from etk.docking import DockGroup [as 別名]
# 或者: from etk.docking.DockGroup import insert_item [as 別名]
 def create_item(self, ui_component): #, widget, title, placement=None):
     """
     Create an item for a ui component. This method can be called from UIComponents.
     """
     item = DockItem(ui_component.title)
     item.add(ui_component.open())
     group = DockGroup()
     group.insert_item(item)
     placement = ui_component.placement
     if placement:
         if placement == 'floating':
             add_new_group_floating(group, self.layout, ui_component.size)
         else:
             location = self.layout.get_widgets(placement[1])[0]
             { 'left': add_new_group_left,
               'right': add_new_group_right,
               'above': add_new_group_above,
               'below': add_new_group_below }[placement[0]](location, group)
     else:
         add_new_group_floating(group)
     item.show()
     item.ui_component = ui_component
     group.show()
開發者ID:dieterv,項目名稱:gaphor,代碼行數:25,代碼來源:mainwindow.py


注:本文中的etk.docking.DockGroup.insert_item方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。