* src/gramps_main.py: fix import problem

svn: r3234
This commit is contained in:
Don Allingham 2004-06-27 18:08:19 +00:00
parent 4c76be91dd
commit 97377f426d
11 changed files with 36 additions and 36 deletions

View File

@ -1,3 +1,6 @@
2004-06-27 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: fix import problem
2004-06-26 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: dropped New Database message. After all, it should
be incredibly obvious.

View File

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

View File

@ -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("<b>%s</b>" % _("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("<b>%s</b>" % _("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 = []

View File

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

View File

@ -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 = []

View File

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

View File

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

View File

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

View File

@ -140,7 +140,7 @@ def importData(database, filename, callback=None,cl=0):
return 0
xml_file.close()
# copy all local images into <database>.images directory
db_dir = os.path.abspath(os.path.dirname(database.get_save_path()))
db_base = os.path.basename(database.get_save_path())

View File

@ -226,7 +226,7 @@ class XmlWriter:
self.g.write(" <people")
person = self.db.get_default_person()
if person:
self.g.write(' default="%s"' % person.get_id())
self.g.write(' default="%s"' % person.get_gramps_id())
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

View File

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