kiwi.ui.objectlist.ObjectList(PropertyObject, gtk.ScrolledWindow)
class documentationkiwi.ui.objectlist
(View In Hierarchy)
Known subclasses: kiwi.ui.objectlist.ObjectTree, kiwi.ui.search.SearchResults, 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 L{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) Signals ======= - B{row-activated} (list, object): - Emitted when a row is "activated", eg double clicked or pressing enter. See the GtkTreeView documentation for more information - B{selection-changed} (list, object): - Emitted when the selection changes for the ObjectList enter. See the documentation on GtkTreeSelection::changed for more information - B{double-click} (list, object): - Emitted when a row is double-clicked, mostly you want to use the row-activated signal instead to be able catch keyboard events. - B{right-click} (list, object): - Emitted when a row is clicked with the right mouse button. - B{cell-edited} (list, object, attribute): - Emitted when a cell is edited. - B{has-rows} (list, bool): - Emitted when the objectlist goes from an empty to a non-empty state or vice verse. Properties ========== - B{selection-mode}: gtk.SelectionMode I{gtk.SELECTION_BROWSE} - Represents the selection-mode of a GtkTreeSelection of a GtkTreeView.
Method | __init__ | No summary |
Method | __len__ | len(list) |
Method | __nonzero__ | if list |
Method | __contains__ | item in list |
Method | __iter__ | for item in list |
Method | __getitem__ | list[n] |
Method | __setitem__ | list[n] = m |
Method | extend | Extend list by appending elements from the iterable |
Method | index | Return first index of value |
Method | count | L.count(item) -> integer -- return number of occurrences of value |
Method | insert | No summary |
Method | pop | Remove and return item at index (default last) @param index: |
Method | reverse | L.reverse() -- reverse *IN PLACE* |
Method | sort | L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1 |
Method | sort_by_attribute | Sort by an attribute in the object model. |
Method | set_context_menu | Sets a context-menu (eg, when you right click) for the list. @param menu: context menu @type menu: ContextMenu |
Method | prop_set_selection_mode | Undocumented |
Method | prop_get_selection_mode | Undocumented |
Method | get_model | Return treemodel of the current list |
Method | get_treeview | Return treeview of the current list |
Method | get_columns | Undocumented |
Method | get_column_by_name | Returns the name of a column |
Method | get_treeview_column | Get the treeview column given an objectlist column @param column: a @Column |
Method | set_spinbutton_digits | Set the number of precision digits used by the spinbutton in a column. |
Method | grab_focus | Grabs the focus of the ObjectList |
Method | set_columns | Set columns. @param columns: a sequence of L{Column} objects. |
Method | append | Adds an instance to the list. @param instance: the instance to be added (according to the columns spec) @param select: whether or not the new item should appear selected. |
Method | remove | Remove an instance from the list. If the instance is not in the list it returns False. Otherwise it returns True. |
Method | update | Undocumented |
Method | refresh | Reloads the values from all objects. |
Method | set_column_visibility | Undocumented |
Method | get_selection_mode | Undocumented |
Method | set_selection_mode | Undocumented |
Method | unselect_all | Undocumented |
Method | select_paths | Selects a number of rows corresponding to paths |
Method | select | Undocumented |
Method | get_selected | Returns the currently selected object If an object is not selected, None is returned |
Method | get_selected_rows | Returns a list of currently selected objects If no objects are selected an empty list is returned |
Method | add_list | Allows a list to be loaded, by default clearing it first. freeze() and thaw() are called internally to avoid flashing. |
Method | clear | Removes all the instances of the list |
Method | get_next | 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. |
Method | get_previous | 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. |
Method | get_selected_row_number | Get the selected row number or None if no rows were selected |
Method | double_click | Same as double clicking on the row rowno |
Method | set_headers_visible | Show or hide the headers. @param value: if true, shows the headers, if false hide then |
Method | set_visible_rows | No summary |
Method | enable_dnd | Enables Drag and Drop from this object list |
Method | get_dnd_targets | Get a list of dnd targets ObjectList supports |
Method | _load | Undocumented |
Method | _setup_columns | Undocumented |
Method | _attach_column | Undocumented |
Method | _select_and_focus_row | Undocumented |
Method | _on_model__row_inserted | Undocumented |
Method | _on_model__row_deleted | Undocumented |
Method | _model_sort_func | This method is used to sort the GtkTreeModel |
Method | _on_selection__changed | This method is used to proxy selection::changed to selection-changed |
Method | _on_scrolled_window__realize | Undocumented |
Method | _on_scrolled_window__size_allocate | Resize the Vertical Scrollbar to make it smaller and let space for the popup button. Also put that button there. |
Method | _treeview_search_equal_func | for searching inside the treeview, case-insensitive by default |
Method | _on_treeview_header__button_release_event | Undocumented |
Method | _after_treeview__row_activated | After activated (double clicked or pressed enter) on a row |
Method | _get_selection_or_selected_rows | Undocumented |
Method | _emit_button_press_signal | Undocumented |
Method | _on_treeview__button_press_event | Generic button-press-event handler to be able to catch double clicks |
Method | _on_treeview__source_drag_data_get | Undocumented |
Method | _get_column_button | Return the button widget of a particular TreeViewColumn. |
Method | _setup_popup_button | 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. |
Method | _find_vertical_scrollbar | 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. |
Method | _get_header_height | Undocumented |
Method | _clear_columns | Undocumented |
Method | _remove | Undocumented |
Inherited from PropertyObject:
Class Method | __class_init__ | Undocumented |
Method | __post_init__ | No summary |
Method | get_attribute_names | Undocumented |
Method | is_default_value | Undocumented |
Method | do_set_property | Undocumented |
Method | do_get_property | Undocumented |
Method | _set | Undocumented |
Method | _get | Undocumented |
Create a new ObjectList object. @param columns: a list of L{Column}s @param objects: a list of objects to be inserted or None @param mode: selection mode @param sortable: whether the user can sort the list @param model: gtk.TreeModel to use or None to create one
Return first index of value @param item: @param start: @param stop
Inserts an instance to the list @param index: position to insert the instance at @param instance: the instance to be added (according to the columns spec) @param select: whether or not the new item should appear selected.
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. @param attribute: attribute to sort on @type attribute: string @param order: one of gtk.SORT_ASCENDING, gtk.SORT_DESCENDING @type order: gtk.SortType
Sets a context-menu (eg, when you right click) for the list. @param menu: context menu @type menu: ContextMenu
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.
Get the treeview column given an objectlist column @param column: a @Column
Set the number of precision digits used by the spinbutton in a column. @param column_name: the column name which has the spinbutton @type column_name: str @param digits: a number specifying the precision digits @type digits: int
Adds an instance to the list. @param instance: the instance to be added (according to the columns spec) @param select: whether or not the new item should appear selected.
Remove an instance from the list. If the instance is not in the list it returns False. Otherwise it returns True. @param instance: @param select: if true, the previous item will be selected if there is one.
Reloads the values from all objects. @param view_only: if True, only force a refresh of the visible part of this objectlist's Treeview.
Selects a number of rows corresponding to paths @param paths: rows to be selected
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. @param instances: a list to be added @param clear: a boolean that specifies whether or not to clear 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. @param instance: the instance
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. @param instance: the instance
Show or hide the headers. @param value: if true, shows the headers, if false hide then