gtk.IconSourcea source for icon variantsSynopsisgtk.IconSourcegobject.GBoxedgtk.IconSourcecopyfreeset_filenamefilenameset_pixbufpixbufget_filenameget_pixbufset_direction_wildcardedsettingset_state_wildcardedsettingset_size_wildcardedsettingget_size_wildcardedget_state_wildcardedget_direction_wildcardedset_directiondirectionset_statestateset_sizesizeget_directionget_stateget_sizeset_icon_nameicon_nameget_icon_nameFunctionsgtk.icon_size_lookupicon_sizegtk.icon_size_lookup_for_settingssettingsicon_sizegtk.icon_size_registernamewidthheightgtk.icon_size_register_aliasaliastargetgtk.icon_size_from_namenamegtk.icon_size_get_namesizeDescriptionA gtk.IconSource
contains a gtk.gdk.Pixbuf (or
an image filename) that serves as the base image for one or more of the
icons in a gtk.IconSet, along
with a specification for which icons in the icon set will be based on that
pixbuf or image file. By default, the icon source has all parameters
wildcarded. That is, the icon source can be used as the base icon for any
desired text direction, widget state, or icon size.Constructorgtk.IconSourceReturns :a new gtk.IconSourceCreates a new gtk.IconSource.
A gtk.IconSource
contains a gtk.gdk.Pixbuf (or
image filename) that serves as the base image for one or more of the icons
in a gtk.IconSet, along
with a specification for which icons in the icon set will be based on that
pixbuf or image file. By default, the icon source has all parameters
wildcarded. That is, the icon source will be used as the base icon for any
desired text direction, widget state, or icon size.Methodsgtk.IconSource.copycopyReturns :a new gtk.IconSourceThe copy() method creates a copy of the
icon source.gtk.IconSource.freefreeThis method is deprecated and should not be used. Use of this
method may cause your application to crash.The free() method frees a
dynamically-allocated icon source, along with its filename, size, and pixbuf
fields if those are not None.gtk.IconSource.set_filenameset_filenamefilenamefilename :the image file to useThe set_filename() method sets the name
of the image file (specified by filename) to use as
the base image when creating icon variants for a gtk.IconSet. The
filename must be absolute.gtk.IconSource.set_pixbufset_pixbufpixbufpixbuf :the pixbuf to use as a
sourceThe set_pixbuf() method sets a pixbuf
(specified by pixbuf) to use as a base image when
creating icon variants for a gtk.IconSet. If an
icon source has both a filename and a pixbuf set, the pixbuf will take
priority.gtk.IconSource.get_filenameget_filenameReturns :the image filenameThe get_filename() method retrieves the
source filename, or None if none is set.gtk.IconSource.get_pixbufget_pixbufReturns :the source pixbufThe get_pixbuf() method retrieves the
source pixbuf, or None if none is set.gtk.IconSource.set_direction_wildcardedset_direction_wildcardedsettingsetting :if True wildcard the text
directionThe set_direction_wildcarded() method
determines whether the icon source direction is wildcarded according to the
value specified by setting. If
setting is True the text direction
is wildcarded and the icon source can be used as the base image for an icon
in any text direction (gtk.TEXT_DIR_NONE,
gtk.TEXT_DIR_LTR or gtk.TEXT_DIR_RTL).
If the text direction is not wildcarded, then the text direction the icon
source applies to should be set with the set_direction()
method and the icon source will only be used with that text direction.
Non-wildcarded icon sources (exact matches) are preferred over wildcarded
icon sources. An exact match will be used when possible.gtk.IconSource.set_state_wildcardedset_state_wildcardedsettingsetting :if True wildcard the widget
stateThe set_state_wildcarded() method
determines whether the icon source state is wildcarded according to the
value of setting. If setting
is True the widget state is wildcarded and the icon
source can be used as the base image for an icon in any widget state
(gtk.STATE_NORMAL, gtk.STATE_ACTIVE,
gtk.STATE_PRELIGHT, gtk.STATE_SELECTED
or gtk.STATE_INSENSITIVE). If the widget state is not
wildcarded, then the widget state the icon source applies to should be set
with the set_state()
method and the icon source will only be used with that specific state.
Non-wildcarded icon sources (exact matches) are preferred over wildcarded
icon sources. An exact match will be used when possible.A gtk.IconSet will
normally transform wildcarded icon source images to produce an appropriate
icon for a given state, for example lightening an image on prelight, but
will not modify source images that match exactly.gtk.IconSource.set_size_wildcardedset_size_wildcardedsettingsetting :if True wildcard the widget
stateThe set_size_wildcarded() determines
whether the icon source can be used as the basis for an icon of any size
according to the value of setting. If
setting is True the icon size is
wildcarded and the icon source can be used as the base image for an icon of
any size. If the size is not wildcarded, then the size the icon source
applies to should be set with gtk.IconSource.set_size()
and the icon source will only be used with that specific size.
Non-wildcarded icon sources (exact matches) are preferred over wildcarded
icon sources. An exact match will be used when possible.gtk.IconSet will
normally scale wildcarded source images to produce an appropriate icon at a
given size, but will not change the size of source images that match
exactly.gtk.IconSource.get_size_wildcardedget_size_wildcardedReturns :True if this icon source is
a base for any icon size variantThe get_size_wildcarded() method gets
the value set by the set_size_wildcarded()
method.gtk.IconSource.get_state_wildcardedget_state_wildcardedReturns :True if this icon source is
a base for any widget state variantThe get_state_wildcarded() method gets
the value set by the set_state_wildcarded()
method.gtk.IconSource.get_direction_wildcardedget_direction_wildcardedReturns :True if this icon source is
a base for any text direction variantThe get_direction_wildcarded() method
gets the value set by the set_direction_wildcarded()
method.gtk.IconSource.set_directionset_directiondirectiondirection :the text direction this icon source applies
toThe set_direction() method sets the
text direction according to the value of direction
that the icon source is intended to be used with. The value of direction
must be one of: gtk.TEXT_DIR_NONE,
gtk.TEXT_DIR_LTR or
gtk.TEXT_DIR_RTL.Setting the text direction on an icon source makes no difference
if the text direction is wildcarded. Therefore, you should usually call the
set_direction_wildcarded()
method with a setting of False to un-wildcard it in
addition to calling this function.gtk.IconSource.set_stateset_statestatestate :the widget state this source applies
toThe set_state() method sets the widget
state specified by state that the icon source is
intended to be used with. The value of state must be
one of: gtk.STATE_NORMAL,
gtk.STATE_ACTIVE, gtk.STATE_PRELIGHT,
gtk.STATE_SELECTED or
gtk.STATE_INSENSITIVE. Setting the widget state on an
icon source makes no difference if the state is wildcarded. Therefore, you
should usually call the set_state_wildcarded()
method with a setting of False to un-wildcard it in
addition to calling this function.gtk.IconSource.set_sizeset_sizesizesize :the icon size this source applies
toThe set_size() method sets the icon
size specified by size that the icon source is
intended to be used with. Setting the icon size for an icon source makes no
difference if the size is wildcarded. Therefore, you should usually call the
gtk.IconSource.set_size_wildcarded()
method with a setting of False to un-wildcard it in
addition to calling this function.gtk.IconSource.get_directionget_directionReturns :the text direction the icon source
matchesThe get_direction() method obtains the
text direction this icon source applies to. The return value is only useful
and meaningful if the text direction is not
wildcarded.gtk.IconSource.get_stateget_stateReturns :the widget state the icon source
matchesThe get_state() method obtains the
widget state this icon source applies to. The return value is only useful
and meaningful if the widget state is not
wildcarded.gtk.IconSource.get_sizeget_sizeReturns :the icon size this source
matches.The get_size() method obtains the icon
size this source applies to. The return value is only useful and meaningful
if the icon size is not wildcarded.gtk.IconSource.set_icon_nameset_icon_nameicon_nameicon_name :an icon name
toThis method is available in PyGTK 2.4 and above.The set_icon_name() method uses the
name specified by icon_name to look up an icon in the
current icon theme to use as a base image when creating icon variants for
gtk.IconSet.In PyGTK 2.10 and above, icon_name may be
None to unset the icon name.gtk.IconSource.get_icon_nameget_icon_nameReturns :the icon name or None if no
name is set.This method is available in PyGTK 2.4 and above.The get_icon() method returns the
source icon name, or None if no name is set.Functionsgtk.icon_size_lookupgtk.icon_size_lookupicon_sizeicon_size : an icon sizeReturns :a 2-tuple containing the width and height of
the specified icon_sizeThe gtk.icon_size_lookup() function returns
a 2-tuple containing the width and height of the icon size specified by
icon_size. The value of
icon_size must be one of:gtk.ICON_SIZE_MENUgtk.ICON_SIZE_SMALL_TOOLBARgtk.ICON_SIZE_LARGE_TOOLBARgtk.ICON_SIZE_BUTTONgtk.ICON_SIZE_DNDgtk.ICON_SIZE_DIALOGor an integer value returned from the gtk.icon_size_register()
function.gtk.icon_size_lookup_for_settingsgtk.icon_size_lookup_for_settingssettingsicon_sizesettings :a gtk.Settings
object used to determine which user preferences to use.icon_size : an icon sizeReturns :a 2-tuple containing the width and height of
the specified icon_size or None
if icon_size was invalid.This function is available in PyGTK 2.4 and above.The gtk.icon_size_lookup_for_settings()
function returns a 2-tuple containing the width and height of the icon size
specified by icon_size of None if
icon_size was not valid. The value of
icon_size must be one of:gtk.ICON_SIZE_MENUgtk.ICON_SIZE_SMALL_TOOLBARgtk.ICON_SIZE_LARGE_TOOLBARgtk.ICON_SIZE_BUTTONgtk.ICON_SIZE_DNDgtk.ICON_SIZE_DIALOGor an integer value returned from the gtk.icon_size_register()
function.gtk.icon_size_registergtk.icon_size_registernamewidthheightname :the name of the icon sizewidth :the width of the icon sizeheight :the height of the icon
sizeReturns :an integer representing the icon
sizeThe gtk.icon_size_register() function
registers a new icon size for the specified width and
height with the specified name
and returns the integer used to represent the icon size.gtk.icon_size_register_aliasgtk.icon_size_register_aliasaliastargetalias :an alias for
targettarget :an integer representing an existing icon
sizeThe gtk.icon_size_register_alias() function
registers the specified alias as another name for the
icon size specified by target.gtk.icon_size_from_namegtk.icon_size_from_namenamename :a name of an existing icon
sizeReturns :the icon size associated with
nameThe gtk.icon_size_from_name() function
returns the integer representing the icon size associated with the specified
name.gtk.icon_size_get_namegtk.icon_size_get_namesizesize :an integer representing an existing icon
sizeReturns :the name associated with the icon size
represented by sizeThe gtk.icon_size_get_name() function
returns the name of the icon size represented by
size.