Package pysqlgtk :: Module models :: Class SqlController
[hide private]
[frames] | no frames]

Class SqlController

source code

object --+
         |
        SqlController
Known Subclasses:
SqlListController

This Class controls representation and manipulation of row data (SQLObject Instance) through pygtk widgets

Instance Methods [hide private]
 
is_dirty(self) source code
 
set_widget_value(self, widget, value)
Sets the value of widget.
source code
 
get_widget_value(self, widget)
returns the value of widget.
source code
 
reset(self)
Sets the widget contents to the values of the assigned SqlObject instance.
source code
 
set_row(self, sqlobj_instance)
row is an sqlobject instance or None
source code
 
get_row(self) source code
 
commit(self)
writes the values of the widgets to the assigned SqlObject instance fields.
source code
 
add_widget(self, field_name, widget, validator=None)
adds the widget to the controller.
source code
 
set_editable(self, editable=True)
calls set_editable of all the widgets assigned to the controller.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  __row = None
  widgets = []
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

set_widget_value(self, widget, value)

source code 
Sets the value of widget. If the widget is unknown it will try to call set_value()

get_widget_value(self, widget)

source code 
returns the value of widget. If widget is unknown, it will try to call get_value(). So, if you write your own widgets or compound widgets, all you have to do is provide a method get_value() in order to be able to use it with the controller.

reset(self)

source code 
Sets the widget contents to the values of the assigned SqlObject instance. This can also be used to explicitely update the widgets' contents, for example when widgets are added to the controller after an SqlObject instance has been set, or simply to implement a reset button in a data form.

commit(self)

source code 
writes the values of the widgets to the assigned SqlObject instance fields. This implies that the values are written to the database, unless lazy update is set. See SqlObject documentation for more details

add_widget(self, field_name, widget, validator=None)

source code 
adds the widget to the controller. If a validator function is given, it will be connected to the focus out event of the widget.

set_editable(self, editable=True)

source code 
calls set_editable of all the widgets assigned to the controller. You should provide a method set_editable(True|False) with your own compound widgets. If you don't, it won't rise an an exception but obviously it won't work either.