gtk.TreeView — a widget for displaying both trees and lists.
|
|
gtk.Container Signal Prototypes
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( | |
def callback( |
A gtk.TreeView
widget is used to display the contents of any model implementing the gtk.TreeModel
interface. The tree models provided standard with GTK+
and PyGTK
are:
In addition, PyGTK
provides gtk.GenericTreeModel
that allows you to create your own tree model entirely in Python.
The gtk.TreeView
uses
columns and cell renderers to actually display the model information.
GTK+
and PyGTK
provides the gtk.TreeViewColumn
to manage the display of a column and the following cell renderers:
In addition, PyGTK
provides the gtk.GenericCellRenderer
that allows you to create your own cell renderers entirely in Python.
gtk.TreeView(model
=None)
| the tree model to display |
Returns : | A new gtk.TreeView
widget. |
Creates a new gtk.TreeView
widget displaying the model specified by model
.
def get_model()
Returns : | the current gtk.TreeModel , or
None if none is currently being
used. |
The get_model
() method returns the
value of the "model" property containing the model the gtk.TreeView
is
displaying or None
there is no the model.
def set_model(model
=None)
| the new tree model to use with the treeview |
The set_model
() method sets the "model"
property for the treeview to the value of model
. If
the treeview already has a model set, this method will remove it before
setting the new model. If model
is
None
, it will unset the old model.
def get_selection()
Returns : | A gtk.TreeSelection
object. |
The get_selection
() method returns the
current gtk.TreeSelection
associated with the treeview.
def get_hadjustment()
Returns : | a gtk.Adjustment
object, or None if none is currently being
used. |
The get_hadjustment
() method returns
the value of the "hadjustment" property that contains the current horizontal
gtk.Adjustment
object or None
(if no horizontal adjustment is being
used).
def set_hadjustment(adjustment
)
| the gtk.Adjustment
to set |
The set_hadjustment
() method sets the
"hadjustment" property to the value of adjustment
that must be a gtk.Adjustment
object.
def get_vadjustment()
Returns : | a gtk.Adjustment
object, or None if none is currently being
used. |
The get_vadjustment
() method returns
the value of the "vadjustment" property that contains the horizontal gtk.Adjustment
or None if there is no vertical adjustment.
def set_vadjustment(adjustment
)
| the gtk.Adjustment
to set |
The set_vadjustment
() method sets the
"vadjustment" property to the value of adjustment
.
The new gtk.Adjustment
replaces the current vertical adjustment.
def get_headers_visible()
Returns : | True if the headers are
visible. |
The get_headers_visible
() method
returns the value of the "headers-visible" property. If "headers-visible" is
True
the headers on the treeview are visible.
def set_headers_visible(headers_visible
)
| if True the headers are
visible |
The set_headers_visible
() method sets
the "headers-visible" property to the value of
headers_visible
. If
headers_visible
is True
the
headers will be displayed.
def columns_autosize()
The columns_autosize
() method resizes
all columns to their optimal width. Only works after the treeview has been
realized.
def set_headers_clickable(active
)
| if True the headers are
clickable |
The set_headers_clickable
() method sets
the "headers-clickable" property to the value of
active
. If active
is
True
the column title buttons can be clicked.
def set_rules_hint(setting
)
| if True the tree requires
reading across rows |
The set_rules_hint
() method sets the
"rules-hint" property to the value of setting
. If
setting
is True
it indicates that
the user interface for your application requires users to read across tree
rows and associate cells with one another. By default, the tree will be
rendered with alternating row colors. Do not use it
just because you prefer the appearance of the ruled tree; that's a question
for the theme. Some themes will draw tree rows in alternating colors even
when rules are turned off, and users who prefer that appearance all the time
can choose those themes. You should call this method only as a
semantic hint to the theme engine that your tree makes
alternating colors useful from a functional standpoint (since it has lots of
columns, generally).
def get_rules_hint()
Returns : | True if rules are useful for
the user of this tree |
The get_rules_hint
() returns the value
of the "rules-hint" property. See the set_rules_hint
()
method for more information on the use of "rules-hint".
def append_column(column
)
| the gtk.TreeViewColumn
to add. |
Returns : | the number of columns in
tree_view after appending. |
The append_column
() method appends the
specified column
to the list of columns and returns
the new number of columns in the treeview.
def remove_column(column
)
| the gtk.TreeViewColumn
to remove. |
Returns : | the number of columns in the treeview after the column removal. |
The remove_column
() method removes the
specified column
from the treeview.
def insert_column(column
, position
)
| the gtk.TreeViewColumn
to be inserted. |
| the position to insert
column . |
Returns : | the number of columns in the treeview after the insertion. |
The insert_column
() method inserts the
specified column
into the treeview at the location
specified by position
. If
position
is -1, then the column is inserted at the
end.
def insert_column_with_attributes(position
, title
, cell
, ...
)
| the position to insert the new column in. |
| the title to set the header to. |
| the gtk.CellRenderer . |
| optional keyword-value arguments |
Returns : | the gtk.TreeViewColumn
that was inserted. |
The insert_column_with_attributes
()
method creates a new gtk.TreeViewColumn
and inserts it into the treeview at the location specified by
position
with the column title specified by
title
and using the gtk.CellRenderer
specified by cell
. If position
is -1, then the newly created column is inserted at the end. The column is
initialized with the optional attributes passed as keyword-value pairs (e.g.
text=0, foreground=2). See the gtk.TreeViewColumn.add_attribute
()
method for more information.
def insert_column_with_data_func(position
, title
, cell
, func
, data
=None)
| the position to insert, -1 for append |
| the column title |
| a cell renderer for the column |
| the function or method to set attributes of the cell renderer |
| the data to pass with
func |
Returns : | the number of columns in the treeview after the insertion |
The insert_column_with_data_func
()
method is a convenience function that inserts a new column into the treeview
at the location specified by position
with the
specified title
and the cell renderer specified by
cell
and using the function or method specified by
func
to set cell renderer attributes (normally using
data from the model). The signature of func is:
def celldatafunction(
column
,cell
,model
,iter
,user_data
)
def celldatamethod(
self
,column
,cell
,model
,iter
,user_data
)
where column
is the gtk.TreeViewColumn
in the treeview, cell
is the gtk.CellRenderer
for column
, model
is the gtk.TreeModel
for
the treeview and iter
is the gtk.TreeIter
pointing at the row. See the gtk.TreeViewColumn.set_cell_data_func
()
and gtk.TreeViewColumn.pack_start
()
methods for more detail.
def get_column(n
)
| the position of the column, counting from 0. |
Returns : | the gtk.TreeViewColumn ,
or None if the position is outside the range of
columns. |
The get_column
() method returns the
gtk.TreeViewColumn
at the specified position
in the treeview.
def get_columns()
Returns : | a list of gtk.TreeViewColumn
s |
The get_columns
() method returns a list
of all the gtk.TreeViewColumn
objects currently in the treeview.
def move_column_after(column
, base_column
)
| the gtk.TreeViewColumn
to be moved. |
| the gtk.TreeViewColumn
column is to be after, or
None . |
The move_column_after
() method moves
the gtk.TreeViewColumn
specified by column
to be after the treeview column
specified by base_column
. If
base_column
is None
, then
column
is placed in the first position.
def set_expander_column(column
)
| the column to draw the expander arrow at
orNone . |
The set_expander_column
() method sets
the "expander-column" property to the value of column
which must be a gtk.TreeViewColumn
in the treeview. If column
is
None
, then the expander arrow is always at the first
visible column.
def get_expander_column()
Returns : | the expander column. |
The get_expander_column
() method
returns the value of the "expander-column" property that contains the
current expander column i.e. the column that has the expander arrow drawn
next to it.
def set_column_drag_function(func
, user_data
)
| A function to determine which columns are reorderable, or None . |
| User data to be passed to func , or None |
This method is available in PyGTK 2.4 and above.
The set_column_drag_function
() method
sets the user function specified by func
for
determining where a column may be dropped when dragged. The user function is
called on every column pair in turn at the beginning of a column drag to
determine where a drop can take place. The signature of
func
is:
def func(tree_view
,column
,prev_column
,next_column
,data
)
where tree_view
is the gtk.TreeView
,
column
is the gtk.TreeViewColumn
being dragged, prev_column and next_column are the two gtk.TreeViewColumn
objects bracketing the drop spot, and data
is
user_data
. If prev_column
or
next_column
is None
, then the drop
is at an edge. If func
is None
,
the user drag function is removed and the gtk.TreeView
reverts to the default behavior of allowing any reorderable column to be
dropped anywhere.
def scroll_to_point(tree_x
, tree_y
)
| the X coordinate of new top-left pixel of visible area, or -1 |
| the Y coordinate of new top-left pixel of visible area, or -1 |
The scroll_to_point
() method scrolls
the treeview so that the top-left corner of the visible area is at the
location specified by tree_x
and
tree_y
, where tree_x
and
tree_y
are specified in tree window coordinates. The
treeview must be realized before this method is called. If it isn't, you
should use the scroll_to_cell
()
method instead. If either tree_x
or
tree_y
are -1, there is no scrolling in that
direction.
def scroll_to_cell(path
, column
=None, use_align
=False, row_align
=0.0, col_align
=0.0)
| the path of the row to move to |
| the gtk.TreeViewColumn
to move horizontally to, or None . |
| if True use the alignment
arguments |
| the vertical alignment of the row specified by
path . |
| the horizontal alignment of the column
specified by column . |
The scroll_to_cell
() method scrolls the
treeview display to the position specified by column
and path
. If column
is
None
, no horizontal scrolling occurs. The alignment
parameters specified by row_align
and
col_align
determines where
column
is placed within the treeview. The values of
col_align
and row_align
range
from 0.0 to 1.0. The alignment values specify the fraction of display space
that is to the left of or above the cell. If
use_align
is False
, the alignment
arguments are ignored, and the tree does the minimum amount of work to
scroll the cell onto the screen. This means that the cell will be scrolled
to the edge closest to it's current position. If the cell is currently
visible on the screen, nothing is done. This method only works if the model
is set, and path
is a valid row in the model.
def row_activated(path
, column
)
| the tree path of the row of the cell to be activated. |
| the gtk.TreeViewColumn
of the cell to be activated. |
The row_activated
() method activates
the cell determined by path
and
column
.
def expand_all()
The expand_all
() method recursively
expands all nodes in the treeview.
def collapse_all()
The collapse_all
() method recursively
collapses all visible, expanded nodes in the treeview.
def expand_to_path(path
)
| a path to a row. |
This method is available in PyGTK 2.2 and above.
The expand_to_row
() method expands the
row with the tree path specified by path
. This will
also expand all parent rows of path
as
necessary.
def expand_row(path
, open_all
)
| the path to a row |
| if True recursively expand,
otherwise just expand immediate children |
The expand_row
() method opens the row
specified by path
so its children are visible. If
open_all
is True
all rows are
expanded, otherwise only the immediate children of
path
are expanded.
def collapse_row(path
)
| the path to a row |
The collapse_row
() method collapses the
row specified by path
(hides its child rows, if they
exist).
def map_expanded_rows(func
, data
)
| A function to be called |
| User data to be passed to the function. |
This method is available in PyGTK 2.2 and above.
The map_expanded_rows
() method calls
the function specified by func
on all expanded rows
passing data
as an argument.
def row_expanded(path
)
| the path to a row to test the expansion state. |
Returns : | True if
path is expanded. |
The row_expanded
() method returns
True
if the node pointed to by
path
is expanded.
def set_reorderable(reorderable
)
| if True , the tree can be
reordered. |
The set_reorderable
() method sets the
"reorderable" property to the value of reorderable
.
This method is a convenience method to allow you to reorder models that
support the gtk.TreeDragSource
and the gtk.TreeDragDest
interfaces. Both gtk.TreeStore
and
gtk.ListStore
support these. If reorderable
is
True
, then the user can reorder the model by dragging and
dropping rows. The application can listen to these changes by connecting to
the model's signals.
This function does not give you any degree of control over the order -- any reordering is allowed. If more control is needed, you should probably handle drag and drop manually.
def get_reorderable()
Returns : | True if the tree can be
reordered. |
The get_reorderable
() method returns
the value of the "reorderable" property that determines if the user can
reorder the tree via drag-and-drop. See the set_reorderable
()
method for more information.
def set_cursor(path
, focus_column
=None, start_editing
=False)
| a tree path |
| a gtk.TreeViewColumn ,
or None |
| if True the specified cell
should start being edited. |
The set_cursor
() method sets the
current keyboard focus to be at the row specified by
path
, and selects it. This is useful when you want to
focus the user's attention on a particular row. If
column
is not None
, then focus is
given to the specified column. Additionally, if
column
is specified, and
start_editing
is True
, then
editing should be started in the specified cell. This method is often
followed by the gtk.Widget.grab_focus
()
method to give keyboard focus to the treeview. Please note that editing can
only happen when the widget is realized.
def set_cursor_on_cell(path
, focus_column
=None, focus_cell
=None, start_editing
=False)
| a tree path |
| a gtk.TreeViewColumn ,
or None |
| a gtk.CellRenderer ,
or None |
| True if the specified cell
should start being edited. |
This method is available in PyGTK 2.2 and above.
The set_cursor_on_cell
() method sets
the current keyboard focus to be at the node specified by
path
, and selects it. This is useful when you want
to focus the user's attention on a particular row. If
focus_column
is specified, focus is given to that
column. If focus_column
and
focus_cell
are specified, and
focus_column
contains 2 or more editable or
activatable cells, then focus is given to the cell specified by
focus_cell
. Additionally, if
focus_column
is specified, and
start_editing
is True
, editing
should be started in the specified cell. This method is often followed by
the gtk.Widget.grab_focus
()
method in order to give keyboard focus to the widget. Please note that
editing can only happen when the widget is realized.
def get_cursor()
Returns : | a tuple containing the current cursor path and focus column. |
The get_cursor
() method returns a tuple
containing the current path and focus column. If the cursor isn't currently
set, the current path will be None
. If no column
currently has focus, the current focus column will be
None
.
def get_bin_window()
Returns : | a gtk.gdk.Window , or
None |
The get_bin_window
() method returns the
window that the treeview renders to or None
if the
treeview is not realized yet. This is used primarily to compare to the
event.window
attribute to confirm that the event on the
treeview is on the right window.
def get_path_at_pos(x
, y
)
| The x position to be identified. |
| The y position to be identified. |
Returns : | a tuple containing: a tree path; a gtk.TreeViewColumn
object; the X coordinate relative to the cell; and, the Y
coordinate relative to the cell. If there is no path at the
position None is returned. |
The get_path_at_pos
() method returns a
tuple containing:
x
, y
), relative to widget
coordinatesgtk.TreeViewColumn
at that pointx
and y
are
relative to the coordinates of an event on the treeview only when
event.window==treeview.get_bin_window()
. It is primarily
used for popup menus. This method is only meaningful if the treeview is
realized. This method returns None
if there is no path at
the position.
def get_cell_area(path
, column
)
| a tree path for the row |
| a gtk.TreeViewColumn
for the column |
Returns : | rectangle |
The get_cell_area
() method returns the
bounding gtk.gdk.Rectangle
in tree window coordinates for the cell at the row specified by
path
and the column specified by
column
. If path
points to a
path not currently displayed, the y
and
height
attributes of the rectangle will be 0. The sum
of all cell rects does not cover the entire tree; there are extra pixels in
between rows, for example. The returned rectangle is equivalent to the
cell_area
passed to the gtk.CellRenderer.render
()
method. This method is only valid if the treeview is realized.
def get_background_area(path
, column
)
| a tree path for the row, |
| a gtk.TreeViewColumn
for the column |
Returns : | a rectangle |
The get_background_area
() method
returns the bounding gtk.gdk.Rectangle
in tree window coordinates for the cell at the row specified by
path
and the column specified by
column
. If path
points to a
node not found in the tree, the y
and
height
attributes of the rectangle will be 0. The
returned rectangle is equivalent to the
background_area
passed to the gtk.CellRenderer.render
().
These background areas tile to cover the entire tree window (except for the
area used for header buttons). Contrast with the
cell_area
, returned by the get_cell_area
()
method, that returns only the cell itself, excluding the surrounding borders
and the tree expander area.
def get_visible_rect()
Returns : | a rectangle |
The get_visible_rect
() method returns
the bounding gtk.gdk.Rectangle
for the currently visible region of the treeview widget, in tree
coordinates. Convert to widget coordinates with the tree_to_widget_coords
().
Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
scrollable area of the tree.
def widget_to_tree_coords(wx
, wy
)
| the widget X coordinate |
| the widget Y coordinate |
Returns : | a tuple containing the tree X and Y coordinates |
The widget_to_tree_coords
() method
returns a tuple containing the tree X and Y coordinates for the widget
coordinates specified by wx
and
wy
. The tree coordinates cover the full scrollable
area of the tree.
def tree_to_widget_coords(tx
, ty
)
| tree X coordinate |
| tree Y coordinate |
Returns : | a tuple containing the widget X and Y coordinates |
The tree_to_widget_coords
() method
returns a tuple containing the widget coordinates for the tree coordinates
specified by tx
and ty
.
def enable_model_drag_source(start_button_mask
, targets
, actions
)
| the bitmask of buttons that can start the drag |
| a sequence of tuples containing target data |
| the possible actions for a drag |
The enable_model_drag_source
() method
sets the treeview to start a drag operation when the user click and
drags on a row. The value of start_button_mask
is a combination of theGDK Modifier Constants.
targets
is a sequence (list or tuple) of
tuples that contain information about the targets. The target data
contains a string representing the drag type, target flags (a
combination of the GTK Target Flags Constants) and an application
assigned integer ID used for identification purposes.
The value of actions
is one of the GDK Drag Action Constants.
def enable_model_drag_dest(targets
, actions
)
| a sequence of tuples containing target data |
| the possible actions for a drag |
The enable_model_drag_dest
() method
sets the treeview to receive a drag drop.
targets
is a sequence (list or tuple) of
tuples that contain information about the targets. The target data
contains a string representing the drag type, target flags (a
combination of gtk.TARGET_SAME_APP
and
gtk.TARGET_SAME_WIDGET
or neither) and an
application assigned integer ID used for identification
purposes.
The value of actions
is one of the GDK Drag Action Constants.
def unset_rows_drag_source()
The unset_rows_drag_source
() method
unsets the drag source information.
def unset_rows_drag_dest()
The unset_rows_drag_dest
() method
unsets the drag destination information.
def set_drag_dest_row(path
, pos
)
| a tree path of the row to highlight, or
None . |
| a drop position |
The set_drag_dest_row
() method sets the
treeview drag destination row to the value specified by
path
with the drop position specified by
pos
. The value of pos
must be
one of: gtk.TREE_VIEW_DROP_BEFORE
,
gtk.TREE_VIEW_DROP_AFTER
,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE
or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER
.
In PyGTK 2.10 and above, path
may be
None
.
def get_drag_dest_row()
Returns : | a 2-tuple containing the tree path and the drop
position relative to the tree path or
None |
The get_drag_dest_row
() method returns
a 2-tuple containing the path of the drag destination row and a drop
position relative to the destination row. The drop position is one of:
gtk.TREE_VIEW_DROP_BEFORE
,
gtk.TREE_VIEW_DROP_AFTER
,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE
or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER
. This method returns
None
if no drag destination row is set.
def get_dest_row_at_pos(x
, y
)
| the x coordinate of the position |
| the y coordinate of the position |
Returns : | a 2-tuple containing the path of the row and
the drop position at the position specified by x and
y or None |
The get_dest_row_at_pos
() method
returns a 2-tuple containing the path of the row and the drop position
relative to the row of the position specified by x
and y
. The drop position is one of:
gtk.TREE_VIEW_DROP_BEFORE
,
gtk.TREE_VIEW_DROP_AFTER
,
gtk.TREE_VIEW_DROP_INTO_OR_BEFORE
or
gtk.TREE_VIEW_DROP_INTO_OR_AFTER
.
def create_row_drag_icon(path
)
| a tree path |
Returns : | a new pixmap of the drag icon. |
The create_row_drag_icon
() method
creates a gtk.gdk.Pixmap
representation of the row specified by path
. This
image is used for a drag icon.
def set_enable_search(enable_search
)
| if True , the user can search
interactively |
The set_enable_search
() method sets the
"enable-search" property to the value of
enable_search
. If
enable_search
is True
the user can
type in text to search through the tree interactively.
def get_enable_search()
Returns : | True if the user can search
interactively |
The get_enable_search
() method returns
the value of the "enable-search" property. If "enable-search" is
True
the tree allows interactive searching.
def get_search_column()
Returns : | the column the interactive search code searches. |
The get_search_column
() method returns
the value of the "search-column" property that is the column searched by
the interactive search code.
def set_search_column(column
)
| the column to search |
The set_search_column
() method sets the
"search-column" property to the value of column
. The
value of column
is the column where the interactive
search code should search. Additionally, this method turns on interactive
searching (see the set_enable_search
()
method).
def set_search_equal_func(func
=None, user_data
=None)
| the compare function to use during the search or None |
| user data to pass to func , or None |
This method is available in PyGTK 2.4 and above.
The set_search_equal_func
() method sets
the compare function for the interactive search capabilities to the function
specified by func
. If
user_data
is specified and not
None
, it is passed to func
. If
func
is None
, the default gtk.TreeView
search equal function will be used. The signature of
func
is:
def func(model
,column
,key
,iter
,data
)
where model
is the gtk.TreeModel
of
the gtk.TreeView
,
column
is the number of the column being searched
(see the set_search_column
()
method for more information), key
is the string being
searched for, iter
is a gtk.TreeIter
pointing to the current candidate row and data
is the
context data user_data
. func
should return False
to indicate that the row matches the
search criteria.
def get_fixed_height_mode()
Returns : | True if fixed height mode
is enabled. |
This method is available in PyGTK 2.6 and above.
The get_fixed_height_mode
() method
returns the value of the "fixed-height-mode" property. If the
"fixed-height-mode" property is True
, all rows are
assumed to be the same height.
def set_fixed_height_mode(enable
)
| if True enable fixed height
mode. |
This method is available in PyGTK 2.6 and above.
The set_fixed_height_mode
() method sets
the "fixed-height-mode" property to the value of
enable
. If enable
is
True
all rows are assumed to have the same height which
speeds up gtk.TreeView
displays. Only enable this option if all rows are the same height and all
columns are of type gtk.TREE_VIEW_COLUMN_FIXED
(see the
GTK TreeViewColumn Sizing Constants).
def get_hover_selection()
Returns : | True if hover selection
mode is enabled. |
This method is available in PyGTK 2.6 and above.
The get_hover_selection
() method
returns the value of the "hover-selection" property. If the
"hover-selection" property is True
the selected row
follows the pointer. See the set_hover_selection
()
method for more detail.
def set_hover_selection(hover
)
| if True enable hover
selection mode. |
This method is available in PyGTK 2.6 and above.
The () method sets the
"hover-selection" property to the value of
hover
. If
hover
is True
the hover selection
mode is enables and the selected row follows the pointer. Currently, this
works only for the selection modes gtk.SELECTION_SINGLE
and gtk.SELECTION_BROWSE
(see the GTK Selection Mode Constants).
def get_hover_expand()
Returns : | True if hover expand mode is
enabled |
This method is available in PyGTK 2.6 and above.
The get_hover_expand
() method returns
the value of the "hover-expand" property. If the "hover-expand" property is
True
rows expand or collapse if the pointer moves over
them.
def set_hover_expand(expand
)
| if True enable hover expand
mode. |
This method is available in PyGTK 2.6 and above.
The set_hover_expand
() method sets the
"hover-expand" property to the value of expand
. If
expand
is True
, rows expand or
collapse if the pointer moves over them.
def set_row_separator_func(func
=None, user_data
=None)
| the row separator function or
None |
| user data to pass to func , or None |
This method is available in PyGTK 2.6 and above.
The set_row_separator_func
() method
sets the row separator function to the function specified by
func
. The row separator function is used to determine
if a row should be displayed as a separator. If
user_data
is specified and not
None
, it is passed to func
. If
func
is None
, no separators will
be drawn. The signature of func
is:
def func(model
,iter
,data
)
where model
is the gtk.TreeModel
of
the gtk.TreeView
,
iter
is a gtk.TreeIter
pointing to the current candidate row and data
is the
context data user_data
. func
should return True
to indicate that the row is a
separator.
A common way to implement this is to have a boolean column in
model
, whose values func
returns.
def get_visible_range()
Returns : | a 2-tuple containing the start and end paths of
the visible region or None . |
This method is available in PyGTK 2.10 and above.
The get_visible_range
() method returns
a 2-tuple containing the start and end paths for the visible region in the
treeview. If no valid paths are available this method returns
None
.
def get_headers_clickable()
Returns : | True if all header columns
are clickable |
This method is available in PyGTK 2.10 and above.
Returns True
if all header columns are
clickable.
def get_search_entry()
Returns : | the entry currently in use as the search entry. |
This method is available in PyGTK 2.10 and above.
Returns the gtk.Entry
which
is currently in use as the interactive search entry for the treeview.
In case the built-in entry is being used, None
will
be returned.
def set_search_entry(entry
=None)
| the entry the interactive search code of the
treeview should use or
None |
This method is available in PyGTK 2.10 and above.
Sets the entry which the interactive search code will use for
this treeview. This is useful when you want to provide a search entry
in our interface at all time at a fixed position. Passing
None
for entry
will make the
interactive search code use the built-in popup entry again.
def set_search_position_func(func
, data
=None)
| the function to use to position the search
dialog, or None to use the default search
position function |
| user data to pass to
func , or
None |
This method is available in PyGTK 2.10 and above.
Sets the function to use when positioning the search dialog. The
signature of func
is:
def func(treeview, search_dialog, user_data):
where search_dialog
is the dialog to be
positioned and user_data
is
data
.
def set_rubber_banding(enable
)
| if True enable rubber
banding |
This method is available in PyGTK 2.10 and above.
Enables or disables rubber banding. If the selection mode is
gtk.SELECTION_MULTIPLE
, rubber banding will allow
the user to select multiple rows by dragging the mouse.
def get_rubber_banding()
Returns : | True if rubber banding is
enabled. |
This method is available in PyGTK 2.10 and above.
Returns whether rubber banding is enabled. If the selection
mode is gtk.SELECTION_MULTIPLE
, rubber banding will
allow the user to select multiple rows by dragging the mouse.
def get_grid_lines()
Returns : | one of the GTK TreeView Grid Lines Constants indicating which grid lines are enabled. |
This method is available in PyGTK 2.10 and above.
Returns which grid lines are enabled.
def set_grid_lines(grid_lines
)
| one of the GTK TreeView Grid Lines Constants indicating which grid lines to enable. |
This method is available in PyGTK 2.10 and above.
Sets which grid lines to draw.
def get_enable_tree_lines()
Returns : | True if tree lines are
drawn. |
This method is available in PyGTK 2.10 and above.
Returns True
if tree lines are drawn.
def set_enable_tree_lines(enabled
)
| if True enable tree line
drawing. |
This method is available in PyGTK 2.10 and above.
Sets whether to draw lines interconnecting the expanders. This does not have any visible effects for lists.
def convert_widget_to_bin_window_coords(widget_x
, widget_y
)
| X coordinate relative to the widget. |
| Y coordinate relative to the widget. |
Returns : | A tuple containing the bin_window X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts widget coordinates to coordinates for the bin_window (see get_bin_window
).
def convert_widget_to_tree_coords(widget_x
, widget_y
)
| X coordinate relative to the widget. |
| Y coordinate relative to the widget. |
Returns : | A tuple containing the tree X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts widget coordinates to coordinates for the tree (the full scrollable area of the tree).
def convert_tree_to_widget_coords(tree_x
, tree_y
)
| X coordinate relative to the tree. |
| Y coordinate relative to the tree. |
Returns : | A tuple containing the widget X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates.
def convert_tree_to_bin_window_coords(tree_x
, tree_y
)
| X coordinate relative to the tree. |
| Y coordinate relative to the tree. |
Returns : | A tuple containing the bin window X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts tree coordinates (coordinates in full scrollable area of the tree) to bin_window coordinates.
def convert_bin_window_to_widget_coords(window_x
, window_y
)
| X coordinate relative to the bin window. |
| Y coordinate relative to the bin window. |
Returns : | A tuple containing the widget X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts bin window coordinates (see get_bin_window
)
to widget relative coordinates.
def convert_bin_window_to_tree_coords(window_x
, window_y
)
| X coordinate relative to the bin window. |
| Y coordinate relative to the bin window. |
Returns : | A tuple containing the tree X and Y coordinates. |
This method is available in PyGTK 2.12 and above.
Converts bin window coordinates (see get_bin_window
)
to the tree (the full scrollable area of the tree).
def get_level_indentation()
Returns : | the amount of extra indentation for child levels in tree_view. A return value of 0 means that this feature is disabled. |
This method is available in PyGTK 2.12 and above.
Returns the amount, in pixels, of extra indentation for child levels in tree_view.
def set_level_indentation(indentation
, )
| the amount, in pixels, of extra indentation in tree_view. |
This method is available in PyGTK 2.12 and above.
Sets the amount of extra indentation for child levels to use in tree_view in addition to the default indentation. The value should be specified in pixels, a value of 0 disables this feature and in this case only the default indentation will be used. This does not have any visible effects for lists.
def get_show_expanders()
Returns : | True if expanders are drawn
in tree_view, False otherwise. |
This method is available in PyGTK 2.12 and above.
Returns whether or not expanders are drawn in tree_view.
def set_show_expanders(enabled
, )
| True to enable expander drawing, False otherwise. |
This method is available in PyGTK 2.12 and above.
Sets whether to draw and enable expanders and indent child rows in tree_view. When disabled there will be no expanders visible in trees and there will be no way to expand and collapse rows by default. Also note that hiding the expanders will disable the default indentation. You can set a custom indentation in this case using gtk_tree_view_set_level_indentation(). This does not have any visible effects for lists.
def get_tooltip_column()
Returns : | the index of the tooltip column that is currently being used, or -1 if this is disabled. |
This method is available in PyGTK 2.12 and above.
Returns the column of tree_view's model which is being used for displaying tooltips on tree_view's rows.
def set_tooltip_column(column
, )
| an integer, which is a valid column number for tree_view's model |
This method is available in PyGTK 2.12 and above.
If you only plan to have simple (text-only) tooltips on full rows, you can use this function to have GtkTreeView handle these automatically for you. column should be set to the column in tree_view's model containing the tooltip texts, or -1 to disable this feature.
When enabled, GtkWidget::has-tooltip will be set to True
and tree_view will connect a GtkWidget::query-tooltip signal handler.
def is_rubber_banding_active()
Returns : | True if a rubber banding
operation is currently being done in tree_view. |
This method is available in PyGTK 2.12 and above.
Returns whether a rubber banding operation is currently being done in tree_view.
def set_tooltip_cell(tooltip
, path
, column
, cell
, )
| a gtk.Tooltip .
|
| a tree path or None . |
| a gtk.TreeViewColumn
or None . |
| a gtk.CellRenderer
or None . |
This method is available in PyGTK 2.12 and above.
Sets the tip area of tooltip to the area path, column and cell have in common.
For example if path is None
and column is set, the tip
area will be set to the full area covered by column.
def set_tooltip_row(tooltip
, path
, )
| a gtk.Tooltip .
|
| a tree path. |
This method is available in PyGTK 2.12 and above.
Sets the tip area of tooltip to be the area covered by the row at path.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "columns-changed" signal is emitted when a column has been
added to, removed from or moved in treeview
.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "cursor-changed" signal is emitted when the cursor moves or is set.
def callback(treeview
, logical
, expand
, open_all
, user_param1
, ...
)
| the treeview that received the signal |
| if True
|
| if True the row should be
expanded |
| if True recursively expand
all children |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "expand-collapse-cursor-row" signal is emitted when the row at the cursor needs to be expanded or collapsed.
def callback(treeview
, step
, count
, user_param1
, ...
)
| the treeview that received the signal |
| the movement step size |
| the number of steps to take |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "move-cursor" signal is emitted when the user moves the cursor using the Right, Left, Up or Down arrow keys or the Page Up, Page Down, Home and End keys.
def callback(treeview
, path
, view_column
, user_param1
, ...
)
| the treeview that received the signal |
| the path of the activated row |
| the column in the activated row |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "row-activated" signal is emitted when the row_activated
()
method is called or the user double clicks a treeview
row. "row-activated" is also emitted when a non-editable row is selected and
one of the keys: Space, Shift+Space,
Return or Enter is pressed.
def callback(treeview
, iter
, path
, user_param1
, ...
)
| the treeview that received the signal |
| a gtk.TreeIter
pointing to the row that collapsed |
| the path of the row that collapsed |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "row-collapsed" signal is emitted when a row is collapsed by user of programmatic action.
def callback(treeview
, iter
, path
, user_param1
, ...
)
| the treeview that received the signal |
| a gtk.TreeIter
pointing to the row that expanded |
| the path of the row that expanded |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "row-expanded" signal is emitted when a row is expanded via user or programmatic action.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "select-all" signal is emitted when the user presses Control+a or Control+/.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "select-cursor-parent" signal is emitted when the user presses Backspace while a row has the cursor.
def callback(treeview
, start_editing
, user_param1
, ...
)
| the treeview that received the signal |
| if True the cell editing is
started |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "select-cursor-row" signal is emitted when a non-editable row is selected and one of the keys: Space, Shift+Space, Return or Enter is pressed.
def callback(treeview
, hadjustment
, vadjustment
, user_param1
, ...
)
| the treeview that received the signal |
| a horizontal gtk.Adjustment |
| a vertical gtk.Adjustment |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "set-scroll-adjustments" signal is emitted when new
horizontal or vertical adjustments are set on the
treeview
.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "start-interactive-search" signal is emitted when the user presses Control+f.
def callback(treeview
, iter
, path
, user_param1
, ...
)
| the treeview that received the signal |
| the gtk.TreeIter
pointing at the row to test. |
| the path of the row to be tested |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the row should be
collapsed. |
The "test-collapse-row" signal is emitted when the row pointed
to by iter
and path
is to be
collapsed.
def callback(treeview
, iter
, path
, user_param1
, ...
)
| the treeview that received the signal |
| the gtk.TreeIter
pointing at the row to test. |
| the path of the row to test |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the row should be
expanded. |
The "test-expand-row" signal is emitted when the row pointed to
by iter
and path
is to be
expanded.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "toggle-cursor-row" signal is emitted when the user presses Control+Space.
def callback(treeview
, user_param1
, ...
)
| the treeview that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
Returns : | True if the signal was
handled. |
The "unselect-all" signal is emitted when the user presses Shift+Control+a or Shift+Control+/.