From a8f2942ff1ea8000d9bbb4bb6322326030f3b0ff Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 6 Jan 2006 05:08:51 +0000 Subject: [PATCH] * src/GrampsGconfKeys.py: family view detail options * src/GrampsIniKeys.py: family view detail options * src/Navigation.py: fix overflow bug * src/PageView.py: toggle initial value fix gender mouseover, inclusion options * src/data/gramps.schemas: new keys for family view detail svn: r5678 --- ChangeLog | 7 ++- src/FamilyView.py | 101 +++++++++++++++++++++++++++------------- src/GrampsGconfKeys.py | 12 +++++ src/GrampsIniKeys.py | 12 +++++ src/Navigation.py | 21 +++++---- src/PageView.py | 5 +- src/PersonView.py | 10 ++-- src/data/gramps.schemas | 24 ++++++++++ 8 files changed, 142 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb221c41f..231415b7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 2006-01-05 Don Allingham + * src/GrampsGconfKeys.py: family view detail options + * src/GrampsIniKeys.py: family view detail options + * src/Navigation.py: fix overflow bug + * src/PageView.py: toggle initial value * src/FamiyView.py: use gender markers, remove Family/Parents, - fix gender mouseover + fix gender mouseover, inclusion options + * src/data/gramps.schemas: new keys for family view detail 2006-01-05 Richard Taylor * src/GrampsLogger/__init__.py: added package interface diff --git a/src/FamilyView.py b/src/FamilyView.py index f11a3f9c4..7efb780a5 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -30,6 +30,7 @@ import Utils import DateHandler import ImgManip import ReportUtils +import GrampsKeys class LinkLabel(gtk.EventBox): @@ -107,6 +108,12 @@ class FamilyView(PageView.PersonNavView): PageView.PersonNavView.__init__(self,'Pedigree View',dbstate,uistate) dbstate.connect('database-changed',self.change_db) dbstate.connect('active-changed',self.change_person) + self.show_siblings = GrampsKeys.get_family_siblings() + if self.show_siblings == None: + self.show_siblings = True + self.show_details = GrampsKeys.get_family_details() + if self.show_details == None: + self.show_details = True def get_stock(self): """ @@ -142,6 +149,10 @@ class FamilyView(PageView.PersonNavView): + + + + @@ -161,6 +172,23 @@ class FamilyView(PageView.PersonNavView): def define_actions(self): PageView.PersonNavView.define_actions(self) + self.add_toggle_action('Details', None, _('Show details'), + None, None, self.details_toggle, + self.show_details) + self.add_toggle_action('Siblings', None, _('Show siblings'), + None, None, self.siblings_toggle, + self.show_siblings) + + def siblings_toggle(self,obj): + self.show_siblings = obj.get_active() + self.change_person(self.dbstate.active.handle) + GrampsKeys.save_family_siblings(self.show_siblings) + + def details_toggle(self,obj): + self.show_details = obj.get_active() + self.change_person(self.dbstate.active.handle) + GrampsKeys.save_family_details(self.show_details) + def change_db(self,db): if self.child: self.vbox.remove(self.child) @@ -173,18 +201,19 @@ class FamilyView(PageView.PersonNavView): gender = "" if use_gender: if p.gender == RelLib.Person.MALE: - gender = u" \u2642" + gender = u' \u2642' elif p.gender == RelLib.Person.FEMALE: gender = u" \u2640" else: gender = u" \u2650" return (name,gender) else: - return _(u"Unknown","") + return (_(u"Unknown"),"") def change_person(self,obj): if self.child: self.vbox.remove(self.child) + self.child = gtk.Table(20,6) self.child.set_border_width(12) self.child.set_col_spacings(12) @@ -205,7 +234,7 @@ class FamilyView(PageView.PersonNavView): for family_handle in family_handle_list: if family_handle: self.write_family(family_handle) - + self.child.show_all() def write_title(self,person): @@ -258,8 +287,8 @@ class FamilyView(PageView.PersonNavView): self.row = 5 def write_data(self,title,start_col=3,stop_col=5): - self.child.attach(BasicLabel(title),start_col,stop_col,self.row,self.row+1, - xoptions=gtk.EXPAND|gtk.FILL) + self.child.attach(BasicLabel(title),start_col,stop_col,self.row, + self.row+1, xoptions=gtk.EXPAND|gtk.FILL) self.row += 1 def write_label(self,title): @@ -269,7 +298,8 @@ class FamilyView(PageView.PersonNavView): self.row += 1 def write_person_data(self,title,data): - self.child.attach(BasicLabel(title),2,3,self.row,self.row+1,xoptions=gtk.FILL) + self.child.attach(BasicLabel(title),2,3,self.row,self.row+1, + xoptions=gtk.FILL) self.child.attach(BasicLabel(data),3,5,self.row,self.row+1, xoptions=gtk.EXPAND|gtk.FILL) self.row += 1 @@ -305,12 +335,12 @@ class FamilyView(PageView.PersonNavView): self.row += 1 - value = self.info_string(handle) - if value: - self.child.attach(BasicLabel(value),4,5,self.row, self.row+1) - self.row += 1 + if self.show_details: + value = self.info_string(handle) + if value: + self.child.attach(BasicLabel(value),4,5,self.row, self.row+1) + self.row += 1 - def info_string(self,handle): child = self.dbstate.db.get_person_from_handle(handle) birth_ref = child.get_birth_ref() @@ -336,24 +366,28 @@ class FamilyView(PageView.PersonNavView): def write_parents(self,family_handle): family = self.dbstate.db.get_family_from_handle(family_handle) self.write_person(_('Father'),family.get_father_handle()) - value = self.info_string(family.get_father_handle()) - if value: - self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) - self.row += 1 + if self.show_details: + value = self.info_string(family.get_father_handle()) + if value: + self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) + self.row += 1 self.write_person(_('Mother'),family.get_mother_handle()) - value = self.info_string(family.get_mother_handle()) - if value: - self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) - self.row += 1 + if self.show_details: + value = self.info_string(family.get_mother_handle()) + if value: + self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) + self.row += 1 - active = self.dbstate.active.handle + if self.show_siblings: + active = self.dbstate.active.handle - child_list = [handle for handle in family.get_child_handle_list() if handle != active] - label = _("Siblings") - if child_list: - for child in child_list: - self.write_child(label,child) - label = u"" + child_list = [handle for handle in family.get_child_handle_list()\ + if handle != active] + label = _("Siblings") + if child_list: + for child in child_list: + self.write_child(label,child) + label = u"" def write_relationship(self,family): rtype = family.get_relationship() @@ -452,14 +486,15 @@ class FamilyView(PageView.PersonNavView): else: handle = father_handle - self.write_person(_('Spouse'),handle) + if handle: + self.write_person(_('Spouse'),handle) - value = self.info_string(handle) - if value: - self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) - self.row += 1 - self.write_relationship(family) - self.write_marriage(family) + value = self.info_string(handle) + if value: + self.child.attach(BasicLabel(value),3,5,self.row, self.row+1) + self.row += 1 + self.write_relationship(family) + self.write_marriage(family) child_list = family.get_child_handle_list() label = _("Children") diff --git a/src/GrampsGconfKeys.py b/src/GrampsGconfKeys.py index 673f112b0..12de930ee 100644 --- a/src/GrampsGconfKeys.py +++ b/src/GrampsGconfKeys.py @@ -364,6 +364,18 @@ def get_researcher_email(): def save_researcher_email(val): set_string("/apps/gramps/researcher/researcher-email",val) +def get_family_details(): + return get_bool("/apps/gramps/preferences/family-details") + +def save_family_details(val): + set_bool("/apps/gramps/preferences/family-details",val) + +def get_family_siblings(): + return get_bool("/apps/gramps/preferences/family-siblings") + +def save_family_siblings(val): + set_bool("/apps/gramps/preferences/family-siblings",val) + #------------------------------------------------------------------------- # # Low-level grabbing and saving keys with error checking. diff --git a/src/GrampsIniKeys.py b/src/GrampsIniKeys.py index d565b8b62..3b4b6e22e 100644 --- a/src/GrampsIniKeys.py +++ b/src/GrampsIniKeys.py @@ -229,6 +229,18 @@ def get_family_view(): def save_family_view(val): set_int("interface", "familyview",val, (0,1)) +def get_family_details(): + return get_bool("/apps/gramps/preferences/family-details", (0,1)) + +def save_family_details(val): + set_bool("/apps/gramps/preferences/family-details",val, (0,1)) + +def get_family_siblings(): + return get_bool("/apps/gramps/preferences/family-siblings",(0,1)) + +def save_family_siblings(val): + set_bool("/apps/gramps/preferences/family-siblings",val,(0,1)) + def get_filter(): return get_bool("interface", "filter") diff --git a/src/Navigation.py b/src/Navigation.py index 60061835b..c780cecc9 100644 --- a/src/Navigation.py +++ b/src/Navigation.py @@ -81,25 +81,26 @@ class BaseNavigation: Builds the UI and action group. """ self.items = items - self.disable() + menu_len = min(len(items),10) - data = map(lambda x: '' % (self.title,x), range(0,len(items))) + data = map(lambda x: '' % (self.title,x), range(0,menu_len)) self.ui = _top + "".join(data) + _btm - self.action_group = gtk.ActionGroup(self.title) - data = [] index = 0 - for item in items: + + mitems = items[:] + mitems.reverse() + for item in mitems[:10]: name = self.build_item_name(item) f = self.func[index] - data.append(('%s%02d'%(self.title,index), None, name, "%d" % index, None, f)) - index +=1 + data.append(('%s%02d'%(self.title,index), None, name, + "%d" % index, None, f)) + index += 1 + self.action_group.add_actions(data) - - if self.active != DISABLED: - self.enable() + self.enable() class PersonNavigation(BaseNavigation): diff --git a/src/PageView.py b/src/PageView.py index 95dda66cb..ed4544a48 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -96,8 +96,9 @@ class PageView: self.action_list.append((name,stock_icon,label,accel,tip,callback)) def add_toggle_action(self, name, stock_icon, label, accel=None, - tip=None, callback=None): - self.action_toggle_list.append((name,stock_icon,label,accel,tip,callback)) + tip=None, callback=None, value=False): + self.action_toggle_list.append((name,stock_icon,label,accel, + tip,callback,value)) def get_actions(self): if not self.action_group: diff --git a/src/PersonView.py b/src/PersonView.py index ec0160d31..5cb41be3c 100644 --- a/src/PersonView.py +++ b/src/PersonView.py @@ -103,8 +103,8 @@ class PersonView(PageView.PersonNavView): self.add_action('Remove', gtk.STOCK_REMOVE, "_Remove", callback=self.remove) - self.add_toggle_action('Filter', None, '_Filter', - callback=self.filter_toggle) + self.add_toggle_action('Filter', None, '_Filter', None, None, + self.filter_toggle) def get_stock(self): """ @@ -529,7 +529,8 @@ class PersonView(PageView.PersonNavView): for column in self.columns: self.tree.remove_column(column) try: - column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0,background=self.model.marker_color_column) + column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0, + background=self.model.marker_color_column) except AttributeError: column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) column.set_resizable(True) @@ -545,7 +546,8 @@ class PersonView(PageView.PersonNavView): continue name = column_names[pair[1]] try: - column = gtk.TreeViewColumn(name, self.renderer, markup=pair[1],background=self.model.marker_color_column) + column = gtk.TreeViewColumn(name, self.renderer, markup=pair[1], + background=self.model.marker_color_column) except AttributeError: column = gtk.TreeViewColumn(name, self.renderer, markup=pair[1]) column.set_resizable(True) diff --git a/src/data/gramps.schemas b/src/data/gramps.schemas index 2948fdfd3..6cb31c992 100644 --- a/src/data/gramps.schemas +++ b/src/data/gramps.schemas @@ -3,6 +3,30 @@ + + /schemas/apps/gramps/preferences/family-details + /apps/gramps/preferences/family-details + gramps + bool + 1 + + Show event details on the Family View + If set to True, event reports are shown on the Family View. + + + + + /schemas/apps/gramps/preferences/family-siblings + /apps/gramps/preferences/family-siblings + gramps + bool + 1 + + Show siblings on the Family View + If set to True, siblings will be shown on the Family View. + + + /schemas/apps/gramps/behavior/autoload /apps/gramps/behavior/autoload