From 0a2ed36cd5b11f0cf14b522345b9a3c7af2aa75f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 7 Dec 2005 05:09:01 +0000 Subject: [PATCH] * src/FamilyView.py: Fixed FamilyView layout svn: r5492 --- ChangeLog | 3 ++ src/FamilyView.py | 114 +++++++++++++++++++++++++--------------------- 2 files changed, 64 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee4693caa..3bf89b81d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2005-12-06 Don Allingham + * src/FamilyView.py: Fixed FamilyView layout + 2005-12-05 Alex Roitman * merge some changes from gramps20. diff --git a/src/FamilyView.py b/src/FamilyView.py index a5999a340..716f44a92 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -27,11 +27,13 @@ import DisplayModels class Gbutton(gtk.Button): - def __init__(self,stock_name): + def __init__(self,stock_name,clicked=None): gtk.Button.__init__(self) image = gtk.Image() image.set_from_stock(stock_name,gtk.ICON_SIZE_BUTTON) self.add(image) + if clicked: + self.connect('clicked',clicked) class Glabel(gtk.Label): @@ -45,7 +47,7 @@ class Slabel(gtk.Label): def __init__(self,val): gtk.Label.__init__(self, val) - self.set_alignment(0,0.5) + self.set_alignment(1.0,0.5) class FamilyView(PageView.PageView): @@ -64,8 +66,7 @@ class FamilyView(PageView.PageView): def build_widget(self): fill = gtk.EXPAND|gtk.FILL - self.father_box = gtk.ComboBox() - self.mother_box = gtk.ComboBox() + self.parents_box = gtk.ComboBox() self.spouse_box = gtk.ComboBox() self.person_name = gtk.Entry() self.person_birth = gtk.Entry() @@ -73,66 +74,67 @@ class FamilyView(PageView.PageView): self.marriage_type = gtk.Entry() self.marriage_info = gtk.Entry() self.family_id = gtk.Entry() - scrollwindow = gtk.ScrolledWindow() - scrollwindow.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) - scrollwindow.set_shadow_type(gtk.SHADOW_IN) self.child_list = gtk.TreeView() self.child_model = DisplayModels.ChildModel([],self.dbstate.db) - scrollwindow.add(self.child_list) - switch = Gbutton(gtk.STOCK_GO_BACK) - edit_active = Gbutton(gtk.STOCK_EDIT) + switch = Gbutton(gtk.STOCK_GO_BACK, self.switch_spouse) + edit_active = Gbutton(gtk.STOCK_EDIT, self.edit_person) new_spouse = Gbutton(gtk.STOCK_NEW) spouse_select = Gbutton(gtk.STOCK_INDEX) rel_edit = Gbutton(gtk.STOCK_EDIT) parents_down = Gbutton(gtk.STOCK_GO_DOWN) - - table = gtk.Table(9,10) - table.set_col_spacings(12) - table.set_row_spacings(6) - table.set_border_width(6) - - table.attach(Glabel(_('_Parents')),0,6, 0,1, fill, 0,0,0) - table.attach(self.father_box, 1,9, 1,2, fill, 0,0,0) - table.attach(parents_down, 9,10, 1,2, 0,0,0,0) - - table.attach(Glabel(_('_Active person')), 0,5, 3,4, fill,0,0,0) - table.attach(self.person_name, 1,5, 4,5, fill,0,0,0) - table.attach(Slabel(_('b.')), 1,2, 5,6, 0,0,0,0) - table.attach(Slabel(_('d.')), 1,2, 6,7, 0,0,0,0) - table.attach(self.person_birth, 2,5, 5,6, fill,0,0,0) - table.attach(self.person_death, 2,5, 6,7, fill,0,0,0) - - table.attach(switch, 5,6, 4,5, 0,0,0,0) - table.attach(edit_active, 5,6, 5,6, 0,0,0,0) - table.attach(new_spouse, 9,10, 4,5, 0,0,0,0) - table.attach(spouse_select, 9,10, 5,6, 0,0,0,0) - table.attach(rel_edit, 9,10, 6,7, 0,0,0,0) - - table.attach(Glabel(_('_Spouse/partner')), 6,9, 3,4, fill,0,0,0) - table.attach(self.spouse_box, 7,9, 4,5, fill, 0,0,0) - table.attach(Slabel(_('Type:')), 7,8, 5,6, gtk.FILL, 0,0,0) - table.attach(self.marriage_type, 8,9, 5,6, fill, 0,0,0) - table.attach(Slabel(_('Marriage:')), 7,8, 6,7, gtk.FILL,0,0,0) - table.attach(self.marriage_info, 8,9, 6,7, fill, 0,0,0) -# table.attach(Slabel(_('ID:')), 7,8, 7,8, gtk.FILL, 0,0,0) -# table.attach(self.family_id, 8,9, 7,8, fill, 0,0,0) - - table.attach(Glabel(_('_Children')), 0,8, 8,9, fill, 0,0,0) - table.attach(scrollwindow, 1,9, 9,10, fill, gtk.FILL, 0,0) - - bbox = gtk.VBox() - bbox.set_spacing(6) child_up = Gbutton(gtk.STOCK_GO_UP) child_new = Gbutton(gtk.STOCK_NEW) child_sel = Gbutton(gtk.STOCK_INDEX) child_del = Gbutton(gtk.STOCK_REMOVE) - bbox.add(child_up) - bbox.add(child_new) - bbox.add(child_sel) - bbox.add(child_del) - - table.attach(bbox, 9,10, 9,10, 0, 0, 0, 0) + + table = gtk.Table(10,8) + table.set_col_spacings(12) + table.set_row_spacings(6) + table.set_border_width(6) + + # Parents + table.attach(Glabel(_("_Parents")), 0, 7, 0, 1, gtk.FILL,0,0,0) + table.attach(self.parents_box, 1, 7, 1, 2, gtk.FILL, gtk.FILL, 0, 0) + table.attach(parents_down, 7, 8, 1, 2, 0, 0, 0, 0) + + # Active Person + table.attach(Glabel('_Active person'), 0, 3, 3, 4, gtk.FILL, 0, 0, 0) + table.attach(self.person_name, 1, 3, 4, 5, gtk.EXPAND | gtk.FILL, 0, 0, 0) + table.attach(Slabel(_("b.")), 1, 2, 5, 6, gtk.FILL, 0,0,0) + table.attach(self.person_birth, 2, 3, 5, 6, gtk.EXPAND|gtk.FILL, 0, 0, 0) + table.attach(Slabel(_("d.")), 1, 2, 6, 7, gtk.FILL, 0, 0, 0) + table.attach(self.person_death, 2, 3, 6, 7, gtk.EXPAND | gtk.FILL, 0,0,0) + table.attach(switch, 3, 4, 4, 5, gtk.FILL, 0,0,0) + table.attach(edit_active, 3, 4, 5, 6, gtk.FILL, 0, 0, 0) + + # Spouse + table.attach(Glabel(_("_Spouse/Partner")), 4, 7, 3, 4, gtk.FILL, 0,0,0) + table.attach(self.spouse_box, 5, 7, 4, 5, gtk.FILL, gtk.FILL, 0, 0) + vbox90 = gtk.VBox(True, 6) + vbox90.pack_start(new_spouse, False, False, 0) + vbox90.pack_start(spouse_select, False, False, 0) + vbox90.pack_start(rel_edit, False, False, 0) + table.attach(vbox90, 7, 8, 4, 7, gtk.FILL, gtk.FILL, 0, 0) + table.attach(Slabel('Type:'), 5,6,5,6,gtk.FILL, 0,0,0) + table.attach(self.marriage_type, 6, 7, 5, 6, gtk.EXPAND|gtk.FILL, 0, 0, 0) + table.attach(self.marriage_info, 6, 7, 6, 7, gtk.EXPAND|gtk.FILL, 0, 0, 0) + + # Children + + table.attach(Glabel('_Children'), 0, 7, 8, 9, gtk.FILL, 0, 0, 0) + vbox89 = gtk.VBox(False, 6) + vbox89.pack_start(child_up, False, False, 0) + vbox89.pack_start(child_new, False, False, 0) + vbox89.pack_start(child_sel, False, False, 0) + vbox89.pack_start(child_del, False, False, 0) + table.attach (vbox89, 7, 8, 9, 10, gtk.FILL, gtk.FILL, 0, 0); + + scrolledwindow83 = gtk.ScrolledWindow() + scrolledwindow83.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + scrolledwindow83.set_shadow_type(gtk.SHADOW_IN) + scrolledwindow83.add(self.child_list) + table.attach(scrolledwindow83, 1, 7, 9, 10, gtk.FILL, gtk.EXPAND|gtk.FILL, 0, 0) return table @@ -152,3 +154,9 @@ class FamilyView(PageView.PageView): def change_db(self,db): return + + def switch_spouse(self,obj): + print "switch spouse" + + def edit_person(self,obj): + print "edit person"