Gtk.IconInfo¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new_for_pixbuf(icon_theme, pixbuf) | 
| get_attach_points() | |
| get_base_scale() | |
| get_base_size() | |
| get_builtin_pixbuf() | |
| get_display_name() | |
| get_embedded_rect() | |
| get_filename() | |
| is_symbolic() | |
| load_icon() | |
| load_icon_async(cancellable, callback, *user_data) | |
| load_icon_finish(res) | |
| load_surface(for_window) | |
| load_symbolic(fg, success_color, warning_color, error_color) | |
| load_symbolic_async(fg, success_color, warning_color, error_color, cancellable, callback, *user_data) | |
| load_symbolic_finish(res) | |
| load_symbolic_for_context(context) | |
| load_symbolic_for_context_async(context, cancellable, callback, *user_data) | |
| load_symbolic_for_context_finish(res) | |
| load_symbolic_for_style(style, state) | |
| set_raw_coordinates(raw_coordinates) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
Properties¶
None
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Gtk.IconInfo(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Gtk.IconInfoClass- Contains information found when looking up an icon in an icon theme. - 
classmethod new_for_pixbuf(icon_theme, pixbuf)[source]¶
- Parameters: - icon_theme (Gtk.IconTheme) – aGtk.IconTheme
- pixbuf (GdkPixbuf.Pixbuf) – the pixbuf to wrap in aGtk.IconInfo
 - Returns: - Return type: - Creates a - Gtk.IconInfofor a- GdkPixbuf.Pixbuf.- New in version 2.14. 
- icon_theme (
 - 
get_attach_points()[source]¶
- Returns: - False- points: - location to store pointer to an array of points, or - Nonefree the array of points with- GLib.free().- Return type: - ( - bool, points: [- Gdk.Point])- This function is deprecated and always returns - False.- New in version 2.4. - Deprecated since version 3.14: Attachment points are deprecated 
 - 
get_base_scale()[source]¶
- Returns: - the base scale - Return type: - int- Gets the base scale for the icon. The base scale is a scale for the icon that was specified by the icon theme creator. For instance an icon drawn for a high-dpi screen with window scale 2 for a base size of 32 will be 64 pixels tall and have a base scale of 2. - New in version 3.10. 
 - 
get_base_size()[source]¶
- Returns: - the base size, or 0, if no base size is known for the icon. - Return type: - int- Gets 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. - Note that for scaled icons the base size does not include the base scale. - New in version 2.4. 
 - 
get_builtin_pixbuf()[source]¶
- Returns: - the built-in image pixbuf, or - None. No extra reference is added to the returned pixbuf, so if you want to keep it around, you must use- GObject.Object.ref(). The returned image must not be modified.- Return type: - GdkPixbuf.Pixbufor- None- Gets the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must pass the - Gtk.IconLookupFlags.USE_BUILTINto- Gtk.IconTheme.lookup_icon().- New in version 2.4. - Deprecated since version 3.14: This function is deprecated, use - Gtk.IconTheme.add_resource_path() instead of builtin icons.
 - 
get_display_name()[source]¶
- Returns: - None- Return type: - str- This function is deprecated and always returns - None.- New in version 2.4. - Deprecated since version 3.14: - xlib.Displaynames are deprecated
 - 
get_embedded_rect()[source]¶
- Returns: - False- rectangle: - Gdk.Rectanglein which to store embedded rectangle coordinates; coordinates are only stored when this function returns- True.- Return type: - ( - bool, rectangle:- Gdk.Rectangle)- This function is deprecated and always returns - False.- New in version 2.4. - Deprecated since version 3.14: Embedded rectangles are deprecated 
 - 
get_filename()[source]¶
- Returns: - the filename for the icon, or - Noneif- Gtk.IconInfo.get_builtin_pixbuf() should be used instead. The return value is owned by GTK+ and should not be modified or freed.- Return type: - stror- None- Gets the filename for the icon. If the - Gtk.IconLookupFlags.USE_BUILTINflag was passed to- Gtk.IconTheme.lookup_icon(), there may be no filename if a builtin icon is returned; in this case, you should use- Gtk.IconInfo.get_builtin_pixbuf().- New in version 2.4. 
 - 
is_symbolic()[source]¶
- Returns: - Trueif the icon is symbolic,- Falseotherwise- Return type: - bool- Checks if the icon is symbolic or not. This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future. - New in version 3.12. 
 - 
load_icon()[source]¶
- Raises: - GLib.Error- Returns: - the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use - GObject.Object.unref() to release your reference to the icon.- Return type: - GdkPixbuf.Pixbuf- Renders an icon previously looked up in an icon theme using - Gtk.IconTheme.lookup_icon(); the size will be based on the size passed to- Gtk.IconTheme.lookup_icon(). Note that the resulting 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 or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the- Gtk.IconLookupFlags.FORCE_SIZEflag when obtaining the- Gtk.IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.- New in version 2.4. 
 - 
load_icon_async(cancellable, callback, *user_data)[source]¶
- Parameters: - cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously load, render and scale an icon previously looked up from the icon theme using - Gtk.IconTheme.lookup_icon().- For more details, see - Gtk.IconInfo.load_icon() which is the synchronous version of this call.- New in version 3.8. 
- cancellable (
 - 
load_icon_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use - GObject.Object.unref() to release your reference to the icon.- Return type: - GdkPixbuf.Pixbuf- Finishes an async icon load, see - Gtk.IconInfo.load_icon_async().- New in version 3.8. 
 - 
load_surface(for_window)[source]¶
- Parameters: - for_window ( - Gdk.Windowor- None) –- Gdk.Windowto optimize drawing for, or- None- Raises: - GLib.Error- Returns: - the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use cairo_surface_destroy() to release your reference to the icon. - Return type: - cairo.Surface- Renders an icon previously looked up in an icon theme using - Gtk.IconTheme.lookup_icon(); the size will be based on the size passed to- Gtk.IconTheme.lookup_icon(). Note that the resulting surface 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 or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the- Gtk.IconLookupFlags.FORCE_SIZEflag when obtaining the- Gtk.IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.- New in version 3.10. 
 - 
load_symbolic(fg, success_color, warning_color, error_color)[source]¶
- Parameters: - fg (Gdk.RGBA) – aGdk.RGBArepresenting the foreground color of the icon
- success_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the warning color of the icon orNoneto use the default color
- warning_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the warning color of the icon orNoneto use the default color
- error_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the error color of the icon orNoneto use the default color (allow-none)
 - Raises: - Returns: - a - GdkPixbuf.Pixbufrepresenting the loaded icon- was_symbolic: - a - bool, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.- Return type: - ( - GdkPixbuf.Pixbuf, was_symbolic:- bool)- Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from - Gtk.IconInfo.load_icon().- This allows loading symbolic icons that will match the system theme. - Unless you are implementing a widget, you will want to use - Gio.ThemedIcon.new_with_default_fallbacks() to load the icon.- As implementation details, the icon loaded needs to be of SVG type, contain the “symbolic” term as the last component of the icon name, and use the “fg”, “success”, “warning” and “error” CSS styles in the SVG file itself. - See the Symbolic Icons Specification for more information about symbolic icons. - New in version 3.0. 
- fg (
 - 
load_symbolic_async(fg, success_color, warning_color, error_color, cancellable, callback, *user_data)[source]¶
- Parameters: - fg (Gdk.RGBA) – aGdk.RGBArepresenting the foreground color of the icon
- success_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the warning color of the icon orNoneto use the default color
- warning_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the warning color of the icon orNoneto use the default color
- error_color (Gdk.RGBAorNone) – aGdk.RGBArepresenting the error color of the icon orNoneto use the default color (allow-none)
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using - Gtk.IconTheme.lookup_icon().- For more details, see - Gtk.IconInfo.load_symbolic() which is the synchronous version of this call.- New in version 3.8. 
- fg (
 - 
load_symbolic_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use - GObject.Object.unref() to release your reference to the icon.- was_symbolic: - a - bool, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.- Return type: - ( - GdkPixbuf.Pixbuf, was_symbolic:- bool)- Finishes an async icon load, see - Gtk.IconInfo.load_symbolic_async().- New in version 3.8. 
 - 
load_symbolic_for_context(context)[source]¶
- Parameters: - context ( - Gtk.StyleContext) – a- Gtk.StyleContext- Raises: - GLib.Error- Returns: - a - GdkPixbuf.Pixbufrepresenting the loaded icon- was_symbolic: - a - bool, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.- Return type: - ( - GdkPixbuf.Pixbuf, was_symbolic:- bool)- Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from - Gtk.IconInfo.load_icon(). This function uses the regular foreground color and the symbolic colors with the names “success_color”, “warning_color” and “error_color” from the context.- This allows loading symbolic icons that will match the system theme. - See - Gtk.IconInfo.load_symbolic() for more details.- New in version 3.0. 
 - 
load_symbolic_for_context_async(context, cancellable, callback, *user_data)[source]¶
- Parameters: - context (Gtk.StyleContext) – aGtk.StyleContext
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using - Gtk.IconTheme.lookup_icon().- For more details, see - Gtk.IconInfo.load_symbolic_for_context() which is the synchronous version of this call.- New in version 3.8. 
- context (
 - 
load_symbolic_for_context_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - the rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use - GObject.Object.unref() to release your reference to the icon.- was_symbolic: - a - bool, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.- Return type: - ( - GdkPixbuf.Pixbuf, was_symbolic:- bool)- Finishes an async icon load, see - Gtk.IconInfo.load_symbolic_for_context_async().- New in version 3.8. 
 - 
load_symbolic_for_style(style, state)[source]¶
- Parameters: - style (Gtk.Style) – aGtk.Styleto take the colors from
- state (Gtk.StateType) – the widget state to use for colors
 - Raises: - Returns: - a - GdkPixbuf.Pixbufrepresenting the loaded icon- was_symbolic: - a - bool, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.- Return type: - ( - GdkPixbuf.Pixbuf, was_symbolic:- bool)- Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. If the icon is not a symbolic one, the function will return the result from - Gtk.IconInfo.load_icon().- This allows loading symbolic icons that will match the system theme. - See - Gtk.IconInfo.load_symbolic() for more details.- New in version 3.0. - Deprecated since version 3.0: Use - Gtk.IconInfo.load_symbolic_for_context() instead
- style (
 - 
set_raw_coordinates(raw_coordinates)[source]¶
- Parameters: - raw_coordinates ( - bool) – whether the coordinates of embedded rectangles and attached points should be returned in their original (unscaled) form.- Sets whether the coordinates returned by - Gtk.IconInfo.get_embedded_rect() and- Gtk.IconInfo.get_attach_points() should be returned in their original form as specified in the icon theme, instead of scaled appropriately for the pixbuf returned by- Gtk.IconInfo.load_icon().- 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 - Gtk.IconInfo.get_filename(), and seeing if it is non-- Noneand ends in “.svg”.- This function is provided primarily to allow compatibility wrappers for older API’s, and is not expected to be useful for applications. - New in version 2.4. - Deprecated since version 3.14: Embedded rectangles and attachment points are deprecated 
 
- 
classmethod