User interface: Framework and Widget support
Bases: gtk.GenericCellRenderer
A Cell Renderer for ComboEntry inspired by firefox’s awesome bar
To show some details on each entry of the popup, you should call the method ComboEntry.set_details_callback with a callable that expects an object.
This will be the object that the entry represents if the ComboEntry mode is DATA and will be None if the mode is STRING (in which case, details don’t make sense).
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Reimplementation of GtkComboBoxEntry in Python.
The main difference between the BaseComboBoxEntry and GtkComboBoxEntry is that a {kiwi.ui.widgets.entry.Entry} is used instead of a GtkEntry.
Widget for displaying a list of objects
Bases: gtk.VBox
Set the iter selected. :param iter: iter to select :type iter: gtk.TreeIter
Display some details as a second line on each entry
Parameters: | callable – a callable that expects an object and returns a string |
---|
Defines the Delegate classes that are included in the Kiwi Framework.
Bases: kiwi.ui.views.BaseView, kiwi.controllers.BaseController
A class that combines view and controller functionality into a single package. The Delegate class possesses a top-level window.
Bases: kiwi.ui.views.BaseView, kiwi.controllers.BaseController
A class that combines view and controller functionality into a single package. The Delegate class possesses a top-level window.
Bases: kiwi.ui.views.SlaveView, kiwi.controllers.BaseController
A class that combines view and controller functionality into a single package. It does not possess a top-level window, but is instead intended to be plugged in to a View or Delegate using attach_slave().
Bases: kiwi.ui.delegates.Delegate
A class that combines view, controller and proxy functionality into a single package. The Delegate class possesses a top-level window.
Variables: |
|
---|
Bases: kiwi.ui.delegates.GladeSlaveDelegate
A class that combines view, controller and proxy functionality into a single package. It does not possess a top-level window, but is instead intended to be plugged in to a View or Delegate using attach_slave()
Variables: |
|
---|
Bases: kiwi.ui.views.SlaveView, kiwi.controllers.BaseController
A class that combines view and controller functionality into a single package. It does not possess a top-level window, but is instead intended to be plugged in to a View or Delegate using attach_slave().
Create and show a MessageDialog.
Parameters: |
|
---|
Displays a save dialog.
Displays an open dialog. :param title: the title of the folder, defaults to ‘Select folder’ :param parent: parent gtk.Window or None :param patterns: a list of pattern strings [‘.py’, ‘.pl’] or None :param folder: initial folder or None :param filter: a filter to use or None, is incompatible with patterns
An enchanced version of GtkEntry that supports icons and masks
Bases: gtk.Entry
The KiwiEntry is a Entry subclass with the following additions:
- Mask, force the input to meet certain requirements
- IComboMixin: Allows you work with objects instead of strings Adds a number of convenience methods such as :class:`prefill`().
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Gets the empty mask between start and end
Parameters: |
|
---|---|
Returns: | mask |
Return type: | string |
Get the fields assosiated with the entry. A field is dynamic content separated by static. For example, the format string 000-000 has two fields separated by a dash. if a field is empty it’ll return an empty string otherwise it’ll include the content
Returns: | fields |
---|---|
Return type: | list of strings |
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Enable exact entry completion. Exact means it needs to start with the value typed and the case needs to be correct.
Parameters: | value (boolean) – enable exact completion |
---|
Sets the mask of the Entry. Supported format characters are:
- ‘0’ digit
- ‘L’ ascii letter (a-z and A-Z)
- ‘&’ alphabet, honors the locale
- ‘a’ alphanumeric, honors the locale
- ‘A’ alphanumeric, honors the locale
This is similar to MaskedTextBox: U{http://msdn2.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask(VS.80).aspx}
Example mask for a ISO-8601 date >>> entry.set_mask(‘0000-00-00’)
Parameters: | mask – the mask to set |
---|
Graphical utilities: color management and eyecandy
Bases: gobject._gobject.GObject
I am a helper class to draw the fading effect of the background Call my methods start() and stop() to control the fading.
Return the background color of the widget as a string
Return the foreground color of the widget as a string
A hyper link widget.
Bases: gtk.EventBox
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Return whether the widget has a menu set.
Returns: | a boolean value indicating whether the internal menu has been set. |
---|
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Popup the menu and emit the popup signal.
Parameters: |
|
---|
Set the menu to be used for popups.
Parameters: | menu (gtk.Menu) – the gtk.Menu to be used. |
---|
Set the text of the hyperlink.
Parameters: | text (str) – The text to set the hyperlink to. |
---|
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
A dialog to manipulate a sequence of objects
Bases: gtk.HBox
A ListContainer is an ObjectList with buttons to be able to modify the content of the list. Depending on the list_mode, @see set_list_mode you will have add, remove and edit buttons.
B{add-item} (returns item): - emitted when the add button is clicked, you’re expected to
return an object here
B{remove-item} (item, returns bool): - emitted when removing an item,
you can block the removal from the list by returning False
B{edit-item} (item): - emitted when editing an item
you can block the update afterwards by returning False
Variables: |
|
---|
Appends a list of items to the list :param items: items to add :type items: a sequence of items
Bases: gtk.Dialog, kiwi.ui.listdialog.ListSlave
A ListDialog implements a ListContainer in a L{gtk.Dialog} with a close button.
It’s a simple Base class which needs to be subclassed to provide interesting functionality.
Example: >>> class MyListDialog(ListDialog): ... ... columns = [Column(‘name’)] ... list_type = ListType.UNEDITABLE ... ... def populate(self): ... return [Settable(name=’test’)] ... ... def add_item(self): ... return Settable(name=”added”)
>>> dialog = MyListDialog()
>>> dialog.run()
Bases: kiwi.ui.delegates.SlaveDelegate
This must be implemented in a subclass if you want to be able to add items.
It should return the model you want to add to the list or None if you don’t want anything to be added, eg the user cancelled creation of the model
A subclass must implement this if you want to support editing of objects. :returns: False if the item should not be removed
This will be called once after the user interface construction is done. It should return a list of objects which will initially be inserted :returns: object to insert :rtype: sequence of objects
A subclass can implement this to get a notification after an item is removed. If it’s not implemented ListContainer.default_remove will be called :returns: False if the item should not be removed
High level wrapper for GtkTreeView
Bases: kiwi.ui.objectlist.Column
I am a column which can colorize the text of columns under certain circumstances. I take a color and an extra function which will be called for each row
Example, to colorize negative values to red:
>>> def colorize(value):
... return value < 0
...
... ColoredColumn('age', data_type=int, color='red',
... data_func=colorize),
Bases: gobject._gobject.GObject
Specifies a column for an ObjectList, see the ObjectList documentation for a simple example.
B{title}: string I{mandatory} - the title of the column, defaulting to the capitalized form of
the attribute
B{data-type}: object I{str} - the type of the attribute that will be inserted into the column.
Supported data types: bool, int, float, str, unicode, decimal.Decimal, datetime.date, datetime.time, datetime.datetime, gtk.gdk.Pixbuf, kiwi.currency.currency, L{kiwi.python.enum}.
B{visible}: bool I{True} - specifying if it is initially hidden or shown.
B{justify}: gtk.Justification I{None} - one of gtk.JUSTIFY_LEFT, gtk.JUSTIFY_RIGHT or gtk.JUSTIFY_CENTER
or None. If None, the justification will be determined by the type of the attribute value of the first instance to be inserted in the ObjectList (for instance numbers will be right-aligned).
B{format}: string I{“”} - a format string to be applied to the attribute value upon insertion
in the list.
B{width}: integer I{65535} - the width in pixels of the column, if not set, uses the default to
ObjectList. If no Column specifies a width, columns_autosize() will be called on the ObjectList upon append() or the first add_list().
B{sorted}: bool I{False} - whether or not the ObjectList is to be sorted by this column.
If no Columns are sorted, the ObjectList will be created unsorted.
B{order}: GtkSortType I{-1} - one of gtk.SORT_ASCENDING, gtk.SORT_DESCENDING or -1
The value -1 is mean that the column is not sorted.
B{expand}: bool I{False} - if set column will expand. Note: this space is shared equally amongst
all columns that have the expand set to True.
B{tooltip}: string I{“”} - a string which will be used as a tooltip for the column header
B{format_func}: object I{None} - a callable which will be used to format the output of a column.
The function will take one argument which is the value to convert and is expected to return a string. I{Note}: that you cannot use format and format_func at the same time, if you provide a format function you’ll be responsible for converting the value to a string.
B{format_func_data}: object I{None} - If format_func_data is not None, format_func will receive the row
object instead of just the column value, and also receive this value as a second argument.
B{editable}: bool I{False} - if true the field is editable and when you modify the contents of
the cell the model will be updated.
B{searchable}: bool I{False} - if true the attribute values of the column can be searched using
type ahead search. Only string attributes are currently supported.
B{radio}: bool I{False} - If true render the column as a radio instead of toggle.
Only applicable for columns with boolean data types.
B{spin_adjustment}: gtk.Adjustment I{None} - A gtk.Adjustment instance. If set, render the column cell as
a spinbutton.
B{use_stock}: bool I{False} - If true, this will be rendered as pixbuf from the value which
should be a stock id.
B{icon_size}: gtk.IconSize I{gtk.ICON_SIZE_MENU}
B{editable_attribute}: string I{“”} - a string which is the attribute which should decide if the
cell is editable or not.
B{use_markup}: bool I{False} - If true, the text will be rendered with markup
B{expander}: bool I{False} - If True, this column will be used as the tree expander column
B{ellipsize}: pango.EllipsizeMode I{pango.ELLIPSIZE_NONE} - One of pango.ELLIPSIZE_{NONE, START, MIDDLE or END}, it describes
where characters should be removed in case ellipsization (where to put the ...) is needed.
B{font-desc}: str I{“”} - A string passed to pango.FontDescription, for instance “Sans” or
B{column}: str None - A string referencing to another column. If this is set a new column
will not be created and the column will be packed into the other.
B{sort_func}: object I{None} - a callable which will be used to sort the contents of the column.
The function will take two values (x and y) from the column and should return negative if x<y, zero if x==y, positive if x>y.
B{pack_end}: bool I{False} - If set it will pack the renderer to the end of the column instead
of the beginning.
B{width_chars}: int I{-1} - If set it will specify the number of characters that should displayed
for the cells in this column.
Formats the column as a string that should be renderd into the cell.
Parameters: |
|
---|
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Gusses which CellRenderer we should use for a given type. It also set the property of the renderer that depends on the model, in the renderer.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Returns the value associated with the attribute in model named by attr_name. If default is provided and model does not have an attribute called attr_name, the default value is returned. If flat=1 is specified, no dot path parsing will be done.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Set the number of precision digits to be shown in the spinbutton.
Parameters: | digits – the number of precision digits to be set in |
---|
spinbutton :type digits: int
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Bases: gtk.HBox
I am a subclass of a GtkHBox which you can use if you want to vertically align a label with a column
Bases: gtk.HBox
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)
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.
B{activate-link} (str): - Emitted when the a link in a message is clicked on
- B{selection-mode}: gtk.SelectionMode I{gtk.SELECTION_BROWSE} - Represents the selection-mode of a GtkTreeSelection of a GtkTreeView.
Allows a list to be loaded, by default clearing it first. freeze() and thaw() are called internally to avoid flashing.
Parameters: |
|
---|
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.
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.
Parameters: | 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.
Parameters: | instance – the instance |
---|
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
Get the treeview column given an objectlist column :param column: a @Column
Return first index of value
Parameters: |
|
---|
: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.
Reloads the values from all objects.
Parameters: | view_only – if True, only force a refresh of the visible part of this objectlist’s Treeview. |
---|
Remove an instance from the list. If the instance is not in the list it returns False. Otherwise it returns True.
Parameters: |
|
---|
Selects a number of rows corresponding to paths
Parameters: | paths – rows to be selected |
---|
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Sets a context-menu (eg, when you right click) for the list. :param menu: context menu :type menu: ContextMenu
Show or hide the headers. :param value: if true, shows the headers, if false hide then
Adds a message on top of the treeview rows :param markup: PangoMarkup with the text to add
Set the number of precision digits used by the spinbutton in a column.
Parameters: |
|
---|
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. :param rows: number of rows to show
L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1
Bases: kiwi.ui.objectlist.ObjectList
B{row-expanded} (list, object): - Emitted when a row is “expanded”, eg the littler arrow to the left
is opened. See the GtkTreeView documentation for more information.
Append the selected row in an instance. :param parent: Object or None, representing the parent :param instance: the instance to be added :param select: select the row :returns: the appended object
This method collapses the row specified by path (hides its child rows, if they exist). :param instance: an instance to collapse
This method opens the row specified by path so its children are visible. :param instance: an instance to expand at :param open_all: If True, expand all rows, otherwise just the immediate children
This method returns the descendants objects of a certain instance. If the given instance is a leaf, then return an empty sequence. :param root_instance: an instance which we want the descendants :returns: a sequence of descendants objects
This method returns the parent of the specified instance are visible. :returns: the parent of the instance or None
Bases: kiwi.ui.objectlist.Column
I am a column that should be used in conjunction with kiwi.ui.search.SearchSlaveDelegate
Parameters: |
|
---|
Bases: kiwi.ui.objectlist.Column
I am a column which will display a sequence of numbers, which represent the row number. The value is independent of the data in the other columns, so no matter what I will always display 1 in the first column, unless you reverse it by clicking on the column header.
If you don’t give me any argument I’ll have the title of a hash (#) and right justify the sequences.
Bases: kiwi.ui.objectlist.ListLabel
I am a subclass of ListLabel which you can use if you want to summarize all the values of a specific column. Please note that I only know how to handle number column data types and I will complain if you give me something else.
This module defines the Proxy class, which is a facility that can be used to keep the state of a model object synchronized with a View.
A Proxy is a class that ‘attaches’ an instance to an interface’s widgets, and transparently manipulates that instance’s attributes as the user alters the content of the widgets.
The Proxy takes the widget list and detects what widgets are to be attached to the model by looking if it is a KiwiWidget and if it has the model-attribute set.
Adds a new widget to the proxy
Parameters: |
|
---|
This is a hook that is called whenever the proxy updates the model. Implement it in the inherited class to perform actions that should be done each time the user changes something in the interface. This hook by default does nothing. :param widget: :param attribute: :param value:
Removes a widget from the proxy
Parameters: | name – the name of the widget to remove |
---|
Updates the model instance of the proxy. Allows a proxy interface to change model without the need to destroy and recreate the UI (which would cause flashing, at least)
Parameters: |
|
---|
Generic frontend function to update the contentss of a widget based on its model attribute name using the internal update functions.
Parameters: |
|
---|
Basic classes for widget support for the Kiwi Framework
Bases: object
This class is a mixin that provide a common interface for KiwiWidgets.
Usually the Proxy class need to set and get data from the widgets. It also need a validation framework.
Variables: | allowed_data_types – A list of types which we are allowed to use in this class. |
---|
Get the content of the widget. The type of the return value :returns: None if the user input a invalid value :rtype: Must matche the data-type property.
Set the data type for the widget
Parameters: | data_type – can be None, a type object or a string with the name of the type object, so None, “<type ‘str’>” or ‘str’ |
---|
Set some options to be passed to the datatype converter. Any additional parameter will be passed the the converter when converting an object to a string, for displaying in the widget. Note that the converter.as_string method should be able to handle such parameters.
Parameters: | datatype – the datatype. |
---|
Bases: kiwi.ui.proxywidget.ProxyWidgetMixin
Class used by some Kiwi Widgets that need to support mandatory input and validation features such as custom validation and data-type validation.
Mandatory support provides a way to warn the user when input is necessary. The validatation feature provides a way to check the data entered and to display information about what is wrong.
Changes the validation state to blank state, this only applies for mandatory widgets, draw an icon and set a tooltip
Changes the validation state to invalid. :param text: text of tooltip of None :param fade: if we should fade the background
Search related widgets
Bases: kiwi.ui.search.DateSearchOption
Bases: kiwi.ui.search.NumberSearchOption
Bases: kiwi.ui.search.SearchFilter
Bases: kiwi.ui.search.StringSearchOption
Bases: kiwi.ui.search.SearchFilter
A filter which helps you to search by a date interval. Can be customized through add_option.
Bases: kiwi.python.enum
Adds the custom options ‘Custom day’ and ‘Custom interval’ which let the user define its own interval dates.
Adds a date option :param option_type: option to add :type option_type: a DateSearchOption subclass
Adds a fixed option, eg one for which date is not possible to modify. :param name: name of the option :param date: fixed data :param position: position to add the option at
Adds a fixed option interval, eg one for which the dates are not possible to modify. :param name: name of the option :param start: start of the fixed interval :param end: end of the fixed interval :param position: position to add the option at
Get the end date. :returns: end date :rtype: datetime.date or None
Get the start date. :returns: start date :rtype: datetime.date or None
Bases: object
Base class for Date search options A date search option is an interval of dates :cvar name: name of the search option
Get start and end date. :returns: start date, end date :rtype: datetime.date tuple
Bases: kiwi.ui.search.StringSearchOption
Bases: kiwi.ui.search.NumberSearchOption
Bases: kiwi.ui.search.DateSearchOption
Bases: kiwi.ui.search.DateSearchOption
Bases: kiwi.ui.search.NumberSearchOption
Bases: kiwi.ui.search.DateSearchOption
Bases: kiwi.ui.search.DateSearchOption
Bases: kiwi.ui.search.NumberSearchOption
Bases: kiwi.ui.search.SearchFilter
A filter which helps you to search by a number interval.
Adds a date option :param option_type: option to add :type option_type: a NumberSearchOption subclass
Bases: object
Base class for Number search options A number search option is an interval of numbers :cvar name: name of the search option :cvar numbers: how many numbers must the user input: 0, 1 or 2
Bases: gtk.VBox
A search container is a widget which consists of: - search entry (w/ a label) (StringSearchFilter) - search button - objectlist result (SearchResult) - a query executer (kiwi.db.query.QueryExecuter)
Additionally you can add a number of search filters to the SearchContainer. You can chose if you want to add the filter in the top-left corner of bottom, see SearchFilterPosition
Adds a search filter :param search_filter: the search filter :param postition: a SearchFilterPosition enum :param columns: :param callback:
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Fetches the primary filter for the SearchContainer. The primary filter is the filter attached to the standard entry normally used to do free text searching :returns: the primary filter
Fetchs the QueryExecuter for the SearchContainer :returns: a querty executer :rtype: a QueryExecuter subclass
alias of SearchResults
Starts a search. Fetches the states of all filters and send it to a query executer and finally puts the result in the result class
Enables/Disables auto search which means that the search result box is automatically populated when a filter changes :param auto_search: True to enable, False to disable
Set the the filter position. :param search_filter: :param position:
Ties a QueryExecuter instance to the SearchContainer class :param querty_executer: a querty executer :type querty_executer: a QueryExecuter subclass
Adds a summary label to the result set :param column: the column to sum from :param label: the label to use, defaults to ‘Total:’ :param format: the format, defaults to ‘%%s’, must include ‘%%s’ :param parent: the parent widget a label should be added to or
None if it should be added to the SearchContainer
Bases: gtk.HBox
A base classed used by common search filters
Returns a description of the search filter. :returns: a string describing the search filter.
Creates a new property which in conjunction with GObject subclass will create a property proxy:
>>> class MyObject(gobject.GObject):
>>> ... prop = gobject.property(type=str)
>>> obj = MyObject()
>>> obj.prop = 'value'
>>> obj.prop
'value'
The API is similar to the builtin property:
@gobject.property def prop(self):
return ...
Which will create a read-only property called prop.
Bases: gtk.Button
Bases: kiwi.ui.delegates.SlaveDelegate
This needs to be implemented in a subclass :returns: columns :rtype: list of kiwi.ui.objectlist.Column
Fetches the primary filter of the SearchSlaveDelegate :returns: primary filter
Bases: kiwi.ui.search.SearchFilter
Variables: |
|
---|
Bases: kiwi.ui.search.DateSearchOption
A box which you can select and will have a border around it when you click on any widgets in it
Bases: object
Bases: kiwi.ui.selectablebox.SelectableBox, gtk.HBox
A tooltip popup window which only pop ups on demand, which makes it possible for us to tie it to a specific gtk.gdk.Window
Defines the View classes that are included in the Kiwi Framework, which are the base of Delegates and Proxies.
Bases: kiwi.ui.views.SlaveView
A view with a toplevel window.
Hides the current window and breaks the GTK+ event loop if this is the last window. Its method signature allows it to be used as a signal handler.
Makes the view a transient for another view; this is commonly done for dialogs, so the dialog window is managed differently than a top-level one.
Bases: kiwi.ui.views.SignalBroker
Bases: gobject._gobject.GObject
Base class for all View classes. Defines the essential class attributes (controller, toplevel, widgets) and handles initialization of toplevel and widgets. Once AbstractView.__init__() has been called, you can be sure self.toplevel and self.widgets are sane and processed.
When a controller is associated with a View (the view should be passed in to its constructor) it will try and call a hook in the View called _attach_callbacks. See AbstractGladeView for an example of this method.
Add a proxy to this view that automatically update a model when the view changes. Arguments:
- model. the object we are proxing. It can be None if we don’t have a model yet and we want to display the interface and set it up with future models.
- widgets. the list of widgets that contains model attributes to be proxied. If it is None (or not specified) it will be the whole list of widgets this View has.
This method return a Proxy object that you may want to use to force updates or setting new models. Keep a reference to it since there is no way to get that proxy later on. You have been warned (tm)
Attaches a slaveview to the current view, substituting the widget specified by placeholder_widget. If placeholder_widget is not specified, an widget with the name specified must exist.
The widget specified must be a eventbox; its child widget will be removed and substituted for the specified slaveview’s toplevel widget:
.-----------------------. the widget that is indicated in the diagram
|window/view (self.view)| as placeholder will be substituted for the
| .----------------. | slaveview's toplevel.
| | eventbox (name)| | .-----------------.
| |.--------------.| |slaveview (slave)|
| || placeholder <----. |.---------------.|
| |'--------------'| \___ toplevel ||
| '----------------' | ''---------------'|
'-----------------------' '-----------------'
the original way of attachment (naming the child widget instead of the eventbox) is still supported for compatibility reasons but will print a warning.
Connect the same handler to the specified signal for a number of widgets.
- widgets: a list of GtkWidgets
- signal: a string specifying the signals
- handler: a callback method
- after: a boolean; if TRUE, we use connect_after(), otherwise,
connect()
Disconnect handlers previously connected with autoconnect_signals()
Enables the dialog to have the same controls as a window (eg minimize, maximize and close buttons in its title bar). This method should be called before the window becomes visible.
Looks through widgets specified (if no widgets are specified, look through all widgets attached to the view and sets focus to the widget that is rendered in the position closest to the view window’s top and left
- widgets: a list of widget names to be searched through
A real hack; returns the widget that is most to the left and top of the window.
- widgets: a list of widget names. If widgets is supplied, it only checks in the widgets in the list; otherwise, it looks at the widgets named in self.widgets, or, if self.widgets is None, looks through all widgets attached to the view.
- can_focus: boolean, if set only searches through widget that can be focused
This is a virtual method that can be customized by classes that want to perform additional initalization after a controller has been set for it. If you need this, add this method to your View subclass and BaseController will call it when the controller is set to the proxy.
The signature of the validate function is:
def function(is_valid):
or, if it is a method:
def function(self, is_valid):
where the ‘is_valid’ parameter is True if all the widgets have valid data or False otherwise.
Sets the view’s controller, checking to see if one has already been set before.
Runs show() and runs the GTK+ event loop. If the parent argument is supplied and is a valid view, this view is set as a transient for the parent view
Parameters: | parent – |
---|
Bases: kiwi.ui.delegates.GladeDelegate
Wizard controller and view class
This class must be inherited by the steps