* src/GrampsGconfKeys.py: Add to CVS -- split off key names.

* src/Makefile.am: Ship GrampsGconfKeys.
* src/ArgHandler.py: Use GrampsGconfKeys.
* src/DbPrompter.py: Use GrampsGconfKeys.
* src/EditPerson.py: Use GrampsGconfKeys.
* src/Exporter.py: Use GrampsGconfKeys.
* src/FamilyView.py: Use GrampsGconfKeys.
* src/GrampsDbBase.py: Use GrampsGconfKeys.
* src/ImageSelect.py: Use GrampsGconfKeys.
* src/MediaView.py: Use GrampsGconfKeys.
* src/Plugins.py: Use GrampsGconfKeys.
* src/Report.py: Use GrampsGconfKeys.
* src/StartupDialog.py: Use GrampsGconfKeys.
* src/TipOfDay.py: Use GrampsGconfKeys.
* src/Utils.py: Use GrampsGconfKeys.
* src/DateDisplay.py: Proper capitalization for _MONS.
* src/DateHandler.py: Use GrampsGconfKeys.
* src/GrampsCfg.py: Use GrampsGconfKeys.
* src/gramps_main.py: Use GrampsGconfKeys.


svn: r3573
This commit is contained in:
Alex Roitman 2004-09-25 05:12:15 +00:00
parent f57fa24b10
commit 983b5a248e
20 changed files with 685 additions and 599 deletions

View File

@ -2,6 +2,26 @@
* src/data/gnome-mime-application-x-geneweb.png: Add to CVS.
* src/data/Makefile.am, src/plugins/Makefile.am: Ship new files.
* src/GrampsGconfKeys.py: Add to CVS -- split off key names.
* src/Makefile.am: Ship GrampsGconfKeys.
* src/ArgHandler.py: Use GrampsGconfKeys.
* src/DbPrompter.py: Use GrampsGconfKeys.
* src/EditPerson.py: Use GrampsGconfKeys.
* src/Exporter.py: Use GrampsGconfKeys.
* src/FamilyView.py: Use GrampsGconfKeys.
* src/GrampsDbBase.py: Use GrampsGconfKeys.
* src/ImageSelect.py: Use GrampsGconfKeys.
* src/MediaView.py: Use GrampsGconfKeys.
* src/Plugins.py: Use GrampsGconfKeys.
* src/Report.py: Use GrampsGconfKeys.
* src/StartupDialog.py: Use GrampsGconfKeys.
* src/TipOfDay.py: Use GrampsGconfKeys.
* src/Utils.py: Use GrampsGconfKeys.
* src/DateDisplay.py: Proper capitalization for _MONS.
* src/DateHandler.py: Use GrampsGconfKeys.
* src/GrampsCfg.py: Use GrampsGconfKeys.
* src/gramps_main.py: Use GrampsGconfKeys.
2004-09-24 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/ImportGeneWeb.py, src/plugins/WriteGeneWeb.py,
src/plugins/genewebexport.glade: Add to CVS.

View File

@ -45,7 +45,7 @@ import ReadXML
import GrampsMime
import DbPrompter
import QuestionDialog
import GrampsCfg
import GrampsGconfKeys
#-------------------------------------------------------------------------
#
@ -307,8 +307,8 @@ class ArgHandler:
if self.imports:
self.parent.import_tool_callback()
elif GrampsCfg.get_lastfile() and GrampsCfg.get_autoload():
if self.auto_save_load(GrampsCfg.get_lastfile()) == 0:
elif GrampsGconfKeys.get_lastfile() and GrampsGconfKeys.get_autoload():
if self.auto_save_load(GrampsGconfKeys.get_lastfile()) == 0:
DbPrompter.DbPrompter(self.parent,0)
else:
DbPrompter.DbPrompter(self.parent,0)

View File

@ -76,18 +76,18 @@ class DateDisplay:
_MONS = (
"",
unicode(locale.nl_langinfo(locale.ABMON_1),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_2),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_3),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_4),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_5),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_6),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_7),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_8),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_9),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_10),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_11),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_12),_codeset),
unicode(locale.nl_langinfo(locale.ABMON_1),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_2),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_3),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_4),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_5),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_6),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_7),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_8),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_9),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_10),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_11),_codeset).upper(),
unicode(locale.nl_langinfo(locale.ABMON_12),_codeset).upper(),
)
_tformat = locale.nl_langinfo(locale.D_FMT)

View File

@ -1,16 +1,50 @@
import DateParser
import DateDisplay
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Class handling language-specific selection for date parser and displayer.
"""
#-------------------------------------------------------------------------
#
# Standard python modules
#
#-------------------------------------------------------------------------
import os
try:
import gconf
except ImportError:
import gnome.gconf
gconf = gnome.gconf
client = gconf.client_get_default()
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsGconfKeys
import DateParser
import DateDisplay
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_lang = os.environ.get('LANG','C')
@ -24,6 +58,11 @@ _lang_to_display = {
'en_US' : DateDisplay.DateDisplay,
}
#-------------------------------------------------------------------------
#
# Functions
#
#-------------------------------------------------------------------------
def create_parser():
try:
return _lang_to_parser[_lang]()
@ -31,8 +70,8 @@ def create_parser():
return DateParser.DateParser()
def create_display():
val = client.get_int("/apps/gramps/preferences/date-format")
try:
val = GrampsGconfKeys.get_date_format(_lang_to_display[_lang].formats)
return _lang_to_display[_lang](val)
except:
return DateDisplay.DateDisplay(3)
@ -46,13 +85,13 @@ def get_date_formats():
def set_format(val):
try:
_lang_to_display[_lang].display_format = val
_lang_to_display[_lang].format = val
except:
pass
def get_format():
try:
return _lang_to_display[_lang].display_format
return _lang_to_display[_lang].format
except:
print "not found"
return 0

View File

@ -51,7 +51,7 @@ import Plugins
import GrampsBSDDB
import GrampsXMLDB
import GrampsGEDDB
import GrampsCfg
import GrampsGconfKeys
#-------------------------------------------------------------------------
#
@ -162,11 +162,11 @@ class ExistingDbPrompter:
# Suggested folder: try last open file, last import, last export,
# then home.
default_dir = os.path.split(GrampsCfg.get_lastfile())[0] + os.path.sep
default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_import_dir()
default_dir = GrampsGconfKeys.get_last_import_dir()
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_export_dir()
default_dir = GrampsGconfKeys.get_last_export_dir()
if len(default_dir)<=1:
default_dir = '~/'
@ -177,7 +177,7 @@ class ExistingDbPrompter:
filetype = gnome.vfs.get_mime_type(filename)
(the_path,the_file) = os.path.split(filename)
GrampsCfg.save_last_import_dir(the_path)
GrampsGconfKeys.save_last_import_dir(the_path)
if filetype == const.app_gramps:
choose.destroy()
@ -274,11 +274,11 @@ class ImportDbPrompter:
# Suggested folder: try last open file, import, then last export,
# then home.
default_dir = GrampsCfg.get_last_import_dir()
default_dir = GrampsGconfKeys.get_last_import_dir()
if len(default_dir)<=1:
default_dir = os.path.split(GrampsCfg.get_lastfile())[0] + os.path.sep
default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_export_dir()
default_dir = GrampsGconfKeys.get_last_export_dir()
if len(default_dir)<=1:
default_dir = '~/'
@ -295,7 +295,7 @@ class ImportDbPrompter:
# return 1
(the_path,the_file) = os.path.split(filename)
GrampsCfg.save_last_import_dir(the_path)
GrampsGconfKeys.save_last_import_dir(the_path)
for (importData,mime_filter,mime_type,native_format) in Plugins._imports:
if filetype == mime_type or the_file == mime_type:
choose.destroy()
@ -351,11 +351,11 @@ class NewNativeDbPrompter:
# Suggested folder: try last open file, import, then last export,
# then home.
default_dir = os.path.split(GrampsCfg.get_lastfile())[0] + os.path.sep
default_dir = os.path.split(GrampsGconfKeys.get_lastfile())[0] + os.path.sep
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_import_dir()
default_dir = GrampsGconfKeys.get_last_import_dir()
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_export_dir()
default_dir = GrampsGconfKeys.get_last_export_dir()
if len(default_dir)<=1:
default_dir = '~/'

View File

@ -47,6 +47,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_
#-------------------------------------------------------------------------
import const
import Utils
import GrampsGconfKeys
import GrampsCfg
import ImageSelect
import AutoComp
@ -310,7 +311,7 @@ class EditPerson:
self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment())
self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing())
if GrampsCfg.get_uselds() \
if GrampsGconfKeys.get_uselds() \
or (not self.lds_baptism.is_empty()) \
or (not self.lds_endowment.is_empty()) \
or (not self.lds_sealing.is_empty()):

View File

@ -50,7 +50,7 @@ import const
import Utils
import Plugins
import QuestionDialog
import GrampsCfg
import GrampsGconfKeys
#-------------------------------------------------------------------------
#
@ -204,7 +204,7 @@ class Exporter:
Depending on the success status, set the text for the final page.
"""
filename = self.chooser.get_filename()
GrampsCfg.save_last_export_dir(os.path.split(filename)[0])
GrampsGconfKeys.save_last_export_dir(os.path.split(filename)[0])
ix = self.get_selected_format_index()
if self.exports[ix][3]:
success = self.exports[ix][0](self.parent.db,filename,self.person,
@ -333,9 +333,9 @@ class Exporter:
ext = self.exports[ix][4]
# Suggested folder: try last export, then last import, then home.
default_dir = GrampsCfg.get_last_export_dir()
default_dir = GrampsGconfKeys.get_last_export_dir()
if len(default_dir)<=1:
default_dir = GrampsCfg.get_last_import_dir()
default_dir = GrampsGconfKeys.get_last_import_dir()
if len(default_dir)<=1:
default_dir = '~/'

View File

@ -37,6 +37,7 @@ from gobject import TYPE_STRING, TYPE_INT
#-------------------------------------------------------------------------
import const
import Utils
import GrampsGconfKeys
import GrampsCfg
import AddSpouse
import SelectChild
@ -45,6 +46,7 @@ import Marriage
import ChooseParents
import RelLib
import EditPerson
import DateHandler
from gettext import gettext as _
from QuestionDialog import QuestionDialog,WarningDialog
@ -152,7 +154,8 @@ class FamilyView:
self.parent.views.get_nth_page(2).hide()
def init_interface(self):
fv = GrampsCfg.get_family_view()
fv = GrampsGconfKeys.get_family_view()
self.dd = DateHandler.create_display()
self.set_widgets(fv)
already_init = self.cadded[fv]
@ -663,7 +666,7 @@ class FamilyView:
return
person = RelLib.Person()
autoname = GrampsCfg.get_lastnamegen()
autoname = GrampsGconfKeys.get_lastnamegen()
if autoname == 0:
name = self.north_american(0)
@ -872,16 +875,16 @@ class FamilyView:
if bd and dd:
n = "%s [%s]\n\t%s %s\n\t%s %s " % (GrampsCfg.get_nameof()(self.person),
self.person.get_gramps_id(),
_BORN,bd.get_date(),
_DIED,dd.get_date())
_BORN,self.dd.display(bd.get_date_object()),
_DIED,self.dd.display(dd.get_date_object()))
elif bd:
n = "%s [%s]\n\t%s %s" % (GrampsCfg.get_nameof()(self.person),
self.person.get_gramps_id(),
_BORN,bd.get_date())
_BORN,self.dd.display(bd.get_date_object()))
elif dd:
n = "%s [%s]\n\t%s %s" % (GrampsCfg.get_nameof()(self.person),
self.person.get_gramps_id(),
_DIED,dd.get_date())
_DIED,self.dd.display(dd.get_date_object()))
else:
n = "%s [%s]" % (GrampsCfg.get_nameof()(self.person),
self.person.get_gramps_id())
@ -920,7 +923,7 @@ class FamilyView:
sp = self.parent.db.get_person_from_handle(sp_id)
event = self.find_marriage(fm)
if event:
mdate = " - %s" % event.get_date()
mdate = " - %s" % self.dd.display(event.get_date_object())
else:
mdate = ""
v = "%s [%s]\n\t%s%s" % (GrampsCfg.get_nameof()(sp),
@ -1052,7 +1055,7 @@ class FamilyView:
event = self.parent.db.get_event_from_handle(val[3])
if event:
dval = event.get_date()
dval = self.dd.display(event.get_date_object())
else:
dval = u''
self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2],

View File

@ -40,20 +40,12 @@ import gtk.glade
import gnome
import gnome.ui
#
# SUSE calls the gconf module "gnome.gconf"
#
try:
import gconf
except ImportError:
import gnome.gconf
gconf = gnome.gconf
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import GrampsGconfKeys
import RelLib
import const
import Utils
@ -61,9 +53,6 @@ import PaperMenu
import Plugins
import DateHandler
client = gconf.client_get_default()
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
#-------------------------------------------------------------------------
#
# Constants
@ -80,22 +69,6 @@ _surname_styles = [
_("Icelandic style"),
]
_date_format_list = [
_("Month Day, Year"),
_("MON Day, Year"),
_("Day MON Year"),
_("MM/DD/YYYY"),
_("MM-DD-YYYY"),
_("DD/MM/YYYY"),
_("DD-MM-YYYY"),
_("MM.DD.YYYY"),
_("DD.MM.YYYY"),
_("DD. Month Year"),
_("YYYY/MM/DD"),
_("YYYY-MM-DD"),
_("YYYY.MM.DD"),
]
_name_format_list = [
(_("Firstname Surname"), Utils.normal_name, Utils.phonebook_name, lambda x: x.get_surname()),
(_("Surname, Firstname"), Utils.phonebook_name, Utils.phonebook_name, lambda x: x.get_surname()),
@ -118,301 +91,24 @@ panellist = [
( _("Data Guessing"), 9)]),
]
#-------------------------------------------------------------------------
#
# Functions to obtain values from gconf keys
# and store values into gconf keys
#
# All gramps keys should be accessed through these functions!
#
#-------------------------------------------------------------------------
# interface keys
def get_default_view():
return get_int("/apps/gramps/interface/defaultview",(0,1))
def save_default_view(val):
set_int("/apps/gramps/interface/defaultview",val,(0,1))
def get_family_view():
return get_int("/apps/gramps/interface/familyview",(0,1))
def save_family_view(val):
set_int("/apps/gramps/interface/familyview",val,(0,1))
def get_filter():
return get_bool("/apps/gramps/interface/filter")
def save_filter(val):
set_bool("/apps/gramps/interface/filter",val)
def get_index_visible():
return get_bool("/apps/gramps/interface/index-visible")
def save_index_visible(val):
set_bool("/apps/gramps/interface/index-visible",val)
def get_statusbar():
return get_int("/apps/gramps/interface/statusbar",(0,1,2))
def save_statusbar(val):
set_int("/apps/gramps/interface/statusbar",val,(0,1,2))
def get_toolbar():
return get_int("/apps/gramps/interface/toolbar",(0,1,2,3,5))
def save_toolbar(val):
set_int("/apps/gramps/interface/toolbar",val,(0,1,2,3,5))
def get_toolbar_on():
return get_bool("/apps/gramps/interface/toolbar-on")
def save_toolbar_on(val):
set_bool("/apps/gramps/interface/toolbar-on",val)
def get_view():
return get_bool("/apps/gramps/interface/view")
def save_view(val):
set_bool("/apps/gramps/interface/view",val)
# paths keys
def get_lastfile():
return get_string("/apps/gramps/paths/recent-file")
def save_last_file(val):
set_string("/apps/gramps/paths/recent-file",val)
def get_last_import_dir():
return get_string("/apps/gramps/paths/recent-import-dir")
def save_last_import_dir(val):
set_string_as_path("/apps/gramps/paths/recent-import-dir",val)
def get_last_export_dir():
return get_string("/apps/gramps/paths/recent-export-dir")
def save_last_export_dir(val):
set_string_as_path("/apps/gramps/paths/recent-export-dir",val)
def get_report_dir():
return get_string("/apps/gramps/paths/report-directory")
def save_report_dir(val):
set_string_as_path("/apps/gramps/paths/report-directory",val)
def get_web_dir():
return get_string("/apps/gramps/paths/website-directory")
def save_web_dir(val):
set_string_as_path("/apps/gramps/paths/website-directory",val)
# behavior keys
def get_startup():
return get_int("/apps/gramps/behavior/startup",(0,1))
def save_startup(val):
set_int("/apps/gramps/behavior/startup",val,(0,1))
def get_screen_size_checked():
return get_bool("/apps/gramps/interface/size-checked")
def save_screen_size_checked(val):
set_bool("/apps/gramps/interface/size-checked",val)
def get_autoload():
return get_bool("/apps/gramps/behavior/autoload")
def save_autoload(val):
set_bool("/apps/gramps/behavior/autoload",val)
def get_betawarn():
return get_bool("/apps/gramps/behavior/betawarn")
def save_betawarn(val):
set_bool("/apps/gramps/behavior/betawarn",val)
def get_media_reference():
return get_bool("/apps/gramps/behavior/make-reference")
def save_media_reference(val):
set_bool("/apps/gramps/behavior/make-reference",val)
def get_media_global():
return get_bool("/apps/gramps/behavior/media-global")
def save_media_global(val):
set_bool("/apps/gramps/behavior/media-global",val)
def get_media_local():
return get_bool("/apps/gramps/behavior/media-local")
def save_media_local(val):
set_bool("/apps/gramps/behavior/media-local",val)
def get_lastnamegen():
return get_int("/apps/gramps/behavior/surname-guessing",
range(len(_surname_styles)))
def save_lastnamegen(val):
set_int("/apps/gramps/behavior/surname-guessing",val,
range(len(_surname_styles)))
def get_uselds():
return get_bool("/apps/gramps/behavior/use-lds")
def save_uselds(val):
set_bool("/apps/gramps/behavior/use-lds",val)
def get_usetips():
return get_bool("/apps/gramps/behavior/use-tips")
def save_usetips(val):
set_bool("/apps/gramps/behavior/use-tips",val)
# preferences keys
def get_person_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def get_event_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def save_iprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val)
def get_object_id_prefix():
return get_string("/apps/gramps/preferences/oprefix")
def save_oprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/oprefix",val)
def get_source_id_prefix():
return get_string("/apps/gramps/preferences/sprefix")
def save_sprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/sprefix",val)
def save_eprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/eprefix",val)
def get_place_id_prefix():
return get_string("/apps/gramps/preferences/pprefix")
def save_pprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/pprefix",val)
def get_family_id_prefix():
return get_string("/apps/gramps/preferences/fprefix")
def save_fprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/fprefix",val)
def get_paper_preference():
return get_string("/apps/gramps/preferences/paper-preference")
def save_paper_preference(val):
set_string("/apps/gramps/preferences/paper-preference",val)
def get_output_preference():
return get_string("/apps/gramps/preferences/output-preference")
def save_output_preference(val):
set_string("/apps/gramps/preferences/output-preference",val)
def get_goutput_preference():
return get_string("/apps/gramps/preferences/goutput-preference")
def save_goutput_preference(val):
set_string("/apps/gramps/preferences/goutput-preference",val)
def get_use_tips():
return get_bool("/apps/gramps/preferences/use-tips")
def save_use_tips(val):
set_bool("/apps/gramps/preferences/use-tips",val)
def get_date_format():
return get_int("/apps/gramps/preferences/date-format",
range(len(_date_format_list)))
def save_date_format(val):
set_int("/apps/gramps/preferences/date-format",val,
range(len(_date_format_list)))
def get_name_format():
return get_int("/apps/gramps/preferences/name-format",
range(len(_name_format_list)))
def save_name_format(val):
set_int("/apps/gramps/preferences/name-format",val,
range(len(_name_format_list)))
# researcher keys
def get_researcher_name():
return get_string("/apps/gramps/researcher/researcher-name")
def save_researcher_name(val):
set_string("/apps/gramps/researcher/researcher-name",val)
def get_researcher_addr():
return get_string("/apps/gramps/researcher/researcher-addr")
def save_researcher_addr(val):
set_string("/apps/gramps/researcher/researcher-addr",val)
def get_researcher_city():
return get_string("/apps/gramps/researcher/researcher-city")
def save_researcher_city(val):
set_string("/apps/gramps/researcher/researcher-city",val)
def get_researcher_state():
return get_string("/apps/gramps/researcher/researcher-state")
def save_researcher_state(val):
set_string("/apps/gramps/researcher/researcher-state",val)
def get_researcher_country():
return get_string("/apps/gramps/researcher/researcher-country")
def save_researcher_country(val):
set_string("/apps/gramps/researcher/researcher-country",val)
def get_researcher_postal():
return get_string("/apps/gramps/researcher/researcher-postal")
def save_researcher_postal(val):
set_string("/apps/gramps/researcher/researcher-postal",val)
def get_researcher_phone():
return get_string("/apps/gramps/researcher/researcher-phone")
def save_researcher_phone(val):
set_string("/apps/gramps/researcher/researcher-phone",val)
def get_researcher_email():
return get_string("/apps/gramps/researcher/researcher-email")
def save_researcher_email(val):
set_string("/apps/gramps/researcher/researcher-email",val)
# Not exactly gconf keys, but the functions directly dependent on them
def get_nameof():
return _name_format_list[get_name_format()][1]
return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][1]
def get_display_name():
return _name_format_list[get_name_format()][2]
return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][2]
def get_display_surname():
return _name_format_list[get_name_format()][3]
return _name_format_list[GrampsGconfKeys.get_name_format(_name_format_list)][3]
def get_toolbar_style():
saved_toolbar = get_toolbar()
saved_toolbar = GrampsGconfKeys.get_toolbar()
if saved_toolbar in range(4):
return saved_toolbar
else:
try:
gnome_toolbar_str = client.get_string("/desktop/gnome/interface/toolbar_style")
gnome_toolbar_str = GrampsGconfKeys.client.get_string("/desktop/gnome/interface/toolbar_style")
gnome_toolbar = eval("gtk.TOOLBAR_%s" %
gnome_toolbar_str.replace('-','_').upper())
except:
@ -420,71 +116,8 @@ def get_toolbar_style():
return gnome_toolbar
def set_calendar_date_format():
DateHandler.set_format(get_date_format())
#-------------------------------------------------------------------------
#
# Low-level grabbing and saving keys with error checking.
#
#-------------------------------------------------------------------------
def get_bool(key):
try:
val = client.get_bool(key)
except gobject.GError:
val = None
if val in (True,False):
return val
else:
return client.get_default_from_schema(key).get_bool()
def set_bool(key,val):
if val in (True,False):
client.set_bool(key,val)
def get_int(key,correct_tuple=None):
try:
val = client.get_int(key)
except gobject.GError:
val = None
if not correct_tuple or val in correct_tuple:
return val
else:
return client.get_default_from_schema(key).get_int()
def set_int(key,val,correct_tuple=None):
if not correct_tuple or val in correct_tuple:
client.set_int(key,val)
def get_string(key,test_func=None):
try:
val = client.get_string(key)
except gobject.GError:
val = None
if not test_func or test_func(val):
return val
else:
return client.get_default_from_schema(key).get_string()
def set_string(key,val,test_func=None):
if not test_func or test_func(val):
client.set_string(key,val)
def set_string_as_path(key,val):
if not val:
val = client.get_default_from_schema(key).get_string()
else:
val = os.path.normpath(val) + os.sep
client.set_string(key,val)
def set_string_as_id_prefix(key,val):
if not val:
val = client.get_default_from_schema(key).get_string()
else:
try:
junk = val % 1
except:
val = client.get_default_from_schema(key).get_string()
client.set_string(key,val)
format_list = DateHandler.get_date_formats()
DateHandler.set_format(GrampsGconfKeys.get_date_format(format_list))
#-------------------------------------------------------------------------
#
@ -512,23 +145,20 @@ def loadConfig():
make_path(os.path.expanduser("~/.gramps/plugins"))
make_path(os.path.expanduser("~/.gramps/templates"))
def sync():
client.suggest_sync()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_researcher():
n = get_researcher_name()
a = get_researcher_addr()
c = get_researcher_city()
s = get_researcher_state()
ct = get_researcher_country()
p = get_researcher_postal()
ph = get_researcher_phone()
e = get_researcher_email()
n = GrampsGconfKeys.get_researcher_name()
a = GrampsGconfKeys.get_researcher_addr()
c = GrampsGconfKeys.get_researcher_city()
s = GrampsGconfKeys.get_researcher_state()
ct = GrampsGconfKeys.get_researcher_country()
p = GrampsGconfKeys.get_researcher_postal()
ph = GrampsGconfKeys.get_researcher_phone()
e = GrampsGconfKeys.get_researcher_email()
owner = RelLib.Researcher()
owner.set(n,a,c,s,ct,p,ph,e)
@ -570,7 +200,7 @@ class ConfigEntry(ConfigWidget):
def set(self):
val = unicode(self.w.get_text())
client.set_string(self.tag,val)
GrampsGconfKeys.client.set_string(self.tag,val)
class ConfigInt(ConfigWidget):
@ -597,7 +227,7 @@ class ConfigInt(ConfigWidget):
def set(self):
val = self.w.get_value_as_int()
client.set_int(self.tag,val)
GrampsGconfKeys.client.set_int(self.tag,val)
class ConfigCheckbox(ConfigWidget):
@ -613,7 +243,7 @@ class ConfigCheckbox(ConfigWidget):
def set(self):
val = self.w.get_active()
client.set_bool(self.tag,val)
GrampsGconfKeys.client.set_bool(self.tag,val)
class ConfigFile(ConfigWidget):
@ -633,7 +263,7 @@ class ConfigFile(ConfigWidget):
def set(self):
val = self.w.get_full_path(0)
client.set_string(self.tag,val)
GrampsGconfKeys.client.set_string(self.tag,val)
def add_text(category,panel,frame,config_tag,label,default):
@ -703,88 +333,88 @@ class GrampsPreferences:
def build(self):
auto = self.top.get_widget("autoload")
auto.set_active(get_autoload())
auto.connect('toggled',lambda obj: save_autoload(obj.get_active()))
auto.set_active(GrampsGconfKeys.get_autoload())
auto.connect('toggled',lambda obj: GrampsGconfKeys.save_autoload(obj.get_active()))
lds = self.top.get_widget("uselds")
lds.set_active(get_uselds())
lds.connect('toggled',lambda obj: save_uselds(obj.get_active()))
lds.set_active(GrampsGconfKeys.get_uselds())
lds.connect('toggled',lambda obj: GrampsGconfKeys.save_uselds(obj.get_active()))
mr = self.top.get_widget("mediaref")
mc = self.top.get_widget("mediacopy")
if get_media_reference():
if GrampsGconfKeys.get_media_reference():
mr.set_active(1)
else:
mc.set_active(1)
mr.connect('toggled',lambda obj: save_media_reference(obj.get_active()))
dg = self.top.get_widget("globalprop")
dg.set_active(get_media_global())
dg.connect('toggled',lambda obj: save_media_global(obj.get_active()))
dg.set_active(GrampsGconfKeys.get_media_global())
dg.connect('toggled',lambda obj: GrampsGconfKeys.save_media_global(obj.get_active()))
dl = self.top.get_widget("localprop")
dl.set_active(get_media_local())
dl.connect('toggled',lambda obj: save_media_local(obj.get_active()))
dl.set_active(GrampsGconfKeys.get_media_local())
dl.connect('toggled',lambda obj: GrampsGconfKeys.save_media_local(obj.get_active()))
index_vis = self.top.get_widget("show_child_id")
index_vis.set_active(get_index_visible())
index_vis.connect('toggled',lambda obj: save_index_visible(obj.get_active()))
index_vis.set_active(GrampsGconfKeys.get_index_visible())
index_vis.connect('toggled',lambda obj: GrampsGconfKeys.save_index_visible(obj.get_active()))
ipr = self.top.get_widget("iprefix")
ipr.set_text(get_person_id_prefix())
ipr.connect('changed',lambda obj: save_iprefix(obj.get_text()))
ipr.set_text(GrampsGconfKeys.get_person_id_prefix())
ipr.connect('changed',lambda obj: GrampsGconfKeys.save_iprefix(obj.get_text()))
opr = self.top.get_widget("oprefix")
opr.set_text(get_object_id_prefix())
opr.connect('changed',lambda obj: save_oprefix(obj.get_text()))
opr.set_text(GrampsGconfKeys.get_object_id_prefix())
opr.connect('changed',lambda obj: GrampsGconfKeys.save_oprefix(obj.get_text()))
fpr = self.top.get_widget("fprefix")
fpr.set_text(get_family_id_prefix())
fpr.connect('changed',lambda obj: save_fprefix(obj.get_text()))
fpr.set_text(GrampsGconfKeys.get_family_id_prefix())
fpr.connect('changed',lambda obj: GrampsGconfKeys.save_fprefix(obj.get_text()))
spr = self.top.get_widget("sprefix")
spr.set_text(get_source_id_prefix())
spr.connect('changed',lambda obj: save_sprefix(obj.get_text()))
spr.set_text(GrampsGconfKeys.get_source_id_prefix())
spr.connect('changed',lambda obj: GrampsGconfKeys.save_sprefix(obj.get_text()))
ppr = self.top.get_widget("pprefix")
ppr.set_text(get_place_id_prefix())
ppr.connect('changed',lambda obj: save_pprefix(obj.get_text()))
ppr.set_text(GrampsGconfKeys.get_place_id_prefix())
ppr.connect('changed',lambda obj: GrampsGconfKeys.save_pprefix(obj.get_text()))
sb2 = self.top.get_widget("stat2")
sb3 = self.top.get_widget("stat3")
if get_statusbar() == 0 or get_statusbar() == 1:
if GrampsGconfKeys.get_statusbar() == 0 or GrampsGconfKeys.get_statusbar() == 1:
sb2.set_active(1)
else:
sb3.set_active(1)
sb2.connect('toggled',
lambda obj: save_statusbar(2-obj.get_active()))
lambda obj: GrampsGconfKeys.save_statusbar(2-obj.get_active()))
toolbarmenu = self.top.get_widget("tooloptmenu")
toolbarmenu.set_history(get_toolbar())
toolbarmenu.connect('changed',lambda obj: save_toolbar(obj.get_history()))
toolbarmenu.set_history(GrampsGconfKeys.get_toolbar())
toolbarmenu.connect('changed',lambda obj: GrampsGconfKeys.save_toolbar(obj.get_history()))
pvbutton = self.top.get_widget('pvbutton')
fvbutton = self.top.get_widget('fvbutton')
if get_default_view() == 0:
if GrampsGconfKeys.get_default_view() == 0:
pvbutton.set_active(1)
else:
fvbutton.set_active(1)
fvbutton.connect('toggled',lambda obj: save_default_view(obj.get_active()))
fvbutton.connect('toggled',lambda obj: GrampsGconfKeys.save_default_view(obj.get_active()))
familyview1 = self.top.get_widget('familyview1')
familyview2 = self.top.get_widget('familyview2')
if get_family_view() == 0:
if GrampsGconfKeys.get_family_view() == 0:
familyview1.set_active(1)
else:
familyview2.set_active(1)
familyview2.connect('toggled',lambda obj: save_family_view(obj.get_active()))
familyview2.connect('toggled',lambda obj: GrampsGconfKeys.save_family_view(obj.get_active()))
usetips = self.top.get_widget('usetips')
usetips.set_active(get_usetips())
usetips.connect('toggled',lambda obj: save_usetips(obj.get_active()))
usetips.set_active(GrampsGconfKeys.get_usetips())
usetips.connect('toggled',lambda obj: GrampsGconfKeys.save_usetips(obj.get_active()))
paper_obj = self.top.get_widget("paper_size")
menu = gtk.Menu()
choice = 0
for index in range(0,len(PaperMenu.paper_sizes)):
name = PaperMenu.paper_sizes[index].get_name()
if name == get_paper_preference():
if name == GrampsGconfKeys.get_paper_preference():
choice = index
item = gtk.MenuItem(name)
item.set_data(DATA,name)
@ -793,7 +423,7 @@ class GrampsPreferences:
menu.set_active(choice)
paper_obj.set_menu(menu)
paper_obj.connect("changed",
lambda obj: save_paper_preference(obj.get_menu().get_active().get_data(DATA)))
lambda obj: GrampsGconfKeys.save_paper_preference(obj.get_menu().get_active().get_data(DATA)))
lastnamegen_obj = self.top.get_widget("lastnamegen")
menu = gtk.Menu()
@ -804,16 +434,16 @@ class GrampsPreferences:
item.set_data(DATA,index)
item.show()
menu.append(item)
menu.set_active(get_lastnamegen())
menu.set_active(GrampsGconfKeys.get_lastnamegen(_surname_styles))
lastnamegen_obj.set_menu(menu)
lastnamegen_obj.connect("changed",
lambda obj: save_lastnamegen(obj.get_menu().get_active().get_data(DATA)))
lambda obj: GrampsGconfKeys.save_lastnamegen(obj.get_menu().get_active().get_data(DATA)),_surname_styles)
self.osubmenu = gtk.Menu()
choice = 0
index = 0
for name in [ _("No default format") ] + Plugins.get_text_doc_list():
if name == get_output_preference():
if name == GrampsGconfKeys.get_output_preference():
choice = index
item = gtk.MenuItem(name)
item.set_data(DATA,name)
@ -823,13 +453,13 @@ class GrampsPreferences:
self.osubmenu.set_active(choice)
self.ofmt.set_menu(self.osubmenu)
self.ofmt.connect("changed",
lambda obj: save_output_preference(obj.get_menu().get_active().get_data(DATA)))
lambda obj: GrampsGconfKeys.save_output_preference(obj.get_menu().get_active().get_data(DATA)))
self.gsubmenu = gtk.Menu()
choice = 0
index = 0
for name in [ _("No default format") ] + Plugins.get_draw_doc_list():
if name == get_goutput_preference():
if name == GrampsGconfKeys.get_goutput_preference():
choice = index
item = gtk.MenuItem(name)
item.set_data(DATA,name)
@ -839,7 +469,7 @@ class GrampsPreferences:
self.gsubmenu.set_active(choice)
self.gfmt.set_menu(self.gsubmenu)
self.gfmt.connect("changed",
lambda obj: save_goutput_preference(obj.get_menu().get_active().get_data(DATA)))
lambda obj: GrampsGconfKeys.save_goutput_preference(obj.get_menu().get_active().get_data(DATA)))
date_option = self.top.get_widget("date_format")
date_menu = gtk.Menu()
@ -849,10 +479,16 @@ class GrampsPreferences:
item.set_data(INDEX,index)
item.show()
date_menu.append(item)
date_menu.set_active(get_date_format())
try:
# Technically, a selected format might me out of range
# for this locale's format list.
date_menu.set_active(GrampsGconfKeys.get_date_format(dlist))
except:
pass
date_option.set_menu(date_menu)
date_option.connect("changed",
lambda obj: save_date_format(obj.get_menu().get_active().get_data(INDEX)))
lambda obj: GrampsGconfKeys.save_date_format(obj.get_menu().get_active().get_data(INDEX),dlist))
name_option = self.top.get_widget("name_format")
name_menu = gtk.Menu()
@ -862,42 +498,42 @@ class GrampsPreferences:
item.set_data(INDEX,index)
item.show()
name_menu.append(item)
name_menu.set_active(get_name_format())
name_menu.set_active(GrampsGconfKeys.get_name_format(_name_format_list))
name_option.set_menu(name_menu)
name_option.connect("changed",
lambda obj: save_name_format(obj.get_menu().get_active().get_data(INDEX)))
lambda obj: GrampsGconfKeys.save_name_format(obj.get_menu().get_active().get_data(INDEX),_name_format_list))
resname = self.top.get_widget("resname")
resname.set_text(get_researcher_name())
resname.connect('changed',lambda obj: save_researcher_name(obj.get_text()))
resname.set_text(GrampsGconfKeys.get_researcher_name())
resname.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_name(obj.get_text()))
resaddr = self.top.get_widget("resaddr")
resaddr.set_text(get_researcher_addr())
resaddr.connect('changed',lambda obj: save_researcher_addr(obj.get_text()))
resaddr.set_text(GrampsGconfKeys.get_researcher_addr())
resaddr.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_addr(obj.get_text()))
rescity = self.top.get_widget("rescity")
rescity.set_text(get_researcher_city())
rescity.connect('changed',lambda obj: save_researcher_city(obj.get_text()))
rescity.set_text(GrampsGconfKeys.get_researcher_city())
rescity.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_city(obj.get_text()))
resstate = self.top.get_widget("resstate")
resstate.set_text(get_researcher_state())
resstate.connect('changed',lambda obj: save_researcher_state(obj.get_text()))
resstate.set_text(GrampsGconfKeys.get_researcher_state())
resstate.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_state(obj.get_text()))
rescountry = self.top.get_widget("rescountry")
rescountry.set_text(get_researcher_country())
rescountry.connect('changed',lambda obj: save_researcher_country(obj.get_text()))
rescountry.set_text(GrampsGconfKeys.get_researcher_country())
rescountry.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_country(obj.get_text()))
respostal = self.top.get_widget("respostal")
respostal.set_text(get_researcher_postal())
respostal.connect('changed',lambda obj: save_researcher_postal(obj.get_text()))
respostal.set_text(GrampsGconfKeys.get_researcher_postal())
respostal.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_postal(obj.get_text()))
resphone = self.top.get_widget("resphone")
resphone.set_text(get_researcher_phone())
resphone.connect('changed',lambda obj: save_researcher_phone(obj.get_text()))
resphone.set_text(GrampsGconfKeys.get_researcher_phone())
resphone.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_phone(obj.get_text()))
resemail = self.top.get_widget("resemail")
resemail.set_text(get_researcher_email())
resemail.connect('changed',lambda obj: save_researcher_email(obj.get_text()))
resemail.set_text(GrampsGconfKeys.get_researcher_email())
resemail.connect('changed',lambda obj: GrampsGconfKeys.save_researcher_email(obj.get_text()))
repdir = self.top.get_widget("repdir").gtk_entry()
repdir.set_text(get_report_dir())
repdir.connect('changed',lambda obj: save_report_dir(obj.get_text()))
repdir.set_text(GrampsGconfKeys.get_report_dir())
repdir.connect('changed',lambda obj: GrampsGconfKeys.save_report_dir(obj.get_text()))
webdir = self.top.get_widget("htmldir").gtk_entry()
webdir.set_text(get_web_dir())
webdir.connect('changed',lambda obj: save_web_dir(obj.get_text()))
webdir.set_text(GrampsGconfKeys.get_web_dir())
webdir.connect('changed',lambda obj: GrampsGconfKeys.save_web_dir(obj.get_text()))
def build_ext(self):
self.c = {}

View File

@ -36,6 +36,8 @@ import time
import locale
from gettext import gettext as _
import GrampsGconfKeys
#-------------------------------------------------------------------------
#
# constants
@ -71,12 +73,12 @@ class GrampsDbBase:
self.lmap_index = 0
self.omap_index = 0
self.set_person_id_prefix(GrampsCfg.get_person_id_prefix())
self.set_object_id_prefix(GrampsCfg.get_object_id_prefix())
self.set_family_id_prefix(GrampsCfg.get_family_id_prefix())
self.set_source_id_prefix(GrampsCfg.get_source_id_prefix())
self.set_place_id_prefix(GrampsCfg.get_place_id_prefix())
self.set_event_id_prefix(GrampsCfg.get_event_id_prefix())
self.set_person_id_prefix(GrampsGconfKeys.get_person_id_prefix())
self.set_object_id_prefix(GrampsGconfKeys.get_object_id_prefix())
self.set_family_id_prefix(GrampsGconfKeys.get_family_id_prefix())
self.set_source_id_prefix(GrampsGconfKeys.get_source_id_prefix())
self.set_place_id_prefix(GrampsGconfKeys.get_place_id_prefix())
self.set_event_id_prefix(GrampsGconfKeys.get_event_id_prefix())
self.open = 0
self.genderStats = GenderStats()

View File

@ -0,0 +1,387 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
"""
Low-level handling of gconf keys.
"""
#-------------------------------------------------------------------------
#
# GConf
#
#-------------------------------------------------------------------------
# SUSE calls the gconf module "gnome.gconf"
try:
import gconf
except ImportError:
import gnome.gconf
gconf = gnome.gconf
client = gconf.client_get_default()
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
#-------------------------------------------------------------------------
#
# Functions to obtain values from gconf keys
# and store values into gconf keys
#
# All gramps keys should be accessed through these functions!
#
#-------------------------------------------------------------------------
# interface keys
def get_default_view():
return get_int("/apps/gramps/interface/defaultview",(0,1))
def save_default_view(val):
set_int("/apps/gramps/interface/defaultview",val,(0,1))
def get_family_view():
return get_int("/apps/gramps/interface/familyview",(0,1))
def save_family_view(val):
set_int("/apps/gramps/interface/familyview",val,(0,1))
def get_filter():
return get_bool("/apps/gramps/interface/filter")
def save_filter(val):
set_bool("/apps/gramps/interface/filter",val)
def get_index_visible():
return get_bool("/apps/gramps/interface/index-visible")
def save_index_visible(val):
set_bool("/apps/gramps/interface/index-visible",val)
def get_statusbar():
return get_int("/apps/gramps/interface/statusbar",(0,1,2))
def save_statusbar(val):
set_int("/apps/gramps/interface/statusbar",val,(0,1,2))
def get_toolbar():
return get_int("/apps/gramps/interface/toolbar",(0,1,2,3,5))
def save_toolbar(val):
set_int("/apps/gramps/interface/toolbar",val,(0,1,2,3,5))
def get_toolbar_on():
return get_bool("/apps/gramps/interface/toolbar-on")
def save_toolbar_on(val):
set_bool("/apps/gramps/interface/toolbar-on",val)
def get_view():
return get_bool("/apps/gramps/interface/view")
def save_view(val):
set_bool("/apps/gramps/interface/view",val)
# paths keys
def get_lastfile():
return get_string("/apps/gramps/paths/recent-file")
def save_last_file(val):
set_string("/apps/gramps/paths/recent-file",val)
def get_last_import_dir():
return get_string("/apps/gramps/paths/recent-import-dir")
def save_last_import_dir(val):
set_string_as_path("/apps/gramps/paths/recent-import-dir",val)
def get_last_export_dir():
return get_string("/apps/gramps/paths/recent-export-dir")
def save_last_export_dir(val):
set_string_as_path("/apps/gramps/paths/recent-export-dir",val)
def get_report_dir():
return get_string("/apps/gramps/paths/report-directory")
def save_report_dir(val):
set_string_as_path("/apps/gramps/paths/report-directory",val)
def get_web_dir():
return get_string("/apps/gramps/paths/website-directory")
def save_web_dir(val):
set_string_as_path("/apps/gramps/paths/website-directory",val)
# behavior keys
def get_startup():
return get_int("/apps/gramps/behavior/startup",(0,1))
def save_startup(val):
set_int("/apps/gramps/behavior/startup",val,(0,1))
def get_screen_size_checked():
return get_bool("/apps/gramps/interface/size-checked")
def save_screen_size_checked(val):
set_bool("/apps/gramps/interface/size-checked",val)
def get_autoload():
return get_bool("/apps/gramps/behavior/autoload")
def save_autoload(val):
set_bool("/apps/gramps/behavior/autoload",val)
def get_betawarn():
return get_bool("/apps/gramps/behavior/betawarn")
def save_betawarn(val):
set_bool("/apps/gramps/behavior/betawarn",val)
def get_media_reference():
return get_bool("/apps/gramps/behavior/make-reference")
def save_media_reference(val):
set_bool("/apps/gramps/behavior/make-reference",val)
def get_media_global():
return get_bool("/apps/gramps/behavior/media-global")
def save_media_global(val):
set_bool("/apps/gramps/behavior/media-global",val)
def get_media_local():
return get_bool("/apps/gramps/behavior/media-local")
def save_media_local(val):
set_bool("/apps/gramps/behavior/media-local",val)
def get_lastnamegen(_surname_styles=[]):
return get_int("/apps/gramps/behavior/surname-guessing",
range(len(_surname_styles)))
def save_lastnamegen(val,_surname_styles=[]):
set_int("/apps/gramps/behavior/surname-guessing",val,
range(len(_surname_styles)))
def get_uselds():
return get_bool("/apps/gramps/behavior/use-lds")
def save_uselds(val):
set_bool("/apps/gramps/behavior/use-lds",val)
def get_usetips():
return get_bool("/apps/gramps/behavior/use-tips")
def save_usetips(val):
set_bool("/apps/gramps/behavior/use-tips",val)
# preferences keys
def get_person_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def get_event_id_prefix():
return get_string("/apps/gramps/preferences/iprefix")
def save_iprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val)
def get_object_id_prefix():
return get_string("/apps/gramps/preferences/oprefix")
def save_oprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/oprefix",val)
def get_source_id_prefix():
return get_string("/apps/gramps/preferences/sprefix")
def save_sprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/sprefix",val)
def save_eprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/eprefix",val)
def get_place_id_prefix():
return get_string("/apps/gramps/preferences/pprefix")
def save_pprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/pprefix",val)
def get_family_id_prefix():
return get_string("/apps/gramps/preferences/fprefix")
def save_fprefix(val):
set_string_as_id_prefix("/apps/gramps/preferences/fprefix",val)
def get_paper_preference():
return get_string("/apps/gramps/preferences/paper-preference")
def save_paper_preference(val):
set_string("/apps/gramps/preferences/paper-preference",val)
def get_output_preference():
return get_string("/apps/gramps/preferences/output-preference")
def save_output_preference(val):
set_string("/apps/gramps/preferences/output-preference",val)
def get_goutput_preference():
return get_string("/apps/gramps/preferences/goutput-preference")
def save_goutput_preference(val):
set_string("/apps/gramps/preferences/goutput-preference",val)
def get_use_tips():
return get_bool("/apps/gramps/preferences/use-tips")
def save_use_tips(val):
set_bool("/apps/gramps/preferences/use-tips",val)
def get_date_format(_date_format_list=[]):
return get_int("/apps/gramps/preferences/date-format",
range(len(_date_format_list)))
def save_date_format(val,_date_format_list=[]):
set_int("/apps/gramps/preferences/date-format",val,
range(len(_date_format_list)))
def get_name_format(_name_format_list):
return get_int("/apps/gramps/preferences/name-format",
range(len(_name_format_list)))
def save_name_format(val,_name_format_list):
set_int("/apps/gramps/preferences/name-format",val,
range(len(_name_format_list)))
# researcher keys
def get_researcher_name():
return get_string("/apps/gramps/researcher/researcher-name")
def save_researcher_name(val):
set_string("/apps/gramps/researcher/researcher-name",val)
def get_researcher_addr():
return get_string("/apps/gramps/researcher/researcher-addr")
def save_researcher_addr(val):
set_string("/apps/gramps/researcher/researcher-addr",val)
def get_researcher_city():
return get_string("/apps/gramps/researcher/researcher-city")
def save_researcher_city(val):
set_string("/apps/gramps/researcher/researcher-city",val)
def get_researcher_state():
return get_string("/apps/gramps/researcher/researcher-state")
def save_researcher_state(val):
set_string("/apps/gramps/researcher/researcher-state",val)
def get_researcher_country():
return get_string("/apps/gramps/researcher/researcher-country")
def save_researcher_country(val):
set_string("/apps/gramps/researcher/researcher-country",val)
def get_researcher_postal():
return get_string("/apps/gramps/researcher/researcher-postal")
def save_researcher_postal(val):
set_string("/apps/gramps/researcher/researcher-postal",val)
def get_researcher_phone():
return get_string("/apps/gramps/researcher/researcher-phone")
def save_researcher_phone(val):
set_string("/apps/gramps/researcher/researcher-phone",val)
def get_researcher_email():
return get_string("/apps/gramps/researcher/researcher-email")
def save_researcher_email(val):
set_string("/apps/gramps/researcher/researcher-email",val)
#-------------------------------------------------------------------------
#
# Low-level grabbing and saving keys with error checking.
#
#-------------------------------------------------------------------------
def get_bool(key):
try:
val = client.get_bool(key)
except gobject.GError:
val = None
if val in (True,False):
return val
else:
return client.get_default_from_schema(key).get_bool()
def set_bool(key,val):
if val in (True,False):
client.set_bool(key,val)
def get_int(key,correct_tuple=None):
try:
val = client.get_int(key)
except gobject.GError:
val = None
if not correct_tuple or val in correct_tuple:
return val
else:
return client.get_default_from_schema(key).get_int()
def set_int(key,val,correct_tuple=None):
if not correct_tuple or val in correct_tuple:
client.set_int(key,val)
def get_string(key,test_func=None):
try:
val = client.get_string(key)
except gobject.GError:
val = None
if not test_func or test_func(val):
return val
else:
return client.get_default_from_schema(key).get_string()
def set_string(key,val,test_func=None):
if not test_func or test_func(val):
client.set_string(key,val)
def set_string_as_path(key,val):
if not val:
val = client.get_default_from_schema(key).get_string()
else:
val = os.path.normpath(val) + os.sep
client.set_string(key,val)
def set_string_as_id_prefix(key,val):
if not val:
val = client.get_default_from_schema(key).get_string()
else:
try:
junk = val % 1
except:
val = client.get_default_from_schema(key).get_string()
client.set_string(key,val)
def sync():
client.suggest_sync()

View File

@ -48,6 +48,7 @@ import gtk.glade
#-------------------------------------------------------------------------
import const
import Utils
import GrampsGconfKeys
import GrampsCfg
import Plugins
import RelLib
@ -471,11 +472,11 @@ class Gallery(ImageSelect):
(root,ext) = os.path.splitext(basename)
photo.set_description(root)
self.savephoto(photo)
if GrampsCfg.get_media_reference() == 0:
if GrampsGconfKeys.get_media_reference() == 0:
name = RelImage.import_media_object(name,self.path,photo.get_handle())
photo.set_path(name)
self.parent.lists_changed = 1
if GrampsCfg.get_media_global():
if GrampsGconfKeys.get_media_global():
GlobalMediaProperties(self.db,photo,None,
self,self.parent_window)
elif protocol != "":
@ -505,7 +506,7 @@ class Gallery(ImageSelect):
return
self.add_thumbnail(oref)
self.parent.lists_changed = 1
if GrampsCfg.get_media_global():
if GrampsGconfKeys.get_media_global():
GlobalMediaProperties(self.db,photo,None,
self,self.parent_window)
else:
@ -535,7 +536,7 @@ class Gallery(ImageSelect):
self.dataobj.add_media_reference(oref)
self.add_thumbnail(oref)
self.parent.lists_changed = 1
if GrampsCfg.get_media_global():
if GrampsGconfKeys.get_media_global():
LocalMediaProperties(oref,self.path,self,self.parent_window)
def on_photolist_drag_data_get(self,w, context, selection_data, info, time):

View File

@ -97,7 +97,8 @@ gdir_PYTHON = \
WriteXML.py\
SelectPerson.py\
ArgHandler.py\
Exporter.py
Exporter.py\
GrampsGconfKeys
# Could use GNU make's ':=' syntax for nice wildcard use.
# If not using GNU make, then list all files individually

View File

@ -43,7 +43,7 @@ import gtk.gdk
#-------------------------------------------------------------------------
import RelLib
import Utils
import GrampsCfg
import GrampsGconfKeys
import const
import ImageSelect
import RelImage
@ -374,7 +374,7 @@ class MediaView:
photo.set_description(description)
trans = self.db.transaction_begin()
self.db.add_object(photo,trans)
if GrampsCfg.get_media_reference() == 0:
if GrampsGconfKeys.get_media_reference() == 0:
name = RelImage.import_media_object(name,
self.db.get_save_path(),
photo.get_handle())
@ -384,7 +384,7 @@ class MediaView:
self.db.commit_media_object(photo,trans)
self.db.transaction_commit(trans,_("Add Media Object"))
if GrampsCfg.get_media_global():
if GrampsGconfKeys.get_media_global():
ImageSelect.GlobalMediaProperties(self.db,photo,
self.update_display,
self,self.topWindow)
@ -418,7 +418,7 @@ class MediaView:
self.db.commit_media_object(photo,trans)
self.db.transaction_commit(trans,_("Add Media Object"))
if GrampsCfg.get_media_global():
if GrampsGconfKeys.get_media_global():
ImageSelect.GlobalMediaProperties(self.db,photo,None,
self,self.topWindow)

View File

@ -55,7 +55,7 @@ from re import compile
#-------------------------------------------------------------------------
import const
import Utils
import GrampsCfg
import GrampsGconfKeys
import Errors
import gettext
@ -665,7 +665,7 @@ def get_text_doc_menu(main_menu,tables,callback,obj=None):
menuitem.connect("activate",callback)
menuitem.show()
myMenu.append(menuitem)
if name == GrampsCfg.get_output_preference():
if name == GrampsGconfKeys.get_output_preference():
myMenu.set_active(index)
callback(menuitem)
index = index + 1
@ -695,7 +695,7 @@ def get_book_menu(main_menu,tables,callback,obj=None):
menuitem.connect("activate",callback)
menuitem.show()
myMenu.append(menuitem)
if name == GrampsCfg.get_output_preference():
if name == GrampsGconfKeys.get_output_preference():
myMenu.set_active(index)
callback(menuitem)
index = index + 1
@ -759,7 +759,7 @@ def get_draw_doc_menu(main_menu,callback=None,obj=None):
menuitem.connect("activate",callback)
menuitem.show()
myMenu.append(menuitem)
if name == GrampsCfg.get_goutput_preference():
if name == GrampsGconfKeys.get_goutput_preference():
myMenu.set_active(index)
if callback:
callback(menuitem)

View File

@ -53,7 +53,7 @@ import Plugins
import GenericFilter
import BaseDoc
import StyleEditor
import GrampsCfg
import GrampsGconfKeys
import PaperMenu
from gettext import gettext as _
@ -839,7 +839,7 @@ class ReportDialog(BareReportDialog):
"""Get the name of the directory to which the target dialog
box should default. This value can be set in the preferences
panel."""
return GrampsCfg.get_report_dir()
return GrampsGconfKeys.get_report_dir()
def set_default_directory(self, value):
"""Save the name of the current directory, so that any future
@ -849,7 +849,7 @@ class ReportDialog(BareReportDialog):
This means that the last directory used will only be
remembered for this session of gramps unless the user saves
his/her preferences."""
GrampsCfg.save_report_dir(value)
GrampsGconfKeys.save_report_dir(value)
#------------------------------------------------------------------------
#
@ -1068,7 +1068,7 @@ class ReportDialog(BareReportDialog):
self.paper_table.attach(l,5,6,2,3,gtk.SHRINK|gtk.FILL)
PaperMenu.make_paper_menu(self.papersize_menu,
self.option_store.get('paper',GrampsCfg.get_paper_preference()))
self.option_store.get('paper',GrampsGconfKeys.get_paper_preference()))
PaperMenu.make_orientation_menu(self.orientation_menu,
self.option_store.get('orientation',BaseDoc.PAPER_PORTRAIT))

View File

@ -25,12 +25,12 @@ import gtk.glade
import gnome
import gnome.ui
import GrampsCfg
import GrampsGconfKeys
from gettext import gettext as _
def need_to_run():
val = GrampsCfg.get_startup()
val = GrampsGconfKeys.get_startup()
if val < const.startup:
return 1
return 0
@ -95,17 +95,17 @@ class StartupDialog:
return p
def complete(self,obj,obj2):
GrampsCfg.save_researcher_name(unicode(self.name.get_text()))
GrampsCfg.save_researcher_addr(unicode(self.addr.get_text()))
GrampsCfg.save_researcher_city(unicode(self.city.get_text()))
GrampsCfg.save_researcher_state(unicode(self.state.get_text()))
GrampsCfg.save_researcher_postal(unicode(self.postal.get_text()))
GrampsCfg.save_researcher_country(unicode(self.country.get_text()))
GrampsCfg.save_researcher_phone(unicode(self.phone.get_text()))
GrampsCfg.save_researcher_email(unicode(self.email.get_text()))
GrampsGconfKeys.save_researcher_name(unicode(self.name.get_text()))
GrampsGconfKeys.save_researcher_addr(unicode(self.addr.get_text()))
GrampsGconfKeys.save_researcher_city(unicode(self.city.get_text()))
GrampsGconfKeys.save_researcher_state(unicode(self.state.get_text()))
GrampsGconfKeys.save_researcher_postal(unicode(self.postal.get_text()))
GrampsGconfKeys.save_researcher_country(unicode(self.country.get_text()))
GrampsGconfKeys.save_researcher_phone(unicode(self.phone.get_text()))
GrampsGconfKeys.save_researcher_email(unicode(self.email.get_text()))
GrampsCfg.save_uselds(self.lds.get_active())
GrampsCfg.save_startup(const.startup)
GrampsGconfKeys.save_uselds(self.lds.get_active())
GrampsGconfKeys.save_startup(const.startup)
self.w.destroy()
self.task(self.args)
@ -143,7 +143,7 @@ class StartupDialog:
box.add(table)
box.show_all()
name = GrampsCfg.get_researcher_name()
name = GrampsGconfKeys.get_researcher_name()
if not name or name.strip() == "":
import pwd
import os
@ -154,13 +154,13 @@ class StartupDialog:
name = ""
self.name.set_text(name)
self.addr.set_text(GrampsCfg.get_researcher_addr())
self.city.set_text(GrampsCfg.get_researcher_city())
self.state.set_text(GrampsCfg.get_researcher_state())
self.postal.set_text(GrampsCfg.get_researcher_postal())
self.country.set_text(GrampsCfg.get_researcher_country())
self.phone.set_text(GrampsCfg.get_researcher_phone())
self.email.set_text(GrampsCfg.get_researcher_email())
self.addr.set_text(GrampsGconfKeys.get_researcher_addr())
self.city.set_text(GrampsGconfKeys.get_researcher_city())
self.state.set_text(GrampsGconfKeys.get_researcher_state())
self.postal.set_text(GrampsGconfKeys.get_researcher_postal())
self.country.set_text(GrampsGconfKeys.get_researcher_country())
self.phone.set_text(GrampsGconfKeys.get_researcher_phone())
self.email.set_text(GrampsGconfKeys.get_researcher_email())
return p
@ -188,7 +188,7 @@ class StartupDialog:
self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support"))
self.lds.set_active(GrampsCfg.get_uselds())
self.lds.set_active(GrampsGconfKeys.get_uselds())
align.add(self.lds)

View File

@ -23,7 +23,7 @@ import string
import gtk
import gtk.glade
import const
import GrampsCfg
import GrampsGconfKeys
class TipOfDay:
def __init__(self):
@ -34,7 +34,7 @@ class TipOfDay:
tp = TipParser()
tip_list = tp.get()
use.set_active(GrampsCfg.get_usetips())
use.set_active(GrampsGconfKeys.get_usetips())
index = 0
rval = 0
@ -46,7 +46,7 @@ class TipOfDay:
else:
index += 1
GrampsCfg.save_usetips(use.get_active())
GrampsGconfKeys.save_usetips(use.get_active())
top.destroy()
class TipParser:

View File

@ -275,9 +275,9 @@ def strip_id(text):
return text
def nautilus_icon(icon,mime_type):
import GrampsCfg
import GrampsGconfKeys
theme = GrampsCfg.client.get_string("/desktop/gnome/file_views/icon_theme")
theme = GrampsGconfKeys.client.get_string("/desktop/gnome/file_views/icon_theme")
if icon :
newicon = "%s/%s/%s.png" % (const.nautdir,theme,icon)

View File

@ -67,6 +67,7 @@ import const
import Plugins
import Utils
import Bookmarks
import GrampsGconfKeys
import GrampsCfg
import EditPerson
import DbPrompter
@ -133,13 +134,13 @@ class Gramps:
GrampsCfg.loadConfig()
if GrampsCfg.get_betawarn() == 0:
if GrampsGconfKeys.get_betawarn() == 0:
WarningDialog(_("Use at your own risk"),
_("This is an unstable development version of GRAMPS. "
"It is intended as a technology preview. Do not trust your "
"family database to this development version. This version may "
"contain bugs which could corrupt your database."))
GrampsCfg.save_betawarn(1)
GrampsGconfKeys.save_betawarn(1)
self.RelClass = Plugins.relationship_class
self.relationship = self.RelClass(self.db)
@ -151,29 +152,27 @@ class Gramps:
# Don't show main window until ArgHandler is done.
# This prevents a window from annoyingly popping up when
# the command line args are sufficient to operate without it.
GrampsCfg.client.notify_add("/apps/gramps/researcher",
GrampsGconfKeys.client.notify_add("/apps/gramps/researcher",
self.researcher_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/statusbar",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/statusbar",
self.statusbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/toolbar",
self.toolbar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/toolbar-on",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/toolbar-on",
self.toolbar_on_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/filter",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/filter",
self.filter_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/view",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/view",
self.sidebar_key_update)
GrampsCfg.client.notify_add("/apps/gramps/interface/familyview",
GrampsGconfKeys.client.notify_add("/apps/gramps/interface/familyview",
self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/name-format",
GrampsGconfKeys.client.notify_add("/apps/gramps/preferences/name-format",
self.familyview_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-format",
GrampsGconfKeys.client.notify_add("/apps/gramps/preferences/date-format",
self.date_format_key_update)
GrampsCfg.client.notify_add("/apps/gramps/preferences/date-entry",
self.date_entry_key_update)
self.topWindow.show()
if GrampsCfg.get_usetips():
if GrampsGconfKeys.get_usetips():
TipOfDay.TipOfDay()
self.db.set_researcher(GrampsCfg.get_researcher())
@ -183,16 +182,13 @@ class Gramps:
GrampsCfg.set_calendar_date_format()
self.familyview_key_update(client,cnxn_id,entry,data)
def date_entry_key_update(self,client,cnxn_id,entry,data):
GrampsCfg.set_calendar_date_entry()
def researcher_key_update(self,client,cnxn_id,entry,data):
self.db.set_person_id_prefix(GrampsCfg.get_person_id_prefix())
self.db.set_family_id_prefix(GrampsCfg.get_family_id_prefix())
self.db.set_source_id_prefix(GrampsCfg.get_source_id_prefix())
self.db.set_object_id_prefix(GrampsCfg.get_object_id_prefix())
self.db.set_place_id_prefix(GrampsCfg.get_place_id_prefix())
self.db.set_event_id_prefix(GrampsCfg.get_event_id_prefix())
self.db.set_person_id_prefix(GrampsGconfKeys.get_person_id_prefix())
self.db.set_family_id_prefix(GrampsGconfKeys.get_family_id_prefix())
self.db.set_source_id_prefix(GrampsGconfKeys.get_source_id_prefix())
self.db.set_object_id_prefix(GrampsGconfKeys.get_object_id_prefix())
self.db.set_place_id_prefix(GrampsGconfKeys.get_place_id_prefix())
self.db.set_event_id_prefix(GrampsGconfKeys.get_event_id_prefix())
def statusbar_key_update(self,client,cnxn_id,entry,data):
self.modify_statusbar()
@ -201,17 +197,17 @@ class Gramps:
self.toolbar.set_style(GrampsCfg.get_toolbar_style())
def toolbar_on_key_update(self,client,cnxn_id,entry,data):
is_on = GrampsCfg.get_toolbar_on()
is_on = GrampsGconfKeys.get_toolbar_on()
self.toolbar_btn.set_active(is_on)
self.enable_toolbar(is_on)
def filter_key_update(self,client,cnxn_id,entry,data):
is_on = GrampsCfg.get_filter()
is_on = GrampsGconfKeys.get_filter()
self.filter_btn.set_active(is_on)
self.enable_filter(is_on)
def sidebar_key_update(self,client,cnxn_id,entry,data):
is_on = GrampsCfg.get_view()
is_on = GrampsGconfKeys.get_view()
self.sidebar_btn.set_active(is_on)
self.enable_sidebar(is_on)
@ -382,25 +378,25 @@ class Gramps:
"on_open_example" : self.open_example,
})
self.filter_btn.set_active(GrampsCfg.get_filter())
self.enable_filter(GrampsCfg.get_filter())
self.toolbar_btn.set_active(GrampsCfg.get_toolbar_on())
self.enable_toolbar(GrampsCfg.get_toolbar_on())
self.filter_btn.set_active(GrampsGconfKeys.get_filter())
self.enable_filter(GrampsGconfKeys.get_filter())
self.toolbar_btn.set_active(GrampsGconfKeys.get_toolbar_on())
self.enable_toolbar(GrampsGconfKeys.get_toolbar_on())
if not GrampsCfg.get_screen_size_checked():
GrampsCfg.save_screen_size_checked(1)
if not GrampsGconfKeys.get_screen_size_checked():
GrampsGconfKeys.save_screen_size_checked(1)
if gtk.gdk.screen_width() <= 900:
GrampsCfg.save_view(0)
self.sidebar_btn.set_active(GrampsCfg.get_view())
self.enable_sidebar(GrampsCfg.get_view())
GrampsGconfKeys.save_view(0)
self.sidebar_btn.set_active(GrampsGconfKeys.get_view())
self.enable_sidebar(GrampsGconfKeys.get_view())
self.find_place = None
self.find_source = None
self.find_media = None
if GrampsCfg.get_default_view() == 0:
if GrampsGconfKeys.get_default_view() == 0:
self.views.set_current_page(PERSON_VIEW)
elif GrampsCfg.get_family_view() == 0:
elif GrampsGconfKeys.get_family_view() == 0:
self.views.set_current_page(FAMILY_VIEW1)
else:
self.views.set_current_page(FAMILY_VIEW2)
@ -732,7 +728,7 @@ class Gramps:
def on_sidebar_activate(self,obj):
self.enable_sidebar(obj.get_active())
GrampsCfg.save_view(obj.get_active())
GrampsGconfKeys.save_view(obj.get_active())
def enable_sidebar(self,val):
if val:
@ -749,10 +745,10 @@ class Gramps:
self.filterbar.hide()
def on_filter_activate(self,obj):
GrampsCfg.save_filter(obj.get_active())
GrampsGconfKeys.save_filter(obj.get_active())
def on_toolbar_activate(self,obj):
GrampsCfg.save_toolbar_on(obj.get_active())
GrampsGconfKeys.save_toolbar_on(obj.get_active())
def enable_toolbar(self,val):
if val:
@ -1079,7 +1075,7 @@ class Gramps:
name = os.path.basename(filename)
self.topWindow.set_title("%s - GRAMPS" % name)
else:
GrampsCfg.save_last_file("")
GrampsGconfKeys.save_last_file("")
ErrorDialog(_('Cannot open database'),
_('The database file specified could not be opened file.'))
return 0
@ -1337,7 +1333,7 @@ class Gramps:
if self.active_person == None:
self.status_text("")
else:
if GrampsCfg.get_statusbar() <= 1:
if GrampsGconfKeys.get_statusbar() <= 1:
pname = GrampsCfg.get_nameof()(self.active_person)
name = "[%s] %s" % (self.active_person.get_gramps_id(),pname)
else:
@ -1385,7 +1381,7 @@ class Gramps:
def on_family_activate(self,obj):
"""Switches to the family view"""
if GrampsCfg.get_family_view() == 0:
if GrampsGconfKeys.get_family_view() == 0:
self.on_family1_activate(obj)
else:
self.on_family2_activate(obj)
@ -1522,7 +1518,7 @@ class Gramps:
self.setup_bookmarks()
GrampsCfg.save_last_file(name)
GrampsGconfKeys.save_last_file(name)
self.gtop.get_widget("filter").set_text("")
self.statusbar.set_progress_percentage(1.0)