def loadToolbar( self, timeout = -1, loadStage = [0,0,0] ):
        if loadStage[1] == 0:
            self.toolbarBox = gtk.HBox()

            scrollbox = HScrolledBox(scroll_policy=gtk.POLICY_NEVER)
            scrollbox.set_viewport(self.toolbarBox)
            scrollbox.modify_bg(gtk.STATE_NORMAL, style.Color(Config.PANEL_BCK_COLOR).get_gdk_color())
            self.mainVBox.pack_start(scrollbox, False, False)

            self.firstTbBtn = None
            self.loadStage[1] = 1
            if timeout >= 0 and time.time() > timeout: return False

        for i in range(loadStage[1]-1, len(Config.CATEGORIES)):
            category = Config.CATEGORIES[i]
            if loadStage[2] == 0:
                self.loadData["btnBox"] = RoundVBox(fillcolor = Config.CATEGORY_BCK_COLOR, bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
                self.loadData["btnBox"].set_border_width(Config.PANEL_SPACING)
                loadStage[2] = 1
                if timeout >= 0 and time.time() > timeout: return False

            if loadStage[2] == 1:
                self.loadData["btn"] = ImageRadioButton(self.firstTbBtn,
                        category + '.png', category + 'sel.png',
                        category + 'sel.png')
                loadStage[2] = 2
                if timeout >= 0 and time.time() > timeout: return False

            if self.firstTbBtn == None:
                self.firstTbBtn = self.loadData["btn"]
            self.loadData["btn"].connect('clicked',self.handleToolbarBtnPress,category)
            self.tooltips.set_tip(self.loadData["btn"],str(category))
            self.loadData["btnBox"].add(self.loadData["btn"])
            self.toolbarBox.pack_start(self.loadData["btnBox"],True,True)

            loadStage[2] = 0
            loadStage[1] += 1
            if timeout >= 0 and time.time() > timeout: return False

        self.loadData.pop("btn")
        self.loadData.pop("btnBox")
        loadStage[1] = 0
        return True
Ejemplo n.º 2
0
    def loadToolbar(self):
        self.toolbarBox = Gtk.HBox()

        scrollbox = HScrolledBox(scroll_policy=Gtk.PolicyType.NEVER)
        scrollbox.set_viewport(self.toolbarBox)
        scrollbox.modify_bg(Gtk.StateType.NORMAL,
                style.Color(Config.PANEL_BCK_COLOR).get_gdk_color())
        self.mainVBox.pack_start(scrollbox, False, False, 0)

        self.firstTbBtn = None

        for i in range(len(Config.CATEGORIES)):
            category = Config.CATEGORIES[i]

            btn = ImageRadioButton(self.firstTbBtn,
                    category + '.png', category + 'sel.png',
                    category + 'sel.png')

            if self.firstTbBtn == None:
                self.firstTbBtn = btn
            btn.connect('clicked',self.handleToolbarBtnPress,category)
            btn.set_tooltip_text(str(category))
            self.toolbarBox.pack_start(btn, False, False, 0)
Ejemplo n.º 3
0
    def loadToolbar(self):
        self.toolbarBox = Gtk.HBox()

        scrollbox = HScrolledBox(scroll_policy=Gtk.PolicyType.NEVER)
        scrollbox.set_viewport(self.toolbarBox)
        scrollbox.modify_bg(
            Gtk.StateType.NORMAL,
            style.Color(Config.PANEL_BCK_COLOR).get_gdk_color())
        self.mainVBox.pack_start(scrollbox, False, False, 0)

        self.firstTbBtn = None

        for i in range(len(Config.CATEGORIES)):
            category = Config.CATEGORIES[i]

            btn = ImageRadioButton(self.firstTbBtn, category + '.png',
                                   category + 'sel.png', category + 'sel.png')

            if self.firstTbBtn == None:
                self.firstTbBtn = btn
            btn.connect('clicked', self.handleToolbarBtnPress, category)
            btn.set_tooltip_text(str(category))
            self.toolbarBox.pack_start(btn, False, False, 0)