* 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
This commit is contained in:
Don Allingham 2006-01-06 05:08:51 +00:00
parent 2db481e691
commit a8f2942ff1
8 changed files with 142 additions and 50 deletions

View File

@ -1,6 +1,11 @@
2006-01-05 Don Allingham <don@gramps-project.org>
* 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 <rjt-gramps@thegrindstone.me.uk>
* src/GrampsLogger/__init__.py: added package interface

View File

@ -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):
<separator/>
</placeholder>
</menu>
<menu action="ViewMenu">
<menuitem action="Siblings"/>
<menuitem action="Details"/>
</menu>
</menubar>
<toolbar name="ToolBar">
<placeholder name="CommonNavigation">
@ -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' <span weight="bold">\u2642</span>'
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")

View File

@ -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.

View File

@ -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")

View File

@ -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: '<menuitem action="%s%02d"/>' % (self.title,x), range(0,len(items)))
data = map(lambda x: '<menuitem action="%s%02d"/>' % (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, "<alt>%d" % index, None, f))
index +=1
data.append(('%s%02d'%(self.title,index), None, name,
"<alt>%d" % index, None, f))
index += 1
self.action_group.add_actions(data)
if self.active != DISABLED:
self.enable()
self.enable()
class PersonNavigation(BaseNavigation):

View File

@ -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:

View File

@ -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)

View File

@ -3,6 +3,30 @@
<gconfschemafile>
<schemalist>
<schema>
<key>/schemas/apps/gramps/preferences/family-details</key>
<applyto>/apps/gramps/preferences/family-details</applyto>
<owner>gramps</owner>
<type>bool</type>
<default>1</default>
<locale name="C">
<short>Show event details on the Family View</short>
<long>If set to True, event reports are shown on the Family View.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gramps/preferences/family-siblings</key>
<applyto>/apps/gramps/preferences/family-siblings</applyto>
<owner>gramps</owner>
<type>bool</type>
<default>1</default>
<locale name="C">
<short>Show siblings on the Family View</short>
<long>If set to True, siblings will be shown on the Family View.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gramps/behavior/autoload</key>
<applyto>/apps/gramps/behavior/autoload</applyto>