XApp.IconChooserDialog

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.Window Gtk.Window Gtk.Bin->Gtk.Window Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container XApp.GtkWindow XApp.GtkWindow Gtk.Window->XApp.GtkWindow XApp.IconChooserDialog XApp.IconChooserDialog XApp.GtkWindow->XApp.IconChooserDialog

Subclasses:

None

Methods

Inherited:

XApp.GtkWindow (5), Gtk.Window (119), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

add_button (button, packing, response_id)

add_custom_category (name, icons)

get_default_icon ()

get_icon_string ()

run ()

run_with_category (category)

run_with_icon (icon)

set_default_icon (icon)

Virtual Methods

Inherited:

Gtk.Window (5), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Window (33), Gtk.Container (3), Gtk.Widget (39)

Name

Type

Flags

Short Description

allow-paths

bool

r/w/en

Whether to allow paths.

default-icon

str

r/w/en

The icon to use by default

icon-size

XApp.IconSize

r/w/en

The preferred icon size.

Style Properties

Inherited:

Gtk.Window (2), Gtk.Widget (17)

Signals

Inherited:

Gtk.Window (5), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

close

select

Fields

Inherited:

Gtk.Window (5), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Class Details

class XApp.IconChooserDialog(*args, **kwargs)
Bases:

XApp.GtkWindow

Abstract:

No

Structure:

XApp.IconChooserDialogClass

classmethod new()
Returns:

a newly created XApp.IconChooserDialog

Return type:

XApp.IconChooserDialog

Creates a new XApp.IconChooserDialog.

add_button(button, packing, response_id)
Parameters:

Allows a button to be added to the Gtk.ActionBar of the dialog with a custom response id.

add_custom_category(name, icons)
Parameters:
  • name (str) – the name of the category as it will be displayed in the category list

  • icons ([str]) – a list of icon names to add to the new category

Adds a custom category to the dialog.

get_default_icon()
Returns:

the default icon, or None if none is set

Return type:

str

Returns the default icon (if set).

get_icon_string()
Returns:

the string representation of the currently selected icon or None if no icon is selected.

Return type:

str

Gets the currently selected icon from the dialog. If allow-paths is True, this function may return either an icon name or a path depending on what the user selects. Otherwise it will only return an icon name.

run()
Returns:

Gtk.ResponseType.OK if the user selected an icon, or Gtk.ResponseType.CANCEL otherwise

Return type:

int

Shows the dialog and enters a separate main loop until an icon is chosen or the action is canceled.

XApp.IconChooserDialog.run (), XApp.IconChooserDialog.run_with_icon(), and XApp.IconChooserDialog.run_with_category () may all be called multiple times. This is useful for applications which use this dialog multiple times, as it may improve performance for subsequent calls.

run_with_category(category)
Parameters:

category (str) –

Returns:

Gtk.ResponseType.OK if the user selected an icon, or Gtk.ResponseType.CANCEL otherwise

Return type:

int

Like XApp.IconChooserDialog.run but selects a particular category specified by category. This is used when there is a particular category of icon that is more appropriate than the others. If the category does not exist, the first category in the list will be selected. To get a list of possible categories, use Gtk.IconTheme.list_contexts ().

XApp.IconChooserDialog.run (), XApp.IconChooserDialog.run_with_icon(), and XApp.IconChooserDialog.run_with_category () may all be called multiple times. This is useful for applications which use this dialog multiple times, as it may improve performance for subsequent calls.

run_with_icon(icon)
Parameters:

icon (str) – a string representing the icon that should be selected

Returns:

Gtk.ResponseType.OK if the user selected an icon, or Gtk.ResponseType.CANCEL otherwise

Return type:

int

Like XApp.IconChooserDialog.run but selects the icon specified by icon. This can be either an icon name or a path. Passing an icon string or path that doesn’t exist is accepted, but it may show multiple results, or none at all. This behavior is useful if, for example, you wish to have the user select an image file from a particular directory.

If the property allow_paths is False, setting a path will yield no results when the dialog is opened.

XApp.IconChooserDialog.run (), XApp.IconChooserDialog.run_with_icon(), and XApp.IconChooserDialog.run_with_category () may all be called multiple times. This is useful for applications which use this dialog multiple times, as it may improve performance for subsequent calls.

set_default_icon(icon)
Parameters:

icon (str) – the default icon, or None to unset

Sets the default icon. If icon is not None, a button will be shown that will reset the dialog to it’s default value.

Signal Details

XApp.IconChooserDialog.signals.close(icon_chooser_dialog)
Signal Name:

close

Flags:

RUN_LAST, ACTION

Parameters:

icon_chooser_dialog (XApp.IconChooserDialog) – The object which received the signal

XApp.IconChooserDialog.signals.select(icon_chooser_dialog)
Signal Name:

select

Flags:

RUN_LAST, ACTION

Parameters:

icon_chooser_dialog (XApp.IconChooserDialog) – The object which received the signal

Property Details

XApp.IconChooserDialog.props.allow_paths
Name:

allow-paths

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow paths to be searched and selected or only icon names.

XApp.IconChooserDialog.props.default_icon
Name:

default-icon

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The icon to use by default.

XApp.IconChooserDialog.props.icon_size
Name:

icon-size

Type:

XApp.IconSize

Default Value:

XApp.IconSize._32

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The preferred size to use when looking up icons. This only works with icon names. Additionally, there is no guarantee that a selected icon name will exist in a particular size.