gramps/gramps2/src/ObjectSelector/_FamilyFrame.py

61 lines
1.8 KiB
Python
Raw Normal View History

#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__ = {}
__gsignals__ = {
'selection-changed' : (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_STRING,
gobject.TYPE_STRING)),
}
__person_id_field = 0
def __init__(self,
dbstate):
ObjectFrameBase.__init__(self,
dbstate=dbstate,
filter_frame = FamilyFilterFrame(dbstate),
preview_frame = FamilyPreviewFrame(dbstate),
tree_frame = FamilyTreeFrame(dbstate))
def handle_selection(treeselection):
(model, iter) = treeselection.get_selected()
if iter and model.get_value(iter,0):
self.emit('selection-changed', "%s / %s (%s)" % (
str(model.get_value(iter,1)),
str(model.get_value(iter,2)),
str(model.get_value(iter,0))),
model.get_value(iter,0))
else:
self.emit('selection-changed',"No Selection","")
self._tree_frame.get_selection().connect('changed',handle_selection)
self._tree_frame.get_selection().connect('changed',self.set_preview,self.__class__.__person_id_field)
if gtk.pygtk_version < (2,8,0):
gobject.type_register(FamilyFrame)
if __name__ == "__main__":
pass