diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index bf4e71051..5e1a626a3 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2004-02-28 Don Allingham + * src/gramps_main.py: switch to DB as default, remove save option + * src/RelLib.py: setup DB environment better + * src/DbPrompter.py: handle save/open with new DBs + 2004-02-26 Don Allingham * src/AddMedia.py: media reference fixes * src/MediaView.py: media reference fixes diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index a338a1510..e70544231 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -131,7 +131,6 @@ class AddMediaObject: name = filename mobj.set_path(name) - Utils.modified() if self.update: self.update() self.object = mobj diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index 20f771e22..bb6c60048 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/src/AddSpouse.py @@ -192,7 +192,6 @@ class AddSpouse: Utils.destroy_passed_object(obj) return - Utils.modified() if not self.active_family: self.active_family = self.db.new_family() self.person.add_family_id(self.active_family.get_id()) diff --git a/gramps2/src/Bookmarks.py b/gramps2/src/Bookmarks.py index 96c590996..256e9b605 100644 --- a/gramps2/src/Bookmarks.py +++ b/gramps2/src/Bookmarks.py @@ -78,7 +78,6 @@ class Bookmarks : def add(self,person_id): """appends the person to the bottom of the bookmarks""" if person_id not in self.bookmarks: - Utils.modified() self.bookmarks.append(person_id) self.redraw() diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index ba0985ed9..543814d18 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -573,8 +573,6 @@ class ChooseParents: self.db.commit_person(self.father) if self.mother: self.db.commit_person(self.mother) - Utils.modified() - class ModifyParents: def __init__(self,db,person,family_id,family_update,full_update,parent_window=None): @@ -679,7 +677,6 @@ class ModifyParents: self.person.remove_parent_family_id(self.family.get_id()) self.person.add_parent_family_id(self.family.get_id(),mother_rel,father_rel) mod = 1 - Utils.modified() if len(self.person.get_parent_family_id_list()): make_pref = self.pref.get_active() @@ -688,12 +685,10 @@ class ModifyParents: if make_pref: if self.family != plist[0]: self.person.set_main_parent_family_id(self.family.get_id()) - Utils.modified() mod = 1 else: if self.family == plist[0]: self.person.set_main_parent_family_id(plist[0]) - Utils.modified() mod = 1 if mod: diff --git a/gramps2/src/DbPrompter.py b/gramps2/src/DbPrompter.py index 336623a9f..d0b898884 100644 --- a/gramps2/src/DbPrompter.py +++ b/gramps2/src/DbPrompter.py @@ -92,19 +92,13 @@ class DbPrompter: "on_ok_button1_clicked": self.save_ok_button_clicked, "destroy_passed_object": self.cancel_button_clicked, }) - if self.new: - wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Create database')) - else: - wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Save database')) + wFs.get_widget('fileselection').set_title('%s - GRAMPS' % _('Create database')) def save_ok_button_clicked(self,obj): filename = obj.get_filename().encode('iso8859-1') if filename: Utils.destroy_passed_object(obj) - if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.db.display_comment_box(filename) - else: - self.db.save_file(filename,_("No Comment Provided")) + self.db.read_file(filename) def open_activate(self): wFs = gtk.glade.XML(const.revisionFile, "dbopen","gramps") @@ -140,15 +134,8 @@ class DbPrompter: if not filename: return - Utils.destroy_passed_object(obj) - - if self.getoldrev.get_active(): - vc = VersionControl.RcsVersionControl(filename) - VersionControl.RevisionSelect(self.db.database,filename,vc, - self.db.load_revision,self.show) - else: - self.db.read_file(filename) + self.db.read_file(filename) def open_delete_event(self,obj,event): gtk.mainquit() diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index d340dcfa8..fd334edd2 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -1593,7 +1593,6 @@ class EditPerson: self.db.add_place(place) self.pdmap[text] = place.get_id() self.add_places.append(place) - Utils.modified() return place.get_id() else: return '' diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index 7e414dd88..9e9ddf7a4 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -302,8 +302,6 @@ class EditPlace: def update_lists(self): self.place.set_url_list(self.ulist) self.place.set_alternate_locations(self.llist) - if self.lists_changed: - Utils.modified() def redraw_url_list(self): length = Utils.redraw_list(self.ulist,self.web_model,disp_url) @@ -338,7 +336,6 @@ class EditPlace: text = unicode(field.get_text()) if text != getf(): setf(text) - Utils.modified() def on_place_apply_clicked(self,obj): @@ -362,15 +359,12 @@ class EditPlace: if self.lists_changed: self.place.set_source_reference_list(self.srcreflist) - Utils.modified() if note != self.place.get_note(): self.place.set_note(note) - Utils.modified() if format != self.place.get_note_format(): self.place.set_note_format(format) - Utils.modified() self.gallery_ok = 1 self.update_lists() @@ -559,7 +553,6 @@ class DeletePlaceQuery: def query_response(self): self.db.remove_place(self.place.get_id()) - Utils.modified() for key in self.db.get_person_keys(): p = self.db.get_person(key) diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index a52c963df..6a2bd612e 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -306,31 +306,22 @@ class EditSource: if author != self.source.get_author(): self.source.set_author(author) - Utils.modified() if title != self.source.get_title(): self.source.set_title(title) - Utils.modified() if pubinfo != self.source.get_publication_info(): self.source.set_publication_info(pubinfo) - Utils.modified() if abbrev != self.source.get_abbreviation(): self.source.set_abbreviation(abbrev) - Utils.modified() if note != self.source.get_note(): self.source.set_note(note) - Utils.modified() if format != self.source.get_note_format(): self.source.set_note_format(format) - Utils.modified() - if self.lists_changed: - Utils.modified() - self.gallery_ok = 1 if self.callback: @@ -371,7 +362,6 @@ class DelSrcQuery: def query_response(self): self.db.remove_source_id(self.source.get_id()) - Utils.modified() for key in self.db.get_person_keys(): p = self.db.get_person(key) diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index 8ccecddfc..6a1d8b83c 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -276,7 +276,6 @@ class EventEditor: self.parent.db.add_place(place) self.pmap[text] = place.get_id() self.plist.append(place) - Utils.modified() return place else: return None diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 35ad5865c..6c87ab6fc 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -728,7 +728,6 @@ class FamilyView: self.parent.db.commit_person(child) self.parent.db.commit_family(self.family) - Utils.modified() self.load_family() def remove_spouse(self,obj): @@ -775,8 +774,6 @@ class FamilyView: if len(self.person.get_family_id_list()) <= 1: self.spouse_selection.set_mode(gtk.SELECTION_NONE) - Utils.modified() - def spouse_swap(self,obj): if self.selected_spouse: self.parent.change_active_person(self.selected_spouse) @@ -1232,7 +1229,6 @@ class FamilyView: person.remove_parent_family_id(fam[0]) self.parent.db.commit_person(person) - Utils.modified() self.load_family() def drag_data_received(self,widget,context,x,y,sel_data,info,time): @@ -1268,7 +1264,6 @@ class FamilyView: return self.family.set_child_id_list(list) self.display_marriage(self.family) - Utils.modified() def drag_data_get(self,widget, context, sel_data, info, time): store,iter = self.child_selection.get_selected() diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 944a9251a..7eedd993f 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -492,7 +492,6 @@ class Gallery(ImageSelect): photo.setLocal(1) self.parent.lists_changed = 1 if GrampsCfg.globalprop: - Utils.modified() GlobalMediaProperties(self.db,photo,None) elif protocol != "": import urllib @@ -524,7 +523,6 @@ class Gallery(ImageSelect): self.add_thumbnail(oref) self.parent.lists_changed = 1 if GrampsCfg.globalprop: - Utils.modified() GlobalMediaProperties(self.db,photo,None) else: if self.db.get_object_map().has_key(data.data): @@ -544,7 +542,6 @@ class Gallery(ImageSelect): del nl[index] nl = nl[0:icon_index] + [item] + nl[icon_index:] self.dataobj.set_media_list(nl) - Utils.modified() self.parent.lists_changed = 1 self.load_images() return @@ -556,7 +553,6 @@ class Gallery(ImageSelect): self.parent.lists_changed = 1 if GrampsCfg.globalprop: LocalMediaProperties(oref,self.path,self,self.parent_window) - Utils.modified() def on_photolist_drag_data_get(self,w, context, selection_data, info, time): if info == 1: @@ -821,14 +817,11 @@ class LocalMediaProperties: self.photo.set_note(text) self.photo.set_privacy(priv) self.parent.lists_changed = 1 - Utils.modified() if format != self.photo.get_note_format(): self.photo.set_note_format(format) - Utils.modified() if self.lists_changed: self.photo.set_attribute_list(self.alist) self.parent.lists_changed = 1 - Utils.modified() self.db.commit_media_object(self.object) def on_help_clicked(self, obj): @@ -1060,13 +1053,10 @@ class GlobalMediaProperties: if text != note or desc != self.object.get_description(): self.object.set_note(text) self.object.set_description(desc) - Utils.modified() if format != self.object.get_note_format(): self.object.set_note_format(format) - Utils.modified() if self.lists_changed: self.object.set_attribute_list(self.alist) - Utils.modified() if self.update != None: self.update() self.db.commit_media_object(self.object) @@ -1124,7 +1114,6 @@ class DeleteMediaQuery: def query_response(self): del self.db.get_object_map()[self.media.get_id()] - Utils.modified() for key in self.db.get_person_keys(): p = self.db.get_person(key) diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index 7d03e50f3..700d053e5 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -565,7 +565,6 @@ class Marriage: del m[family.get_id()] m[idval] = family family.set_id(idval) - Utils.modified() else: WarningDialog(_("GRAMPS ID value was not changed."), _('The GRAMPS ID that you chose for this ' @@ -587,22 +586,18 @@ class Marriage: self.family.set_father_id(mother) self.family.set_mother_id(father) self.family.set_relationship(val) - Utils.modified() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),gtk.FALSE)) if text != self.family.get_note(): self.family.set_note(text) - Utils.modified() format = self.preform.get_active() if format != self.family.get_note_format(): self.family.set_note_format(format) - Utils.modified() if self.complete.get_active() != self.family.get_complete(): self.family.set_complete(self.complete.get_active()) - Utils.modified() date = unicode(self.lds_date.get_text()) temple = unicode(self.lds_temple.entry.get_text()) @@ -621,30 +616,22 @@ class Marriage: ord.set_status(self.seal_stat) ord.set_place_id(place) self.family.set_lds_sealing(ord) - Utils.modified() else: d = Date.Date() d.set(date) if Date.compare_dates(d,ord.get_date_object()) != 0: ord.set_date_object(d) - Utils.modified() if ord.get_temple() != temple: ord.set_temple(temple) - Utils.modified() if ord.get_status() != self.seal_stat: ord.set_status(self.seal_stat) - Utils.modified() if ord.get_place_id() != place.get_id(): ord.set_place_id(place.get_id()) - Utils.modified() if self.lists_changed: self.family.set_source_reference_list(self.srcreflist) - Utils.modified() self.update_lists() - if self.lists_changed: - Utils.modified() self.update_fv(self.family) self.db.commit_family(self.family) diff --git a/gramps2/src/MediaView.py b/gramps2/src/MediaView.py index 4172a8609..221ae2ed3 100644 --- a/gramps2/src/MediaView.py +++ b/gramps2/src/MediaView.py @@ -302,7 +302,6 @@ class MediaView: ans.query_response) else: self.db.remove_object(mobj.get_id()) - Utils.modified() self.update(0) def is_object_used(self,mobj): @@ -363,7 +362,6 @@ class MediaView: description = os.path.basename(name) photo.set_description(description) self.db.add_object(photo) - Utils.modified() self.load_media() if GrampsCfg.mediaref == 0: name = RelImage.import_media_object(name, @@ -402,7 +400,6 @@ class MediaView: except: photo.set_path(tfile) return - Utils.modified() self.db.commit_media_object(photo) if GrampsCfg.globalprop: ImageSelect.GlobalMediaProperties(self.db,photo,None) diff --git a/gramps2/src/MergeData.py b/gramps2/src/MergeData.py index 7be013a0e..978b8bcfa 100644 --- a/gramps2/src/MergeData.py +++ b/gramps2/src/MergeData.py @@ -230,8 +230,6 @@ class MergePeople: one.add_source_reference(xsrc) def on_merge_clicked(self,obj): - Utils.modified() - list = self.p1.get_alternate_names()[:] for xdata in self.p2.get_alternate_names(): for data in list: @@ -903,6 +901,5 @@ class MergePlaces: self.db.build_place_display(self.p1.get_id(),old_id) self.update(self.p1.get_id()) - Utils.modified() Utils.destroy_passed_object(obj) diff --git a/gramps2/src/NoteEdit.py b/gramps2/src/NoteEdit.py index 63bd1deb8..c05778c19 100644 --- a/gramps2/src/NoteEdit.py +++ b/gramps2/src/NoteEdit.py @@ -123,5 +123,4 @@ class NoteEditor: buffer.get_end_iter(),gtk.FALSE)) if text != self.data.get_note(): self.data.set_note(text) - Utils.modified() self.close(obj) diff --git a/gramps2/src/PlaceView.py b/gramps2/src/PlaceView.py index ed491160b..e4c88df6c 100644 --- a/gramps2/src/PlaceView.py +++ b/gramps2/src/PlaceView.py @@ -265,7 +265,6 @@ class PlaceView: else: self.db.remove_place(place.get_id()) self.update(0) - Utils.modified() def on_edit_clicked(self,obj): """Display the selected places in the EditPlace display""" diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index af9a6f6e3..0e4ceaf5f 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -32,6 +32,7 @@ __version__ = "$Revision$" #------------------------------------------------------------------------- from re import compile import os +import os.path import types #------------------------------------------------------------------------- @@ -2269,24 +2270,6 @@ class GrampsDB: def __init__(self): """creates a new GrampsDB""" - self.env = db.DBEnv() - flags = db.DB_CREATE|db.DB_INIT_MPOOL - - self.env.open(".", flags) - - self.person_map = dbshelve.open('person.db', dbname="person", dbenv=self.env) - self.family_map = dbshelve.open('person.db', dbname="family", dbenv=self.env) - self.place_map = dbshelve.open('person.db', dbname="places", dbenv=self.env) - self.source_map = dbshelve.open('person.db', dbname="sources",dbenv=self.env) - self.media_map = dbshelve.open('person.db', dbname="media", dbenv=self.env) - self.event_map = dbshelve.open('person.db', dbname="events", dbenv=self.env) - - self.surnames = db.DB(self.env) - self.surnames.set_flags(db.DB_DUP) - self.surnames.open("person.db", "surnames", db.DB_HASH, flags=db.DB_CREATE) - - self.person_map.associate(self.surnames, find_surname, db.DB_CREATE) - self.iprefix = "I%04d" self.sprefix = "S%04d" self.oprefix = "O%04d" @@ -2297,6 +2280,37 @@ class GrampsDB: self.added_files = [] self.genderStats = GenderStats () + self.env = None + self.person_map = None + self.family_map = None + self.place_map = None + self.source_map = None + self.media_map = None + self.event_map = None + self.surnames = None + + def load(self,name,callback): + if self.person_map: + self.close() + + self.env = db.DBEnv() + flags = db.DB_CREATE|db.DB_INIT_MPOOL|db.DB_PRIVATE + + self.env.open(os.path.dirname(name), flags) + name = os.path.basename(name) + self.person_map = dbshelve.open(name, dbname="person", dbenv=self.env) + self.family_map = dbshelve.open(name, dbname="family", dbenv=self.env) + self.place_map = dbshelve.open(name, dbname="places", dbenv=self.env) + self.source_map = dbshelve.open(name, dbname="sources",dbenv=self.env) + self.media_map = dbshelve.open(name, dbname="media", dbenv=self.env) + self.event_map = dbshelve.open(name, dbname="events", dbenv=self.env) + + self.surnames = db.DB(self.env) + self.surnames.set_flags(db.DB_DUP) + self.surnames.open(name, "surnames", db.DB_HASH, flags=db.DB_CREATE) + + self.person_map.associate(self.surnames, find_surname, db.DB_CREATE) + def close(self): self.person_map.close() self.family_map.close() @@ -2305,6 +2319,7 @@ class GrampsDB: self.media_map.close() self.event_map.close() self.surnames.close() + self.env.close() def get_added_media_objects(self): return self.added_files @@ -2318,17 +2333,20 @@ class GrampsDB: def get_base(self): return "" - def need_autosave(self): - return 1 - def get_number_of_people(self): return len(self.person_map) def get_person_keys(self): - return self.person_map.keys() + if self.person_map: + return self.person_map.keys() + else: + return [] def get_family_keys(self): - return self.family_map.keys() + if self.family_map: + return self.family_map.keys() + else: + return [] def sort_by_name(self,f,s): n1 = self.person_map.get(str(f))[2].sname @@ -2336,7 +2354,10 @@ class GrampsDB: return cmp(n1,n2) def sort_person_keys(self): - return self.person_map.keys() + if self.person_map: + return self.person_map.keys() + else: + return [] # keys = self.person_map.keys() # if type(keys) == type([]): # keys.sort(self.sort_by_name) @@ -2921,13 +2942,18 @@ class GrampsDB: return cmp(fp,sp) def sort_place_keys(self): - keys = self.place_map.keys() - if type(keys) == type([]): - keys.sort(self.sortbyplace) - return keys + if self.place_map: + keys = self.place_map.keys() + if type(keys) == type([]): + keys.sort(self.sortbyplace) + return keys + return [] def get_place_id_keys(self): - return self.place_map.keys() + if self.place_map: + return self.place_map.keys() + else: + return [] def get_place_id(self,key): place = Place() @@ -2941,10 +2967,14 @@ class GrampsDB: return place.get_display_info() def get_source_keys(self): - return self.source_map.keys() + if self.source_map: + return self.source_map.keys() + return [] def get_object_keys(self): - return self.media_map.keys() + if self.media_map: + return self.media_map.keys() + return [] def sortbysource(self,f,s): f1 = self.source_map[f][1].upper() diff --git a/gramps2/src/SourceView.py b/gramps2/src/SourceView.py index 21bcaaf25..4b7977b1d 100644 --- a/gramps2/src/SourceView.py +++ b/gramps2/src/SourceView.py @@ -192,7 +192,6 @@ class SourceView: ans.query_response,self.topWindow) else: self.db.remove_source_id(source.get_id()) - Utils.modified() self.update(0) def is_used(self,source): diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 95989a1b3..9386cba10 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -480,7 +480,6 @@ class SourceEditor: if self.update: self.update(self.parent,self.source_ref) - Utils.modified() self.close(obj) def on_source_changed(self,obj): diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index d074306a6..cea64db52 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -51,7 +51,7 @@ - + True gtk-new 1 @@ -73,7 +73,7 @@ - + True gtk-open 1 @@ -86,49 +86,6 @@ - - - True - _Save - True - - - - - - True - gtk-save - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Save _As... - True - - - - - True - gtk-save-as - 1 - 0.5 - 0.5 - 0 - 0 - - - - - True @@ -150,7 +107,7 @@ True - + True gtk-convert 1 @@ -171,7 +128,7 @@ - + True gtk-revert-to-saved 1 @@ -192,7 +149,7 @@ - + True gtk-refresh 1 @@ -220,7 +177,7 @@ - + True gtk-quit 1 @@ -256,7 +213,7 @@ - + True gtk-add 1 @@ -279,7 +236,7 @@ - + True gtk-remove 1 @@ -317,7 +274,7 @@ - + True gtk-find 1 @@ -339,7 +296,7 @@ - + True gtk-convert 1 @@ -366,7 +323,7 @@ - + True gtk-preferences 1 @@ -387,7 +344,7 @@ - + True gtk-home 1 @@ -473,7 +430,7 @@ - + True gtk-index 1 @@ -495,7 +452,7 @@ - + True gnome-stock-book-open 1 @@ -568,7 +525,7 @@ - + True gtk-help 1 @@ -589,7 +546,7 @@ - + True gnome-stock-book-open 1 @@ -616,7 +573,7 @@ - + True gtk-jump-to 1 @@ -637,7 +594,7 @@ - + True gnome-stock-mail 1 @@ -691,7 +648,7 @@ - + True gnome-stock-about 1 @@ -743,17 +700,6 @@ - - - True - Save database - Save - True - gtk-save - - - - True @@ -6722,7 +6668,7 @@ 5 True True - Create a new _XML database + _Create a new database True GTK_RELIEF_NORMAL False diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 16e567b53..103135a04 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -72,7 +72,6 @@ import EditPerson import Find import VersionControl import ReadXML -import GrampsXML #------------------------------------------------------------------------- # @@ -154,10 +153,6 @@ class Gramps: import DbPrompter DbPrompter.DbPrompter(self,0,self.topWindow) - if self.db.need_autosave() and GrampsCfg.autosave_int != 0: - Utils.enable_autosave(self.autosave_database, - GrampsCfg.autosave_int) - self.db.set_researcher(GrampsCfg.get_researcher()) def pref_callback(self,val): @@ -325,8 +320,6 @@ class Gramps: "on_reload_plugins_activate" : Plugins.reload_plugins, "on_reports_clicked" : self.on_reports_clicked, "on_revert_activate" : self.on_revert_activate, - "on_save_activate" : self.on_save_activate, - "on_save_as_activate" : self.on_save_as_activate, "on_show_plugin_status" : self.on_show_plugin_status, "on_source_list_button_press" : self.source_view.button_press, "on_sources_activate" : self.on_sources_activate, @@ -884,13 +877,6 @@ class Gramps: self.people_view.clear_person_tabs() - self.db = GrampsXML.GrampsXML() - self.db.set_iprefix(GrampsCfg.iprefix) - self.db.set_oprefix(GrampsCfg.oprefix) - self.db.set_fprefix(GrampsCfg.fprefix) - self.db.set_sprefix(GrampsCfg.sprefix) - self.db.set_pprefix(GrampsCfg.pprefix) - self.relationship.set_db(self.db) self.place_view.change_db(self.db) @@ -919,7 +905,6 @@ class Gramps: self.import_tool_callback() def import_tool_callback(self): - Utils.modified() self.people_view.clear_person_tabs() if Utils.wasHistory_broken(): self.clear_history() @@ -1042,20 +1027,6 @@ class Gramps: self.topWindow.set_resizable(gtk.FALSE) filename = os.path.normpath(os.path.abspath(filename)) - base = os.path.basename(filename) - if base == const.xmlFile: - filename = os.path.dirname(filename) - elif base == "autosave.gramps": - filename = os.path.dirname(filename) - elif not os.path.isdir(filename): - import DbPrompter - DbPrompter.DbPrompter(self,0,self.topWindow) - self.displayError(_("Database could not be opened"), - _("%s is not a directory.") % filename + ' ' + \ - _("You should select a directory that contains a " - "data.gramps file.")) - return - self.clear_database() if self.load_database(filename) == 1: if filename[-1] == '/': @@ -1073,10 +1044,7 @@ class Gramps: if filename: Utils.destroy_passed_object(obj) self.save_media(filename) - if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.display_comment_box(filename) - else: - self.save_file(filename,_("No Comment Provided")) + self.save_file(filename,_("No Comment Provided")) def save_media(self,filename): import RelImage @@ -1172,6 +1140,7 @@ class Gramps: def save_file(self,filename,comment): + print "save",filename path = filename filename = os.path.normpath(os.path.abspath(filename)) self.status_text(_("Saving %s ...") % filename) @@ -1203,8 +1172,8 @@ class Gramps: old_file = filename filename = "%s/%s" % (filename,self.db.get_base()) + print filename try: - self.db.save(filename,self.load_progress) self.db.clear_added_media_objects() except (OSError,IOError), msg: emsg = _("Could not create %s") % filename @@ -1341,8 +1310,6 @@ class Gramps: self.change_active_person(None) self.redraw_histmenu() - Utils.modified() - def merge_update(self,p1,p2,old_id): self.people_view.remove_from_person_list(p1,old_id) self.people_view.remove_from_person_list(p2) @@ -1494,30 +1461,6 @@ class Gramps: self.on_ok_button2_clicked(fileSelector) fileSelector.destroy() - def on_save_activate(self,obj): - """Saves the file, first prompting for a comment if revision - control needs it""" - if not self.db.get_save_path(): - self.on_save_as_activate(obj) - else: - if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.display_comment_box(self.db.get_save_path()) - else: - msg = _("No Comment Provided") - self.save_file(self.db.get_save_path(),msg) - - def on_save_activate_quit(self): - """Saves the file, first prompting for a comment if revision - control needs it""" - if not self.db.get_save_path(): - self.on_save_as_activate(None) - else: - if GrampsCfg.usevc and GrampsCfg.vc_comment: - self.display_comment_box(self.db.get_save_path()) - else: - msg = _("No Comment Provided") - self.save_file(self.db.get_save_path(),msg) - def display_comment_box(self,filename): """Displays a dialog box, prompting for a revison control comment""" filename = os.path.normpath(os.path.abspath(filename)) @@ -1685,7 +1628,6 @@ class Gramps: if res.get_name() == "" and owner.get_name(): self.db.set_researcher(owner) - Utils.modified() self.setup_bookmarks() @@ -1745,7 +1687,7 @@ class Gramps: def load_database(self,name): - filename = "%s/%s" % (name,const.xmlFile) + filename = name self.clear_database() self.status_text(_("Loading %s...") % name) @@ -1825,7 +1767,6 @@ class Gramps: def set_person(self): self.db.set_default_person(self.active_person) - Utils.modified() def export_callback(self,obj,plugin_function): """Call the export plugin, with the active person and database""" diff --git a/gramps2/src/revision.glade b/gramps2/src/revision.glade index fadd6f0fe..51508920c 100644 --- a/gramps2/src/revision.glade +++ b/gramps2/src/revision.glade @@ -141,7 +141,7 @@ recentdbs 10 Open a database - True + False True