* src/gramps_main.py: remove unused functions, fix history
* src/FamilyView.py: improve reordering of children svn: r3058
This commit is contained in:
parent
551215fb01
commit
13837efea8
@ -180,7 +180,6 @@ class FamilyView:
|
|||||||
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
|
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
|
||||||
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
|
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
|
||||||
self.child_list.connect('drag_data_get', self.drag_data_get)
|
self.child_list.connect('drag_data_get', self.drag_data_get)
|
||||||
self.child_list.connect('drag_begin', self.drag_begin)
|
|
||||||
self.child_list.connect('drag_data_received',self.drag_data_received)
|
self.child_list.connect('drag_data_received',self.drag_data_received)
|
||||||
|
|
||||||
self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
|
self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
|
||||||
@ -1259,7 +1258,7 @@ class FamilyView:
|
|||||||
list.remove(obj)
|
list.remove(obj)
|
||||||
list.insert(row,obj)
|
list.insert(row,obj)
|
||||||
|
|
||||||
if (birth_dates_in_order(list) == 0):
|
if self.birth_dates_in_order(list) == 0:
|
||||||
WarningDialog(_("Attempt to Reorder Children Failed"),
|
WarningDialog(_("Attempt to Reorder Children Failed"),
|
||||||
_("Children must be ordered by their birth dates."))
|
_("Children must be ordered by their birth dates."))
|
||||||
return
|
return
|
||||||
@ -1323,43 +1322,24 @@ class FamilyView:
|
|||||||
else:
|
else:
|
||||||
return ("","")
|
return ("","")
|
||||||
|
|
||||||
def drag_begin(self, obj, context):
|
def birth_dates_in_order(self,list):
|
||||||
return
|
"""Check any *valid* birthdates in the list to insure that they are in
|
||||||
# model, iter = self.child_selection.get_selected()
|
numerically increasing order."""
|
||||||
# path = model.get_path(iter)
|
inorder = 1
|
||||||
# pixmap = self.child_list.create_row_drag_icon(path)
|
prev_date = "00000000"
|
||||||
# print "map",pixmap
|
for i in range(len(list)):
|
||||||
|
child_id = list[i]
|
||||||
# myimage = gtk.Image()
|
child = self.parent.db.find_person_from_id(child_id)
|
||||||
# print "set",pixmap
|
birth_id = child.get_birth_id()
|
||||||
# myimage.set_from_pixmap(pixmap,None)
|
birth = self.parent.db.find_event_from_id(birth_id)
|
||||||
|
if not birth:
|
||||||
# print "image"
|
continue
|
||||||
# pixbuf = myimage.get_pixbuf()
|
bday = birth.get_date_object()
|
||||||
# print "buf", pixbuf
|
child_date = sort.build_sort_date(bday)
|
||||||
|
if (child_date == "99999999"):
|
||||||
# context.set_icon_pixbuf(pixbuf,0,0)
|
continue
|
||||||
# return
|
if (prev_date <= child_date): # <= allows for twins
|
||||||
|
prev_date = child_date
|
||||||
#-------------------------------------------------------------------------
|
else:
|
||||||
#
|
inorder = 0
|
||||||
# birth_dates_in_order
|
return inorder
|
||||||
#
|
|
||||||
# Check any *valid* birthdates in the list to insure that they are in
|
|
||||||
# numerically increasing order.
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def birth_dates_in_order(list):
|
|
||||||
inorder = 1
|
|
||||||
prev_date = "00000000"
|
|
||||||
for i in range(len(list)):
|
|
||||||
child = list[i]
|
|
||||||
bday = child.get_birth().get_date_object()
|
|
||||||
child_date = sort.build_sort_date(bday)
|
|
||||||
if (child_date == "99999999"):
|
|
||||||
continue
|
|
||||||
if (prev_date <= child_date): # <= allows for twins
|
|
||||||
prev_date = child_date
|
|
||||||
else:
|
|
||||||
inorder = 0
|
|
||||||
return inorder
|
|
||||||
|
@ -107,7 +107,6 @@ class Gramps:
|
|||||||
|
|
||||||
self.parents_index = 0
|
self.parents_index = 0
|
||||||
self.active_person = None
|
self.active_person = None
|
||||||
self.place_loaded = 0
|
|
||||||
self.bookmarks = None
|
self.bookmarks = None
|
||||||
self.c_details = 6
|
self.c_details = 6
|
||||||
self.cl = 0
|
self.cl = 0
|
||||||
@ -194,7 +193,7 @@ class Gramps:
|
|||||||
self.statusbar = self.gtop.get_widget("statusbar")
|
self.statusbar = self.gtop.get_widget("statusbar")
|
||||||
|
|
||||||
self.filter_list = self.gtop.get_widget("filter_list")
|
self.filter_list = self.gtop.get_widget("filter_list")
|
||||||
self.views = self.gtop.get_widget("views")
|
self.views = self.gtop.get_widget("views")
|
||||||
self.merge_button= self.gtop.get_widget("merge")
|
self.merge_button= self.gtop.get_widget("merge")
|
||||||
self.canvas = self.gtop.get_widget("canvas1")
|
self.canvas = self.gtop.get_widget("canvas1")
|
||||||
self.toolbar = self.gtop.get_widget("toolbar1")
|
self.toolbar = self.gtop.get_widget("toolbar1")
|
||||||
@ -372,7 +371,6 @@ class Gramps:
|
|||||||
PeopleView.column_names,
|
PeopleView.column_names,
|
||||||
self.set_column_order)
|
self.set_column_order)
|
||||||
elif cpage == SOURCE_VIEW:
|
elif cpage == SOURCE_VIEW:
|
||||||
print self.db.get_source_column_order()
|
|
||||||
ColumnOrder.ColumnOrder(self.db.get_source_column_order(),
|
ColumnOrder.ColumnOrder(self.db.get_source_column_order(),
|
||||||
SourceView.column_names,
|
SourceView.column_names,
|
||||||
self.set_source_column_order)
|
self.set_source_column_order)
|
||||||
@ -815,8 +813,6 @@ class Gramps:
|
|||||||
"""Close database and delete abandoned photos, no quit"""
|
"""Close database and delete abandoned photos, no quit"""
|
||||||
self.delete_abandoned_photos()
|
self.delete_abandoned_photos()
|
||||||
self.db.close()
|
self.db.close()
|
||||||
if GrampsCfg.lastfile:
|
|
||||||
self.delete_autosave(GrampsCfg.lastfile)
|
|
||||||
|
|
||||||
def delete_abandoned_photos(self):
|
def delete_abandoned_photos(self):
|
||||||
"""
|
"""
|
||||||
@ -900,7 +896,6 @@ class Gramps:
|
|||||||
self.pedigree_view.clear()
|
self.pedigree_view.clear()
|
||||||
self.source_view.load_sources()
|
self.source_view.load_sources()
|
||||||
self.place_view.load_places()
|
self.place_view.load_places()
|
||||||
self.place_loaded = 0
|
|
||||||
self.media_view.load_media()
|
self.media_view.load_media()
|
||||||
|
|
||||||
def tool_callback(self,val):
|
def tool_callback(self,val):
|
||||||
@ -945,7 +940,6 @@ class Gramps:
|
|||||||
self.status_text(_('Updating display...'))
|
self.status_text(_('Updating display...'))
|
||||||
self.place_view.load_places()
|
self.place_view.load_places()
|
||||||
self.modify_statusbar()
|
self.modify_statusbar()
|
||||||
self.place_loaded = 1
|
|
||||||
else:
|
else:
|
||||||
self.media_view.load_media()
|
self.media_view.load_media()
|
||||||
|
|
||||||
@ -989,33 +983,9 @@ class Gramps:
|
|||||||
dirname = filename
|
dirname = filename
|
||||||
else:
|
else:
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.dirname(filename)
|
||||||
autosave = "%s/autosave.gramps" % dirname
|
|
||||||
|
|
||||||
if os.path.isfile(autosave):
|
self.active_person = None
|
||||||
self.yname = autosave
|
self.read_file(filename)
|
||||||
self.nname = filename
|
|
||||||
|
|
||||||
OptionDialog(_('An autosave file was detected'),
|
|
||||||
_('GRAMPS has detected an autosave file for the '
|
|
||||||
'selected database. This file is more recent than '
|
|
||||||
'the last saved database. This typically happens '
|
|
||||||
'when GRAMPS was unexpected shutdown before the '
|
|
||||||
'data was saved. You may load this file to try to '
|
|
||||||
'recover any missing data.'),
|
|
||||||
_('_Load autosave file'),
|
|
||||||
self.autosave_query,
|
|
||||||
_('Load _saved database'),
|
|
||||||
self.loadsaved_file)
|
|
||||||
else:
|
|
||||||
self.active_person = None
|
|
||||||
self.place_loaded = 0
|
|
||||||
self.read_file(filename)
|
|
||||||
|
|
||||||
def autosave_query(self):
|
|
||||||
self.read_file(self.yname)
|
|
||||||
|
|
||||||
def loadsaved_file(self):
|
|
||||||
self.read_file(self.nname)
|
|
||||||
|
|
||||||
def read_gedcom(self,filename):
|
def read_gedcom(self,filename):
|
||||||
import ReadGedcom
|
import ReadGedcom
|
||||||
@ -1194,36 +1164,6 @@ class Gramps:
|
|||||||
self.topWindow.set_title("%s - GRAMPS" % name)
|
self.topWindow.set_title("%s - GRAMPS" % name)
|
||||||
self.status_text("")
|
self.status_text("")
|
||||||
self.statusbar.set_progress_percentage(0.0)
|
self.statusbar.set_progress_percentage(0.0)
|
||||||
self.delete_autosave(old_file)
|
|
||||||
|
|
||||||
def delete_autosave(self,filename):
|
|
||||||
autosave = "%s/autosave.gramps" % filename
|
|
||||||
if os.path.exists(autosave):
|
|
||||||
try:
|
|
||||||
os.remove(autosave)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def autosave_database(self):
|
|
||||||
path = self.db.get_save_path()
|
|
||||||
if not path:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
Utils.clear_timer()
|
|
||||||
|
|
||||||
filename = "%s/autosave.gramps" % (path)
|
|
||||||
|
|
||||||
self.status_text(_("autosaving..."));
|
|
||||||
try:
|
|
||||||
self.db.save(filename,self.quick_progress)
|
|
||||||
self.status_text(_("autosave complete"))
|
|
||||||
gtk.timeout_add(5000,self.modify_statusbar)
|
|
||||||
self.load_progress(0)
|
|
||||||
except (IOError,OSError),msg:
|
|
||||||
self.status_text("%s - %s" % (_("autosave failed"),msg))
|
|
||||||
except:
|
|
||||||
DisplayTrace.DisplayTrace()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def load_selected_people(self,obj):
|
def load_selected_people(self,obj):
|
||||||
"""Display the selected people in the EditPerson display"""
|
"""Display the selected people in the EditPerson display"""
|
||||||
@ -1322,7 +1262,12 @@ class Gramps:
|
|||||||
self.people_view.goto_active_person(first)
|
self.people_view.goto_active_person(first)
|
||||||
|
|
||||||
def change_active_person(self,person):
|
def change_active_person(self,person):
|
||||||
if person != self.active_person:
|
if person == None:
|
||||||
|
self.set_buttons(0)
|
||||||
|
self.active_person = None
|
||||||
|
self.modify_statusbar()
|
||||||
|
elif self.active_person == None or \
|
||||||
|
person.get_id() != self.active_person.get_id():
|
||||||
self.active_person = person
|
self.active_person = person
|
||||||
self.modify_statusbar()
|
self.modify_statusbar()
|
||||||
if person:
|
if person:
|
||||||
@ -1347,11 +1292,7 @@ class Gramps:
|
|||||||
else:
|
else:
|
||||||
self.backbtn.set_sensitive(0)
|
self.backbtn.set_sensitive(0)
|
||||||
self.back.set_sensitive(0)
|
self.back.set_sensitive(0)
|
||||||
|
|
||||||
if person:
|
|
||||||
self.set_buttons(1)
|
self.set_buttons(1)
|
||||||
else:
|
|
||||||
self.set_buttons(0)
|
|
||||||
|
|
||||||
def modify_statusbar(self):
|
def modify_statusbar(self):
|
||||||
|
|
||||||
@ -1378,9 +1319,8 @@ class Gramps:
|
|||||||
if name:
|
if name:
|
||||||
if plist == None:
|
if plist == None:
|
||||||
return name
|
return name
|
||||||
else:
|
return _("%(relationship)s of %(person)s") % {
|
||||||
return _("%(relationship)s of %(person)s") % {
|
'relationship' : name, 'person' : pname }
|
||||||
'relationship' : name, 'person' : pname }
|
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
except:
|
except:
|
||||||
@ -1582,13 +1522,6 @@ class Gramps:
|
|||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.mainiteration()
|
gtk.mainiteration()
|
||||||
|
|
||||||
def quick_progress(self,value):
|
|
||||||
gtk.threads_enter()
|
|
||||||
self.statusbar.set_progress_percentage(value)
|
|
||||||
while gtk.events_pending():
|
|
||||||
gtk.mainiteration()
|
|
||||||
gtk.threads_leave()
|
|
||||||
|
|
||||||
def post_load(self,name):
|
def post_load(self,name):
|
||||||
self.db.set_save_path(name)
|
self.db.set_save_path(name)
|
||||||
res = self.db.get_researcher()
|
res = self.db.get_researcher()
|
||||||
@ -1709,7 +1642,8 @@ class Gramps:
|
|||||||
gtk.timeout_add(5000,self.modify_statusbar)
|
gtk.timeout_add(5000,self.modify_statusbar)
|
||||||
else:
|
else:
|
||||||
WarningDialog(_("Could Not Set a Bookmark"),
|
WarningDialog(_("Could Not Set a Bookmark"),
|
||||||
_("A bookmark could not be set because no one was selected."))
|
_("A bookmark could not be set because "
|
||||||
|
"no one was selected."))
|
||||||
|
|
||||||
def on_edit_bookmarks_activate(self,obj):
|
def on_edit_bookmarks_activate(self,obj):
|
||||||
self.bookmarks.edit()
|
self.bookmarks.edit()
|
||||||
@ -1722,7 +1656,8 @@ class Gramps:
|
|||||||
self.update_display(0)
|
self.update_display(0)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
WarningDialog(_("Could not go to a Person"),
|
WarningDialog(_("Could not go to a Person"),
|
||||||
_("Either stale bookmark or broken history caused by IDs reorder."))
|
_("Either stale bookmark or broken history "
|
||||||
|
"caused by IDs reorder."))
|
||||||
self.clear_history()
|
self.clear_history()
|
||||||
self.change_active_person(old_person)
|
self.change_active_person(old_person)
|
||||||
self.update_display(0)
|
self.update_display(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user