diff --git a/gramps/src/Config.py b/gramps/src/Config.py
index 10d8d4684..3ffe9ee22 100644
--- a/gramps/src/Config.py
+++ b/gramps/src/Config.py
@@ -94,6 +94,8 @@ sprefix = "S"
pprefix = "P"
fprefix = "F"
autoload = 0
+autosave = 0
+autosave_int = 5
usetabs = 0
autocomp = 1
usevc = 0
@@ -161,6 +163,8 @@ def make_path(path):
#-------------------------------------------------------------------------
def loadConfig(call):
global autoload
+ global autosave
+ global autosave_int
global owner
global usetabs
global autocomp
@@ -218,6 +222,8 @@ def loadConfig(call):
hide_altnames = get_bool("/gramps/config/DisplayAltNames")
autoload = get_bool("/gramps/config/autoLoad")
+ autosave = get_bool("/gramps/config/autoSave")
+ autosave_int = get_int("/gramps/config/autoSaveInterval")
dateFormat = get_int("/gramps/config/dateFormat")
dateEntry = get_int("/gramps/config/dateEntry")
paper_preference = get_string("/gramps/config/paperPreference")
@@ -295,6 +301,10 @@ def loadConfig(call):
if autoload == None:
autoload = 1
+ if autosave == None:
+ autosave = 0
+ if autosave_int == None:
+ autosave = 5
if mediaref == None:
mediaref = 1
if globalprop == None:
@@ -456,6 +466,8 @@ def on_propertybox_apply(obj,page):
show_detail = prefsTop.get_widget("showdetail").get_active()
autoload = prefsTop.get_widget("autoload").get_active()
+ autosave = prefsTop.get_widget("save_enable").get_active()
+ autosave_int = prefsTop.get_widget("save_interval").get_value_as_int()
display_attr = prefsTop.get_widget("attr_display").get_active()
attr_name = string.strip(prefsTop.get_widget("attr_name").get_text())
usetabs = prefsTop.get_widget("usetabs").get_active()
@@ -539,6 +551,13 @@ def on_propertybox_apply(obj,page):
set_string("/gramps/config/paperPreference",paper_preference)
set_string("/gramps/config/outputPreference",output_preference)
set_bool("/gramps/config/autoLoad",autoload)
+ set_bool("/gramps/config/autoSave",autosave)
+ set_int("/gramps/config/autoSaveInterval",autosave_int)
+ if autosave and autosave_int != 0:
+ utils.enable_autosave(None,autosave_int)
+ else:
+ utils.disable_autosave()
+
set_bool("/gramps/config/DisplayAltNames",hide_altnames)
set_string("/gramps/config/ReportDirectory",report_dir)
set_string("/gramps/config/WebsiteDirectory",web_dir)
@@ -684,6 +703,8 @@ def display_preferences_box(db):
pbox = prefsTop.get_widget("propertybox")
pbox.set_data("db",db)
auto = prefsTop.get_widget("autoload")
+ asave = prefsTop.get_widget("save_enable")
+ asave_int = prefsTop.get_widget("save_interval")
vis = prefsTop.get_widget("gid_visible")
idedit = prefsTop.get_widget("gid_edit")
index_vis = prefsTop.get_widget("show_child_id")
@@ -701,6 +722,8 @@ def display_preferences_box(db):
display_attr_obj = prefsTop.get_widget("attr_display")
display_altnames = prefsTop.get_widget("display_altnames")
auto.set_active(autoload)
+ asave.set_active(autosave)
+ asave_int.set_value(autosave_int)
detail.set_active(show_detail)
tabs.set_active(usetabs)
ac.set_active(autocomp)
@@ -854,7 +877,7 @@ def display_preferences_box(db):
prefsTop.get_widget("dbdir").gtk_entry().set_text(db_dir)
prefsTop.get_widget("repdir").gtk_entry().set_text(report_dir)
prefsTop.get_widget("htmldir").gtk_entry().set_text(web_dir)
-
+
pbox.set_modified(0)
pbox.show()
diff --git a/gramps/src/EventEdit.py b/gramps/src/EventEdit.py
index 7b8b9a786..7dabfcebf 100644
--- a/gramps/src/EventEdit.py
+++ b/gramps/src/EventEdit.py
@@ -67,7 +67,7 @@ class EventEditor:
self.place_combo = self.top.get_widget("eventPlace_combo")
self.date_field = self.top.get_widget("eventDate")
self.cause_field = self.top.get_widget("eventCause")
- self.descr_field = self.top.get_widget("eventDescription")
+ self.descr_field = self.top.get_widget("event_description")
self.note_field = self.top.get_widget("eventNote")
self.event_menu = self.top.get_widget("personalEvents")
self.priv = self.top.get_widget("priv")
diff --git a/gramps/src/MergeData.py b/gramps/src/MergeData.py
index b48ae04e8..2bdf6c4b8 100644
--- a/gramps/src/MergeData.py
+++ b/gramps/src/MergeData.py
@@ -339,7 +339,10 @@ class MergePeople:
old_note = old_note + "\n\n"
self.p1.setNote(old_note + self.p2.getNote())
- del self.db.getPersonMap()[self.p2.getId()]
+ try:
+ del self.db.getPersonMap()[self.p2.getId()]
+ except:
+ print "%s is not in the person map!" % (Config.nameof(self.p2))
self.update(self.p1,self.p2)
utils.destroy_passed_object(self.top)
diff --git a/gramps/src/VersionControl.py b/gramps/src/VersionControl.py
index 3a2c30de9..844fa853d 100644
--- a/gramps/src/VersionControl.py
+++ b/gramps/src/VersionControl.py
@@ -91,15 +91,16 @@ class RevisionComment:
class RevisionSelect:
- def __init__(self,db,filename,vc,load):
+ def __init__(self,db,filename,vc,load,callback=None):
self.db = db
self.filename = filename
self.vc = vc
self.load = load
+ self.callback = callback
dialog = libglade.GladeXML(const.revisionFile, "revselect")
dialog.signal_autoconnect({
- "destroy_passed_object" : utils.destroy_passed_object,
+ "destroy_passed_object" : self.on_cancel_clicked,
"on_loadrev_clicked" : self.on_loadrev_clicked,
})
@@ -111,6 +112,11 @@ class RevisionSelect:
self.revlist.set_row_data(index,f[0])
index = index + 1
+ def on_cancel_clicked(self,obj):
+ utils.destroy_passed_object(obj)
+ if self.callback:
+ self.callback()
+
def on_loadrev_clicked(self,obj):
if len(self.revlist.selection) > 0:
rev = self.revlist.get_row_data(self.revlist.selection[0])
diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py
index bd8e80724..05ca35d69 100644
--- a/gramps/src/WriteXML.py
+++ b/gramps/src/WriteXML.py
@@ -488,12 +488,12 @@ def exportData(database, filename, callback):
GnomeErrorDialog(_("Failure writing %s, original file restored") % filename)
shutil.copy(filename + ".bak", filename)
-def quick_write(database, filename):
+def quick_write(database, filename,callback=None):
global fileroot
fileroot = os.path.dirname(filename)
g = gzip.open(filename,"wb")
- write_xml_data(database, g, None, 0)
+ write_xml_data(database, g, callback, 0)
g.close()
def write_xml_data(database, g, callback, sp):
diff --git a/gramps/src/config.glade b/gramps/src/config.glade
index a4808a393..edc0072d2 100644
--- a/gramps/src/config.glade
+++ b/gramps/src/config.glade
@@ -78,70 +78,12 @@
GtkTable
table13
- 3
- 2
+ 4
+ 3
False
0
0
-
- GtkCheckButton
- uncompress
- True
-
- toggled
- on_object_toggled
-
- Sat, 09 Dec 2000 18:11:20 GMT
-
-
- False
- True
-
- 0
- 2
- 1
- 2
- 3
- 3
- False
- False
- False
- False
- True
- False
-
-
-
-
- GtkCheckButton
- autoload
- True
-
- toggled
- on_object_toggled
-
- Sat, 09 Dec 2000 18:11:20 GMT
-
-
- True
- True
-
- 0
- 2
- 0
- 1
- 3
- 3
- False
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label205
@@ -155,8 +97,8 @@
0
1
- 2
- 3
+ 3
+ 4
3
3
False
@@ -178,9 +120,9 @@
False
1
- 2
- 2
- 3
+ 3
+ 3
+ 4
3
3
True
@@ -209,6 +151,157 @@
+
+
+ GtkLabel
+ label217
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0.5
+ 0
+ 0
+
+ 1
+ 2
+ 2
+ 3
+ 0
+ 0
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkCheckButton
+ save_enable
+ True
+
+ toggled
+ on_object_toggled
+
+ Mon, 24 Dec 2001 23:25:36 GMT
+
+
+ False
+ True
+
+ 0
+ 1
+ 2
+ 3
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkSpinButton
+ save_interval
+ True
+
+ changed
+ on_object_changed
+
+ Mon, 24 Dec 2001 23:25:52 GMT
+
+ 1
+ 0
+ True
+ GTK_UPDATE_IF_VALID
+ True
+ False
+ 5
+ 0
+ 100
+ 1
+ 10
+ 10
+
+ 2
+ 3
+ 2
+ 3
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkCheckButton
+ autoload
+ True
+
+ toggled
+ on_object_toggled
+
+ Sat, 09 Dec 2000 18:11:20 GMT
+
+
+ True
+ True
+
+ 0
+ 3
+ 0
+ 1
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
+
+
+ GtkCheckButton
+ uncompress
+ True
+
+ toggled
+ on_object_toggled
+
+ Sat, 09 Dec 2000 18:11:20 GMT
+
+
+ False
+ True
+
+ 0
+ 3
+ 1
+ 2
+ 3
+ 3
+ False
+ False
+ False
+ False
+ True
+ False
+
+
@@ -1993,7 +2086,7 @@
GnomeFileEntry
htmldir
- repdir
+ webdir
10
Gramps - Select default report directory
True
diff --git a/gramps/src/const.py b/gramps/src/const.py
index b96ee875a..16113c280 100644
--- a/gramps/src/const.py
+++ b/gramps/src/const.py
@@ -91,7 +91,7 @@ gtkrcFile = "%s/gtkrc" % rootDir
#
#-------------------------------------------------------------------------
progName = "gramps"
-version = "0.7.0"
+version = "0.7.1pre"
copyright = "© 2001 Donald N. Allingham"
authors = ["Donald N. Allingham", "David Hampton"]
comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program.")
diff --git a/gramps/src/dialog.glade b/gramps/src/dialog.glade
index 43fb8d184..020190a51 100644
--- a/gramps/src/dialog.glade
+++ b/gramps/src/dialog.glade
@@ -240,44 +240,6 @@
-
- GnomeEntry
- eDescBox
- event_description
- 15
-
- 1
- 2
- 4
- 5
- 3
- 3
- True
- False
- False
- False
- True
- False
-
-
-
- GtkEntry
- GnomeEntry:entry
- eventDescription
- True
-
- insert_text
- on_combo_insert_text
-
- Thu, 18 Oct 2001 01:38:54 GMT
-
- True
- True
- 0
-
-
-
-
GtkCombo
eventPlace_combo
@@ -587,6 +549,30 @@ French
+
+
+ GtkEntry
+ event_description
+ True
+ True
+ True
+ 0
+
+
+ 1
+ 2
+ 4
+ 5
+ 3
+ 3
+ True
+ False
+ False
+ False
+ True
+ False
+
+
diff --git a/gramps/src/filters/EventPlace.py b/gramps/src/filters/EventPlace.py
index b2d6d7882..823cf8c7f 100644
--- a/gramps/src/filters/EventPlace.py
+++ b/gramps/src/filters/EventPlace.py
@@ -27,7 +27,7 @@ import intl
_ = intl.gettext
class EventPlace(Filter.Filter):
- "People with an event location of ..."
+ """Finds people with a specfied event location in any field"""
def __init__(self,text):
self.ok = 1
@@ -44,9 +44,23 @@ class EventPlace(Filter.Filter):
list.append(person.getDeath())
for event in list:
if self.regexp.search(event.getPlaceName()):
- val = 1
- break
- return val
+ return 1
+ place = event.getPlace()
+ if not place:
+ continue
+ locs = [place.get_main_location()] + place.get_alternate_locations()
+ for location in locs:
+ if self.regexp.search(location.get_city()):
+ return 1
+ if self.regexp.search(location.get_parish()):
+ return 1
+ if self.regexp.search(location.get_county()):
+ return 1
+ if self.regexp.search(location.get_state()):
+ return 1
+ if self.regexp.search(location.get_country()):
+ return 1
+ return 0
#------------------------------------------------------------------------
#
diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade
index baad0c5c6..b0d0c2d4d 100644
--- a/gramps/src/gramps.glade
+++ b/gramps/src/gramps.glade
@@ -485,6 +485,19 @@
GNOME_STOCK_MENU_MAIL
+
+ GtkMenuItem
+ report_a_bug1
+ Report a bug to the GRAMPS bug tracking system
+
+ activate
+ on_gramps_report_bug_activate
+ Mon, 24 Dec 2001 05:43:23 GMT
+
+
+ False
+
+
GtkPixmapMenuItem
about1
@@ -7025,4 +7038,155 @@ Unknown
+
+ GnomeDialog
+ opendb
+
+ delete_event
+ on_opendb_delete_event
+ Mon, 24 Dec 2001 16:08:13 GMT
+
+ Gramps - Open a Database
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_NONE
+ True
+ False
+ True
+ False
+ False
+ False
+
+
+ GtkVBox
+ GnomeDialog:vbox
+ dialog-vbox13
+ False
+ 8
+
+ 4
+ True
+ True
+
+
+
+ GtkHButtonBox
+ GnomeDialog:action_area
+ dialog-action_area13
+ GTK_BUTTONBOX_END
+ 8
+ 85
+ 27
+ 7
+ 0
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+ GtkButton
+ open_ok
+ True
+ True
+ True
+
+ clicked
+ on_open_ok_clicked
+
+ Mon, 24 Dec 2001 15:57:56 GMT
+
+ GNOME_STOCK_BUTTON_OK
+
+
+
+ GtkButton
+ open_cancel
+ True
+ True
+
+ clicked
+ on_open_cancel_clicked
+
+ Mon, 24 Dec 2001 15:57:24 GMT
+
+ GNOME_STOCK_BUTTON_CANCEL
+
+
+
+
+ GtkVBox
+ vbox49
+ False
+ 0
+
+ 0
+ True
+ True
+
+
+
+ GtkLabel
+ label293
+ 300
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 10
+ 10
+
+ 0
+ False
+ False
+
+
+
+
+ GtkHSeparator
+ hseparator24
+
+ 5
+ False
+ True
+
+
+
+
+ GtkRadioButton
+ existing
+ 5
+ True
+
+ True
+ True
+ open
+
+ 0
+ False
+ False
+
+
+
+
+ GtkRadioButton
+ new
+ 5
+ True
+
+ False
+ True
+ open
+
+ 0
+ False
+ False
+
+
+
+
+
+
diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py
index 4d78830e4..f24b9d769 100755
--- a/gramps/src/gramps_main.py
+++ b/gramps/src/gramps_main.py
@@ -162,6 +162,10 @@ def on_gramps_mailing_lists_activate(obj):
import gnome.url
gnome.url.show("http://sourceforge.net/mail/?group_id=25770")
+def on_gramps_report_bug_activate(obj):
+ import gnome.url
+ gnome.url.show("http://sourceforge.net/tracker/?group_id=25770&atid=385137")
+
#-------------------------------------------------------------------------
#
# Merge
@@ -381,15 +385,18 @@ def on_new_clicked(obj):
gnome.ui.GnomeQuestionDialog(msg,new_database_response)
def new_database_response(val):
+ if val == 1:
+ return
+ clear_database()
+ DbPrompter(database,1)
+
+def clear_database():
"""Clear out the database if permission was granted"""
global active_person, active_father
global active_family, active_mother
global active_child, active_spouse
global id2col,alt2col,person_list
- if val == 1:
- return
-
const.personalEvents = const.initialize_personal_event_list()
const.personalAttributes = const.initialize_personal_attribute_list()
const.marriageEvents = const.initialize_marriage_event_list()
@@ -408,6 +415,7 @@ def new_database_response(val):
alt2col = {}
utils.clearModified()
+ utils.clear_timer()
change_active_person(None)
person_list.clear()
load_family()
@@ -504,7 +512,7 @@ def on_ok_button1_clicked(obj):
if filename == "" or filename == None:
return
- new_database_response(0)
+ clear_database()
if getoldrev.get_active():
vc = VersionControl.RcsVersionControl(filename)
@@ -559,8 +567,13 @@ def save_file(filename,comment):
path = filename
filename = os.path.normpath(filename)
+ autosave = "%s/autosave.gramps" % filename
+
statusbar.set_status(_("Saving %s ...") % filename)
+ utils.clearModified()
+ utils.clear_timer()
+
if os.path.exists(filename):
if os.path.isdir(filename) == 0:
displayError(_("%s is not a directory") % filename)
@@ -590,15 +603,46 @@ def save_file(filename,comment):
return
database.setSavePath(old_file)
- utils.clearModified()
Config.save_last_file(old_file)
if Config.usevc:
vc = VersionControl.RcsVersionControl(path)
vc.checkin(filename,comment,not Config.uncompress)
+ topWindow.set_title("Gramps - " + database.getSavePath())
statusbar.set_status("")
statusbar.set_progress(0)
+ if os.path.exists(autosave):
+ try:
+ os.remove(autosave)
+ except:
+ pass
+
+#-------------------------------------------------------------------------
+#
+#
+#
+#-------------------------------------------------------------------------
+def autosave_database():
+ import WriteXML
+
+ path = database.getSavePath()
+ filename = os.path.normpath(path)
+ utils.clearModified()
+
+ filename = "%s/autosave.gramps" % (database.getSavePath())
+
+ statusbar.set_status(_("autosaving..."));
+ try:
+ WriteXML.quick_write(database,filename,quick_progress)
+ statusbar.set_status(_("autosave complete"));
+ except (IOError,OSError):
+ statusbar.set_status(_("autosave failed"));
+ except:
+ import traceback
+ traceback.print_exc()
+
+ return 0
#-------------------------------------------------------------------------
#
@@ -1100,6 +1144,7 @@ def revert_query(value):
database.new()
read_file(file)
utils.clearModified()
+ utils.clear_timer()
#-------------------------------------------------------------------------
#
@@ -1593,6 +1638,18 @@ def load_progress(value):
while gtk.events_pending():
gtk.mainiteration()
+#-------------------------------------------------------------------------
+#
+#
+#
+#-------------------------------------------------------------------------
+def quick_progress(value):
+ gtk.threads_enter()
+ statusbar.set_progress(value)
+ while gtk.events_pending():
+ gtk.mainiteration()
+ gtk.threads_leave()
+
#-------------------------------------------------------------------------
#
#
@@ -1883,7 +1940,7 @@ def on_main_key_release_event(obj,event):
on_delete_person_clicked(obj)
elif event.keyval == GDK.Insert:
load_new_person(obj)
-
+
#-------------------------------------------------------------------------
#
# Main program
@@ -1913,7 +1970,7 @@ def main(arg):
Config.loadConfig(full_update)
gtop = libglade.GladeXML(const.gladeFile, "gramps")
- toolbar = gtop.get_widget("toolbar1")
+ toolbar = gtop.get_widget("toolbar1")
toolbar.set_style(Config.toolbar)
statusbar = gtop.get_widget("statusbar")
@@ -2034,6 +2091,7 @@ def main(arg):
"on_swap_clicked" : on_swap_clicked,
"on_tools_clicked" : on_tools_clicked,
"on_gramps_home_page_activate" : on_gramps_home_page_activate,
+ "on_gramps_report_bug_activate" : on_gramps_report_bug_activate,
"on_gramps_mailing_lists_activate" : on_gramps_mailing_lists_activate,
"on_writing_extensions_activate" : on_writing_extensions_activate,
})
@@ -2054,11 +2112,99 @@ def main(arg):
read_file(arg)
elif Config.lastfile != None and Config.lastfile != "" and Config.autoload:
read_file(Config.lastfile)
+ else:
+ DbPrompter(database,0)
+
+ if Config.autosave and Config.autosave_int != 0:
+ utils.enable_autosave(autosave_database,Config.autosave_int)
database.setResearcher(Config.owner)
-
gtk.mainloop()
+#-------------------------------------------------------------------------
+#
+# Make sure a database is opened
+#
+#-------------------------------------------------------------------------
+class DbPrompter:
+ def __init__(self,db,want_new):
+ self.db = db
+ self.want_new = want_new
+ self.show()
+
+ def show(self):
+ opendb = libglade.GladeXML(const.gladeFile, "opendb")
+ opendb.signal_autoconnect({
+ "on_open_ok_clicked" : self.open_ok_clicked,
+ "on_open_cancel_clicked" : self.open_cancel_clicked,
+ "on_opendb_delete_event": self.open_delete_event,
+ })
+ self.new = opendb.get_widget("new")
+ if self.want_new:
+ self.new.set_active(1)
+
+ def open_ok_clicked(self,obj):
+ if self.new.get_active():
+ self.save_as_activate()
+ else:
+ self.open_activate()
+ utils.destroy_passed_object(obj)
+
+ def save_as_activate(self):
+ wFs = libglade.GladeXML (const.gladeFile, FILESEL)
+ wFs.signal_autoconnect({
+ "on_ok_button1_clicked": self.save_ok_button_clicked,
+ "destroy_passed_object": self.cancel_button_clicked,
+ })
+
+ def save_ok_button_clicked(self,obj):
+ filename = obj.get_filename()
+ if filename:
+ utils.destroy_passed_object(obj)
+ if Config.usevc and Config.vc_comment:
+ display_comment_box(filename)
+ else:
+ save_file(filename,_("No Comment Provided"))
+
+ def open_activate(self):
+ wFs = libglade.GladeXML(const.revisionFile, "dbopen")
+ wFs.signal_autoconnect({
+ "on_ok_button1_clicked": self.ok_button_clicked,
+ "destroy_passed_object": self.cancel_button_clicked,
+ })
+
+ self.fileSelector = wFs.get_widget("dbopen")
+ self.dbname = wFs.get_widget("dbname")
+ self.getoldrev = wFs.get_widget("getoldrev")
+ self.dbname.set_default_path(Config.db_dir)
+ self.getoldrev.set_sensitive(Config.usevc)
+
+ def cancel_button_clicked(self,obj):
+ utils.destroy_passed_object(obj)
+ self.show()
+
+ def ok_button_clicked(self,obj):
+ filename = self.dbname.get_full_path(0)
+
+ if not filename:
+ return
+
+ utils.destroy_passed_object(obj)
+ clear_database()
+
+ if self.getoldrev.get_active():
+ vc = VersionControl.RcsVersionControl(filename)
+ VersionControl.RevisionSelect(self.db,filename,vc,load_revision,self.show)
+ else:
+ read_file(filename)
+
+ def open_delete_event(self,obj,event):
+ gtk.mainquit()
+
+ def open_cancel_clicked(self,obj):
+ gtk.mainquit()
+
+
#-------------------------------------------------------------------------
#
# Start it all
@@ -2066,3 +2212,4 @@ def main(arg):
#-------------------------------------------------------------------------
if __name__ == '__main__':
main(None)
+
diff --git a/gramps/src/revision.glade b/gramps/src/revision.glade
index f7fa4b581..8547f25d9 100644
--- a/gramps/src/revision.glade
+++ b/gramps/src/revision.glade
@@ -20,7 +20,7 @@
Gramps - Open a database
GTK_WINDOW_TOPLEVEL
GTK_WIN_POS_NONE
- False
+ True
False
True
False
diff --git a/gramps/src/utils.py b/gramps/src/utils.py
index 78368f099..7bd71b7fb 100644
--- a/gramps/src/utils.py
+++ b/gramps/src/utils.py
@@ -58,6 +58,9 @@ _ = gettext
#
#-------------------------------------------------------------------------
_modifiedFlag = 0
+_autotime_val = 1
+_autosave_fun = None
+_autosave_tim = None
LISTOBJ = "s"
OBJECT = "o"
@@ -70,9 +73,29 @@ OBJECT = "o"
#
#-------------------------------------------------------------------------
def modified():
- global _modifiedFlag
+ global _modifiedFlag, _autosave_tim
+
+ if _autosave_fun and not _autosave_tim:
+ _autosave_tim = gtk.timeout_add(60000*_autotime_val,_autosave_fun)
_modifiedFlag = 1
+def enable_autosave(fun,value):
+ global _autosave_fun
+ global _autosave_val
+ if fun != None:
+ _autosave_fun = fun
+ _autosave_val = value
+
+def disable_autosave():
+ global _autosave_fun
+ _autosave_fun = None
+
+def clear_timer():
+ global _autosave_tim
+ if _autosave_tim:
+ gtk.timeout_remove(_autosave_tim)
+ _autosave_tim = None
+
#-------------------------------------------------------------------------
#
# Clears the modified flag. Should be called after data is saved.