* src/gramps_main.py: fix import problem
svn: r3234
This commit is contained in:
parent
4c76be91dd
commit
97377f426d
@ -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>
|
2004-06-26 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/gramps_main.py: dropped New Database message. After all, it should
|
* src/gramps_main.py: dropped New Database message. After all, it should
|
||||||
be incredibly obvious.
|
be incredibly obvious.
|
||||||
|
@ -117,7 +117,7 @@ class AddSpouse:
|
|||||||
|
|
||||||
self.renderer = gtk.CellRendererText()
|
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.spouse_list.set_model(self.slist)
|
||||||
self.selection = self.spouse_list.get_selection()
|
self.selection = self.spouse_list.get_selection()
|
||||||
self.selection.connect('changed',self.select_row)
|
self.selection.connect('changed',self.select_row)
|
||||||
@ -342,7 +342,7 @@ class AddSpouse:
|
|||||||
the potential spouse list.
|
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)
|
self.spouse_list.set_model(self.slist)
|
||||||
|
|
||||||
def on_show_toggled(self,obj):
|
def on_show_toggled(self,obj):
|
||||||
|
@ -298,12 +298,10 @@ class ChooseParents:
|
|||||||
|
|
||||||
def redrawf(self):
|
def redrawf(self):
|
||||||
"""Redraws the potential father list"""
|
"""Redraws the potential father list"""
|
||||||
self.father_nsort = PeopleModel.PeopleModel(self.db, self.father_filter)
|
self.father_nsort = PeopleModel.PeopleModel(self.db)
|
||||||
if self.nosort:
|
|
||||||
self.father_model = self.father_nsort
|
|
||||||
else:
|
|
||||||
self.father_model = gtk.TreeModelSort(self.father_nsort)
|
self.father_model = gtk.TreeModelSort(self.father_nsort)
|
||||||
self.father_list.set_model(self.father_model)
|
self.father_list.set_model(self.father_model)
|
||||||
|
|
||||||
if self.type == "Partners":
|
if self.type == "Partners":
|
||||||
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
|
self.flabel.set_label("<b>%s</b>" % _("Par_ent"))
|
||||||
else:
|
else:
|
||||||
@ -311,13 +309,10 @@ class ChooseParents:
|
|||||||
|
|
||||||
def redrawm(self):
|
def redrawm(self):
|
||||||
"""Redraws the potential mother list"""
|
"""Redraws the potential mother list"""
|
||||||
self.mother_nsort = PeopleModel.PeopleModel(self.db, self.mother_filter)
|
self.mother_nsort = PeopleModel.PeopleModel(self.db)
|
||||||
if self.nosort:
|
|
||||||
self.mother_model = self.mother_nsort
|
|
||||||
else:
|
|
||||||
self.mother_model = gtk.TreeModelSort(self.mother_nsort)
|
self.mother_model = gtk.TreeModelSort(self.mother_nsort)
|
||||||
|
|
||||||
self.mother_list.set_model(self.mother_model)
|
self.mother_list.set_model(self.mother_model)
|
||||||
|
|
||||||
if self.type == "Partners":
|
if self.type == "Partners":
|
||||||
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
|
self.mlabel.set_label("<b>%s</b>" % _("Pa_rent"))
|
||||||
else:
|
else:
|
||||||
@ -401,10 +396,14 @@ class ChooseParents:
|
|||||||
#self.father_model.center_selected()
|
#self.father_model.center_selected()
|
||||||
|
|
||||||
def father_select_function(self,store,path,iter,id_list):
|
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):
|
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):
|
def get_selected_father_ids(self):
|
||||||
mlist = []
|
mlist = []
|
||||||
|
@ -1620,7 +1620,9 @@ class EditPerson:
|
|||||||
elif makenew:
|
elif makenew:
|
||||||
place = RelLib.Place()
|
place = RelLib.Place()
|
||||||
place.set_title(text)
|
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.pdmap[text] = place.get_id()
|
||||||
self.add_places.append(place)
|
self.add_places.append(place)
|
||||||
return place.get_id()
|
return place.get_id()
|
||||||
|
@ -102,7 +102,7 @@ class EventEditor:
|
|||||||
# in translated languages with the 'Death' event, which is a partial match
|
# in translated languages with the 'Death' event, which is a partial match
|
||||||
# to other events
|
# to other events
|
||||||
if not transname in elist:
|
if not transname in elist:
|
||||||
list.append(transname)
|
elist.append(transname)
|
||||||
else:
|
else:
|
||||||
self.srcreflist = []
|
self.srcreflist = []
|
||||||
self.witnesslist = []
|
self.witnesslist = []
|
||||||
|
@ -1049,12 +1049,14 @@ class FamilyView:
|
|||||||
val = self.parent.db.get_person_display(child.get_id())
|
val = self.parent.db.get_person_display(child.get_id())
|
||||||
i += 1
|
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:
|
if event:
|
||||||
dval = event.get_date()
|
dval = event.get_date()
|
||||||
else:
|
else:
|
||||||
dval = u''
|
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],
|
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())
|
4,dval,5,status,6,val[6],7,child.get_id())
|
||||||
|
|
||||||
|
@ -69,11 +69,10 @@ _FAMILY_COL= 9
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PeopleModel(gtk.GenericTreeModel):
|
class PeopleModel(gtk.GenericTreeModel):
|
||||||
|
|
||||||
def __init__(self,db,filter=None):
|
def __init__(self,db):
|
||||||
gtk.GenericTreeModel.__init__(self)
|
gtk.GenericTreeModel.__init__(self)
|
||||||
|
|
||||||
self.db = db
|
self.db = db
|
||||||
self.filter = filter
|
|
||||||
self.visible = {}
|
self.visible = {}
|
||||||
self.top_visible = {}
|
self.top_visible = {}
|
||||||
|
|
||||||
@ -297,10 +296,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
def on_iter_has_child(self, node):
|
def on_iter_has_child(self, node):
|
||||||
'''returns true if this node has children'''
|
'''returns true if this node has children'''
|
||||||
if node == None:
|
if node == None:
|
||||||
if len(self.top_iter2path) > 0:
|
return len(self.top_iter2path)
|
||||||
return gtk.TRUE
|
|
||||||
else:
|
|
||||||
return gtk.FALSE
|
|
||||||
if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0:
|
if self.sname_sub.has_key(node) and len(self.sname_sub[node]) > 0:
|
||||||
return gtk.TRUE
|
return gtk.TRUE
|
||||||
return gtk.FALSE
|
return gtk.FALSE
|
||||||
|
@ -122,10 +122,7 @@ class PeopleView:
|
|||||||
|
|
||||||
def build_tree(self):
|
def build_tree(self):
|
||||||
self.person_model = PeopleModel.PeopleModel(self.parent.db)
|
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()
|
self.sort_model = gtk.TreeModelSort(self.person_model).filter_new()
|
||||||
else:
|
|
||||||
self.sort_model = gtk.TreeModelSort(self.person_model)
|
|
||||||
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
|
||||||
self.person_tree.set_model(self.sort_model)
|
self.person_tree.set_model(self.sort_model)
|
||||||
|
|
||||||
@ -217,8 +214,8 @@ class PeopleView:
|
|||||||
self.parent.load_person(self.parent.active_person)
|
self.parent.load_person(self.parent.active_person)
|
||||||
|
|
||||||
def apply_filter(self,current_model=None):
|
def apply_filter(self,current_model=None):
|
||||||
|
self.person_model.rebuild_data()
|
||||||
self.parent.status_text(_('Updating display...'))
|
self.parent.status_text(_('Updating display...'))
|
||||||
|
|
||||||
keys = self.DataFilter.apply(self.parent.db,
|
keys = self.DataFilter.apply(self.parent.db,
|
||||||
self.parent.db.get_person_keys())
|
self.parent.db.get_person_keys())
|
||||||
self.person_model.reset_visible()
|
self.person_model.reset_visible()
|
||||||
|
@ -226,7 +226,7 @@ class XmlWriter:
|
|||||||
self.g.write(" <people")
|
self.g.write(" <people")
|
||||||
person = self.db.get_default_person()
|
person = self.db.get_default_person()
|
||||||
if person:
|
if person:
|
||||||
self.g.write(' default="%s"' % person.get_id())
|
self.g.write(' default="%s"' % person.get_gramps_id())
|
||||||
self.g.write(">\n")
|
self.g.write(">\n")
|
||||||
|
|
||||||
keys = self.db.get_person_keys()
|
keys = self.db.get_person_keys()
|
||||||
@ -521,7 +521,7 @@ class XmlWriter:
|
|||||||
|
|
||||||
def write_id(self,label,person,index=1):
|
def write_id(self,label,person,index=1):
|
||||||
if person:
|
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()
|
comp = person.get_complete()
|
||||||
if comp:
|
if comp:
|
||||||
self.g.write(' complete="1"')
|
self.g.write(' complete="1"')
|
||||||
@ -780,8 +780,8 @@ class XmlWriter:
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def sortById(first,second):
|
def sortById(first,second):
|
||||||
fid = first.get_id()
|
fid = first.get_gramps_id()
|
||||||
sid = second.get_id()
|
sid = second.get_gramps_id()
|
||||||
|
|
||||||
if fid < sid:
|
if fid < sid:
|
||||||
return -1
|
return -1
|
||||||
|
@ -917,10 +917,11 @@ class Gramps:
|
|||||||
self.import_tool_callback()
|
self.import_tool_callback()
|
||||||
|
|
||||||
def import_tool_callback(self):
|
def import_tool_callback(self):
|
||||||
self.people_view.build_tree()
|
self.people_view.person_model.rebuild_data()
|
||||||
if Utils.wasHistory_broken():
|
if Utils.wasHistory_broken():
|
||||||
self.clear_history()
|
self.clear_history()
|
||||||
Utils.clearHistory_broken()
|
Utils.clearHistory_broken()
|
||||||
|
self.people_view.change_db(self.db)
|
||||||
self.people_view.apply_filter()
|
self.people_view.apply_filter()
|
||||||
if not self.active_person:
|
if not self.active_person:
|
||||||
self.change_active_person(self.find_initial_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."),
|
_("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)
|
self.topWindow)
|
||||||
DbPrompter.DbPrompter(self,1,self.topWindow,filename)
|
DbPrompter.DbPrompter(self,1,self.topWindow,filename)
|
||||||
print "filename:", filename
|
|
||||||
importData(self.db,filename)
|
importData(self.db,filename)
|
||||||
self.import_tool_callback()
|
self.import_tool_callback()
|
||||||
opened = 1
|
opened = 1
|
||||||
@ -1858,6 +1858,7 @@ class Gramps:
|
|||||||
def import_callback(self,obj,plugin_function):
|
def import_callback(self,obj,plugin_function):
|
||||||
"""Call the import plugin"""
|
"""Call the import plugin"""
|
||||||
plugin_function(self.db,self.active_person,self.import_tool_callback)
|
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())
|
self.topWindow.set_title("%s - GRAMPS" % self.db.get_save_path())
|
||||||
|
|
||||||
def on_preferences_activate(self,obj):
|
def on_preferences_activate(self,obj):
|
||||||
|
Loading…
Reference in New Issue
Block a user