Icons & Images¶
Provides methods for convenient icons and image handling
Icon management¶
-
xlgui.icons.
MANAGER
¶ Singleton instance of the
IconManager
-
class
xlgui.icons.
IconManager
[source]¶ Provides convenience functions for managing icons and images in general
-
add_icon_name_from_directory
(icon_name, directory)[source]¶ Registers an icon name from files found in a directory
Parameters: - icon_name (string) – the name for the icon
- directory (string) – the location to search for icons
Returns: filesystem location of the highest-quality icon of this name, or None if not found
Return type: Optional[str]
-
add_icon_name_from_file
(icon_name, filename, size=None)[source]¶ Registers an icon name from a filename
Parameters: - icon_name (string) – the name for the icon
- filename (string) – the filename of an image
- size (int) – the size the icon shall be registered for
-
add_icon_name_from_pixbuf
(icon_name, pixbuf, size=None)[source]¶ Registers an icon name from a pixbuf
Parameters: - icon_name (string) – the name for the icon
- pixbuf (
GdkPixbuf.Pixbuf
) – the pixbuf of an image - size (int) – the size the icon shall be registered for
-
Utilities¶
-
class
xlgui.icons.
ExtendedPixbuf
(pixbuf)[source]¶ A
GdkPixbuf.Pixbuf
wrapper class allowing for interaction using standard operatorsThus you can do the following:
pixbuf1 + pixbuf2
(horizontally appendspixbuf2
topixbuf1
)pixbuf * 5
(multiplies the content ofpixbuf
)pixbuf1 & pixbuf2
(simple composition ofpixbuf2
onpixbuf1
, the desired alpha value has to be included in the pixbufs themselves)pixbuf1 < pixbuf2
,pixbuf1 > pixbuf2
(compares the pixbuf dimensions)pixbuf1 == pixbuf2
(compares the pixel data, use the is operator to check for identity)
Even more is possible with the provided verbose methods
-
add_horizontal
(other, spacing=0)[source]¶ Horizontally appends a pixbuf to the current
Parameters: - other (
GdkPixbuf.Pixbuf
) – the pixbuf to append - spacing (int) – amount of pixels between the pixbufs
Returns: a new pixbuf
Return type: - other (
-
add_vertical
(other, spacing=0)[source]¶ Vertically appends a pixbuf to the current
Parameters: - other (
GdkPixbuf.Pixbuf
) – the pixbuf to append - spacing (int) – amount of pixels between the pixbufs
Returns: a new pixbuf
Return type: - other (
-
composite_simple
(other)[source]¶ Composites a pixbuf on the current pixbuf at the location (0, 0)
Parameters: other ( GdkPixbuf.Pixbuf
) – the pixbuf to compositeReturns: a new pixbuf Return type: ExtendedPixbuf
-
move
(offset_x, offset_y, resize=False)[source]¶ Moves the content of the current pixbuf within its boundaries (clips overlapping data) and optionally resizes the pixbuf to contain the movement
Parameters: Returns: a new pixbuf
Return type:
-
multiply_horizontal
(multiplier, spacing=0)[source]¶ Horizontally multiplies the current pixbuf content
Parameters: Returns: a new pixbuf
Return type:
-
xlgui.icons.
extended_pixbuf_new_from_file
(filename)[source]¶ Returns a new
ExtendedPixbuf
containing an image loaded from the specified fileParameters: filename (string) – the name of the file containing the image to load Returns: a new pixbuf Return type: ExtendedPixbuf