gtk.IconInfo

gtk.IconInfo — object containing information about and icon in an icon theme (new in PyGTK 2.4)

Synopsis

class gtk.IconInfo(gobject.GBoxed):
    def copy()
def free()
def get_base_size()
def get_filename()
def get_builtin_pixbuf()
def load_icon()
def set_raw_coordinates(raw_coordinates)
def get_embedded_rect()
def get_attach_points()
def get_display_name()

Description

Note

This object is available in PyGTK 2.4 and above.

A gtk.IconInfo object contains information about an icon in a gtk.IconTheme. A gtk.IconInfo object is created using the gtk.IconTheme.lookup_icon() method.

A gtk.gdk.Pixbuf can be rendered with the icon using the load_icon() method. If you just want to load the pixbuf of an icon you can use the gtk.IconTheme.load_icon() method that combines the gtk.IconTheme.lookup_icon() method and the load_icon() method.

Methods

gtk.IconInfo.copy

    def copy()
Returns :the new gtk.IconInfo

Note

This method is available in PyGTK 2.4 and above.

The copy() method returns a copy of the icon info object.

gtk.IconInfo.free

    def free()

Note

This method is available in PyGTK 2.4 and above.

Warning

This method is deprecated and should not be used since it can crash your application.

The free() method frees the icon info and its associated information

gtk.IconInfo.get_base_size

    def get_base_size()
Returns :the base size, or 0, if no base size is known for the icon.

Note

This method is available in PyGTK 2.4 and above.

The get_base_size() method returns the base size for the icon. The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; an example of this is small emblem icons that can be attached to a larger icon. These icons will be given the same base size as the larger icons to which they are attached.

gtk.IconInfo.get_filename

    def get_filename()
Returns :the filename for the icon, or None if the get_builtin_pixbuf() should be used instead.

Note

This method is available in PyGTK 2.4 and above.

The get_filename() method returns the filename for the icon. If the gtk.ICON_LOOKUP_USE_BUILTIN flag was passed to the gtk.IconTheme.lookup_icon() method, there may be no filename if a builtin icon is returned. In this case, you should use the get_builtin_pixbuf() method.

gtk.IconInfo.get_builtin_pixbuf

    def get_builtin_pixbuf()
Returns :the built-in image pixbuf, or None.

Note

This method is available in PyGTK 2.4 and above.

The get_builtin_pixbuf() method returns the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must pass the gtk.ICON_LOOKUP_USE_BUILTIN to the gtk.IconTheme.lookup_icon() method.

gtk.IconInfo.load_icon

    def load_icon()
Returns :the icon rendered into a gtk.gdk.Pixbuf. This may be a newly created icon or a new reference to an internal icon, so you must not modify the icon.

Note

This method is available in PyGTK 2.4 and above.

The load_icon() method renders the icon previously looked up in an icon theme using the gtk.IconTheme.lookup_icon() method. The icon size will be based on the size passed to the gtk.IconTheme.lookup_icon() method. Note that the resulting gtk.gdk.Pixbuf may not be exactly this size. An icon theme may have icons that differ slightly from their nominal sizes, and in addition GTK+ will avoid scaling icons that it considers sufficiently close to the requested size to maintain sharpness.

This method raise the GError exception if an error occurs during rendering of the icon.

gtk.IconInfo.set_raw_coordinates

    def set_raw_coordinates(raw_coordinates)
raw_coordinates :if TRUE, the coordinates of embedded rectangles and attached points should be returned in their original (unscaled) form.

Note

This method is available in PyGTK 2.4 and above.

The set_raw_coordinates() method sets the internal raw_coordinates flag to the value of raw_coordinates. If raw_coordinates is TRUE, the coordinates returned by the get_embedded_rect() and get_attach_points() methods will be returned in their original form as specified in the icon theme, instead of scaled appropriately for the pixbuf returned by the load_icon() method.

Raw coordinates are somewhat strange; they are specified to be with respect to the unscaled pixmap for PNG and XPM icons, but for SVG icons, they are in a 1000x1000 coordinate space that is scaled to the final size of the icon. You can determine if the icon is an SVG icon by using the get_filename() method, and seeing if it is not None and ends in '.svg'.

This method is provided primarily to allow compatibility wrappers for older API's, and is not expected to be useful for applications.

gtk.IconInfo.get_embedded_rect

    def get_embedded_rect()
Returns :a gtk.gdk.Rectangle or None

Note

This method is available in PyGTK 2.4 and above.

The get_embedded_rect() method returns a gtk.gdk.Rectangle containing the coordinates of a rectangle within the icon that can be used for display of information such as a preview of the contents of a text file. See the set_raw_coordinates() method for further information about the coordinate system.

gtk.IconInfo.get_attach_points

    def get_attach_points()
Returns :a tuple containing a set of 2-tuples for the attach points

Note

This method is available in PyGTK 2.4 and above.

The get_attach_points() method returns a tuple containing the attach points for an icon as a set of 2-tuples. An attach point is a location in the icon that can be used as anchor points for attaching emblems or overlays to the icon.

gtk.IconInfo.get_display_name

    def get_display_name()
Returns :the display name for the icon or None, if the icon doesn't have a specified display name.

Note

This method is available in PyGTK 2.4 and above.

The get_display_name() method returns the display name for an icon. A display name is a string to be used in place of the icon name in a user visible context like a list of icons.