inkex.gui.listview module#

Wraps the gtk treeview and iconview in something a little nicer.

inkex.gui.listview.default(item, attr, d=None)[source]#

Python logic to choose an attribute, call it if required and return

inkex.gui.listview.cmp(a, b)[source]#

Compare two objects

inkex.gui.listview.item_property(name, d=None)[source]#
inkex.gui.listview.label(obj)[source]#
class inkex.gui.listview.BaseView(widget, liststore=None, **kwargs)[source]#

Bases: object

Controls for tree and icon views, a base class

widget_type: Optional[Type[gi.overrides.Gtk.Widget]] = None#
get_model()[source]#

Returns the current data store model

create_model(liststore)[source]#

Setup the model and list

refresh()[source]#

Attempt to refresh the listview

setup()[source]#

Setup columns, views, sorting etc

get_item_id(item)[source]#

Return an id set against this item.

If item.get_id() is set then duplicates will be ignored.

replace(new_item, item_iter=None)[source]#

Replace all items, or a single item with object

item_selected(item=None, *others)[source]#

Base method result, called as an item is selected

remove_item(item=None)[source]#

Remove an item from this view

check_item_id(item)[source]#

Item id is recorded to guard against duplicates

set_sensitive(sen=True)[source]#

Proxy the GTK property for sensitivity

clear()[source]#

Clear all items from this treeview

item_double_clicked(*items)[source]#

What happens when you double click an item

get_item(item_iter)[source]#

Return the object of attention from an iter

get_iter(item, path=False)[source]#

Return the iter given the item

class inkex.gui.listview.TreeView(widget, liststore=None, **kwargs)[source]#

Bases: inkex.gui.listview.BaseView

Controls and operates a tree view.

column_size = 16#
widget_type#

alias of gi.overrides.Gtk.TreeView

changed_signal = 'cursor_changed'#
setup()[source]#

Setup the treeview

static is_separator(model, item_iter, data)[source]#

Internal function for seperator checking

get_selected_items()[source]#

Return a list of selected item objects

set_selected_items(*items)[source]#

Select the given items

is_selected(item)[source]#

Return true if the item is selected

add(target, parent=None)[source]#

Add all items from the target to the treeview

add_item(item, parent=None)[source]#

Add a single item image to the control, returns the TreePath

_add_item(item, parent)[source]#
item_selected_signal(*args, **kwargs)[source]#

Signal for selecting an item

item_button_clicked(_, event)[source]#

Signal for mouse button click

expand_item(item, expand=True)[source]#

Expand one of our nodes

create_model(liststore=None)[source]#

Set up an icon view for showing gallery images

create_column(name, expand=True)[source]#

Create and pack a new column to this list.

name - Label in the column header expand - Should the column expand

create_sort(*args, **kwargs)[source]#

Create and attach a sorting view to this list.

see ViewSort arguments for details.

class inkex.gui.listview.ComboBox(widget, liststore=None, **kwargs)[source]#

Bases: inkex.gui.listview.TreeView

Controls and operates a combo box list.

widget_type#

alias of gi.overrides.Gtk.ComboBox

changed_signal = 'changed'#
setup()[source]#

Setup the treeview

get_selected_item()[source]#

Return the selected item of this combo box

set_selected_item(item)[source]#

Set the given item as the selected item

is_selected(item)[source]#

Returns true if this item is the selected item

get_selected_items()[source]#

Return a list of selected items (one)

class inkex.gui.listview.IconView(widget, pixmaps, *args, **kwargs)[source]#

Bases: inkex.gui.listview.BaseView

Allows a simpler IconView for DBus List Objects

widget_type#

alias of gi.overrides.Gtk.IconView

changed_signal = 'selection-changed'#
set_selected_item(item)[source]#

Sets the selected item to this item

get_selected_items()[source]#

Return the seleced item

create_model(liststore)[source]#

Setup the icon view control and model

setup()[source]#

Setup the columns for the iconview

add(target)[source]#

Add all items from the target to the iconview

add_item(item)[source]#

Add a single item image to the control

get_markup(item)[source]#

Default text return for markup.

get_icon(item)[source]#

Default icon return, pixbuf or gnome theme name

_get_icon(item)[source]#
_add_item(item)[source]#

Each item’s properties must be stuffed into the ListStore directly or the IconView won’t see them, but only if on auto.

item_selected_signal(*args, **kwargs)[source]#

Item has been selected

class inkex.gui.listview.ViewSort(widget, data=None, ascending=False, exact=None, contains=None)[source]#

Bases: object

A sorting function for use is ListViews

ascending - Boolean which direction to sort contains - Contains this string data - A string or function to get data from each item. exact - Compare to this exact string instead.

get_data(model, list_iter)[source]#

Generate sortable data from the item

sort_func(model, iter1, iter2, data)[source]#

Called by Gtk to sort items

resort()[source]#
class inkex.gui.listview.ViewColumn(widget, name, expand=False)[source]#

Bases: object

Add a column to a gtk treeview.

name - The column name used as a label. expand - Set column expansion.

add_renderer(renderer, func, expand=True)[source]#

Set a custom renderer

add_image_renderer(icon, pad=0, pixmaps=None, size=None)[source]#

Set the image renderer

icon - The function that returns the image to be dsplayed. pad - The amount of padding around the image. pixmaps - The pixmap manager to use to get images. size - Restrict the images to this size.

add_text_renderer(text, wrap=None, template=None)[source]#

Set the text renderer.

text - the function that returns the text to be displayed. wrap - The wrapping setting for this renderer. template - A standard template used for this text markup.

classmethod clean(text, markup=False)[source]#

Clean text of any pango markup confusing chars

get_callout(call, default=None)[source]#

Returns the right kind of method

text_func(call, template=None)[source]#

Wrap up our text functionality

image_func(call, pixmaps=None)[source]#

Wrap, wrap wrap the func

default_text(item)[source]#

Default text return for markup.

default_icon(item)[source]#

Default icon return, pixbuf or gnome theme name

class inkex.gui.listview.Separator[source]#

Bases: object

Reprisentation of a separator in a list