Exemplo n.º 1
0
    def test_item_removed_signal(self):
        remove_events = []
        item_removed_events = []

        def on_remove(self, widget):
            remove_events.append(widget)

        def on_item_removed(dockpaned, child):
            item_removed_events.append(child)

        dockgroup1 = DockGroup()
        dockgroup2 = DockGroup()
        dockpaned = DockPaned()
        dockpaned.connect('remove', on_remove)
        dockpaned.connect('item-removed', on_item_removed)
        dockpaned.add(dockgroup1)
        dockpaned.add(dockgroup2)
        dockpaned.remove(dockgroup1)
        dockpaned.remove_item(0)

        self.assertTrue(dockgroup1 in item_removed_events)
        self.assertTrue(dockgroup1 in remove_events)
        self.assertTrue(dockgroup2 in item_removed_events)
        self.assertFalse(dockgroup2 in remove_events)

        dockgroup1.destroy()
        dockgroup2.destroy()
        dockpaned.destroy()
Exemplo n.º 2
0
    def test_construction_after_setting_layout(self):
        win = gtk.Window(gtk.WINDOW_TOPLEVEL)
        frame = DockFrame()
        paned = DockPaned()
        group = DockGroup()
        item = DockItem()

        layout = DockLayout()

        layout.add(frame)

        win.add(frame)
        frame.add(paned)
        paned.add(group)
        group.add(item)

        assert frame in layout.frames
        self.assertEquals(4, len(layout._signal_handlers))
        self.assertEquals(9, len(layout._signal_handlers[frame]))

        paned.remove(group)

        self.assertEquals(2, len(layout._signal_handlers), layout._signal_handlers)
        assert frame in layout._signal_handlers.keys(), layout._signal_handlers
        assert paned in layout._signal_handlers.keys(), layout._signal_handlers
        assert group not in layout._signal_handlers.keys(), layout._signal_handlers
        assert item not in layout._signal_handlers.keys(), layout._signal_handlers
        assert frame in layout.frames
Exemplo n.º 3
0
    def test_remove(self):
        dockgroup = DockGroup()
        dockpaned = DockPaned()
        dockpaned.add(dockgroup)
        dockpaned.remove(dockgroup)

        self.assertTrue(dockgroup not in dockpaned)

        dockgroup.destroy()
        dockpaned.destroy()