2006-01-16 19:02:59 +05:30
|
|
|
#for debug, remove later
|
|
|
|
import sys
|
|
|
|
sys.path.append("..")
|
|
|
|
|
|
|
|
import gtk
|
|
|
|
import gobject
|
|
|
|
|
|
|
|
from _ObjectFrameBase import ObjectFrameBase
|
|
|
|
from _FamilyFilterFrame import FamilyFilterFrame
|
|
|
|
from _FamilyPreviewFrame import FamilyPreviewFrame
|
|
|
|
from _FamilyTreeFrame import FamilyTreeFrame
|
|
|
|
|
|
|
|
class FamilyFrame(ObjectFrameBase):
|
|
|
|
|
|
|
|
__gproperties__ = {}
|
|
|
|
|
2006-01-17 14:08:34 +05:30
|
|
|
__gsignals__ = {
|
|
|
|
'selection-changed' : (gobject.SIGNAL_RUN_LAST,
|
|
|
|
gobject.TYPE_NONE,
|
|
|
|
(gobject.TYPE_STRING,
|
|
|
|
gobject.TYPE_STRING)),
|
2006-01-17 20:24:46 +05:30
|
|
|
|
|
|
|
'add-object': (gobject.SIGNAL_RUN_LAST,
|
|
|
|
gobject.TYPE_NONE,
|
|
|
|
())
|
2006-01-17 14:08:34 +05:30
|
|
|
}
|
2006-01-16 19:02:59 +05:30
|
|
|
|
2006-01-17 19:13:29 +05:30
|
|
|
__person_id_field = 0
|
2006-01-16 19:02:59 +05:30
|
|
|
|
|
|
|
def __init__(self,
|
2006-01-19 21:33:09 +05:30
|
|
|
dbstate,
|
|
|
|
uistate):
|
2006-01-16 19:02:59 +05:30
|
|
|
|
|
|
|
ObjectFrameBase.__init__(self,
|
|
|
|
dbstate=dbstate,
|
2006-01-19 21:33:09 +05:30
|
|
|
uistate=uistate,
|
2006-01-16 19:02:59 +05:30
|
|
|
filter_frame = FamilyFilterFrame(dbstate),
|
|
|
|
preview_frame = FamilyPreviewFrame(dbstate),
|
|
|
|
tree_frame = FamilyTreeFrame(dbstate))
|
|
|
|
|
2006-01-17 14:08:34 +05:30
|
|
|
|
2006-01-17 20:24:46 +05:30
|
|
|
self._tree_frame.get_selection().connect('changed',self._handle_selection)
|
2006-01-17 19:13:29 +05:30
|
|
|
self._tree_frame.get_selection().connect('changed',self.set_preview,self.__class__.__person_id_field)
|
2006-01-17 20:24:46 +05:30
|
|
|
self._tree_frame.get_tree().connect('row-activated',self._on_row_activated)
|
2006-01-17 14:08:34 +05:30
|
|
|
|
2006-01-19 21:33:09 +05:30
|
|
|
def new_object(self,button):
|
|
|
|
pass
|
2006-01-17 20:24:46 +05:30
|
|
|
|
|
|
|
def _handle_selection(self,treeselection):
|
|
|
|
(model, iter) = treeselection.get_selected()
|
|
|
|
if iter and model.get_value(iter,self.__class__.__person_id_field):
|
2006-01-17 20:37:01 +05:30
|
|
|
self.emit('selection-changed', "%s / %s [%s]" % (
|
2006-01-17 20:24:46 +05:30
|
|
|
str(model.get_value(iter,1)),
|
|
|
|
str(model.get_value(iter,2)),
|
|
|
|
str(model.get_value(iter,0))),
|
|
|
|
model.get_value(iter,self.__class__.__person_id_field))
|
|
|
|
else:
|
|
|
|
self.emit('selection-changed',"No Selection","")
|
|
|
|
|
|
|
|
def _on_row_activated(self,widget,path,col):
|
|
|
|
(model, iter) = widget.get_selection().get_selected()
|
|
|
|
if iter and model.get_value(iter,self.__class__.__person_id_field):
|
|
|
|
self.emit('add-object')
|
2006-01-17 14:08:34 +05:30
|
|
|
|
2006-01-17 20:24:46 +05:30
|
|
|
|
2006-01-17 14:08:34 +05:30
|
|
|
|
|
|
|
|
2006-01-16 19:02:59 +05:30
|
|
|
|
|
|
|
|
|
|
|
if gtk.pygtk_version < (2,8,0):
|
|
|
|
gobject.type_register(FamilyFrame)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
pass
|