def __init__(self, 
                 module_infos, 
                 switch_page, 
                 click_module_item, 
                 backward_cb=None, 
                 forward_cb=None, 
                 search_cb=None):
        '''
        init docs
        '''
        # Init.
        gtk.Alignment.__init__(self)
        self.module_infos = module_infos
        self.set(0.5, 0.5, 1, 1)
        self.set_padding(0, 0, 0, 0)
        self.set_size_request(-1, 32)

        # Init action box.
        self.main_box = gtk.HBox()
        
        # Init action button.
        self.backward_align = gtk.Alignment()
        self.backward_align.set(0, 0, 0, 0)
        self.backward_align.set_padding(8, 5, 10, 0)
        self.backward_button = ImageButton(
            app_theme.get_pixbuf("action_button/backward_normal.png"),
            app_theme.get_pixbuf("action_button/backward_hover.png"),
            app_theme.get_pixbuf("action_button/backward_press.png"),
            insensitive_dpixbuf = app_theme.get_pixbuf("action_button/backward_normal.png")
            )
        self.backward_cb = backward_cb
        self.backward_button.connect("clicked", self.__backward_clicked)
        self.backward_align.add(self.backward_button)
        self.forward_align = gtk.Alignment()
        self.forward_align.set(0, 0, 0, 0)
        self.forward_align.set_padding(8, 5, 10, 0)
        self.forward_button = ImageButton(
            app_theme.get_pixbuf("action_button/forward_normal.png"),
            app_theme.get_pixbuf("action_button/forward_hover.png"),
            app_theme.get_pixbuf("action_button/forward_press.png"),
            insensitive_dpixbuf = app_theme.get_pixbuf("action_button/forward_normal.png")
            )
        self.forward_cb = forward_cb
        self.forward_button.connect("clicked", self.__forward_clicked)
        self.forward_align.add(self.forward_button)
        self.action_box = gtk.HBox()
        self.action_align = gtk.Alignment()
        self.action_align.set(0.5, 0, 0, 0)
        self.action_align.set_padding(0, 0, 5, 5)
        self.bread_align = gtk.Alignment()
        self.bread_align.set(0, 0.5, 1, 0)
        self.bread_align.set_padding(0, 0, 4, 4)
        
        # Init navigate bar.
        self.navigate_bar = gtk.HBox()
        self.bread = Bread(crumb = [(_("System Settings"), 
                             map(lambda module_info: ModuleMenuItem(module_info, click_module_item),
                                 list(itertools.chain(*module_infos)))),
                            ], 
                           show_left_right_box = False)
        #self.bread.set_size(-1, 24)
        self.bread.connect("item_clicked", switch_page)
        
        # Init search entry.
        self.search_button = ImageButton(
            app_theme.get_pixbuf("entry/search_normal.png"),
            app_theme.get_pixbuf("entry/search_hover.png"),
            app_theme.get_pixbuf("entry/search_press.png"),
            )
        self.search_cb = search_cb
        self.search_entry = InputEntry(action_button=self.search_button)
        self.search_entry.set_size(150, 24)
        self.search_entry.entry.connect("changed", self.__search_changed)
        self.search_entry.entry.connect("press-return", self.__search_press_enter)
        self.search_align = gtk.Alignment()
        self.search_align.set(0.5, 0.5, 0, 0)
        self.search_align.set_padding(5, 0, 5, 10)
        
        # Connect widgets.
        self.action_align.add(self.action_box)
        self.bread_align.add(self.bread)
        self.search_align.add(self.search_entry)
        self.action_box.pack_start(self.backward_align)
        self.action_box.pack_start(self.forward_align)
        self.navigate_bar.pack_start(self.bread_align, True, True)
        self.main_box.pack_start(self.action_align, False, False)
        self.main_box.pack_start(self.navigate_bar, True, True)
        self.main_box.pack_start(self.search_align, False, False)
        self.add(self.main_box)
Ejemplo n.º 2
0
    
    tab_4_box.pack_start(icon_view_vframe, True, True)
    
    # Tab 5.
    button_box = gtk.VBox()
    check_button = CheckButton(label_text = "Check Button")
    radio_button_1 = RadioButton("Radio Button1")
    radio_button_2 = RadioButton("Radio Button2")
    button_box.pack_start(check_button, False, False, 4)
    button_box.pack_start(radio_button_1, False, False, 4)
    button_box.pack_start(radio_button_2, False, False, 4)
    tab_5_box.pack_start(button_box, False, False)

    # Breadcrumb
    bread = Bread(["Root", None],
                  show_entry = True,
                  show_others = False)
    bread.connect("entry-changed", lambda w, p: bread.change_node(0,[(i,[(None, "test", None)]) for i in p.split("/")[1:]]))
    bread.set_size(100, -1)
     

    tab_5_box.pack_start(bread, False, False)
    btn = gtk.Button("add")
    btn.connect("clicked", lambda w: bread.add(Crumb("Child", Menu(
                                [(None, "Child", None),],
                                shadow_visible = False,
                                is_root_menu = True))))

    tab_5_box.pack_start(btn, False, False)
    
    #Tree view.
Ejemplo n.º 3
0
    # icon_view.add_items(icon_items)

    tab_4_box.pack_start(icon_view_vframe, True, True)

    # Tab 5.
    button_box = gtk.VBox()
    check_button = CheckButton(label_text="Check Button")
    radio_button_1 = RadioButton("Radio Button1")
    radio_button_2 = RadioButton("Radio Button2")
    button_box.pack_start(check_button, False, False, 4)
    button_box.pack_start(radio_button_1, False, False, 4)
    button_box.pack_start(radio_button_2, False, False, 4)
    tab_5_box.pack_start(button_box, False, False)

    # Breadcrumb
    bread = Bread(["Root", None], show_entry=True, show_others=False)
    bread.connect(
        "entry-changed",
        lambda w, p: bread.change_node(0, [(i, [(None, "test", None)])
                                           for i in p.split("/")[1:]]))
    bread.set_size(100, -1)

    tab_5_box.pack_start(bread, False, False)
    btn = gtk.Button("add")
    btn.connect(
        "clicked", lambda w: bread.add(
            Crumb(
                "Child",
                Menu([
                    (None, "Child", None),
                ],
    def __init__(self,
                 module_infos,
                 switch_page,
                 click_module_item,
                 backward_cb=None,
                 forward_cb=None,
                 search_cb=None):
        '''
        init docs
        '''
        # Init.
        gtk.Alignment.__init__(self)
        self.module_infos = module_infos
        self.set(0.5, 0.5, 1, 1)
        self.set_padding(0, 0, 0, 0)
        self.set_size_request(-1, 32)

        # Init action box.
        self.main_box = gtk.HBox()

        # Init action button.
        self.backward_align = gtk.Alignment()
        self.backward_align.set(0, 0, 0, 0)
        self.backward_align.set_padding(8, 5, 10, 0)
        self.backward_button = ImageButton(
            app_theme.get_pixbuf("action_button/backward_normal.png"),
            app_theme.get_pixbuf("action_button/backward_hover.png"),
            app_theme.get_pixbuf("action_button/backward_press.png"),
            insensitive_dpixbuf=app_theme.get_pixbuf(
                "action_button/backward_normal.png"))
        self.backward_cb = backward_cb
        self.backward_button.connect("clicked", self.__backward_clicked)
        self.backward_align.add(self.backward_button)
        self.forward_align = gtk.Alignment()
        self.forward_align.set(0, 0, 0, 0)
        self.forward_align.set_padding(8, 5, 10, 0)
        self.forward_button = ImageButton(
            app_theme.get_pixbuf("action_button/forward_normal.png"),
            app_theme.get_pixbuf("action_button/forward_hover.png"),
            app_theme.get_pixbuf("action_button/forward_press.png"),
            insensitive_dpixbuf=app_theme.get_pixbuf(
                "action_button/forward_normal.png"))
        self.forward_cb = forward_cb
        self.forward_button.connect("clicked", self.__forward_clicked)
        self.forward_align.add(self.forward_button)
        self.action_box = gtk.HBox()
        self.action_align = gtk.Alignment()
        self.action_align.set(0.5, 0, 0, 0)
        self.action_align.set_padding(0, 0, 5, 5)
        self.bread_align = gtk.Alignment()
        self.bread_align.set(0, 0.5, 1, 0)
        self.bread_align.set_padding(0, 0, 4, 4)

        # Init navigate bar.
        self.navigate_bar = gtk.HBox()
        self.bread = Bread(crumb=[
            (_("System Settings"),
             map(
                 lambda module_info: ModuleMenuItem(module_info,
                                                    click_module_item),
                 list(itertools.chain(*module_infos)))),
        ],
                           show_left_right_box=False)
        #self.bread.set_size(-1, 24)
        self.bread.connect("item_clicked", switch_page)

        # Init search entry.
        self.search_button = ImageButton(
            app_theme.get_pixbuf("entry/search_normal.png"),
            app_theme.get_pixbuf("entry/search_hover.png"),
            app_theme.get_pixbuf("entry/search_press.png"),
        )
        self.search_cb = search_cb
        self.search_entry = InputEntry(action_button=self.search_button)
        self.search_entry.set_size(150, 24)
        self.search_entry.entry.connect("changed", self.__search_changed)
        self.search_entry.entry.connect("press-return",
                                        self.__search_press_enter)
        self.search_align = gtk.Alignment()
        self.search_align.set(0.5, 0.5, 0, 0)
        self.search_align.set_padding(5, 0, 5, 10)

        # Connect widgets.
        self.action_align.add(self.action_box)
        self.bread_align.add(self.bread)
        self.search_align.add(self.search_entry)
        self.action_box.pack_start(self.backward_align)
        self.action_box.pack_start(self.forward_align)
        self.navigate_bar.pack_start(self.bread_align, True, True)
        self.main_box.pack_start(self.action_align, False, False)
        self.main_box.pack_start(self.navigate_bar, True, True)
        self.main_box.pack_start(self.search_align, False, False)
        self.add(self.main_box)