known subclasses: kiwi.ui.search.SearchResults, kiwi.ui.objectlist.ObjectTree, kiwi.ui.widgets.list.List
An enhanced version of GtkTreeView, which provides pythonic wrappers for accessing rows, and optional facilities for column sorting (with types) and column selection.
Items in an ObjectList is stored in objects. Each row represents an object and each column represents an attribute in the object. The column description object must be a subclass of Column. Simple example
>>> class Fruit: >>> pass
>>> apple = Fruit() >>> apple.name = 'Apple' >>> apple.description = 'Worm house'
>>> banana = Fruit() >>> banana.name = 'Banana' >>> banana.description = 'Monkey food'
>>> fruits = ObjectList([Column('name'), >>> Column('description')]) >>> fruits.append(apple) >>> fruits.append(banana)
Function | __init__ | Create a new ObjectList object. |
Function | __len__ | len(list) |
Function | __nonzero__ | if list |
Function | __contains__ | item in list |
Function | __iter__ | for item in list |
Function | __getitem__ | list[n] |
Function | __setitem__ | list[n] = m |
Function | extend | Extend list by appending elements from the iterable |
Function | index | Return first index of value |
Function | count | L.count(item) -> integer -- return number of occurrences of value |
Function | insert | Inserts an instance to the list |
Function | pop | Remove and return item at index (default last) |
Function | reverse | L.reverse() -- reverse *IN PLACE* |
Function | sort | L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; |
Function | sort_by_attribute | Sort by an attribute in the object model. |
Function | set_context_menu | Sets a context-menu (eg, when you right click) for the list. |
Function | prop_set_selection_mode | Undocumented |
Function | prop_get_selection_mode | Undocumented |
Function | _load | Undocumented |
Function | _setup_columns | Undocumented |
Function | _attach_column | Undocumented |
Function | _select_and_focus_row | Undocumented |
Function | _on_model__row_inserted | Undocumented |
Function | _on_model__row_deleted | Undocumented |
Function | _model_sort_func | This method is used to sort the GtkTreeModel |
Function | _on_selection__changed | This method is used to proxy selection::changed to selection-changed |
Function | _on_scrolled_window__realize | Undocumented |
Function | _on_scrolled_window__size_allocate | Resize the Vertical Scrollbar to make it smaller and let space |
Function | _treeview_search_equal_func | for searching inside the treeview, case-insensitive by default |
Function | _on_treeview_header__button_release_event | Undocumented |
Function | _after_treeview__row_activated | After activated (double clicked or pressed enter) on a row |
Function | _get_selection_or_selected_rows | Undocumented |
Function | _emit_button_press_signal | Undocumented |
Function | _on_treeview__button_press_event | Generic button-press-event handler to be able to catch double clicks |
Function | _on_treeview__source_drag_data_get | Undocumented |
Function | _get_column_button | Return the button widget of a particular TreeViewColumn. |
Function | _setup_popup_button | Put a button on top of the vertical scrollbar to show the popup |
Function | _find_vertical_scrollbar | This method is called from a .forall() method in the ScrolledWindow. |
Function | _get_header_height | Undocumented |
Function | get_model | Return treemodel of the current list |
Function | get_treeview | Return treeview of the current list |
Function | get_columns | Undocumented |
Function | get_column_by_name | Returns the name of a column |
Function | get_treeview_column | Get the treeview column given an objectlist column |
Function | set_spinbutton_digits | Set the number of precision digits used by the spinbutton in |
Function | grab_focus | Grabs the focus of the ObjectList |
Function | _clear_columns | Undocumented |
Function | set_columns | Set columns. |
Function | append | Adds an instance to the list. |
Function | _remove | Undocumented |
Function | remove | Remove an instance from the list. |
Function | update | Undocumented |
Function | refresh | Reloads the values from all objects. |
Function | set_column_visibility | Undocumented |
Function | get_selection_mode | Undocumented |
Function | set_selection_mode | Undocumented |
Function | unselect_all | Undocumented |
Function | select_paths | Selects a number of rows corresponding to paths |
Function | select | Undocumented |
Function | get_selected | Returns the currently selected object |
Function | get_selected_rows | Returns a list of currently selected objects |
Function | add_list | Allows a list to be loaded, by default clearing it first. |
Function | clear | Removes all the instances of the list |
Function | get_next | Returns the item after instance in the list. |
Function | get_previous | Returns the item before instance in the list. |
Function | get_selected_row_number | Get the selected row number or None if no rows were selected |
Function | double_click | Same as double clicking on the row rowno |
Function | set_headers_visible | Show or hide the headers. |
Function | set_visible_rows | Sets the number of visible rows of the treeview. This is useful to use |
Function | enable_dnd | Enables Drag and Drop from this object list |
Function | get_dnd_targets | Get a list of dnd targets ObjectList supports |
Create a new ObjectList object.
len(list)
if list
item in list
for item in list
list[n]
list[n] = m
Extend list by appending elements from the iterable
Return first index of value
L.count(item) -> integer -- return number of occurrences of value
Inserts an instance to the list
Remove and return item at index (default last)
L.reverse() -- reverse *IN PLACE*
L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Sort by an attribute in the object model.
Sets a context-menu (eg, when you right click) for the list.
This method is used to sort the GtkTreeModel
This method is used to proxy selection::changed to selection-changed
Resize the Vertical Scrollbar to make it smaller and let space for the popup button. Also put that button there.
for searching inside the treeview, case-insensitive by default
After activated (double clicked or pressed enter) on a row
Generic button-press-event handler to be able to catch double clicks
Return the button widget of a particular TreeViewColumn.
This hack is needed since that widget is private of the TreeView but we need access to them for Tooltips, right click menus, ...
Use this function at your own risk
Put a button on top of the vertical scrollbar to show the popup menu. Internally it uses a POPUP window so you can tell how *Evil* is this.
This method is called from a .forall() method in the ScrolledWindow. It just save a reference to the vertical scrollbar for doing evil things later.
Return treemodel of the current list
Return treeview of the current list
Returns the name of a column
Get the treeview column given an objectlist column
Set the number of precision digits used by the spinbutton in a column.
Grabs the focus of the ObjectList
Set columns.
Adds an instance to the list.
Remove an instance from the list. If the instance is not in the list it returns False. Otherwise it returns True.
Reloads the values from all objects.
Selects a number of rows corresponding to paths
Returns the currently selected object If an object is not selected, None is returned
Returns a list of currently selected objects If no objects are selected an empty list is returned
Allows a list to be loaded, by default clearing it first. freeze() and thaw() are called internally to avoid flashing.
Removes all the instances of the list
Returns the item after instance in the list. Note that the instance must be inserted before this can be called If there are no instances after, the first item will be returned.
Returns the item before instance in the list. Note that the instance must be inserted before this can be called If there are no instances before, the last item will be returned.
Get the selected row number or None if no rows were selected
Same as double clicking on the row rowno
Show or hide the headers.
Sets the number of visible rows of the treeview. This is useful to use instead of set_size_request() directly, since you can avoid using raw pixel sizes.
Enables Drag and Drop from this object list
Get a list of dnd targets ObjectList supports