From 92ab997d17f1217e5404d3bcbcfce04f011b8e65 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 13 Oct 2004 03:51:27 +0000 Subject: [PATCH] * src/DisplayModels.py: fix source display * src/GrampsBSDDB.py: add abort_changes task * src/GrampsDbBase.py: add abort_changes task * src/GrampsInMemDB.py: add abort_changes task * src/Makefile.am: Add target to build documentation using epydoc * src/gramps.glade: Add abandon changes menu item. Not fully implemented yet * src/gramps_main.py: add exit_and_undo svn: r3623 --- gramps2/ChangeLog | 9 +++++++ gramps2/src/DisplayModels.py | 2 +- gramps2/src/GrampsBSDDB.py | 5 ++++ gramps2/src/GrampsDbBase.py | 8 ++++-- gramps2/src/GrampsInMemDB.py | 3 +++ gramps2/src/Makefile.am | 10 ++++++++ gramps2/src/gramps.glade | 47 +++++++++++++++++++++--------------- gramps2/src/gramps_main.py | 6 +++++ 8 files changed, 68 insertions(+), 22 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 549cac8d7..89c3b9a3a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,12 @@ +2004-10-12 Don Allingham + * src/DisplayModels.py: fix source display + * src/GrampsBSDDB.py: add abort_changes task + * src/GrampsDbBase.py: add abort_changes task + * src/GrampsInMemDB.py: add abort_changes task + * src/Makefile.am: Add target to build documentation using epydoc + * src/gramps.glade: Add abandon changes menu item. Not fully implemented yet + * src/gramps_main.py: add exit_and_undo + 2004-10-12 Alex Roitman * src/gramps.glade: Remove "Save as" from toolbar. diff --git a/gramps2/src/DisplayModels.py b/gramps2/src/DisplayModels.py index eaa3deb18..62d57652f 100644 --- a/gramps2/src/DisplayModels.py +++ b/gramps2/src/DisplayModels.py @@ -138,7 +138,6 @@ class BaseModel(gtk.GenericTreeModel): class SourceModel(BaseModel): def __init__(self,db): - BaseModel.__init__(self,db) self.sort_keys = db.get_source_handles self.map = db.source_map self.fmap = [ @@ -150,6 +149,7 @@ class SourceModel(BaseModel): self.column_change, self.column_handle, ] + BaseModel.__init__(self,db) def on_get_n_columns(self): return len(self.fmap)+1 diff --git a/gramps2/src/GrampsBSDDB.py b/gramps2/src/GrampsBSDDB.py index 68d5b7973..d7d919c0b 100644 --- a/gramps2/src/GrampsBSDDB.py +++ b/gramps2/src/GrampsBSDDB.py @@ -122,6 +122,11 @@ class GrampsBSDDB(GrampsDbBase): self.genderStats = GenderStats(self.metadata.get('gender_stats')) return 1 + def abort_changes(self): + while self.undo(): + pass + self.close() + def close(self): self.name_group.close() self.person_map.close() diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index cedd51362..c0a66f27f 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -128,6 +128,9 @@ class GrampsDbBase: """ assert False, "Needs to be overridden in the derived class" + def abort_changes(self): + pass + def is_open(self): """ Returns 1 if the database has been opened. @@ -789,7 +792,7 @@ class GrampsDbBase: the state before the transaction was committed. """ if self.undoindex == -1: - return + return False transaction = self.translist[self.undoindex] self.undoindex -= 1 @@ -834,7 +837,8 @@ class GrampsDbBase: else: transaction = self.translist[self.undoindex] self.undo_callback(_("_Undo %s") % transaction.get_description()) - + return True + def set_undo_callback(self,callback): """ Defines the callback function that is called whenever an undo operation diff --git a/gramps2/src/GrampsInMemDB.py b/gramps2/src/GrampsInMemDB.py index 03cd5f612..0b0b8d5f9 100644 --- a/gramps2/src/GrampsInMemDB.py +++ b/gramps2/src/GrampsInMemDB.py @@ -58,6 +58,9 @@ class GrampsInMemDB(GrampsDbBase): def close(self): pass + def abort_changes(self): + pass + def set_name_group_mapping(self,name,group): if group == None and self.name_group.has_key(name): del self.name_group[name] diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index 4315d550b..dcc1a4d86 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -12,6 +12,13 @@ MOSTLYCLEANFILES = gdirdir=$(prefix)/share/gramps +docfiles = \ + RelLib.py \ + Date.py \ + DateParser.py \ + DateDisplay.py \ + GrampsDbBase.py + gdir_PYTHON = \ accent.py \ AddMedia.py\ @@ -145,3 +152,6 @@ pycheck: done; pychecker $(gdir_PYTHON) +docs: + epydoc -o doc --url http://gramps.sourceforge.net --name GRAMPS --html $(docfiles) + epydoc --pdf $(docfiles) \ No newline at end of file diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index a7b86ea35..0c65d31eb 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -56,7 +56,7 @@ - + True gtk-new 1 @@ -78,7 +78,7 @@ - + True gtk-open 1 @@ -106,7 +106,7 @@ - + True gtk-convert 1 @@ -128,7 +128,7 @@ - + True gtk-save-as 1 @@ -147,6 +147,15 @@ + + + True + A_bandon changes and quit + True + + + + True @@ -156,7 +165,7 @@ - + True gtk-quit 1 @@ -191,7 +200,7 @@ - + True gtk-undo 1 @@ -228,7 +237,7 @@ - + True gtk-add 1 @@ -251,7 +260,7 @@ - + True gtk-remove 1 @@ -289,7 +298,7 @@ - + True gtk-convert 1 @@ -316,7 +325,7 @@ - + True gtk-preferences 1 @@ -337,7 +346,7 @@ - + True gtk-properties 1 @@ -358,7 +367,7 @@ - + True gtk-home 1 @@ -444,7 +453,7 @@ - + True gtk-index 1 @@ -466,7 +475,7 @@ - + True gnome-stock-book-open 1 @@ -539,7 +548,7 @@ - + True gtk-help 1 @@ -560,7 +569,7 @@ - + True gnome-stock-book-open 1 @@ -587,7 +596,7 @@ - + True gtk-jump-to 1 @@ -608,7 +617,7 @@ - + True gnome-stock-mail 1 @@ -662,7 +671,7 @@ - + True gnome-stock-about 1 diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 9224ab454..96412f5aa 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -312,6 +312,7 @@ class Gramps: self.gtop.signal_autoconnect({ "on_undo_activate" : self.undo, + "on_abandon_activate" : self.exit_and_undo, "on_column_order_activate": self.column_order, "on_back_clicked" : self.back_clicked, "on_back_pressed" : self.back_pressed, @@ -435,6 +436,11 @@ class Gramps: self.media_view.change_db(self.db) self.family_view.load_family() + def exit_and_undo(self,*args): + self.db.abort_changes() + self.db.set_people_view_maps((None,None,None,None)) + gtk.main_quit() + def set_person_column_order(self,list): self.db.set_person_column_order(list) self.people_view.build_columns()