Пример #1
0
    def add_tab(self, tab):
        '''Add new tab to this tab group.'''
        # Add to the dictionary so that the tab can be called by name
        self._tabs[tab.name] = tab

        self.tabs_list.append(tab)

        tab.active = False

        # Set first tab visible
        if self.current_tab == None:
            self.current_tab = 0
            self.tabs_list[0].visible = True

        tab_title = Label(0.01, self.color, 0, 0, tab.title)
        self.labels.append(tab_title)
        tab_title.set_name(tab.name)

        self.add(tab_title)
        self._reposition_labels()

        tab_title.set_reactive(True)
        tab_title.connect('button-press-event', self._on_tab_title_button_press)

        timeline = clutter.Timeline(500)
        alpha = clutter.Alpha(timeline, clutter.EASE_IN_OUT_SINE)
        behaviour = clutter.BehaviourOpacity(255, 96, alpha)
        behaviour.apply(tab_title)
        self.timelines.append((timeline, alpha, behaviour))