From 97377f426d649f052ae47c19efa8cf29ab696d44 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 27 Jun 2004 18:08:19 +0000 Subject: [PATCH] * src/gramps_main.py: fix import problem svn: r3234 --- ChangeLog | 3 +++ src/AddSpouse.py | 4 ++-- src/ChooseParents.py | 25 ++++++++++++------------- src/EditPerson.py | 4 +++- src/EventEdit.py | 2 +- src/FamilyView.py | 4 +++- src/PeopleModel.py | 8 ++------ src/PeopleView.py | 7 ++----- src/ReadXML.py | 2 +- src/WriteXML.py | 8 ++++---- src/gramps_main.py | 5 +++-- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcb5b162c..77ac84491 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2004-06-27 Don Allingham + * src/gramps_main.py: fix import problem + 2004-06-26 Don Allingham * src/gramps_main.py: dropped New Database message. After all, it should be incredibly obvious. diff --git a/src/AddSpouse.py b/src/AddSpouse.py index ae7f60196..e9a7970e2 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -117,7 +117,7 @@ class AddSpouse: self.renderer = gtk.CellRendererText() - self.slist = PeopleModel.PeopleModel(self.db,self.filter_func) + self.slist = PeopleModel.PeopleModel(self.db) self.spouse_list.set_model(self.slist) self.selection = self.spouse_list.get_selection() self.selection.connect('changed',self.select_row) @@ -342,7 +342,7 @@ class AddSpouse: the potential spouse list. """ - self.slist = PeopleModel.PeopleModel(self.db,self.filter_func) + self.slist = PeopleModel.PeopleModel(self.db) self.spouse_list.set_model(self.slist) def on_show_toggled(self,obj): diff --git a/src/ChooseParents.py b/src/ChooseParents.py index 5fbdcf583..ebee95dd8 100644 --- a/src/ChooseParents.py +++ b/src/ChooseParents.py @@ -298,12 +298,10 @@ class ChooseParents: def redrawf(self): """Redraws the potential father list""" - self.father_nsort = PeopleModel.PeopleModel(self.db, self.father_filter) - if self.nosort: - self.father_model = self.father_nsort - else: - self.father_model = gtk.TreeModelSort(self.father_nsort) + self.father_nsort = PeopleModel.PeopleModel(self.db) + self.father_model = gtk.TreeModelSort(self.father_nsort) self.father_list.set_model(self.father_model) + if self.type == "Partners": self.flabel.set_label("%s" % _("Par_ent")) else: @@ -311,13 +309,10 @@ class ChooseParents: def redrawm(self): """Redraws the potential mother list""" - self.mother_nsort = PeopleModel.PeopleModel(self.db, self.mother_filter) - if self.nosort: - self.mother_model = self.mother_nsort - else: - self.mother_model = gtk.TreeModelSort(self.mother_nsort) - + self.mother_nsort = PeopleModel.PeopleModel(self.db) + self.mother_model = gtk.TreeModelSort(self.mother_nsort) self.mother_list.set_model(self.mother_model) + if self.type == "Partners": self.mlabel.set_label("%s" % _("Pa_rent")) else: @@ -401,10 +396,14 @@ class ChooseParents: #self.father_model.center_selected() def father_select_function(self,store,path,iter,id_list): - id_list.append(self.father_model.get_value(iter,PeopleModel.COLUMN_INT_ID)) + if len(path) != 1: + val = self.father_model.get_value(iter,PeopleModel.COLUMN_INT_ID) + id_list.append(val) def mother_select_function(self,store,path,iter,id_list): - id_list.append(self.mother_model.get_value(iter,PeopleModel.COLUMN_INT_ID)) + if len(path) != 1: + val = self.mother_model.get_value(iter,PeopleModel.COLUMN_INT_ID) + id_list.append(val) def get_selected_father_ids(self): mlist = [] diff --git a/src/EditPerson.py b/src/EditPerson.py index 5ca549c20..167e83e08 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1620,7 +1620,9 @@ class EditPerson: elif makenew: place = RelLib.Place() place.set_title(text) - self.db.add_place(place) + trans = self.db.start_transaction() + self.db.add_place(place,trans) + self.db.add_transaction(trans,_('Add Place (%s)' % text)) self.pdmap[text] = place.get_id() self.add_places.append(place) return place.get_id() diff --git a/src/EventEdit.py b/src/EventEdit.py index 8df4afae0..f8e801430 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -102,7 +102,7 @@ class EventEditor: # in translated languages with the 'Death' event, which is a partial match # to other events if not transname in elist: - list.append(transname) + elist.append(transname) else: self.srcreflist = [] self.witnesslist = [] diff --git a/src/FamilyView.py b/src/FamilyView.py index 9e95a6863..d58a601d8 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -1049,12 +1049,14 @@ class FamilyView: val = self.parent.db.get_person_display(child.get_id()) i += 1 - event = self.parent.db.find_event_from_id(val[4]) + event = self.parent.db.find_event_from_id(val[3]) + print event.serialize() if event: dval = event.get_date() else: dval = u'' + print i,val[0],val[1],val[2],dval,status,val[3],child.get_id() self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2], 4,dval,5,status,6,val[6],7,child.get_id()) diff --git a/src/PeopleModel.py b/src/PeopleModel.py index e658449df..98a0edd4e 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -69,11 +69,10 @@ _FAMILY_COL= 9 #------------------------------------------------------------------------- class PeopleModel(gtk.GenericTreeModel): - def __init__(self,db,filter=None): + def __init__(self,db): gtk.GenericTreeModel.__init__(self) self.db = db - self.filter = filter self.visible = {} self.top_visible = {} @@ -297,10 +296,7 @@ class PeopleModel(gtk.GenericTreeModel): def on_iter_has_child(self, node): '''returns true if this node has children''' if node == None: - if len(self.top_iter2path) > 0: - return gtk.TRUE - else: - return gtk.FALSE + return len(self.top_iter2path) if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0: return gtk.TRUE return gtk.FALSE diff --git a/src/PeopleView.py b/src/PeopleView.py index 37159711f..663cdf108 100644 --- a/src/PeopleView.py +++ b/src/PeopleView.py @@ -122,10 +122,7 @@ class PeopleView: def build_tree(self): self.person_model = PeopleModel.PeopleModel(self.parent.db) - if gtk.pygtk_version >= (2,3,92): - self.sort_model = gtk.TreeModelSort(self.person_model).filter_new() - else: - self.sort_model = gtk.TreeModelSort(self.person_model) + self.sort_model = gtk.TreeModelSort(self.person_model).filter_new() self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW) self.person_tree.set_model(self.sort_model) @@ -217,8 +214,8 @@ class PeopleView: self.parent.load_person(self.parent.active_person) def apply_filter(self,current_model=None): + self.person_model.rebuild_data() self.parent.status_text(_('Updating display...')) - keys = self.DataFilter.apply(self.parent.db, self.parent.db.get_person_keys()) self.person_model.reset_visible() diff --git a/src/ReadXML.py b/src/ReadXML.py index 3d5dbbe5b..a65203d27 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -140,7 +140,7 @@ def importData(database, filename, callback=None,cl=0): return 0 xml_file.close() - + # copy all local images into .images directory db_dir = os.path.abspath(os.path.dirname(database.get_save_path())) db_base = os.path.basename(database.get_save_path()) diff --git a/src/WriteXML.py b/src/WriteXML.py index d5687159f..5c79371b7 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -226,7 +226,7 @@ class XmlWriter: self.g.write(" \n") keys = self.db.get_person_keys() @@ -521,7 +521,7 @@ class XmlWriter: def write_id(self,label,person,index=1): if person: - self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_id())) + self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_gramps_id())) comp = person.get_complete() if comp: self.g.write(' complete="1"') @@ -780,8 +780,8 @@ class XmlWriter: # #------------------------------------------------------------------------- def sortById(first,second): - fid = first.get_id() - sid = second.get_id() + fid = first.get_gramps_id() + sid = second.get_gramps_id() if fid < sid: return -1 diff --git a/src/gramps_main.py b/src/gramps_main.py index b681e3875..bb791d05f 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -917,10 +917,11 @@ class Gramps: self.import_tool_callback() def import_tool_callback(self): - self.people_view.build_tree() + self.people_view.person_model.rebuild_data() if Utils.wasHistory_broken(): self.clear_history() Utils.clearHistory_broken() + self.people_view.change_db(self.db) self.people_view.apply_filter() if not self.active_person: self.change_active_person(self.find_initial_person()) @@ -1472,7 +1473,6 @@ class Gramps: _("New gramps database has to be set up when opening non-native formats. The following dialog will let you select the new database."), self.topWindow) DbPrompter.DbPrompter(self,1,self.topWindow,filename) - print "filename:", filename importData(self.db,filename) self.import_tool_callback() opened = 1 @@ -1858,6 +1858,7 @@ class Gramps: def import_callback(self,obj,plugin_function): """Call the import plugin""" plugin_function(self.db,self.active_person,self.import_tool_callback) + self.people_view.person_model.rebuild_data() self.topWindow.set_title("%s - GRAMPS" % self.db.get_save_path()) def on_preferences_activate(self,obj):