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

def panflute::applet::widget::Button::__reload_image (   self  )  [private]

Load the image specified by stock ID or icon name so it can be

Definition at line 252 of file widget.py.

00252                              :
        Load the image specified by stock ID or icon name so it can be

        self.__normal_pixbuf = None
        self.__mouseover_pixbuf = None
        size = self.__preferred_size ()

        if self.__stock_id is not None:
            self.__normal_pixbuf = panflute.applet.stock.render_icon_pixel_size (self, self.__stock_id, size)
            if self.__normal_pixbuf is None:
                self.log.warn ("Unable to render stock icon '{0}'".format (self.__stock_id))
        elif self.__icon_name is not None:
                pixbuf = self.__icon_theme.load_icon (self.__icon_name, size, 0)
                # Named icons don't automatically have the "disabled widget" effect applied to them,
                # so do it manually if needed.
                if not self.props.sensitive:
                    source = gtk.IconSource ()
                    source.set_pixbuf (pixbuf)
                    source.set_size (gtk.ICON_SIZE_LARGE_TOOLBAR)
                    source.set_size_wildcarded (False)
                    self.__normal_pixbuf = self.style.render_icon (source,
                                                                   self.get_direction (),
                    self.__normal_pixbuf = pixbuf
            except gobject.GError, e:
                self.log.warn ("Unable to load icon '{0}': {1}".format (self.__icon_name, e))

        if self.__normal_pixbuf is None:
            # Fallback to a (hopefully) safe default.
            self.__normal_pixbuf = panflute.applet.stock.render_icon_pixel_size (self, panflute.applet.stock.PANFLUTE, size)

        if self.__normal_pixbuf is not None:
            self.__mouseover_pixbuf = self.__normal_pixbuf.copy ()
            self.__shift_pixbuf_colors (self.__mouseover_pixbuf, self.HIGHLIGHT_SHIFT)
            self.log.error ("All attempts to load an icon failed")

        self.queue_resize ()
        self.queue_draw ()

    def __shift_pixbuf_colors (self, pixbuf, shift):

Generated by  Doxygen 1.6.0   Back to index