First attempt at autosave
svn: r668
This commit is contained in:
parent
4e6a9abe93
commit
62a662daf3
@ -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()
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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])
|
||||
|
@ -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):
|
||||
|
@ -78,70 +78,12 @@
|
||||
<widget>
|
||||
<class>GtkTable</class>
|
||||
<name>table13</name>
|
||||
<rows>3</rows>
|
||||
<columns>2</columns>
|
||||
<rows>4</rows>
|
||||
<columns>3</columns>
|
||||
<homogeneous>False</homogeneous>
|
||||
<row_spacing>0</row_spacing>
|
||||
<column_spacing>0</column_spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>uncompress</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_object_toggled</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Sat, 09 Dec 2000 18:11:20 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Do not compress XML data file</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>autoload</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_object_toggled</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Sat, 09 Dec 2000 18:11:20 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Automatically load last database</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label205</name>
|
||||
@ -155,8 +97,8 @@
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<top_attach>3</top_attach>
|
||||
<bottom_attach>4</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
@ -178,9 +120,9 @@
|
||||
<modal>False</modal>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>3</top_attach>
|
||||
<bottom_attach>4</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
@ -209,6 +151,157 @@
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label217</name>
|
||||
<label>Autosave interval (minutes)</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>1</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>save_enable</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_object_toggled</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Mon, 24 Dec 2001 23:25:36 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Enable Autosaving</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>1</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkSpinButton</class>
|
||||
<name>save_interval</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>changed</name>
|
||||
<handler>on_object_changed</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Mon, 24 Dec 2001 23:25:52 GMT</last_modification_time>
|
||||
</signal>
|
||||
<climb_rate>1</climb_rate>
|
||||
<digits>0</digits>
|
||||
<numeric>True</numeric>
|
||||
<update_policy>GTK_UPDATE_IF_VALID</update_policy>
|
||||
<snap>True</snap>
|
||||
<wrap>False</wrap>
|
||||
<value>5</value>
|
||||
<lower>0</lower>
|
||||
<upper>100</upper>
|
||||
<step>1</step>
|
||||
<page>10</page>
|
||||
<page_size>10</page_size>
|
||||
<child>
|
||||
<left_attach>2</left_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>2</top_attach>
|
||||
<bottom_attach>3</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>autoload</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_object_toggled</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Sat, 09 Dec 2000 18:11:20 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Automatically load last database</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>0</top_attach>
|
||||
<bottom_attach>1</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>uncompress</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>toggled</name>
|
||||
<handler>on_object_toggled</handler>
|
||||
<object>propertybox</object>
|
||||
<last_modification_time>Sat, 09 Dec 2000 18:11:20 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Do not compress XML data file</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<left_attach>0</left_attach>
|
||||
<right_attach>3</right_attach>
|
||||
<top_attach>1</top_attach>
|
||||
<bottom_attach>2</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>False</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@ -1993,7 +2086,7 @@
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmldir</name>
|
||||
<history_id>repdir</history_id>
|
||||
<history_id>webdir</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Gramps - Select default report directory</title>
|
||||
<directory>True</directory>
|
||||
|
@ -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.")
|
||||
|
@ -240,44 +240,6 @@
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeEntry</class>
|
||||
<name>eDescBox</name>
|
||||
<history_id>event_description</history_id>
|
||||
<max_saved>15</max_saved>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>4</top_attach>
|
||||
<bottom_attach>5</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<child_name>GnomeEntry:entry</child_name>
|
||||
<name>eventDescription</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>insert_text</name>
|
||||
<handler>on_combo_insert_text</handler>
|
||||
<object>eDescBox</object>
|
||||
<last_modification_time>Thu, 18 Oct 2001 01:38:54 GMT</last_modification_time>
|
||||
</signal>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCombo</class>
|
||||
<name>eventPlace_combo</name>
|
||||
@ -587,6 +549,30 @@ French
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkEntry</class>
|
||||
<name>event_description</name>
|
||||
<can_focus>True</can_focus>
|
||||
<editable>True</editable>
|
||||
<text_visible>True</text_visible>
|
||||
<text_max_length>0</text_max_length>
|
||||
<text></text>
|
||||
<child>
|
||||
<left_attach>1</left_attach>
|
||||
<right_attach>2</right_attach>
|
||||
<top_attach>4</top_attach>
|
||||
<bottom_attach>5</bottom_attach>
|
||||
<xpad>3</xpad>
|
||||
<ypad>3</ypad>
|
||||
<xexpand>True</xexpand>
|
||||
<yexpand>False</yexpand>
|
||||
<xshrink>False</xshrink>
|
||||
<yshrink>False</yshrink>
|
||||
<xfill>True</xfill>
|
||||
<yfill>False</yfill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -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
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -485,6 +485,19 @@
|
||||
<stock_icon>GNOME_STOCK_MENU_MAIL</stock_icon>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkMenuItem</class>
|
||||
<name>report_a_bug1</name>
|
||||
<tooltip>Report a bug to the GRAMPS bug tracking system</tooltip>
|
||||
<signal>
|
||||
<name>activate</name>
|
||||
<handler>on_gramps_report_bug_activate</handler>
|
||||
<last_modification_time>Mon, 24 Dec 2001 05:43:23 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>_Report a bug</label>
|
||||
<right_justify>False</right_justify>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkPixmapMenuItem</class>
|
||||
<name>about1</name>
|
||||
@ -7025,4 +7038,155 @@ Unknown
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>opendb</name>
|
||||
<signal>
|
||||
<name>delete_event</name>
|
||||
<handler>on_opendb_delete_event</handler>
|
||||
<last_modification_time>Mon, 24 Dec 2001 16:08:13 GMT</last_modification_time>
|
||||
</signal>
|
||||
<title>Gramps - Open a Database</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>True</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox13</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>8</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area13</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>open_ok</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<has_focus>True</has_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_open_ok_clicked</handler>
|
||||
<object>opendb</object>
|
||||
<last_modification_time>Mon, 24 Dec 2001 15:57:56 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>open_cancel</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_open_cancel_clicked</handler>
|
||||
<object>opendb</object>
|
||||
<last_modification_time>Mon, 24 Dec 2001 15:57:24 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox49</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label293</name>
|
||||
<width>300</width>
|
||||
<label>Open a Database</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>10</xpad>
|
||||
<ypad>10</ypad>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator24</name>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>existing</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Open an Existing Database</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>open</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkRadioButton</class>
|
||||
<name>new</name>
|
||||
<border_width>5</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Create a New Database</label>
|
||||
<active>False</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<group>open</group>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
||||
|
@ -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)
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
<title>Gramps - Open a database</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<modal>True</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user