Each field is represented using a proper gtk widget. Table and Mask need two different objects, a cell renderer for tables and a widget from module sqlkit.widgets.mask.miniwidgets for masks.
Cell renderers and function to represent the data are defined in sqlkit.widgets.table.columns.
Widgets defined in sqlkit.widgets.mask.miniwidgets are just interfaces (or proxies) to other gtk widgets.
|Field or Property||Mask||Table|
|Datetime w/ TZ||DateTimeTZWidget|
|Time w/ timezone||TimeTZWidget|
|Boolean with null||BooleanNullWidget|
|Enum (varchar or integer with render=’enum’)||EnumWidget|
|Image (varchar with render=’image’)||ImageWidget|
|relation (o2m/m2m)||CollectionWidget. This is just a SqlTable that represents the related field|
A proxy between the field and a real gtk widget
setup all what is needed in the widget: completion if any and much more for complex cases as CollectionWidget
Set the value in the widget
Return the displayed value
|Parameter:||shown – (boolean) return the shown value or the real value (only meaningful for foreign keys)|
Null value is not admittable
A boolean widget can be represented via CheckButton (default) or radio button (just use r=field_name when setting layout). In the latter case you can safely group widgets toghether with normal gtk tools .set.group() to gain a switch between different alternatives:
m.SqlMask(..., layout='r=male, r=female') m.widgets['r=female'].set_group(m.widgets['r=male'])
A ComboBoxEntry that displays a represention of the referenced record rather that the referece. I.e.: it shows last_name/first_name of a director rather than the id of the record in the directors’ table.
It also enforces the foreign key constraint. Completion occurs on the foreign (referenced) table according to what is detailed in Completion documentation.
A SqlTable widget that represents a collection of records. This is used to represent a property that in turn holds a relation. E.g.: director.movies movies being a list. The contructor setups a SqlTable that has relationship_leader pointing to the main SqlMask.
It maintains the same session so that a single commit will save parent and children.
a signal emitted each time a value is set (via method Widget.set_value). This signal does not trigger a general change in value as would be for entries a changed signal. Callback function:
You can change default color for not nullable object globally:
from sqlkit.widgets.mask import miniwidgets miniwidgets.NOT_NULL_COLOR = gtk.gdk.color_parse('green')
You can change the foreground of unsensitive widgets setting NOT_EDITABLE_COLOR
Image Widget suitable for basic image viewing. Inherits from VBox
scale pixbuf image with the same ratio so that it fits into self.w/self.h
set rendered image
|Parameter:||image_path – the path of the image|
Set the image via the pixbuf
|Parameter:||pixbuf – the gtk.gdk.Pixbuf|
Set the image via the stock-id
imageViewer has the following properties:
|image:||the image path currently rendered|
|scale:||possible values AUTOREDUCTION, SCALE. If True the image should autoscale. If value is AUTOREDUCTION the image is never enlarged over its natural size|
|width:||the with of the gtk.Image widget|
|height:||the height og the gtk.Image widget|
|scale_factor:||the current scale factor between render image and thumbnail|
ImageViewer has the following signals:
The image has been selected for upload. Callback:
The image has been displayed
the image has been deleted