* 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
This commit is contained in:
Don Allingham 2004-10-13 03:51:27 +00:00
parent 01e8d88f52
commit 92ab997d17
8 changed files with 68 additions and 22 deletions

View File

@ -1,3 +1,12 @@
2004-10-12 Don Allingham <dallingham@users.sourceforge.net>
* 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 <shura@alex.neuro.umn.edu> 2004-10-12 Alex Roitman <shura@alex.neuro.umn.edu>
* src/gramps.glade: Remove "Save as" from toolbar. * src/gramps.glade: Remove "Save as" from toolbar.

View File

@ -138,7 +138,6 @@ class BaseModel(gtk.GenericTreeModel):
class SourceModel(BaseModel): class SourceModel(BaseModel):
def __init__(self,db): def __init__(self,db):
BaseModel.__init__(self,db)
self.sort_keys = db.get_source_handles self.sort_keys = db.get_source_handles
self.map = db.source_map self.map = db.source_map
self.fmap = [ self.fmap = [
@ -150,6 +149,7 @@ class SourceModel(BaseModel):
self.column_change, self.column_change,
self.column_handle, self.column_handle,
] ]
BaseModel.__init__(self,db)
def on_get_n_columns(self): def on_get_n_columns(self):
return len(self.fmap)+1 return len(self.fmap)+1

View File

@ -122,6 +122,11 @@ class GrampsBSDDB(GrampsDbBase):
self.genderStats = GenderStats(self.metadata.get('gender_stats')) self.genderStats = GenderStats(self.metadata.get('gender_stats'))
return 1 return 1
def abort_changes(self):
while self.undo():
pass
self.close()
def close(self): def close(self):
self.name_group.close() self.name_group.close()
self.person_map.close() self.person_map.close()

View File

@ -128,6 +128,9 @@ class GrampsDbBase:
""" """
assert False, "Needs to be overridden in the derived class" assert False, "Needs to be overridden in the derived class"
def abort_changes(self):
pass
def is_open(self): def is_open(self):
""" """
Returns 1 if the database has been opened. Returns 1 if the database has been opened.
@ -789,7 +792,7 @@ class GrampsDbBase:
the state before the transaction was committed. the state before the transaction was committed.
""" """
if self.undoindex == -1: if self.undoindex == -1:
return return False
transaction = self.translist[self.undoindex] transaction = self.translist[self.undoindex]
self.undoindex -= 1 self.undoindex -= 1
@ -834,6 +837,7 @@ class GrampsDbBase:
else: else:
transaction = self.translist[self.undoindex] transaction = self.translist[self.undoindex]
self.undo_callback(_("_Undo %s") % transaction.get_description()) self.undo_callback(_("_Undo %s") % transaction.get_description())
return True
def set_undo_callback(self,callback): def set_undo_callback(self,callback):
""" """

View File

@ -58,6 +58,9 @@ class GrampsInMemDB(GrampsDbBase):
def close(self): def close(self):
pass pass
def abort_changes(self):
pass
def set_name_group_mapping(self,name,group): def set_name_group_mapping(self,name,group):
if group == None and self.name_group.has_key(name): if group == None and self.name_group.has_key(name):
del self.name_group[name] del self.name_group[name]

View File

@ -12,6 +12,13 @@ MOSTLYCLEANFILES =
gdirdir=$(prefix)/share/gramps gdirdir=$(prefix)/share/gramps
docfiles = \
RelLib.py \
Date.py \
DateParser.py \
DateDisplay.py \
GrampsDbBase.py
gdir_PYTHON = \ gdir_PYTHON = \
accent.py \ accent.py \
AddMedia.py\ AddMedia.py\
@ -145,3 +152,6 @@ pycheck:
done; done;
pychecker $(gdir_PYTHON) pychecker $(gdir_PYTHON)
docs:
epydoc -o doc --url http://gramps.sourceforge.net --name GRAMPS --html $(docfiles)
epydoc --pdf $(docfiles)

View File

@ -56,7 +56,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2204"> <widget class="GtkImage" id="image2242">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-new</property> <property name="stock">gtk-new</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -78,7 +78,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2205"> <widget class="GtkImage" id="image2243">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-open</property> <property name="stock">gtk-open</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -106,7 +106,7 @@
<accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2206"> <widget class="GtkImage" id="image2244">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-convert</property> <property name="stock">gtk-convert</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -128,7 +128,7 @@
<accelerator key="S" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/> <accelerator key="S" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2207"> <widget class="GtkImage" id="image2245">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-save-as</property> <property name="stock">gtk-save-as</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -147,6 +147,15 @@
</widget> </widget>
</child> </child>
<child>
<widget class="GtkMenuItem" id="abandon_changes_and_quit1">
<property name="visible">True</property>
<property name="label" translatable="yes">A_bandon changes and quit</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_abandon_activate" last_modification_time="Tue, 12 Oct 2004 03:06:25 GMT"/>
</widget>
</child>
<child> <child>
<widget class="GtkImageMenuItem" id="exit1"> <widget class="GtkImageMenuItem" id="exit1">
<property name="visible">True</property> <property name="visible">True</property>
@ -156,7 +165,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2208"> <widget class="GtkImage" id="image2246">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-quit</property> <property name="stock">gtk-quit</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -191,7 +200,7 @@
<accelerator key="z" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="z" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2209"> <widget class="GtkImage" id="image2247">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-undo</property> <property name="stock">gtk-undo</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -228,7 +237,7 @@
<accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2210"> <widget class="GtkImage" id="image2248">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-add</property> <property name="stock">gtk-add</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -251,7 +260,7 @@
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2211"> <widget class="GtkImage" id="image2249">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-remove</property> <property name="stock">gtk-remove</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -289,7 +298,7 @@
<accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2212"> <widget class="GtkImage" id="image2250">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-convert</property> <property name="stock">gtk-convert</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -316,7 +325,7 @@
<signal name="activate" handler="on_preferences1_activate"/> <signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2213"> <widget class="GtkImage" id="image2251">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-preferences</property> <property name="stock">gtk-preferences</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -337,7 +346,7 @@
<signal name="activate" handler="on_column_order_activate" last_modification_time="Wed, 10 Mar 2004 04:36:07 GMT"/> <signal name="activate" handler="on_column_order_activate" last_modification_time="Wed, 10 Mar 2004 04:36:07 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2214"> <widget class="GtkImage" id="image2252">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-properties</property> <property name="stock">gtk-properties</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -358,7 +367,7 @@
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/> <signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2215"> <widget class="GtkImage" id="image2253">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-home</property> <property name="stock">gtk-home</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -444,7 +453,7 @@
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2216"> <widget class="GtkImage" id="image2254">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-index</property> <property name="stock">gtk-index</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -466,7 +475,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/> <accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2217"> <widget class="GtkImage" id="image2255">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property> <property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -539,7 +548,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/> <accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2218"> <widget class="GtkImage" id="image2256">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-help</property> <property name="stock">gtk-help</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -560,7 +569,7 @@
<signal name="activate" handler="on_faq_activate" last_modification_time="Wed, 26 Nov 2003 17:59:23 GMT"/> <signal name="activate" handler="on_faq_activate" last_modification_time="Wed, 26 Nov 2003 17:59:23 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2219"> <widget class="GtkImage" id="image2257">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property> <property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -587,7 +596,7 @@
<signal name="activate" handler="on_gramps_home_page_activate"/> <signal name="activate" handler="on_gramps_home_page_activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2220"> <widget class="GtkImage" id="image2258">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gtk-jump-to</property> <property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -608,7 +617,7 @@
<signal name="activate" handler="on_gramps_mailing_lists_activate"/> <signal name="activate" handler="on_gramps_mailing_lists_activate"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2221"> <widget class="GtkImage" id="image2259">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gnome-stock-mail</property> <property name="stock">gnome-stock-mail</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>
@ -662,7 +671,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/> <signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
<child internal-child="image"> <child internal-child="image">
<widget class="GtkImage" id="image2222"> <widget class="GtkImage" id="image2260">
<property name="visible">True</property> <property name="visible">True</property>
<property name="stock">gnome-stock-about</property> <property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property> <property name="icon_size">1</property>

View File

@ -312,6 +312,7 @@ class Gramps:
self.gtop.signal_autoconnect({ self.gtop.signal_autoconnect({
"on_undo_activate" : self.undo, "on_undo_activate" : self.undo,
"on_abandon_activate" : self.exit_and_undo,
"on_column_order_activate": self.column_order, "on_column_order_activate": self.column_order,
"on_back_clicked" : self.back_clicked, "on_back_clicked" : self.back_clicked,
"on_back_pressed" : self.back_pressed, "on_back_pressed" : self.back_pressed,
@ -435,6 +436,11 @@ class Gramps:
self.media_view.change_db(self.db) self.media_view.change_db(self.db)
self.family_view.load_family() 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): def set_person_column_order(self,list):
self.db.set_person_column_order(list) self.db.set_person_column_order(list)
self.people_view.build_columns() self.people_view.build_columns()