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()
def dock_group_factory(parent, weight=None, name=None): group = DockGroup() if name: group.set_name(name) if weight is not None: parent.insert_item(group, weight=float(weight) / 100.) else: parent.add(group) group.show() return group
def default_window(n_groups): world.window = gtk.Window(gtk.WINDOW_TOPLEVEL) world.window.set_default_size(800, 150) world.frame = DockFrame() world.window.add(world.frame) world.layout = DockLayout() world.layout.add(world.frame) paned = DockPaned() world.frame.add(paned) world.window.show() world.frame.show() paned.show() world.groups = [] for i in range(int(n_groups)): group = DockGroup() paned.add(group) group.show() world.groups.append(group)