Logo Search packages:      
Sourcecode: panflute version File versions  Download package

def panflute::applet::applet::Applet::__bundle_widgets (   self  )  [private]

Bundle the applet's content widgets into a box according to the
orientation of the panel.

Definition at line 208 of file applet.py.

00208                                :
        """
        Bundle the applet's content widgets into a box according to the
        orientation of the panel.
        """

        # Undo previous bundling before doing the new one

        old_box = self.__applet.get_child ()
        if old_box is not None:
            self.__applet.remove (old_box)

        for widget in self.__first_widgets + self.__second_widgets:
            if widget.get_parent () is not None:
                widget.get_parent ().remove (widget)

        # Now bundle the widgets

        orient = self.__applet.get_orient ()
        size = self.__applet.get_size ()
        self.log.debug ("Applet size is {0}; two-row threshold is {1}".format (size, self.TWO_ROW_SIZE_THRESHOLD))

        if self.__applet.get_size () < self.TWO_ROW_SIZE_THRESHOLD:
            self.log.debug ("Forcing one-row layout due to size constraints")
            all_box = self.__bundle_row (self.__first_widgets + self.__second_widgets)
            self.__applet.add (all_box)
        else:
            first_box = self.__bundle_row (self.__first_widgets)
            second_box = self.__bundle_row (self.__second_widgets)

            if first_box is not None and second_box is not None:
                self.log.debug ("Using a two-row layout")
                if orient == gnomeapplet.ORIENT_UP or orient == gnomeapplet.ORIENT_DOWN:
                    big_box = gtk.VBox ()
                else:
                    big_box = gtk.HBox ()
                big_box.set_border_width (0)
                big_box.set_spacing (0)
                big_box.set_homogeneous (True)
                big_box.pack_start (first_box)
                big_box.pack_start (second_box)
                big_box.show ()
                self.__applet.add (big_box)
            elif first_box is not None:
                self.log.debug ("Using an empty-second-row layout")
                self.__applet.add (first_box)
            else:
                assert (second_box is not None)
                self.log.debug ("Using an empty-first-row layout")
                self.__applet.add (second_box)


    def __bundle_row (self, widgets):


Generated by  Doxygen 1.6.0   Back to index