* src/DisplayModels.py: support for Spouse column

* src/MediaView.py: fix try_to_find_object_from_id
* src/PeopleModel.py:  support for Spouse column
* src/RelLib.py: handle expanding columns


svn: r3198
This commit is contained in:
Don Allingham 2004-06-03 03:28:46 +00:00
parent bf5ad74a5d
commit 7113318c2b
8 changed files with 49 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2004-06-02 Don Allingham <dallingham@users.sourceforge.net>
* src/DisplayModels.py: support for Spouse column
* src/MediaView.py: fix try_to_find_object_from_id
* src/PeopleModel.py: support for Spouse column
* src/RelLib.py: handle expanding columns
2004-05-30 Don Allingham <dallingham@users.sourceforge.net>
* src/EditSource.py: try_to_find_person_from_id fix
* src/PedView.py: try_to_find_person_from_id fix

View File

@ -67,7 +67,7 @@ class BaseModel(gtk.GenericTreeModel):
return gtk.TREE_MODEL_LIST_ONLY
def on_get_n_columns(self):
return 9
return 10
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various

View File

@ -177,7 +177,7 @@ class MediaView:
id = store.get_value(iter,1)
mobj = self.db.try_to_find_object_from_id(id,None)
mobj = self.db.try_to_find_object_from_id(id)
type = mobj.get_mime_type()
type_name = Utils.get_mime_description(type)
path = mobj.get_path()

View File

@ -49,9 +49,9 @@ from RelLib import *
#
#-------------------------------------------------------------------------
COLUMN_NAME = 0
COLUMN_NAME_SORT = 7
COLUMN_VIEW = 8
COLUMN_BOLD = 9
COLUMN_NAME_SORT = 8
COLUMN_VIEW = COLUMN_NAME_SORT + 1
COLUMN_BOLD = COLUMN_VIEW + 1
#-------------------------------------------------------------------------
#
@ -76,6 +76,7 @@ class PeopleModel(gtk.GenericTreeModel):
self.column_birth_place,
self.column_death_day,
self.column_death_place,
self.column_spouse,
self.sort_name,
]
@ -319,6 +320,21 @@ class PeopleModel(gtk.GenericTreeModel):
def sort_name(self,data):
return data[2].get_sort_name()
def column_spouse(self,data):
id = data[0]
if data[8]:
fid = data[8][0]
else:
return u""
d2 = self.db.family_map.get(str(fid))
if fid and d2 :
if d2[1] == id:
return self.db.person_map.get(str(d2[2]))[2].get_name()
else:
return self.db.person_map.get(str(d2[1]))[2].get_name()
else:
return u""
def column_name(self,data):
return data[2].get_name()

View File

@ -54,6 +54,7 @@ column_names = [
_('Birth Place'),
_('Death Date'),
_('Death Place'),
_('Spouse'),
]
#-------------------------------------------------------------------------
@ -81,7 +82,8 @@ class PeopleView:
self.person_selection = self.person_tree.get_selection()
self.person_selection.connect('changed',self.row_changed)
self.person_tree.connect('row_activated', self.alpha_event)
self.person_tree.connect('button-press-event',self.on_plist_button_press)
self.person_tree.connect('button-press-event',
self.on_plist_button_press)
def get_maps(self):
return (self.person_model.top_iter2path,
@ -136,9 +138,10 @@ class PeopleView:
return mlist
def row_changed(self,obj):
"""Called with a row is changed. Check the selected objects from the person_tree
to get the IDs of the selected objects. Set the active person to the first person
in the list. If no one is selected, set the active person to None"""
"""Called with a row is changed. Check the selected objects from
the person_tree to get the IDs of the selected objects. Set the
active person to the first person in the list. If no one is
selected, set the active person to None"""
selected_ids = self.get_selected_objects()
@ -163,8 +166,8 @@ class PeopleView:
self.person_tree.set_model(self.sort_model)
def remove_from_person_list(self,person,old_id=None):
"""Remove the selected person from the list. A person object is expected,
not an ID"""
"""Remove the selected person from the list. A person object is
expected, not an ID"""
if old_id == None:
old_id = person.get_id()
path = self.person_model.on_get_path(old_id)
@ -216,7 +219,8 @@ class PeopleView:
def apply_filter(self,current_model=None):
self.parent.status_text(_('Updating display...'))
keys = self.DataFilter.apply(self.parent.db,self.parent.db.get_person_keys())
keys = self.DataFilter.apply(self.parent.db,
self.parent.db.get_person_keys())
self.person_model.reset_visible()
for person_id in keys:
self.person_model.set_visible(person_id,1)

View File

@ -2965,6 +2965,7 @@ class GrampsDB:
If no such Person exists, a new Person is added to the database."""
data = self.person_map.get(str(val))
print data
if data:
person = Person()
@ -2979,7 +2980,6 @@ class GrampsDB:
person = Person()
data = self.person_map.get(str(val))
if data:
person.unserialize(data)
else:
@ -3557,10 +3557,15 @@ class GrampsDB:
self.metadata['media_columns'] = list
def get_column_order(self):
default = [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6),(0,7)]
if self.metadata == None:
return [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6)]
return default
else:
return self.metadata.get('columns',[(1,1),(1,2),(1,3),(0,4),(1,5),(0,6)])
cols = self.metadata.get('columns',default)
if len(cols) != len(default):
return cols + default[len(cols):]
else:
return cols
def get_place_column_order(self):
default = [(1,1),(1,2),(0,3),(1,4),(0,5),(1,6),(0,7),(0,8)]

View File

@ -122,7 +122,8 @@ class SelectChild:
self.frel.set_text(_("Birth"))
self.refmodel = PeopleModel.PeopleModel(self.db)
self.add_child.set_model(self.refmodel)
self.add_child.set_model(self.refmodel)
self.redraw_child_list(2)
self.add_itself_to_menu()
self.add_columns(self.add_child)

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<tips>
<tip>You can represent a range of dates by using the format of &quot;between January 4, 2000 and March 20, 2003&quot;</tip>
<tip>You can drag and drop an image from either the Media View or any gallery into another gallery</tip>
<tip>You can add an image to any gallery or the Media View by dragging and dropping from a file manager or a web browser.</tip>
<tip>You can set the birth order of children in a family even if you do not have birth dates by using drag and drop.</tip>