2007-10-05 James G. Sack <jgsack@san.rr.com>

* src/GrampsDb/_GrampsDbBase.py:
	* src/GrampsDb/_GrampsGEDDB.py:
	* src/GrampsDb/_GrampsXMLDB.py:
	* src/GrampsDb/_GrampsInMemDB.py:
	* src/Bookmarks.py:
	issue #1261: creating bookmark does not lead to save of xml


svn: r9077
This commit is contained in:
Benny Malengier 2007-10-05 09:03:59 +00:00
parent 5183394480
commit cf5ae68625
6 changed files with 31 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2007-10-05 James G. Sack <jgsack@san.rr.com>
* src/GrampsDb/_GrampsDbBase.py:
* src/GrampsDb/_GrampsGEDDB.py:
* src/GrampsDb/_GrampsXMLDB.py:
* src/GrampsDb/_GrampsInMemDB.py:
* src/Bookmarks.py:
issue #1261: creating bookmark does not lead to save of xml
2007-10-03 Benny Malengier <benny.malengier@gramps-project.org> 2007-10-03 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/Check.py: add remove empty objects. This needs testing... * src/plugins/Check.py: add remove empty objects. This needs testing...

View File

@ -106,6 +106,10 @@ class Bookmarks :
self.uistate.uimanager.remove_action_group(self.action_group) self.uistate.uimanager.remove_action_group(self.action_group)
self.active = DISABLED self.active = DISABLED
def redraw_and_report_change(self):
self.dbstate.db.report_bm_change()
self.redraw()
def redraw(self): def redraw(self):
"""Create the pulldown menu""" """Create the pulldown menu"""
f = StringIO() f = StringIO()
@ -153,7 +157,7 @@ class Bookmarks :
"""appends the person to the bottom of the bookmarks""" """appends the person to the bottom of the bookmarks"""
if person_handle not in self.bookmarks.get(): if person_handle not in self.bookmarks.get():
self.bookmarks.append(person_handle) self.bookmarks.append(person_handle)
self.redraw() self.redraw_and_report_change()
def remove_handles(self, handle_list): def remove_handles(self, handle_list):
""" """
@ -169,7 +173,7 @@ class Bookmarks :
self.bookmarks.remove(handle) self.bookmarks.remove(handle)
modified = True modified = True
if modified: if modified:
self.redraw() self.redraw_and_report_change()
def draw_window(self): def draw_window(self):
"""Draws the bookmark dialog box""" """Draws the bookmark dialog box"""
@ -233,7 +237,7 @@ class Bookmarks :
if self.response == gtk.RESPONSE_HELP: if self.response == gtk.RESPONSE_HELP:
self.help_clicked() self.help_clicked()
if self.modified: if self.modified:
self.redraw() self.redraw_and_report_change()
self.top.destroy() self.top.destroy()
def delete_clicked(self,obj): def delete_clicked(self,obj):

View File

@ -303,6 +303,7 @@ class GrampsDbBase(GrampsDBCallback):
self.path = "" self.path = ""
self.name_group = {} self.name_group = {}
self.surname_list = [] self.surname_list = []
self._bm_changes = 0
def rebuild_secondary(self, callback): def rebuild_secondary(self, callback):
pass pass
@ -2182,6 +2183,13 @@ class GrampsDbBase(GrampsDBCallback):
cursor.close() cursor.close()
return return
def report_bm_change(self):
self._bm_changes += 1;
def db_has_bm_changes(self):
return self._bm_changes > 0
class Transaction: class Transaction:
""" """

View File

@ -69,8 +69,7 @@ class GrampsGEDDB(GrampsInMemDB):
def close(self): def close(self):
if not self.db_is_open: if not self.db_is_open:
return return
if (not self.readonly) and ((len(self.undodb)>0) or if self.db_is_changed():
not self.abort_possible):
writer = GedcomWriter(self,self.get_default_person()) writer = GedcomWriter(self,self.get_default_person())
writer.export_data(self.full_name) writer.export_data(self.full_name)
self.db_is_open = False self.db_is_open = False

View File

@ -365,3 +365,9 @@ class GrampsInMemDB(GrampsDbBase):
obj.unserialize(data) obj.unserialize(data)
return obj return obj
return None return None
def db_is_changed(self):
return not self.readonly and \
(len(self.undodb) > 0 or
not self.abort_possible)

View File

@ -72,8 +72,7 @@ class GrampsXMLDB(GrampsInMemDB):
def close(self): def close(self):
if not self.db_is_open: if not self.db_is_open:
return return
if (not self.readonly) and ((len(self.undodb)>0) or if self.db_is_changed() or self.db_has_bm_changes():
not self.abort_possible):
quick_write(self,self.full_name) quick_write(self,self.full_name)
self.db_is_open = False self.db_is_open = False
GrampsInMemDB.close(self) GrampsInMemDB.close(self)