gtk.IconView

gtk.IconView — a widget which displays a list of icons in a grid (new in PyGTK 2.6)

Synopsis

class gtk.IconView(gtk.Container):
    gtk.IconView(model=None)
def set_model(model=None)
def get_model()
def set_text_column(column)
def get_text_column()
def set_markup_column(column)
def get_markup_column()
def set_pixbuf_column(column)
def get_pixbuf_column()
def get_path_at_pos(x, y)
def selected_foreach(func, data)
def set_selection_mode(mode)
def get_selection_mode()
def set_orientation(orientation)
def get_orientation()
def select_path(path)
def unselect_path(path)
def path_is_selected(path)
def get_selected_items()
def select_all()
def unselect_all()
def item_activated(path)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.IconView

Properties

"markup-column"Read-WriteThe number of the model column containing markup information to be displayed. If this property and the "text-column" property are both set to column numbers, this overrides the text column. If both are set to -1, no text is displayed. Allowed values: >= -1. Default value: -1. Available in GTK+ 2.6 and above.
"model"Read-WriteThe gtk.TreeModel for the icon view. Available in GTK+ 2.6 and above.
"orientation"Read-WriteHow the text and icon of each item are positioned relative to each other. Default value: gtk.ORIENTATION_VERTICAL. Available in GTK+ 2.6 and above.
"pixbuf-column"Read-WriteThe number of the model column containing the pixbufs that are displayed. Setting this property to -1 turns off the display of pixbufs. Allowed values: >= -1. Default value: -1. Available in GTK+ 2.6 and above.
"selection-mode"Read-WriteThe selection mode of the icon view. If the mode is gtk.SELECTION_MULTIPLE, rubberband selection is enabled, for the other modes, only keyboard selection is possible. Default value: gtk.SELECTION_SINGLE. Available in GTK+ 2.6 and above.
"text-column"Read-WriteThe number of the model column containing the text that is displayed. If this property and the "markup-column" property are both set to -1, no text is displayed. Allowed values: >= -1. Default value: -1. Available in GTK+ 2.6 and above.

Style Properties

"selection-box-alpha"ReadThe opacity of the selection box. Default value: 64. Available in GTK+ 2.6 and above.
"selection-box-color"ReadThe color of the selection box. Available in GTK+ 2.6 and above.

Signal Prototypes

"activate-cursor-item" def callback(iconview, user_param1, ...)
"item-activated" def callback(iconview, path, user_param1, ...)
"move-cursor" def callback(iconview, step, number, user_param1, ...)
"select-all" def callback(iconview, user_param1, ...)
"select-cursor-item" def callback(iconview, user_param1, ...)
"selection-changed" def callback(iconview, user_param1, ...)
"set-scroll-adjustments" def callback(iconview, hadj, vadj, user_param1, ...)
"toggle-cursor-item" def callback(iconview, user_param1, ...)
"unselect-all" def callback(iconview, user_param1, ...)

Description

Note

This widget is available in PyGTK 2.6 and above.

The gtk.IconView widget provides an alternative view of a gtk.ListStore model. It displays the model as a grid of icons with labels. Like gtk.TreeView, you can select one or multiple items (depending on the selection mode, see the set_selection_mode() method for more information). In addition to selection with the arrow keys, gtk.IconView supports rubberband selection, which is controlled by dragging the pointer.

Constructor

    gtk.IconView(model=None)
model :A gtk.TreeModel, or None
Returns :a new gtk.IconView widget.

Note

This constructor is available in PyGTK 2.6 and above.

Creates a new gtk.IconView widget. If model is specified and not None it should specify a gtk.TreeModel to be used as the model.

Methods

gtk.IconView.set_model

    def set_model(model=None)
model :a gtk.TreeModel or None

Note

This method is available in PyGTK 2.6 and above.

The set_model() method sets the "model" property to the gtk.TreeModel specified by model. If model is None the old model will be unset.

gtk.IconView.get_model

    def get_model()
Returns :The gtk.TreeModel used by the cell view or None.

Note

This method is available in PyGTK 2.6 and above.

The get_model() method returns the value of the "model" property which contains the gtk.TreeModel used by the cell view. If no model is being used this method returns None.

gtk.IconView.set_text_column

    def set_text_column(column)
column :The index of a column in the model or -1 to unset the column

Note

This method is available in PyGTK 2.6 and above.

The set_text_column() method sets the "text-column" property to the value of column which should be the index of a column in the model containing strings to be used for text. If column is -1 the text column is unset.

gtk.IconView.get_text_column

    def get_text_column()
Returns :The index of a model's column or -1 if unset.

Note

This method is available in PyGTK 2.6 and above.

The get_text_column() method returns the value of the "text-column" property which contains the index of the column in the model that provides strings to be used for text. If the "text-column" property contains -1 then no column is used for text.

gtk.IconView.set_markup_column

    def set_markup_column(column)
column :The index of a column in the model or -1.

Note

This method is available in PyGTK 2.6 and above.

The set_markup_column() method sets the "markup-column" property to the value specified by column. The "markup-column" property indicates the index of a column in the model to be used for markup information. If column is -1 the markup column will be unset. If the markup column is set, it overrides the text column set by the set_text_column() method.

gtk.IconView.get_markup_column

    def get_markup_column()
Returns :the index of the model column containing markup or -1.

Note

This method is available in PyGTK 2.6 and above.

The get_markup_column method returns the value of the "markup-column" property which contains the index of the column in the model that contains the Pango markup for text. if the "markup-column" property is -1, the markup column is unset.

gtk.IconView.set_pixbuf_column

    def set_pixbuf_column(column)
column :the index of a model column or -1

Note

This method is available in PyGTK 2.6 and above.

The set_pixbuf_column() method sets the "pixbuf-column" property to the value of column. If column >= 0 the icon view gtk.gdk.Pixbuf objects will be retrieved from the specified column. If column is -1 then no pixbufs will be used,

gtk.IconView.get_pixbuf_column

    def get_pixbuf_column()
Returns :The index of a column in the model or -1

Note

This method is available in PyGTK 2.6 and above.

The get_pixbuf_column() returns the value of the "pixbuf-column" property which contains the index of the model column use to to retrieve gtk.gdk.Pixbuf objects to display. If the "pixbuf-column" property is -1 no pixbufs will be retrieved.

gtk.IconView.get_path_at_pos

    def get_path_at_pos(x, y)
x :the x coordinate
y :the y coordinate
Returns :the path at the specified point or None.

Note

This method is available in PyGTK 2.6 and above.

The get_path_at_pos() method returns the model path of the icon located at the coordinates specified by (x, y). This method return None if there is no icon at the specified location.

gtk.IconView.selected_foreach

    def selected_foreach(func, data)
func :a callback function or method.
data :User data to pass to func.

Note

This method is available in PyGTK 2.6 and above.

The selected_foreach() method calls the callback function or method specified by func for each selected icon. The signature of func is:

  def func(iconview, path, user_data):

where iconview is the gtk.IconView, path is the tree path of the icon row and user_data is data.

gtk.IconView.set_selection_mode

    def set_selection_mode(mode)
mode :The selection mode.

Note

This method is available in PyGTK 2.6 and above.

The set_selection_mode() method sets the "selection-mode" property to the value of mode. mode should be one of the GTK Selection Mode Constants.

gtk.IconView.get_selection_mode

    def get_selection_mode()
Returns :the selection mode.

Note

This method is available in PyGTK 2.6 and above.

The get_selection_mode() method returns the value of the "selection-mode" property which contains one of the GTK Selection Mode Constants.

gtk.IconView.set_orientation

    def set_orientation(orientation)
orientation :the relative position of the icon and text.

Note

This method is available in PyGTK 2.6 and above.

The set_orientation() method sets the "orientation" property to the value of orientation. orientation should contain one of the GTK Orientation Constants. The "orientation" property indicates the relative positioning of the icon and text.

gtk.IconView.get_orientation

    def get_orientation(, )
Returns :the relative position of the icon and text.

Note

This method is available in PyGTK 2.6 and above.

The get_orientation() method returns the value of the "orientation" property that indicates the relative position between the icon and text. See the set_orientation() method for more information.

gtk.IconView.select_path

    def select_path(path)
path :a path indicating the icon to be selected

Note

This method is available in PyGTK 2.6 and above.

The select_path method selects the icon with the tree path specified by path.

gtk.IconView.unselect_path

    def unselect_path(path)
path :a path indicating the icon to be unselected

Note

This method is available in PyGTK 2.6 and above.

The unselect_path method unselects the icon with the tree path specified by path.

gtk.IconView.path_is_selected

    def path_is_selected(path)
path :a path of an icon.
Returns :TRUE if path is selected.

Note

This method is available in PyGTK 2.6 and above.

The path_is_selected() method returns TRUE if the icon with the tree path specified by path is selected.

gtk.IconView.get_selected_items

    def get_selected_items()
Returns :a list of the paths of the selected icons.

Note

This method is available in PyGTK 2.6 and above.

The get_selected_items() method returns a list of the paths of the selected icons.

gtk.IconView.select_all

    def select_all()

Note

This method is available in PyGTK 2.6 and above.

The select_all() method selects all the icons if the selection mode is set to gtk.SELECTION_MULTIPLE.

gtk.IconView.unselect_all

    def unselect_all()

Note

This method is available in PyGTK 2.6 and above.

The unselect_all() method unselects all the icons.

gtk.IconView.item_activated

    def item_activated(path)
path :a tree path pointing to an icon row.

Note

This method is available in PyGTK 2.6 and above.

The item_activated() method activates the icon pointed to by the path specified by path.

Signals

The "activate-cursor-item" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)
Returns :TRUE if the signal was handled.

The "activate-cursor-item" signal is emitted when an icon is selected and the Enter key is pressed.

The "item-activated" gtk.IconView Signal

    def callback(iconview, path, user_param1, ...)
iconview :the widget that received the signal
path :the path to the activated icon item.
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "item-activated" signal is emitted when an icon item is activated by the user double clicking an icon item, pressing the Enter key when an icon item is selected or via a call to the item_activated() method.

The "move-cursor" gtk.IconView Signal

    def callback(iconview, step, number, user_param1, ...)
iconview :the widget that received the signal
step :the step size to move the cursor
number :the number of steps to move
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)
Returns :TRUE if the signal was handled.

The "move-cursor" signal is emitted when the cursor is moved using the keyboard keys: Up, Down, Control-p, Control-n, Home, End, Page_Up, Page_Down, Right, Left with various Shift and Control combinations. step will be one of the GTK Movement Step Constants.

The "select-all" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "select-all" signal is emitted when all icon items are selected by pressing Control-a.

The "select-cursor-item" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "select-cursor-item" signal is emitted when the icon item at the cursor is selected by the user pressing the Space key.

The "selection-changed" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "selection-changed" signal is emitted when the selection is changed either by user action or program method calls.

The "set-scroll-adjustments" gtk.IconView Signal

    def callback(iconview, hadj, vadj, user_param1, ...)
iconview :the widget that received the signal
hadj :the new horizontal gtk.Adjustment
vadj :the new vertical gtk.Adjustment
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "set-scroll-adjustments" signal is emitted when the new horizontal and veritcal scroll gtk.Adjustment objects are set.

The "toggle-cursor-item" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "toggle-cursor-item" signal is emitted when the user presses Control-Space.

The "unselect-all" gtk.IconView Signal

    def callback(iconview, user_param1, ...)
iconview :the widget that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "unselect-all" signal is emitted when the user presses Control-Shift-a.