示例#1
0
 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()
示例#2
0
文件: layout.py 项目: xqbumu/gaphor
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
示例#3
0
文件: layout.py 项目: Nyox/gaphor
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
示例#4
0
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)
示例#5
0
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)
示例#6
0
 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()