configtreeview Module


This module contains the ConfigTreeView and the tools necessary to initialize a gtk.TreeView, create a data model, and map the data model to rows that can be appended to a gtk.TreeModel

class configtreeview.ConfigTreeView(config)

Bases: gtk.TreeView

A TreeView wrapper that initializes its columns, renderers and properties through the use of a configuration structure. This ConfigTreeView is a little different from the original design. The TreeView itself handles assigning indices to the data model, which is determined by the configuration structure sent in this TreeView’s init method.


This treeview is built from a configuration data structure. The configuration gives enough information to build all of the TreeView’s columns, creates headers, create and pack cellrenderers, apply attributes and properties to the columns and cellrenderers, and keeps track of the indices that the columns require to give to the data model.

Parameters:config – The configuration structure( a python dict) that will build the underlying gtk.TreeView.Check out HOW-TO create a config for info on how to build a configuration structure

Validate the configuration structure, build the treeview’s columns, headers, renderers and properties based on the configuration data structure

_handle_args(*args, **kwargs)

This abstract method is for use with custom classes that inherit ConfigTreeView that wish to pass custom args and kwargs to the constructor Note: You must override this function in your custom class and properly assign the args and kwargs you’re trying to grab from the config file.

  • args – Positional arguments passed in typical python fashion.
  • kwargs – Keyword arguments passed in typical python fashion.

Initializes a treemodel that’s special for this ConfigTreeView as defined in the treemodel key of the config structure. If there is no treemodel defined in the config structure, then a GtkListStore is initialized with the types list created from initializing the ConfigTreeView. If a custom GtkTreeModel is defined in the config structure, then it must have a function _handle_args() that should assign args and kwargs, and also any other post initialization stuff.

Returns:an instance of GtkTreeModel that is initialized with the correct types array that is generated from the config structure. If a custom treemodel was supplied in the config structure, then this function attempts to create the custom GtkTreeModel and initialize it with any arguments supplied in the config structure. If one doesn’t exist, then a GtkListStore is initialized and returned.

Table Of Contents

Previous topic

HOW-TO: Create a config file

Next topic Package

This Page