diff --git a/src/FamilyView.py b/src/FamilyView.py index d4cb29dc9..438ce017f 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -180,7 +180,6 @@ class FamilyView: 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.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_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING, @@ -1259,7 +1258,7 @@ class FamilyView: list.remove(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"), _("Children must be ordered by their birth dates.")) return @@ -1323,43 +1322,24 @@ class FamilyView: else: return ("","") - def drag_begin(self, obj, context): - return -# model, iter = self.child_selection.get_selected() -# path = model.get_path(iter) -# pixmap = self.child_list.create_row_drag_icon(path) -# print "map",pixmap - -# myimage = gtk.Image() -# print "set",pixmap -# myimage.set_from_pixmap(pixmap,None) - -# print "image" -# pixbuf = myimage.get_pixbuf() -# print "buf", pixbuf - -# context.set_icon_pixbuf(pixbuf,0,0) -# return - -#------------------------------------------------------------------------- -# -# birth_dates_in_order -# -# 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 + def birth_dates_in_order(self,list): + """Check any *valid* birthdates in the list to insure that they are in + numerically increasing order.""" + inorder = 1 + prev_date = "00000000" + for i in range(len(list)): + child_id = list[i] + child = self.parent.db.find_person_from_id(child_id) + birth_id = child.get_birth_id() + birth = self.parent.db.find_event_from_id(birth_id) + if not birth: + continue + bday = 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 diff --git a/src/gramps_main.py b/src/gramps_main.py index 391a65458..f91ce52e2 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -107,7 +107,6 @@ class Gramps: self.parents_index = 0 self.active_person = None - self.place_loaded = 0 self.bookmarks = None self.c_details = 6 self.cl = 0 @@ -194,7 +193,7 @@ class Gramps: self.statusbar = self.gtop.get_widget("statusbar") 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.canvas = self.gtop.get_widget("canvas1") self.toolbar = self.gtop.get_widget("toolbar1") @@ -372,7 +371,6 @@ class Gramps: PeopleView.column_names, self.set_column_order) elif cpage == SOURCE_VIEW: - print self.db.get_source_column_order() ColumnOrder.ColumnOrder(self.db.get_source_column_order(), SourceView.column_names, self.set_source_column_order) @@ -815,8 +813,6 @@ class Gramps: """Close database and delete abandoned photos, no quit""" self.delete_abandoned_photos() self.db.close() - if GrampsCfg.lastfile: - self.delete_autosave(GrampsCfg.lastfile) def delete_abandoned_photos(self): """ @@ -900,7 +896,6 @@ class Gramps: self.pedigree_view.clear() self.source_view.load_sources() self.place_view.load_places() - self.place_loaded = 0 self.media_view.load_media() def tool_callback(self,val): @@ -945,7 +940,6 @@ class Gramps: self.status_text(_('Updating display...')) self.place_view.load_places() self.modify_statusbar() - self.place_loaded = 1 else: self.media_view.load_media() @@ -989,33 +983,9 @@ class Gramps: dirname = filename else: dirname = os.path.dirname(filename) - autosave = "%s/autosave.gramps" % dirname - if os.path.isfile(autosave): - self.yname = autosave - 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) + self.active_person = None + self.read_file(filename) def read_gedcom(self,filename): import ReadGedcom @@ -1194,36 +1164,6 @@ class Gramps: self.topWindow.set_title("%s - GRAMPS" % name) self.status_text("") 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): """Display the selected people in the EditPerson display""" @@ -1322,7 +1262,12 @@ class Gramps: self.people_view.goto_active_person(first) 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.modify_statusbar() if person: @@ -1347,11 +1292,7 @@ class Gramps: else: self.backbtn.set_sensitive(0) self.back.set_sensitive(0) - - if person: self.set_buttons(1) - else: - self.set_buttons(0) def modify_statusbar(self): @@ -1378,9 +1319,8 @@ class Gramps: if name: if plist == None: return name - else: - return _("%(relationship)s of %(person)s") % { - 'relationship' : name, 'person' : pname } + return _("%(relationship)s of %(person)s") % { + 'relationship' : name, 'person' : pname } else: return "" except: @@ -1582,13 +1522,6 @@ class Gramps: while gtk.events_pending(): 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): self.db.set_save_path(name) res = self.db.get_researcher() @@ -1709,7 +1642,8 @@ class Gramps: gtk.timeout_add(5000,self.modify_statusbar) else: 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): self.bookmarks.edit() @@ -1722,7 +1656,8 @@ class Gramps: self.update_display(0) except TypeError: 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.change_active_person(old_person) self.update_display(0)