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 |
Varchar | VarcharWidget | |
Text | TextWidget | |
Integer | IntegerWidget | |
Float | FloatWidget | |
Numeric | DecimalWidget | |
Date | DateWidget | |
Datetime | DateTimeWidget | |
Datetime w/ TZ | DateTimeTZWidget | |
Interval | IntervalWidget | |
Time | TimeWidget | |
Time w/ timezone | TimeTZWidget | |
Boolean | BooleanWidget | |
Boolean with null | BooleanNullWidget | |
Enum (varchar or integer with render=’enum’) | EnumWidget | |
Image (varchar with render=’image’) | ImageWidget | |
ForeignKey | ForeignKeyWidget | |
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
Parameters: |
|
---|
Set the value in the widget
Parameters: |
|
---|
Return the displayed value
Parameter: | shown – (boolean) return the shown value or the real value (only meaningful for foreign keys) |
---|
add completion bindings and liststore
This adds completion capabilities to varchar fields and to foreign keys. You can add it to other widgets as well provided you also use completion’s set_values method to provide values to be used in completion.
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.
value-set: | 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
Parameters: |
|
---|
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
Parameters: |
|
---|
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:
image-selected: | The image has been selected for upload. Callback:
|
||
---|---|---|---|
image-displayed: | |||
The image has been displayed
|
|||
image-deleted: | the image has been deleted
|