Config method changed
svn: r6429
This commit is contained in:
parent
999711b902
commit
5afa945819
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2006-04-24 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_FamilyView.py: Config changes
|
||||
* src/ViewManager.py: Config changes
|
||||
* src/GrampsDb/_GrampsDbBase.py: Config changes
|
||||
* src/Exporter.py: Config changes
|
||||
* src/GrampsCfg.py: Config changes
|
||||
* src/Config/_GrampsConfigKeys.py: Config changes
|
||||
* src/Config/__init__.py: Config changes
|
||||
* src/Config/_GrampsGconfKeys.py: Config changes
|
||||
* src/Config/Makefile.am: Config changes
|
||||
* src/Config/_GrampsIniKeys.py: Config changes
|
||||
* src/Config/gen_schema_keys.py: Config changes
|
||||
* src/StartupDialog.py: Config changes
|
||||
* src/Editors/_EditPrimary.py: Config changes
|
||||
* src/Editors/_EditFamily.py: Config changes
|
||||
* src/TipOfDay.py: Config changes
|
||||
* src/DisplayState.py: Config changes
|
||||
* src/Spell.py: Config changes
|
||||
* src/QuestionDialog.py: Config changes
|
||||
* src/PluginUtils/_Report.py: Config changes
|
||||
* src/PluginUtils/_Plugins.py: Config changes
|
||||
* src/PluginUtils/_ReportOptions.py: Config changes
|
||||
* src/gramps_main.py: Config changes
|
||||
* src/ArgHandler.py: Config changes
|
||||
|
||||
2006-04-23 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_MediaView.py: Column editor changes
|
||||
* src/DataViews/_RepositoryView.py: Column editor changes
|
||||
|
@ -397,8 +397,8 @@ class ArgHandler:
|
||||
|
||||
## if self.imports:
|
||||
## self.parent.import_tool_callback()
|
||||
elif Config.get_lastfile() and Config.get_autoload():
|
||||
self.auto_save_load(Config.get_lastfile())
|
||||
elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
|
||||
self.auto_save_load(Config.get(Config.RECENT_FILE))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -688,11 +688,11 @@ class NewNativeDbPrompter:
|
||||
|
||||
# Suggested folder: try last open file, import, then last export,
|
||||
# then home.
|
||||
default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep
|
||||
default_dir = os.path.split(Config.get(Config.RECENT_FILE))[0] + os.path.sep
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_import_dir()
|
||||
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_export_dir()
|
||||
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = '~/'
|
||||
|
||||
|
@ -8,6 +8,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/Config
|
||||
pkgdata_PYTHON = \
|
||||
__init__.py\
|
||||
_GrampsGconfKeys.py\
|
||||
_GrampsConfigKeys.py\
|
||||
_GrampsIniKeys.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/Config
|
||||
|
128
src/Config/_GrampsConfigKeys.py
Normal file
128
src/Config/_GrampsConfigKeys.py
Normal file
@ -0,0 +1,128 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2006 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
|
||||
#
|
||||
|
||||
FAMILY_DETAILS = ('preferences','family-details', 0)
|
||||
FAMILY_SIBLINGS = ('preferences','family-siblings', 0)
|
||||
AUTOLOAD = ('behavior','autoload', 0)
|
||||
SPELLCHECK = ('behavior','spellcheck', 0)
|
||||
BETAWARN = ('behavior','betawarn', 0)
|
||||
FAMILY_WARN = ('behavior','family-warn', 0)
|
||||
WELCOME = ('behavior','welcome', 1)
|
||||
DATE_FORMAT = ('preferences','date-format', 1)
|
||||
DONT_ASK = ('interface','dont-ask', 0)
|
||||
DEFAULTVIEW = ('interface','defaultview', 1)
|
||||
HEIGHT = ('interface','height', 1)
|
||||
WIDTH = ('interface','width', 1)
|
||||
FAMILYVIEW = ('interface','familyview', 1)
|
||||
FILTER = ('interface','filter', 0)
|
||||
FPREFIX = ('preferences','fprefix', 2)
|
||||
EPREFIX = ('preferences','eprefix', 2)
|
||||
IPREFIX = ('preferences','iprefix', 2)
|
||||
OPREFIX = ('preferences','oprefix', 2)
|
||||
PPREFIX = ('preferences','pprefix', 2)
|
||||
SPREFIX = ('preferences','sprefix', 2)
|
||||
RPREFIX = ('preferences','rprefix', 2)
|
||||
GOUTPUT_PREFERENCE = ('preferences','goutput-preference', 2)
|
||||
OUTPUT_PREFERENCE = ('preferences','output-preference', 2)
|
||||
PAPER_PREFERENCE = ('preferences','paper-preference', 2)
|
||||
RECENT_FILE = ('paths','recent-file', 2)
|
||||
RECENT_IMPORT_DIR = ('paths','recent-import-dir', 2)
|
||||
RECENT_EXPORT_DIR = ('paths','recent-export-dir', 2)
|
||||
MAKE_REFERENCE = ('behavior','make-reference', 0)
|
||||
MEDIA_GLOBAL = ('behavior','media-global', 0)
|
||||
MEDIA_LOCAL = ('behavior','media-local', 0)
|
||||
NAME_FORMAT = ('preferences','name-format', 1)
|
||||
REPORT_DIRECTORY = ('paths','report-directory', 2)
|
||||
RESEARCHER_ADDR = ('researcher','researcher-addr', 2)
|
||||
RESEARCHER_CITY = ('researcher','researcher-city', 2)
|
||||
RESEARCHER_COUNTRY = ('researcher','researcher-country', 2)
|
||||
RESEARCHER_EMAIL = ('researcher','researcher-email', 2)
|
||||
RESEARCHER_NAME = ('researcher','researcher-name', 2)
|
||||
RESEARCHER_PHONE = ('researcher','researcher-phone', 2)
|
||||
RESEARCHER_POSTAL = ('researcher','researcher-postal', 2)
|
||||
RESEARCHER_STATE = ('researcher','researcher-state', 2)
|
||||
SHOW_CALENDAR = ('behavior','show-calendar', 0)
|
||||
STARTUP = ('behavior','startup', 1)
|
||||
SIZE_CHECKED = ('interface','size-checked', 0)
|
||||
STATUSBAR = ('interface','statusbar', 1)
|
||||
SURNAME_GUESSING = ('behavior','surname-guessing', 1)
|
||||
TOOLBAR = ('interface','toolbar', 1)
|
||||
TOOLBAR_ON = ('interface','toolbar-on', 0)
|
||||
USE_LDS = ('behavior','use-lds', 0)
|
||||
USE_TIPS = ('behavior','use-tips', 0)
|
||||
POP_PLUGIN_STATUS = ('behavior','pop-plugin-status', 0)
|
||||
VIEW = ('interface','view', 0)
|
||||
WEBSITE_DIRECTORY = ('paths','website-directory', 2)
|
||||
|
||||
|
||||
default_value = {
|
||||
FAMILY_DETAILS : True,
|
||||
FAMILY_SIBLINGS : True,
|
||||
AUTOLOAD : False,
|
||||
SPELLCHECK : False,
|
||||
BETAWARN : False,
|
||||
FAMILY_WARN : False,
|
||||
WELCOME : 100,
|
||||
DATE_FORMAT : 0,
|
||||
DONT_ASK : False,
|
||||
DEFAULTVIEW : 0,
|
||||
HEIGHT : 500,
|
||||
WIDTH : 775,
|
||||
FAMILYVIEW : 0,
|
||||
FILTER : False,
|
||||
FPREFIX : 'F%04d',
|
||||
EPREFIX : 'E%04d',
|
||||
IPREFIX : 'I%04d',
|
||||
OPREFIX : 'O%04d',
|
||||
PPREFIX : 'P%04d',
|
||||
SPREFIX : 'S%04d',
|
||||
RPREFIX : 'R%04d',
|
||||
GOUTPUT_PREFERENCE : 'No default format',
|
||||
OUTPUT_PREFERENCE : 'No default format',
|
||||
PAPER_PREFERENCE : 'Letter',
|
||||
RECENT_FILE : '',
|
||||
RECENT_IMPORT_DIR : '',
|
||||
RECENT_EXPORT_DIR : '',
|
||||
MAKE_REFERENCE : True,
|
||||
MEDIA_GLOBAL : True,
|
||||
MEDIA_LOCAL : True,
|
||||
NAME_FORMAT : 0,
|
||||
REPORT_DIRECTORY : './',
|
||||
RESEARCHER_ADDR : '',
|
||||
RESEARCHER_CITY : '',
|
||||
RESEARCHER_COUNTRY : '',
|
||||
RESEARCHER_EMAIL : '',
|
||||
RESEARCHER_NAME : '',
|
||||
RESEARCHER_PHONE : '',
|
||||
RESEARCHER_POSTAL : '',
|
||||
RESEARCHER_STATE : '',
|
||||
SHOW_CALENDAR : False,
|
||||
STARTUP : 0,
|
||||
SIZE_CHECKED : False,
|
||||
STATUSBAR : 1,
|
||||
SURNAME_GUESSING : 0,
|
||||
TOOLBAR : -1,
|
||||
TOOLBAR_ON : True,
|
||||
USE_LDS : False,
|
||||
USE_TIPS : False,
|
||||
POP_PLUGIN_STATUS : False,
|
||||
VIEW : True,
|
||||
WEBSITE_DIRECTORY : './',
|
||||
}
|
@ -39,6 +39,7 @@ except ImportError:
|
||||
import gobject
|
||||
import os
|
||||
import Errors
|
||||
from _GrampsConfigKeys import default_value
|
||||
|
||||
client = gconf.client_get_default()
|
||||
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
||||
@ -53,258 +54,6 @@ client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# 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_height():
|
||||
return get_int("/apps/gramps/interface/height")
|
||||
|
||||
def save_height(val):
|
||||
set_int("/apps/gramps/interface/height",val)
|
||||
|
||||
def get_width():
|
||||
return get_int("/apps/gramps/interface/width")
|
||||
|
||||
def save_width(val):
|
||||
set_int("/apps/gramps/interface/width",val)
|
||||
|
||||
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_dont_ask():
|
||||
return get_bool("/apps/gramps/interface/dont-ask")
|
||||
|
||||
def save_dont_ask(val):
|
||||
set_bool("/apps/gramps/interface/dont-ask",val)
|
||||
|
||||
def get_family_warn():
|
||||
return get_bool("/apps/gramps/interface/family-warn")
|
||||
|
||||
def save_family_warn(val):
|
||||
set_bool("/apps/gramps/interface/family-warn",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",(-1,0,1,2,3))
|
||||
|
||||
def save_toolbar(val):
|
||||
set_int("/apps/gramps/interface/toolbar",val,(-1,0,1,2,3))
|
||||
|
||||
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 get_spellcheck():
|
||||
return get_bool("/apps/gramps/behavior/spellcheck")
|
||||
|
||||
def save_autoload(val):
|
||||
set_bool("/apps/gramps/behavior/autoload",val)
|
||||
|
||||
def save_spellcheck(val):
|
||||
set_bool("/apps/gramps/behavior/spellcheck",val)
|
||||
|
||||
def get_betawarn():
|
||||
return get_bool("/apps/gramps/behavior/betawarn")
|
||||
|
||||
def save_betawarn(val):
|
||||
set_bool("/apps/gramps/behavior/betawarn",val)
|
||||
|
||||
def get_welcome():
|
||||
return get_int("/apps/gramps/behavior/welcome")
|
||||
|
||||
def save_welcome(val):
|
||||
set_int("/apps/gramps/behavior/welcome",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)
|
||||
|
||||
def get_pop_plugin_status():
|
||||
return get_bool("/apps/gramps/behavior/pop-plugin-status")
|
||||
|
||||
def save_pop_plugin_status(val):
|
||||
set_bool("/apps/gramps/behavior/pop-plugin-status",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/eprefix")
|
||||
|
||||
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_repository_id_prefix():
|
||||
return get_string("/apps/gramps/preferences/rprefix")
|
||||
|
||||
def save_rprefix(val):
|
||||
set_string_as_id_prefix("/apps/gramps/preferences/rprefix",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)))
|
||||
@ -321,72 +70,33 @@ 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)
|
||||
|
||||
def get_family_details():
|
||||
return get_bool("/apps/gramps/preferences/family-details")
|
||||
|
||||
def save_family_details(val):
|
||||
set_bool("/apps/gramps/preferences/family-details",val)
|
||||
|
||||
def get_family_siblings():
|
||||
return get_bool("/apps/gramps/preferences/family-siblings")
|
||||
|
||||
def save_family_siblings(val):
|
||||
set_bool("/apps/gramps/preferences/family-siblings",val)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Low-level grabbing and saving keys with error checking.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def set(key, value):
|
||||
token = "/apps/gramps/%s/%s" % (key[0],key[1])
|
||||
if key[2] == 0:
|
||||
set_bool(token,value)
|
||||
elif key[2] == 1:
|
||||
set_int(token,value)
|
||||
else:
|
||||
set_string(token,value)
|
||||
|
||||
def get(key):
|
||||
token = "/apps/gramps/%s/%s" % (key[0],key[1])
|
||||
if key[2] == 0:
|
||||
val = get_bool(token)
|
||||
elif key[2] == 1:
|
||||
val = get_int(token)
|
||||
else:
|
||||
val = get_string(token)
|
||||
if not val:
|
||||
val = default_value[key]
|
||||
return val
|
||||
|
||||
def get_bool(key):
|
||||
try:
|
||||
val = client.get_bool(key)
|
||||
@ -438,22 +148,5 @@ 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()
|
||||
|
@ -29,64 +29,10 @@ import time
|
||||
import ConfigParser
|
||||
import errno
|
||||
import const
|
||||
from _GrampsConfigKeys import *
|
||||
|
||||
NL = "\n" # FIX: newlines on Mac/Windows, if different?
|
||||
|
||||
# the following table was generated from data/gramps.schemas
|
||||
|
||||
_ini_schema = {
|
||||
'behavior/autoload' : '0',
|
||||
'behavior/spellcheck' : '1',
|
||||
'behavior/betawarn' : '0',
|
||||
'behavior/welcome' : '100',
|
||||
'preferences/date-format' : '0',
|
||||
'preferences/dont-ask' : '0',
|
||||
'interface/defaultview' : '0',
|
||||
'interface/familyview' : '0',
|
||||
'interface/filter' : '0',
|
||||
'preferences/fprefix' : 'F%04d',
|
||||
'preferences/eprefix' : 'E%04d',
|
||||
'preferences/iprefix' : 'I%04d',
|
||||
'preferences/oprefix' : 'O%04d',
|
||||
'preferences/pprefix' : 'P%04d',
|
||||
'preferences/sprefix' : 'S%04d',
|
||||
'preferences/rprefix' : 'R%04d',
|
||||
'preferences/goutput-preference' : 'No default format',
|
||||
'preferences/output-preference' : 'No default format',
|
||||
'preferences/paper-preference' : 'Letter',
|
||||
'index-visible' : '0',
|
||||
'interface/index-visible' : '0',
|
||||
'paths/recent-file' : '',
|
||||
'paths/recent-import-dir' : '',
|
||||
'paths/recent-export-dir' : '',
|
||||
'behavior/make-reference' : '1',
|
||||
'behavior/media-global' : '1',
|
||||
'behavior/media-local' : '1',
|
||||
'preferences/name-format' : '0',
|
||||
'paths/report-directory' : './',
|
||||
'researcher/researcher-addr' : '',
|
||||
'researcher/researcher-city' : '',
|
||||
'researcher/researcher-country' : '',
|
||||
'researcher/researcher-email' : '',
|
||||
'researcher/researcher-name' : '',
|
||||
'researcher/researcher-phone' : '',
|
||||
'researcher/researcher-postal' : '',
|
||||
'researcher/researcher-state' : '',
|
||||
'behavior/show-calendar' : '0',
|
||||
'behavior/startup' : '0',
|
||||
'interface/size-checked' : '0',
|
||||
'interface/statusbar' : '1',
|
||||
'behavior/surname-guessing' : '0',
|
||||
'interface/toolbar' : '5',
|
||||
'interface/toolbar-on' : '1',
|
||||
'behavior/use-lds' : '0',
|
||||
'behavior/use-tips' : '0',
|
||||
'behavior/pop-plugin-status' : '0',
|
||||
'interface/view' : '1',
|
||||
'paths/website-directory' : './',
|
||||
}
|
||||
|
||||
|
||||
def make_bool(val):
|
||||
""" Function to turn strings into booleans. """
|
||||
# these are the possible strings that should be considered False
|
||||
@ -104,6 +50,7 @@ class IniKeyClient:
|
||||
self.filename = filename
|
||||
if self.filename and os.path.exists(filename):
|
||||
self.data = self.load_ini(self.filename)
|
||||
|
||||
def notify_add(self, path, func):
|
||||
"""
|
||||
I think that these are callbacks that get called when the keys
|
||||
@ -116,6 +63,7 @@ class IniKeyClient:
|
||||
if section not in self.callbacks:
|
||||
self.callbacks[section] = {}
|
||||
self.callbacks[section][key] = func
|
||||
|
||||
def load_ini(self, filename):
|
||||
""" Load .ini into dict of dicts, which it returns """
|
||||
cp = ConfigParser.ConfigParser()
|
||||
@ -128,6 +76,7 @@ class IniKeyClient:
|
||||
for opt in cp.options(sec):
|
||||
data[name][opt.lower()] = cp.get(sec, opt).strip()
|
||||
return data
|
||||
|
||||
def save_ini(self, filename = None):
|
||||
"""
|
||||
Saves the current section/keys to a .ini file. Optional filename
|
||||
@ -156,47 +105,48 @@ class IniKeyClient:
|
||||
fp.write(NL)
|
||||
fp.close()
|
||||
# else, no filename given
|
||||
def get_bool(self, section, key):
|
||||
|
||||
def get_bool(self, key):
|
||||
""" Emulates gconf's client method """
|
||||
return make_bool(self.data[section][key])
|
||||
def get_string(self, section, key):
|
||||
return make_bool(self.data[key[0]][key[1]])
|
||||
|
||||
def get_string(self, key):
|
||||
""" Emulates gconf's client method """
|
||||
return self.data[section][key]
|
||||
def get_int(self, section, key):
|
||||
return self.data[key[0]][key[1]]
|
||||
|
||||
def get_int(self, key):
|
||||
""" Emulates gconf's client method """
|
||||
if self.data[section][key].isdigit():
|
||||
return int(self.data[section][key])
|
||||
elif self.data[section][key].lower() in ["true"]:
|
||||
if self.data[key[0]][key[1]].isdigit():
|
||||
return int(self.data[key[0]][key[1]])
|
||||
elif self.data[key[0]][key[1]].lower() in ["true"]:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
def set_bool(self, section, key, val):
|
||||
|
||||
def set_bool(self, key, val):
|
||||
""" Emulates gconf's client method """
|
||||
if section not in self.data:
|
||||
self.data[section] = {}
|
||||
self.data[section][key] = str(val)
|
||||
if section in self.callbacks and key in self.callbacks[section]:
|
||||
self.callbacks[section][key](self,0,self.data[section][key],None)
|
||||
def set_string(self, section, key, val):
|
||||
if key[0] not in self.data:
|
||||
self.data[key[0]] = {}
|
||||
self.data[key[0]][key[1]] = str(val)
|
||||
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
|
||||
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
|
||||
|
||||
def set_string(self, key, val):
|
||||
""" Emulates gconf's client method """
|
||||
if section not in self.data:
|
||||
self.data[section] = {}
|
||||
self.data[section][key] = val
|
||||
if section in self.callbacks and key in self.callbacks[section]:
|
||||
self.callbacks[section][key](self,0,self.data[section][key],None)
|
||||
def set_int(self, section, key, val):
|
||||
if key[0] not in self.data:
|
||||
self.data[key[0]] = {}
|
||||
self.data[key[0]][key[1]] = val
|
||||
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
|
||||
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
|
||||
|
||||
def set_int(self, key, val):
|
||||
""" Emulates gconf's client method """
|
||||
if section not in self.data:
|
||||
self.data[section] = {}
|
||||
self.data[section][key] = str(val)
|
||||
if section in self.callbacks and key in self.callbacks[section]:
|
||||
self.callbacks[section][key](self,0,self.data[section][key],None)
|
||||
def get_default_from_schema(self, section, key):
|
||||
try:
|
||||
return _ini_schema["%s/%s" % (section,key)]
|
||||
except:
|
||||
print "get_default_from_schema:", section, key
|
||||
return "0" # FIX: where does this get its defaults?
|
||||
if key[0] not in self.data:
|
||||
self.data[key[0]] = {}
|
||||
self.data[key[0]][key[1]] = str(val)
|
||||
if key[0] in self.callbacks and key[1] in self.callbacks[key[0]]:
|
||||
self.callbacks[key[0]][key[1]](self,0,self.data[key[0]][key[1]],None)
|
||||
|
||||
def suggest_sync(self):
|
||||
self.save_ini() # save back to default file, if named
|
||||
|
||||
@ -211,520 +161,87 @@ client = IniKeyClient(os.path.join(const.home_dir,"keys.ini"))
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# interface keys
|
||||
def get_default_view():
|
||||
return get_int("interface", "defaultview",(0,1))
|
||||
|
||||
def save_default_view(val):
|
||||
set_int("interface", "defaultview",val,(0,1))
|
||||
|
||||
def get_height():
|
||||
return get_int("interface", "height")
|
||||
|
||||
def save_height(val):
|
||||
set_int("interface", "height",val)
|
||||
|
||||
def get_width():
|
||||
return get_int("interface", "width")
|
||||
|
||||
def save_width(val):
|
||||
set_int("interface", "width",val)
|
||||
|
||||
def get_family_view():
|
||||
return get_int("interface", "familyview", (0,1))
|
||||
|
||||
def save_family_view(val):
|
||||
set_int("interface", "familyview",val, (0,1))
|
||||
|
||||
def get_family_details():
|
||||
return get_bool("/apps/gramps/preferences/family-details", (0,1))
|
||||
|
||||
def save_family_details(val):
|
||||
set_bool("/apps/gramps/preferences/family-details",val, (0,1))
|
||||
|
||||
def get_family_siblings():
|
||||
return get_bool("/apps/gramps/preferences/family-siblings",(0,1))
|
||||
|
||||
def save_family_siblings(val):
|
||||
set_bool("/apps/gramps/preferences/family-siblings",val,(0,1))
|
||||
|
||||
def get_filter():
|
||||
return get_bool("interface", "filter")
|
||||
|
||||
def save_filter(val):
|
||||
set_bool("interface", "filter",val)
|
||||
|
||||
def get_dont_ask():
|
||||
return get_bool("interface", "dont-ask")
|
||||
|
||||
def save_dont_ask(val):
|
||||
set_bool("interface", "dont-ask",val)
|
||||
|
||||
def get_family_warn():
|
||||
return get_bool("interface","family-warn")
|
||||
|
||||
def save_family_warn(val):
|
||||
set_bool("interface","family-warn",val)
|
||||
|
||||
def get_index_visible():
|
||||
return get_bool("interface", "index-visible")
|
||||
|
||||
def save_index_visible(val):
|
||||
set_bool("interface", "index-visible",val)
|
||||
|
||||
def get_statusbar():
|
||||
return get_int("interface", "statusbar",(0,1,2))
|
||||
|
||||
def save_statusbar(val):
|
||||
set_int("interface", "statusbar",val,(0,1,2))
|
||||
|
||||
def get_toolbar():
|
||||
return get_int("interface", "toolbar",(0,1,2,3,5))
|
||||
|
||||
def save_toolbar(val):
|
||||
set_int("interface", "toolbar",val,(0,1,2,3,5))
|
||||
|
||||
def get_toolbar_on():
|
||||
return get_bool("interface", "toolbar-on")
|
||||
|
||||
def save_toolbar_on(val):
|
||||
set_bool("interface", "toolbar-on",val)
|
||||
|
||||
def get_view():
|
||||
return get_bool("interface", "view")
|
||||
|
||||
def save_view(val):
|
||||
set_bool("interface", "view",val)
|
||||
|
||||
# paths keys
|
||||
def get_lastfile():
|
||||
return get_string("paths", "recent-file")
|
||||
|
||||
def save_last_file(val):
|
||||
set_string("paths", "recent-file",val)
|
||||
|
||||
def get_last_import_dir():
|
||||
return get_string("paths", "recent-import-dir")
|
||||
|
||||
def save_last_import_dir(val):
|
||||
set_string_as_path("paths", "recent-import-dir",val)
|
||||
|
||||
def get_last_export_dir():
|
||||
return get_string("paths", "recent-export-dir")
|
||||
|
||||
def save_last_export_dir(val):
|
||||
set_string_as_path("paths", "recent-export-dir",val)
|
||||
|
||||
def get_report_dir():
|
||||
return get_string("paths", "report-directory")
|
||||
|
||||
def save_report_dir(val):
|
||||
set_string_as_path("paths", "report-directory",val)
|
||||
|
||||
def get_web_dir():
|
||||
return get_string("paths", "website-directory")
|
||||
|
||||
def save_web_dir(val):
|
||||
set_string_as_path("paths", "website-directory",val)
|
||||
|
||||
# behavior keys
|
||||
def get_startup():
|
||||
return get_int("behavior", "startup",(0,1))
|
||||
|
||||
def save_startup(val):
|
||||
set_int("behavior", "startup",val,(0,1))
|
||||
|
||||
def get_screen_size_checked():
|
||||
return get_bool("interface", "size-checked")
|
||||
|
||||
def save_screen_size_checked(val):
|
||||
set_bool("interface", "size-checked",val)
|
||||
|
||||
def get_autoload():
|
||||
return get_bool("behavior", "autoload")
|
||||
|
||||
def get_spellcheck():
|
||||
return get_bool("behavior", "spellcheck")
|
||||
|
||||
def save_autoload(val):
|
||||
set_bool("behavior", "autoload",val)
|
||||
|
||||
def save_spellcheck(val):
|
||||
set_bool("behavior", "spellcheck",val)
|
||||
|
||||
def get_betawarn():
|
||||
return get_bool("behavior", "betawarn")
|
||||
|
||||
def save_betawarn(val):
|
||||
set_bool("behavior", "betawarn",val)
|
||||
|
||||
def get_welcome():
|
||||
return get_bool("behavior", "welcome")
|
||||
|
||||
def save_welcome(val):
|
||||
set_bool("behavior", "welcome",val)
|
||||
|
||||
def get_media_reference():
|
||||
return get_bool("behavior", "make-reference")
|
||||
|
||||
def save_media_reference(val):
|
||||
set_bool("behavior", "make-reference",val)
|
||||
|
||||
def get_media_global():
|
||||
return get_bool("behavior", "media-global")
|
||||
|
||||
def save_media_global(val):
|
||||
set_bool("behavior", "media-global",val)
|
||||
|
||||
def get_media_local():
|
||||
return get_bool("behavior", "media-local")
|
||||
|
||||
def save_media_local(val):
|
||||
set_bool("behavior", "media-local",val)
|
||||
|
||||
def get_lastnamegen(_surname_styles=[]):
|
||||
return get_int("behavior", "surname-guessing",
|
||||
range(len(_surname_styles)))
|
||||
|
||||
def save_lastnamegen(val,_surname_styles=[]):
|
||||
set_int("behavior", "surname-guessing",val,
|
||||
range(len(_surname_styles)))
|
||||
|
||||
def get_uselds():
|
||||
return get_bool("behavior", "use-lds")
|
||||
|
||||
def save_uselds(val):
|
||||
set_bool("behavior", "use-lds",val)
|
||||
|
||||
def get_usetips():
|
||||
return get_bool("behavior", "use-tips")
|
||||
|
||||
def save_usetips(val):
|
||||
set_bool("behavior", "use-tips",val)
|
||||
|
||||
def get_pop_plugin_status():
|
||||
return get_bool("behavior", "pop-plugin-status")
|
||||
|
||||
def save_pop_plugin_status(val):
|
||||
set_bool("behavior", "pop-plugin-status",val)
|
||||
|
||||
# preferences keys
|
||||
def get_person_id_prefix():
|
||||
return get_string("preferences", "iprefix")
|
||||
|
||||
def get_event_id_prefix():
|
||||
return get_string("preferences", "eprefix")
|
||||
|
||||
def save_iprefix(val):
|
||||
set_string_as_id_prefix("preferences", "iprefix",val)
|
||||
|
||||
def get_object_id_prefix():
|
||||
return get_string("preferences", "oprefix")
|
||||
|
||||
def save_oprefix(val):
|
||||
set_string_as_id_prefix("preferences", "oprefix",val)
|
||||
|
||||
def get_source_id_prefix():
|
||||
return get_string("preferences", "sprefix")
|
||||
|
||||
def save_sprefix(val):
|
||||
set_string_as_id_prefix("preferences", "sprefix",val)
|
||||
|
||||
def save_eprefix(val):
|
||||
set_string_as_id_prefix("preferences", "eprefix",val)
|
||||
|
||||
def get_place_id_prefix():
|
||||
return get_string("preferences", "pprefix")
|
||||
|
||||
def save_pprefix(val):
|
||||
set_string_as_id_prefix("preferences", "pprefix",val)
|
||||
|
||||
def get_family_id_prefix():
|
||||
return get_string("preferences", "fprefix")
|
||||
|
||||
def save_fprefix(val):
|
||||
set_string_as_id_prefix("preferences", "fprefix",val)
|
||||
|
||||
def get_repository_id_prefix():
|
||||
return get_string("preferences", "rprefix")
|
||||
|
||||
def save_rprefix(val):
|
||||
set_string_as_id_prefix("preferences", "rprefix",val)
|
||||
|
||||
def get_paper_preference():
|
||||
return get_string("preferences", "paper-preference")
|
||||
|
||||
def save_paper_preference(val):
|
||||
set_string("preferences", "paper-preference",val)
|
||||
|
||||
def get_output_preference():
|
||||
return get_string("preferences", "output-preference")
|
||||
|
||||
def save_output_preference(val):
|
||||
set_string("preferences", "output-preference",val)
|
||||
|
||||
def get_goutput_preference():
|
||||
return get_string("preferences", "goutput-preference")
|
||||
|
||||
def save_goutput_preference(val):
|
||||
set_string("preferences", "goutput-preference",val)
|
||||
|
||||
def get_use_tips():
|
||||
return get_bool("preferences", "use-tips")
|
||||
|
||||
def save_use_tips(val):
|
||||
set_bool("preferences", "use-tips",val)
|
||||
|
||||
def get_date_format(_date_format_list=[]):
|
||||
return get_int("preferences", "date-format",
|
||||
return get_int(Config.DATE_FORMAT,
|
||||
range(len(_date_format_list)))
|
||||
|
||||
def save_date_format(val,_date_format_list=[]):
|
||||
set_int("preferences", "date-format",val,
|
||||
set_int(Config.DATE_FORMAT, val,
|
||||
range(len(_date_format_list)))
|
||||
|
||||
def get_name_format(_name_format_list):
|
||||
return get_int("preferences", "name-format",
|
||||
return get_int(Config.NAME_FORMAT,
|
||||
range(len(_name_format_list)))
|
||||
|
||||
def save_name_format(val,_name_format_list):
|
||||
set_int("preferences", "name-format",val,
|
||||
set_int(Config.NAME_FORMAT, val,
|
||||
range(len(_name_format_list)))
|
||||
|
||||
# researcher keys
|
||||
def get_researcher_name():
|
||||
return get_string("researcher", "researcher-name")
|
||||
|
||||
def save_researcher_name(val):
|
||||
set_string("researcher", "researcher-name",val)
|
||||
|
||||
def get_researcher_addr():
|
||||
return get_string("researcher", "researcher-addr")
|
||||
|
||||
def save_researcher_addr(val):
|
||||
set_string("researcher", "researcher-addr",val)
|
||||
|
||||
def get_researcher_city():
|
||||
return get_string("researcher", "researcher-city")
|
||||
|
||||
def save_researcher_city(val):
|
||||
set_string("researcher", "researcher-city",val)
|
||||
|
||||
def get_researcher_state():
|
||||
return get_string("researcher", "researcher-state")
|
||||
|
||||
def save_researcher_state(val):
|
||||
set_string("researcher", "researcher-state",val)
|
||||
|
||||
def get_researcher_country():
|
||||
return get_string("researcher", "researcher-country")
|
||||
|
||||
def save_researcher_country(val):
|
||||
set_string("researcher", "researcher-country",val)
|
||||
|
||||
def get_researcher_postal():
|
||||
return get_string("researcher", "researcher-postal")
|
||||
|
||||
def save_researcher_postal(val):
|
||||
set_string("researcher", "researcher-postal",val)
|
||||
|
||||
def get_researcher_phone():
|
||||
return get_string("researcher", "researcher-phone")
|
||||
|
||||
def save_researcher_phone(val):
|
||||
set_string("researcher", "researcher-phone",val)
|
||||
|
||||
def get_researcher_email():
|
||||
return get_string("researcher", "researcher-email")
|
||||
|
||||
def save_researcher_email(val):
|
||||
set_string("researcher", "researcher-email",val)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Low-level grabbing and saving keys with error checking.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_bool(section, key):
|
||||
|
||||
def set(key, value):
|
||||
if key[2] == 0:
|
||||
set_bool(key, value)
|
||||
elif key[2] == 1:
|
||||
set_int(key, value)
|
||||
else:
|
||||
set_string(key, value)
|
||||
|
||||
def get(key):
|
||||
if key[2] == 0:
|
||||
val = get_bool(key)
|
||||
elif key[2] == 1:
|
||||
val = get_int(key)
|
||||
else:
|
||||
val = get_string(key)
|
||||
if not val:
|
||||
val = default_value[key]
|
||||
return val
|
||||
|
||||
def get_bool(key):
|
||||
try:
|
||||
val = client.get_bool(section, key)
|
||||
val = client.get_bool(key)
|
||||
except KeyError:
|
||||
val = None
|
||||
if val in (True,False):
|
||||
return val
|
||||
else:
|
||||
return make_bool(client.get_default_from_schema(section, key))
|
||||
return default_value[key]
|
||||
|
||||
def set_bool(section, key,val):
|
||||
def set_bool(key, val):
|
||||
if val in (True,False):
|
||||
client.set_bool(section, key,val)
|
||||
client.set_bool(key,val)
|
||||
|
||||
def get_int(section, key,correct_tuple=None):
|
||||
def get_int(key, correct_tuple=None):
|
||||
try:
|
||||
val = client.get_int(section, key)
|
||||
return client.get_int(key)
|
||||
except KeyError:
|
||||
val = None
|
||||
if not correct_tuple or val in correct_tuple:
|
||||
return val
|
||||
else:
|
||||
return int(client.get_default_from_schema(section, key))
|
||||
return default_value[key]
|
||||
|
||||
def set_int(section, key,val,correct_tuple=None):
|
||||
def set_int(key, val, correct_tuple=None):
|
||||
if not correct_tuple or val in correct_tuple:
|
||||
client.set_int(section, key,val)
|
||||
client.set_int(key, val)
|
||||
|
||||
def get_string(section, key,test_func=None):
|
||||
def get_string(key, test_func=None):
|
||||
try:
|
||||
val = client.get_string(section, key)
|
||||
val = client.get_string(key)
|
||||
except KeyError:
|
||||
val = ""
|
||||
if not test_func or test_func(val):
|
||||
return val
|
||||
else:
|
||||
return client.get_default_from_schema(section, key)
|
||||
return default_value[key]
|
||||
|
||||
def set_string(section, key,val,test_func=None):
|
||||
def set_string(key, val, test_func=None):
|
||||
if not test_func or test_func(val):
|
||||
client.set_string(section, key,val)
|
||||
|
||||
def set_string_as_path(section, key,val):
|
||||
if not val:
|
||||
val = client.get_default_from_schema(section, key)
|
||||
else:
|
||||
val = os.path.normpath(val) + os.sep
|
||||
client.set_string(section, key,val)
|
||||
|
||||
def set_string_as_id_prefix(section, key,val):
|
||||
if not val:
|
||||
val = client.get_default_from_schema(section, key)
|
||||
else:
|
||||
try:
|
||||
junk = val % 1
|
||||
except:
|
||||
val = client.get_default_from_schema(section, key)
|
||||
client.set_string(section, key,val)
|
||||
client.set_string(key, val)
|
||||
|
||||
def sync():
|
||||
client.suggest_sync()
|
||||
|
||||
if __name__ == "__main__":
|
||||
print "Testing..."
|
||||
client.filename = "test1.ini"
|
||||
val = "test"
|
||||
print "get_default_view()", get_default_view()
|
||||
save_default_view(val)
|
||||
print "get_family_view()", get_family_view()
|
||||
save_family_view(val)
|
||||
print "get_filter()", get_filter()
|
||||
save_filter(val)
|
||||
print "get_dont_ask()", get_dont_ask()
|
||||
save_dont_ask(val)
|
||||
print "get_index_visible()", get_index_visible()
|
||||
save_index_visible(val)
|
||||
print "get_statusbar()", get_statusbar()
|
||||
save_statusbar(val)
|
||||
print "get_toolbar()", get_toolbar()
|
||||
save_toolbar(val)
|
||||
print "get_toolbar_on()", get_toolbar_on()
|
||||
save_toolbar_on(val)
|
||||
print "get_view()", get_view()
|
||||
save_view(val)
|
||||
print "get_lastfile()", get_lastfile()
|
||||
save_last_file(val)
|
||||
print "get_last_import_dir()", get_last_import_dir()
|
||||
save_last_import_dir(val)
|
||||
print "get_last_export_dir()", get_last_export_dir()
|
||||
save_last_export_dir(val)
|
||||
print "get_report_dir()", get_report_dir()
|
||||
save_report_dir(val)
|
||||
print "get_web_dir()", get_web_dir()
|
||||
save_web_dir(val)
|
||||
print "get_startup()", get_startup()
|
||||
save_startup(val)
|
||||
print "get_screen_size_checked()", get_screen_size_checked()
|
||||
save_screen_size_checked(val)
|
||||
print "get_autoload()", get_autoload()
|
||||
save_autoload(val)
|
||||
print "get_betawarn()", get_betawarn()
|
||||
save_betawarn(val)
|
||||
print "get_welcome()", get_welcome()
|
||||
save_welcome(val)
|
||||
print "get_media_reference()", get_media_reference()
|
||||
save_media_reference(val)
|
||||
print "get_media_global()", get_media_global()
|
||||
save_media_global(val)
|
||||
print "get_media_local()", get_media_local()
|
||||
save_media_local(val)
|
||||
print "get_lastnamegen(val)", get_lastnamegen(val)
|
||||
save_lastnamegen(val, val)
|
||||
print "get_uselds()", get_uselds()
|
||||
save_uselds(val)
|
||||
print "get_usetips()", get_usetips()
|
||||
save_usetips(val)
|
||||
print "get_pop_plugin_status()", get_pop_plugin_status()
|
||||
save_pop_plugin_status(val)
|
||||
print "get_person_id_prefix()", get_person_id_prefix()
|
||||
print "get_event_id_prefix()", get_event_id_prefix()
|
||||
save_iprefix(val)
|
||||
print "get_object_id_prefix()", get_object_id_prefix()
|
||||
save_oprefix(val)
|
||||
print "get_source_id_prefix()", get_source_id_prefix()
|
||||
save_sprefix(val)
|
||||
save_eprefix(val)
|
||||
print "get_place_id_prefix()", get_place_id_prefix()
|
||||
save_pprefix(val)
|
||||
print "get_family_id_prefix()", get_family_id_prefix()
|
||||
save_fprefix(val)
|
||||
print "get_repository_id_prefix()", get_repository_id_prefix()
|
||||
save_rprefix(val)
|
||||
print "get_paper_preference()", get_paper_preference()
|
||||
save_paper_preference(val)
|
||||
print "get_output_preference()", get_output_preference()
|
||||
save_output_preference(val)
|
||||
print "get_goutput_preference()", get_goutput_preference()
|
||||
save_goutput_preference(val)
|
||||
print "get_use_tips()", get_use_tips()
|
||||
save_use_tips(val)
|
||||
print "get_date_format(val)", get_date_format(val)
|
||||
save_date_format(val, val)
|
||||
print "get_name_format(val)", get_name_format(val)
|
||||
save_name_format(val, val)
|
||||
print "get_researcher_name()", get_researcher_name()
|
||||
save_researcher_name(val)
|
||||
print "get_researcher_addr()", get_researcher_addr()
|
||||
save_researcher_addr(val)
|
||||
print "get_researcher_city()", get_researcher_city()
|
||||
save_researcher_city(val)
|
||||
print "get_researcher_state()", get_researcher_state()
|
||||
save_researcher_state(val)
|
||||
print "get_researcher_country()", get_researcher_country()
|
||||
save_researcher_country(val)
|
||||
print "get_researcher_postal()", get_researcher_postal()
|
||||
save_researcher_postal(val)
|
||||
print "get_researcher_phone()", get_researcher_phone()
|
||||
save_researcher_phone(val)
|
||||
print "get_researcher_email()", get_researcher_email()
|
||||
save_researcher_email(val)
|
||||
print "Syncing..."
|
||||
sync()
|
||||
client = IniKeyClient("test1.ini")
|
||||
client.filename = "test2.ini"
|
||||
print "Syncing..."
|
||||
sync()
|
||||
client = IniKeyClient()
|
||||
def callback(client, id, data, args):
|
||||
print "it called back! new value is %s" % data
|
||||
print "Testing callbacks..."
|
||||
client.notify_add("/apps/gramps/section/key", callback)
|
||||
client.set_int("section", "key", 23)
|
||||
assert client.get_int("section", "key") == 23
|
||||
print "client.notify_add(): passed"
|
||||
client.filename = "test3.ini"
|
||||
print "Syncing..."
|
||||
sync()
|
||||
client = IniKeyClient("test3.ini")
|
||||
assert client.get_int("section", "key") == 23
|
||||
print "client.load_ini(): passed"
|
||||
print "-" * 50
|
||||
print "test1.ini and test2.ini should be identical, except for"
|
||||
print "maybe the time. test3.ini should have [section] key=23"
|
||||
|
@ -26,11 +26,16 @@ It provides the choice between different storage backends.
|
||||
"""
|
||||
|
||||
import const
|
||||
from _GrampsConfigKeys import *
|
||||
|
||||
if const.no_gconf:
|
||||
#if const.no_gconf:
|
||||
if True:
|
||||
from _GrampsIniKeys import *
|
||||
else:
|
||||
try:
|
||||
from _GrampsGconfKeys import *
|
||||
except:
|
||||
from _GrampsIniKeys import *
|
||||
|
||||
|
||||
|
||||
|
100
src/Config/gen_schema_keys.py
Normal file
100
src/Config/gen_schema_keys.py
Normal file
@ -0,0 +1,100 @@
|
||||
copy = """#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2006 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
|
||||
#
|
||||
"""
|
||||
|
||||
from xml.parsers.expat import ExpatError, ParserCreate
|
||||
|
||||
class SchemaHandler:
|
||||
|
||||
def __init__(self):
|
||||
self.tlist = []
|
||||
self.type = ""
|
||||
self.default = ""
|
||||
self.key = ""
|
||||
self.short = ""
|
||||
self.list = []
|
||||
|
||||
def startElement(self,tag,attrs):
|
||||
self.tlist = []
|
||||
|
||||
def endElement(self,tag):
|
||||
data = ''.join(self.tlist)
|
||||
if tag == "type":
|
||||
self.type = data
|
||||
elif tag == "default":
|
||||
self.default = data
|
||||
elif tag == "applyto":
|
||||
self.key = data
|
||||
elif tag == "schema":
|
||||
self.list.append((self.key, self.type, self.default))
|
||||
|
||||
def characters(self, data):
|
||||
self.tlist.append(data)
|
||||
|
||||
def parse(self, name):
|
||||
|
||||
f = open(name)
|
||||
|
||||
self.p = ParserCreate()
|
||||
self.p.StartElementHandler = self.startElement
|
||||
self.p.EndElementHandler = self.endElement
|
||||
self.p.CharacterDataHandler = self.characters
|
||||
self.p.ParseFile(f)
|
||||
|
||||
f.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
type_map = { 'bool' : 0, 'int' : 1 , 'string' : 2 }
|
||||
|
||||
print copy
|
||||
|
||||
parser = SchemaHandler()
|
||||
parser.parse(sys.argv[1])
|
||||
for (key, key_type, default) in parser.list:
|
||||
data = key.split('/')
|
||||
category = data[3]
|
||||
token = data[4]
|
||||
|
||||
print "%-20s = ('%s','%s', %d)" % (token.upper().replace('-','_'),
|
||||
category,
|
||||
token,
|
||||
type_map[key_type])
|
||||
|
||||
print '\n\ndefault_value = {'
|
||||
for (key, key_type, default) in parser.list:
|
||||
data = key.split('/')
|
||||
category = data[3]
|
||||
token = data[4]
|
||||
tkey = token.upper().replace('-','_')
|
||||
if key_type == 'bool':
|
||||
if default == "1":
|
||||
print " %-20s : True," % tkey
|
||||
else:
|
||||
print " %-20s : False," % tkey
|
||||
elif key_type == "int":
|
||||
print " %-20s : %s," % (tkey,default)
|
||||
else:
|
||||
print " %-20s : '%s'," % (tkey,default)
|
||||
|
||||
print '}'
|
||||
|
@ -85,12 +85,8 @@ class FamilyView(PageView.PersonNavView):
|
||||
|
||||
dbstate.connect('database-changed', self.change_db)
|
||||
dbstate.connect('active-changed', self.change_person)
|
||||
self.show_siblings = Config.get_family_siblings()
|
||||
if self.show_siblings == None:
|
||||
self.show_siblings = True
|
||||
self.show_details = Config.get_family_details()
|
||||
if self.show_details == None:
|
||||
self.show_details = True
|
||||
self.show_siblings = Config.get(Config.FAMILY_SIBLINGS)
|
||||
self.show_details = Config.get(Config.FAMILY_DETAILS)
|
||||
self.connect_to_db(dbstate.db)
|
||||
self.redrawing = False
|
||||
self.child = None
|
||||
@ -225,12 +221,12 @@ class FamilyView(PageView.PersonNavView):
|
||||
def siblings_toggle(self, obj):
|
||||
self.show_siblings = obj.get_active()
|
||||
self.change_person(self.dbstate.active.handle)
|
||||
Config.save_family_siblings(self.show_siblings)
|
||||
Config.set(Config.FAMILY_SIBLINGS,self.show_siblings)
|
||||
|
||||
def details_toggle(self, obj):
|
||||
self.show_details = obj.get_active()
|
||||
self.change_person(self.dbstate.active.handle)
|
||||
Config.save_family_details(self.show_details)
|
||||
Config.set(Config.FAMILY_DETAILS,self.show_details)
|
||||
|
||||
def change_db(self, db):
|
||||
self.connect_to_db(db)
|
||||
|
@ -300,7 +300,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
if self.dbstate.active == None:
|
||||
self.status.push(self.status_id,"")
|
||||
else:
|
||||
if Config.get_statusbar() <= 1:
|
||||
if Config.get(Config.STATUSBAR) <= 1:
|
||||
person = self.dbstate.get_active_person()
|
||||
pname = NameDisplay.displayer.display(person)
|
||||
name = "[%s] %s" % (person.get_gramps_id(),pname)
|
||||
|
@ -194,7 +194,7 @@ class ChildEmbedList(EmbeddedList):
|
||||
from Editors import EditPerson
|
||||
|
||||
person = RelLib.Person()
|
||||
autoname = Config.get_lastnamegen()
|
||||
autoname = Config.get(Config.SURNAME_GUESSING)
|
||||
if autoname == 0:
|
||||
name = self.north_american()
|
||||
elif autoname == 2:
|
||||
@ -320,7 +320,7 @@ class EditFamily(EditPrimary):
|
||||
self.obj.get_mother_handle() == None and \
|
||||
len(self.obj.get_child_ref_list()) == 1:
|
||||
self.add_parent = True
|
||||
if not Config.get_family_warn():
|
||||
if not Config.get(Config.FAMILY_WARN):
|
||||
for i in self.hidden:
|
||||
i.set_sensitive(False)
|
||||
|
||||
@ -328,7 +328,7 @@ class EditFamily(EditPrimary):
|
||||
dialog = glade.get_widget('family_warn')
|
||||
dialog.run()
|
||||
if glade.get_widget('dont_show').get_active():
|
||||
Config.save_family_warn(True)
|
||||
Config.set(Config.FAMILY_WARN,True)
|
||||
dialog.destroy()
|
||||
else:
|
||||
self.add_parent = False
|
||||
|
@ -116,7 +116,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
|
||||
def close(self,*obj):
|
||||
"""If the data has changed, give the user a chance to cancel
|
||||
the close window"""
|
||||
if not Config.get_dont_ask() and self.data_has_changed():
|
||||
if not Config.get(Config.DONT_ASK) and self.data_has_changed():
|
||||
SaveDialog(
|
||||
_('Save Changes?'),
|
||||
_('If you close without saving, the changes you '
|
||||
|
@ -169,7 +169,7 @@ class Exporter:
|
||||
Depending on the success status, set the text for the final page.
|
||||
"""
|
||||
filename = self.chooser.get_filename()
|
||||
Config.save_last_export_dir(os.path.split(filename)[0])
|
||||
Config.set(Config.RECENT_EXPORT_DIR,os.path.split(filename)[0])
|
||||
ix = self.get_selected_format_index()
|
||||
self.pre_save()
|
||||
if self.exports[ix][3]:
|
||||
@ -304,9 +304,9 @@ class Exporter:
|
||||
ext = self.exports[ix][4]
|
||||
|
||||
# Suggested folder: try last export, then last import, then home.
|
||||
default_dir = Config.get_last_export_dir()
|
||||
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_import_dir()
|
||||
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = const.user_home
|
||||
|
||||
|
104
src/GrampsCfg.py
104
src/GrampsCfg.py
@ -121,14 +121,14 @@ def loadConfig():
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_researcher():
|
||||
n = Config.get_researcher_name()
|
||||
a = Config.get_researcher_addr()
|
||||
c = Config.get_researcher_city()
|
||||
s = Config.get_researcher_state()
|
||||
ct = Config.get_researcher_country()
|
||||
p = Config.get_researcher_postal()
|
||||
ph = Config.get_researcher_phone()
|
||||
e = Config.get_researcher_email()
|
||||
n = Config.get(Config.RESEARCHER_NAME)
|
||||
a = Config.get(Config.RESEARCHER_ADDR)
|
||||
c = Config.get(Config.RESEARCHER_CITY)
|
||||
s = Config.get(Config.RESEARCHER_STATE)
|
||||
ct = Config.get(Config.RESEARCHER_COUNTRY)
|
||||
p = Config.get(Config.RESEARCHER_POSTAL)
|
||||
ph = Config.get(Config.RESEARCHER_PHONE)
|
||||
e = Config.get(Config.RESEARCHER_EMAIL)
|
||||
|
||||
owner = RelLib.Researcher()
|
||||
owner.set(n,a,c,s,ct,p,ph,e)
|
||||
@ -186,58 +186,58 @@ class GrampsPreferences:
|
||||
def build(self):
|
||||
|
||||
auto = self.top.get_widget("autoload")
|
||||
auto.set_active(Config.get_autoload())
|
||||
auto.set_active(Config.get(Config.AUTOLOAD))
|
||||
auto.connect('toggled',
|
||||
lambda obj: Config.save_autoload(obj.get_active()))
|
||||
lambda obj: Config.set(Config.AUTOLOAD,obj.get_active()))
|
||||
|
||||
spell = self.top.get_widget("spellcheck")
|
||||
spell.set_active(Config.get_spellcheck())
|
||||
spell.set_active(Config.get(Config.SPELLCHECK))
|
||||
spell.connect('toggled',
|
||||
lambda obj: Config.save_spellcheck(obj.get_active()))
|
||||
lambda obj: Config.set(Config.SPELLCHECK))
|
||||
|
||||
lds = self.top.get_widget("uselds")
|
||||
lds.set_active(Config.get_uselds())
|
||||
lds.set_active(Config.get(Config.USE_LDS))
|
||||
lds.connect('toggled',
|
||||
lambda obj: Config.save_uselds(obj.get_active()))
|
||||
lambda obj: Config.set(Config.USE_LDS,obj.get_active()))
|
||||
|
||||
self.ipr = self.top.get_widget("iprefix")
|
||||
self.ipr.set_text(Config.get_person_id_prefix())
|
||||
self.ipr.set_text(Config.get(Config.IPREFIX))
|
||||
self.opr = self.top.get_widget("oprefix")
|
||||
self.opr.set_text(Config.get_object_id_prefix())
|
||||
self.opr.set_text(Config.get(Config.OPREFIX))
|
||||
self.fpr = self.top.get_widget("fprefix")
|
||||
self.fpr.set_text(Config.get_family_id_prefix())
|
||||
self.fpr.set_text(Config.get(Config.FPREFIX))
|
||||
self.spr = self.top.get_widget("sprefix")
|
||||
self.spr.set_text(Config.get_source_id_prefix())
|
||||
self.spr.set_text(Config.get(Config.SPREFIX))
|
||||
self.ppr = self.top.get_widget("pprefix")
|
||||
self.ppr.set_text(Config.get_place_id_prefix())
|
||||
self.ppr.set_text(Config.get(Config.PPREFIX))
|
||||
|
||||
sb2 = self.top.get_widget("stat2")
|
||||
sb3 = self.top.get_widget("stat3")
|
||||
if Config.get_statusbar() == 0 or Config.get_statusbar() == 1:
|
||||
if Config.get(Config.STATUSBAR) == 0 or Config.get(Config.STATUSBAR) == 1:
|
||||
sb2.set_active(1)
|
||||
else:
|
||||
sb3.set_active(1)
|
||||
sb2.connect('toggled',
|
||||
lambda obj: Config.save_statusbar(2-obj.get_active()))
|
||||
lambda obj: Config.set(Config.STATUSBAR,(2-obj.get_active())))
|
||||
|
||||
toolbarmenu = self.top.get_widget("tooloptmenu")
|
||||
toolbarmenu.set_active(Config.get_toolbar()+1)
|
||||
toolbarmenu.set_active(Config.get(Config.TOOLBAR)+1)
|
||||
toolbarmenu.connect('changed',
|
||||
lambda obj: Config.save_toolbar(obj.get_active()-1))
|
||||
lambda obj: Config.set(Config.TOOLBAR,obj.get_active()-1))
|
||||
|
||||
pvbutton = self.top.get_widget('pvbutton')
|
||||
fvbutton = self.top.get_widget('fvbutton')
|
||||
if Config.get_default_view() == 0:
|
||||
if Config.get(Config.DEFAULT_VIEW) == 0:
|
||||
pvbutton.set_active(1)
|
||||
else:
|
||||
fvbutton.set_active(1)
|
||||
fvbutton.connect('toggled',
|
||||
lambda obj: Config.save_default_view(obj.get_active()))
|
||||
lambda obj: Config.set(Config.DEFAULT_VIEW,(obj.get_active())))
|
||||
|
||||
usetips = self.top.get_widget('usetips')
|
||||
usetips.set_active(Config.get_usetips())
|
||||
usetips.set_active(Config.get(Config.USE_TIPS))
|
||||
usetips.connect('toggled',
|
||||
lambda obj: Config.save_usetips(obj.get_active()))
|
||||
lambda obj: Config.set(Config.USE_TIPS,obj.get_active()))
|
||||
|
||||
lastnamegen_obj = self.top.get_widget("lastnamegen")
|
||||
cell = gtk.CellRendererText()
|
||||
@ -248,10 +248,14 @@ class GrampsPreferences:
|
||||
for name in _surname_styles:
|
||||
store.append(row=[name])
|
||||
lastnamegen_obj.set_model(store)
|
||||
lastnamegen_obj.set_active(Config.get_lastnamegen(_surname_styles))
|
||||
guess = Config.get(Config.SURNAME_GUESSING)
|
||||
if guess not in _surname_styles:
|
||||
guess = Config.default_value[Config.SURNAME_GUESSING]
|
||||
|
||||
lastnamegen_obj.set_active(guess)
|
||||
lastnamegen_obj.connect("changed",
|
||||
lambda obj:
|
||||
Config.save_lastnamegen(obj.get_active(),_surname_styles)
|
||||
Config.set(Config.SURNAME_GUESSING,obj.get_active())
|
||||
)
|
||||
|
||||
date_option = self.top.get_widget("date_format")
|
||||
@ -277,37 +281,37 @@ class GrampsPreferences:
|
||||
)
|
||||
|
||||
resname = self.top.get_widget("resname")
|
||||
resname.set_text(Config.get_researcher_name())
|
||||
resname.set_text(Config.get(Config.RESEARCHER_NAME))
|
||||
resname.connect('changed',
|
||||
lambda obj: Config.save_researcher_name(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_NAME,obj.get_text()))
|
||||
resaddr = self.top.get_widget("resaddr")
|
||||
resaddr.set_text(Config.get_researcher_addr())
|
||||
resaddr.set_text(Config.get(Config.RESEARCHER_ADDR))
|
||||
resaddr.connect('changed',
|
||||
lambda obj: Config.save_researcher_addr(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_ADDR,obj.get_text()))
|
||||
rescity = self.top.get_widget("rescity")
|
||||
rescity.set_text(Config.get_researcher_city())
|
||||
rescity.set_text(Config.get(Config.RESEARCHER_CITY))
|
||||
rescity.connect('changed',
|
||||
lambda obj: Config.save_researcher_city(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_CITY,obj.get_text()))
|
||||
resstate = self.top.get_widget("resstate")
|
||||
resstate.set_text(Config.get_researcher_state())
|
||||
resstate.set_text(Config.get(Config.RESEARCHER_STATE))
|
||||
resstate.connect('changed',
|
||||
lambda obj: Config.save_researcher_state(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_STATE,obj.get_text()))
|
||||
rescountry = self.top.get_widget("rescountry")
|
||||
rescountry.set_text(Config.get_researcher_country())
|
||||
rescountry.set_text(Config.get(Config.RESEARCHER_COUNTRY))
|
||||
rescountry.connect('changed',
|
||||
lambda obj: Config.save_researcher_country(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_COUNTRY,obj.get_text()))
|
||||
respostal = self.top.get_widget("respostal")
|
||||
respostal.set_text(Config.get_researcher_postal())
|
||||
respostal.set_text(Config.get(Config.RESEARCHER_POSTAL))
|
||||
respostal.connect('changed',
|
||||
lambda obj: Config.save_researcher_postal(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_POSTAL,obj.get_text()))
|
||||
resphone = self.top.get_widget("resphone")
|
||||
resphone.set_text(Config.get_researcher_phone())
|
||||
resphone.set_text(Config.get(Config.RESEARCHER_PHONE))
|
||||
resphone.connect('changed',
|
||||
lambda obj: Config.save_researcher_phone(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_PHONE,obj.get_text()))
|
||||
resemail = self.top.get_widget("resemail")
|
||||
resemail.set_text(Config.get_researcher_email())
|
||||
resemail.set_text(Config.get(Config.RESEARCHER_EMAIL))
|
||||
resemail.connect('changed',
|
||||
lambda obj: Config.save_researcher_email(obj.get_text()))
|
||||
lambda obj: Config.set(Config.RESEARCHER_EMAIL,obj.get_text()))
|
||||
|
||||
def save_prefix(self):
|
||||
""" Validate the GRAMPS ID definitions to be usable"""
|
||||
@ -356,11 +360,11 @@ class GrampsPreferences:
|
||||
self.window)
|
||||
return False
|
||||
|
||||
Config.save_iprefix(ip)
|
||||
Config.save_oprefix(op)
|
||||
Config.save_fprefix(fp)
|
||||
Config.save_sprefix(sp)
|
||||
Config.save_pprefix(pp)
|
||||
Config.set(Config.IPREFIX,ip)
|
||||
Config.set(Config.OPREFIX,op)
|
||||
Config.set(Config.FPREFIX,fp)
|
||||
Config.set(Config.SPREFIX,sp)
|
||||
Config.set(Config.PPREFIX,pp)
|
||||
return True
|
||||
|
||||
def select(self,obj):
|
||||
|
@ -224,13 +224,13 @@ class GrampsDbBase(GrampsDBCallback):
|
||||
self.family_attributes = set()
|
||||
self.marker_names = set()
|
||||
|
||||
self.set_person_id_prefix(Config.get_person_id_prefix())
|
||||
self.set_object_id_prefix(Config.get_object_id_prefix())
|
||||
self.set_family_id_prefix(Config.get_family_id_prefix())
|
||||
self.set_source_id_prefix(Config.get_source_id_prefix())
|
||||
self.set_place_id_prefix(Config.get_place_id_prefix())
|
||||
self.set_event_id_prefix(Config.get_event_id_prefix())
|
||||
self.set_repository_id_prefix(Config.get_repository_id_prefix())
|
||||
self.set_person_id_prefix(Config.get(Config.IPREFIX))
|
||||
self.set_object_id_prefix(Config.get(Config.OPREFIX))
|
||||
self.set_family_id_prefix(Config.get(Config.FPREFIX))
|
||||
self.set_source_id_prefix(Config.get(Config.SPREFIX))
|
||||
self.set_place_id_prefix(Config.get(Config.PPREFIX))
|
||||
self.set_event_id_prefix(Config.get(Config.EPREFIX))
|
||||
self.set_repository_id_prefix(Config.get(Config.RPREFIX))
|
||||
|
||||
self.open = 0
|
||||
self.genderStats = GenderStats()
|
||||
|
@ -462,7 +462,7 @@ class Reload(_Tool.Tool):
|
||||
except:
|
||||
_PluginMgr.failmsg_list.append((filename,sys.exc_info()))
|
||||
|
||||
if Config.get_pop_plugin_status() and len(_PluginMgr.failmsg_list):
|
||||
if Config.get(Config.POP_PLUGIN_STATUS) and len(_PluginMgr.failmsg_list):
|
||||
PluginStatus()
|
||||
else:
|
||||
global status_up
|
||||
|
@ -1085,7 +1085,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 Config.get_report_dir()
|
||||
return Config.get(Config.REPORT_DIRECTORY)
|
||||
|
||||
def set_default_directory(self, value):
|
||||
"""Save the name of the current directory, so that any future
|
||||
@ -1095,7 +1095,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."""
|
||||
Config.save_report_dir(value)
|
||||
Config.set(Config.REPORT_DIRECTORY,value)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -1961,7 +1961,7 @@ class GrampsTextFormatComboBox(gtk.ComboBox):
|
||||
self.pack_start(cell,True)
|
||||
self.add_attribute(cell,'text',0)
|
||||
|
||||
out_pref = Config.get_output_preference()
|
||||
out_pref = Config.get(Config.OUTPUT_PREFERENCE)
|
||||
index = 0
|
||||
_PluginMgr.textdoc_list.sort()
|
||||
active_index = 0
|
||||
@ -2009,7 +2009,7 @@ class GrampsDrawFormatComboBox(gtk.ComboBox):
|
||||
self.pack_start(cell,True)
|
||||
self.add_attribute(cell,'text',0)
|
||||
|
||||
out_pref = Config.get_output_preference()
|
||||
out_pref = Config.get(Config.OUTPUT_PREFERENCE)
|
||||
index = 0
|
||||
_PluginMgr.drawdoc_list.sort()
|
||||
active_index = 0
|
||||
@ -2057,7 +2057,7 @@ class GrampsBookFormatComboBox(gtk.ComboBox):
|
||||
self.pack_start(cell,True)
|
||||
self.add_attribute(cell,'text',0)
|
||||
|
||||
out_pref = Config.get_output_preference()
|
||||
out_pref = Config.get(Config.OUTPUT_PREFERENCE)
|
||||
index = 0
|
||||
_PluginMgr.drawdoc_list.sort()
|
||||
active_index = 0
|
||||
|
@ -168,7 +168,7 @@ class OptionListCollection(_Options.OptionListCollection):
|
||||
def init_common(self):
|
||||
# Default values for common options
|
||||
self.default_style_name = "default"
|
||||
self.default_paper_name = Config.get_paper_preference()
|
||||
self.default_paper_name = Config.get(Config.PAPER_PREFERENCE)
|
||||
self.default_template_name = ""
|
||||
self.default_orientation = BaseDoc.PAPER_PORTRAIT
|
||||
self.default_format_name = 'print'
|
||||
|
@ -74,7 +74,7 @@ class SaveDialog:
|
||||
elif response == gtk.RESPONSE_YES:
|
||||
self.task2()
|
||||
|
||||
Config.save_dont_ask(self.dontask.get_active())
|
||||
Config.set(Config.DONT_ASK,self.dontask.get_active())
|
||||
self.top.destroy()
|
||||
|
||||
class QuestionDialog:
|
||||
|
@ -66,7 +66,7 @@ except SystemError,msg:
|
||||
class Spell:
|
||||
|
||||
def __init__(self,obj):
|
||||
if success and Config.get_spellcheck():
|
||||
if success and Config.get(Config.SPELLCHECK):
|
||||
self.spell = gtkspell.Spell(obj)
|
||||
lang = locale.getlocale()[0]
|
||||
self.spell.set_language(lang)
|
||||
|
@ -53,7 +53,7 @@ from QuestionDialog import ErrorDialog
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
def need_to_run():
|
||||
val = Config.get_startup()
|
||||
val = Config.get(Config.STARTUP)
|
||||
if val < const.startup:
|
||||
return True
|
||||
return False
|
||||
@ -68,34 +68,50 @@ def upgrade_prefs():
|
||||
client = gconf.client_get_default()
|
||||
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
|
||||
|
||||
Config.save_fprefix(client.get_string('/apps/gramps/fprefix'))
|
||||
Config.save_sprefix(client.get_string('/apps/gramps/sprefix'))
|
||||
Config.save_pprefix(client.get_string('/apps/gramps/pprefix'))
|
||||
Config.save_oprefix(client.get_string('/apps/gramps/oprefix'))
|
||||
Config.save_iprefix(client.get_string('/apps/gramps/iprefix'))
|
||||
Config.set(Config.FPREFIX,client.get_string('/apps/gramps/fprefix'))
|
||||
Config.set(Config.SPREFIX,client.get_string('/apps/gramps/sprefix'))
|
||||
Config.set(Config.PPREFIX,client.get_string('/apps/gramps/pprefix'))
|
||||
Config.set(Config.OPREFIX,client.get_string('/apps/gramps/oprefix'))
|
||||
Config.set(Config.IPREFIX,client.get_string('/apps/gramps/iprefix'))
|
||||
|
||||
Config.save_researcher_country(client.get_string('/apps/gramps/researcher-country'))
|
||||
Config.save_researcher_email(client.get_string('/apps/gramps/researcher-email'))
|
||||
Config.save_researcher_phone(client.get_string('/apps/gramps/researcher-phone'))
|
||||
Config.save_researcher_city(client.get_string('/apps/gramps/researcher-city'))
|
||||
Config.save_researcher_postal(client.get_string('/apps/gramps/researcher-postal'))
|
||||
Config.save_researcher_addr(client.get_string('/apps/gramps/researcher-addr'))
|
||||
Config.save_researcher_state(client.get_string('/apps/gramps/researcher-state'))
|
||||
Config.save_researcher_name(client.get_string('/apps/gramps/researcher-name'))
|
||||
Config.set(Config.RESEARCHER_COUNTRY,
|
||||
client.get_string('/apps/gramps/researcher-country'))
|
||||
|
||||
Config.save_family_view(client.get_int('/apps/gramps/familyview'))
|
||||
Config.save_default_view(client.get_int('/apps/gramps/defaultview'))
|
||||
Config.save_autoload(client.get_bool('/apps/gramps/autoload'))
|
||||
Config.save_uselds(client.get_bool('/apps/gramps/use-lds'))
|
||||
Config.save_statusbar(client.get_int('/apps/gramps/statusbar'))
|
||||
Config.save_view(not client.get_bool('/apps/gramps/view'))
|
||||
Config.save_screen_size_checked(client.get_bool('/apps/gramps/screen-size-checked'))
|
||||
Config.save_lastnamegen(client.get_int('/apps/gramps/surname-guessing'))
|
||||
Config.set(Config.RESEARCHER_EMAIL,
|
||||
client.get_string('/apps/gramps/researcher-email'))
|
||||
Config.set(Config.RESEARCHER_PHONE,
|
||||
client.get_string('/apps/gramps/researcher-phone'))
|
||||
Config.set(Config.RESEARCHER_CITY,
|
||||
client.get_string('/apps/gramps/researcher-city'))
|
||||
Config.set(Config.RESEARCHER_POSTAL,
|
||||
client.get_string('/apps/gramps/researcher-postal'))
|
||||
Config.set(Config.RESEARCHER_ADDR,
|
||||
client.get_string('/apps/gramps/researcher-addr'))
|
||||
Config.set(Config.RESEARCHER_STATE,
|
||||
client.get_string('/apps/gramps/researcher-state'))
|
||||
Config.set(Config.RESEARCHER_NAME,
|
||||
client.get_string('/apps/gramps/researcher-name'))
|
||||
|
||||
Config.set(Config.DEFAULTVIEW,
|
||||
client.get_int('/apps/gramps/defaultview'))
|
||||
Config.set(Config.AUTOLOAD,
|
||||
client.get_bool('/apps/gramps/autoload'))
|
||||
Config.set(Config.USE_LDS,
|
||||
client.get_bool('/apps/gramps/use-lds'))
|
||||
Config.set(Config.STATUSBAR,
|
||||
client.get_int('/apps/gramps/statusbar'))
|
||||
Config.set(Config.VIEW,
|
||||
not client.get_bool('/apps/gramps/view'))
|
||||
Config.set(Config.SIZE_CHECKED,
|
||||
client.get_bool('/apps/gramps/screen-size-checked'))
|
||||
Config.set(Config.SURNAME_GUESSING,
|
||||
client.get_int('/apps/gramps/surname-guessing'))
|
||||
toolbar = client.get_int('/apps/gramps/toolbar')
|
||||
if toolbar == 5:
|
||||
toolbar = -1
|
||||
Config.save_toolbar(toolbar)
|
||||
Config.save_toolbar_on(client.get_bool('/apps/gramps/toolbar-on'))
|
||||
Config.set(Config.TOOLBAR,toolbar)
|
||||
Config.set(Config.TOOLBAR_ON,
|
||||
client.get_bool('/apps/gramps/toolbar-on'))
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
@ -113,7 +129,7 @@ class StartupDialog:
|
||||
self.args = args
|
||||
|
||||
if not const.no_gconf and upgrade_prefs():
|
||||
Config.save_startup(const.startup)
|
||||
Config.set(Config.STARTUP,const.startup)
|
||||
self.close()
|
||||
return
|
||||
self.w = Assistant.Assistant(self.complete)
|
||||
@ -128,7 +144,7 @@ class StartupDialog:
|
||||
try:
|
||||
self.w.add_page(_('Researcher information'),self.build_page2())
|
||||
self.w.add_page(_('LDS support'), self.build_page5())
|
||||
except:
|
||||
except IndexError:
|
||||
ErrorDialog(_("Configuration error"),
|
||||
_("\n\nPossibly the installation of GRAMPS was incomplete."
|
||||
" Make sure the GConf schema of GRAMPS is properly installed."))
|
||||
@ -149,17 +165,27 @@ class StartupDialog:
|
||||
self.task(self.args)
|
||||
|
||||
def complete(self):
|
||||
Config.save_researcher_name(unicode(self.name.get_text()))
|
||||
Config.save_researcher_addr(unicode(self.addr.get_text()))
|
||||
Config.save_researcher_city(unicode(self.city.get_text()))
|
||||
Config.save_researcher_state(unicode(self.state.get_text()))
|
||||
Config.save_researcher_postal(unicode(self.postal.get_text()))
|
||||
Config.save_researcher_country(unicode(self.country.get_text()))
|
||||
Config.save_researcher_phone(unicode(self.phone.get_text()))
|
||||
Config.save_researcher_email(unicode(self.email.get_text()))
|
||||
Config.set(Config.RESEARCHER_NAME,
|
||||
unicode(self.name.get_text()))
|
||||
Config.set(Config.RESEARCHER_ADDR,
|
||||
unicode(self.addr.get_text()))
|
||||
Config.set(Config.RESEARCHER_CITY,
|
||||
unicode(self.city.get_text()))
|
||||
Config.set(Config.RESEARCHER_STATE,
|
||||
unicode(self.state.get_text()))
|
||||
Config.set(Config.RESEARCHER_POSTAL,
|
||||
unicode(self.postal.get_text()))
|
||||
Config.set(Config.RESEARCHER_COUNTRY,
|
||||
unicode(self.country.get_text()))
|
||||
Config.set(Config.RESEARCHER_PHONE,
|
||||
unicode(self.phone.get_text()))
|
||||
Config.set(Config.RESEARCHER_EMAIL,
|
||||
unicode(self.email.get_text()))
|
||||
|
||||
Config.save_uselds(self.lds.get_active())
|
||||
Config.save_startup(const.startup)
|
||||
Config.set(Config.USE_LDS,
|
||||
self.lds.get_active())
|
||||
Config.set(Config.STARTUP,
|
||||
const.startup)
|
||||
self.w.destroy()
|
||||
Config.sync()
|
||||
self.task(self.args)
|
||||
@ -193,7 +219,7 @@ class StartupDialog:
|
||||
box.add(table)
|
||||
box.show_all()
|
||||
|
||||
name = Config.get_researcher_name()
|
||||
name = Config.get(Config.RESEARCHER_NAME)
|
||||
if not name or name.strip() == "":
|
||||
try:
|
||||
import pwd
|
||||
@ -205,13 +231,13 @@ class StartupDialog:
|
||||
self.name.set_text(name)
|
||||
|
||||
try:
|
||||
self.addr.set_text(Config.get_researcher_addr())
|
||||
self.city.set_text(Config.get_researcher_city())
|
||||
self.state.set_text(Config.get_researcher_state())
|
||||
self.postal.set_text(Config.get_researcher_postal())
|
||||
self.country.set_text(Config.get_researcher_country())
|
||||
self.phone.set_text(Config.get_researcher_phone())
|
||||
self.email.set_text(Config.get_researcher_email())
|
||||
self.addr.set_text(Config.get(Config.RESEARCHER_ADDR))
|
||||
self.city.set_text(Config.get(Config.RESEARCHER_CITY))
|
||||
self.state.set_text(Config.get(Config.RESEARCHER_STATE))
|
||||
self.postal.set_text(Config.get(Config.RESEARCHER_POSTAL))
|
||||
self.country.set_text(Config.get(Config.RESEARCHER_COUNTRY))
|
||||
self.phone.set_text(Config.get(Config.RESEARCHER_PHONE))
|
||||
self.email.set_text(Config.get(Config.RESEARCHER_EMAIL))
|
||||
except:
|
||||
ErrorDialog(_("Configuration/Installation error"),
|
||||
_("The gconf schemas were not found. First, try "
|
||||
@ -244,7 +270,7 @@ class StartupDialog:
|
||||
|
||||
self.lds = gtk.CheckButton(label=_("Enable LDS ordinance support"))
|
||||
|
||||
self.lds.set_active(Config.get_uselds())
|
||||
self.lds.set_active(Config.get(Config.USE_LDS))
|
||||
|
||||
align.add(self.lds)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class TipOfDay:
|
||||
|
||||
tp = TipParser()
|
||||
tip_list = tp.get()
|
||||
use.set_active(Config.get_usetips())
|
||||
use.set_active(Config.get(Config.USE_TIPS))
|
||||
|
||||
new_index = range(len(tip_list))
|
||||
Random().shuffle(new_index)
|
||||
@ -85,7 +85,7 @@ class TipOfDay:
|
||||
else:
|
||||
index += 1
|
||||
|
||||
Config.save_usetips(use.get_active())
|
||||
Config.set(Config.USE_TIPS,use.get_active())
|
||||
top.destroy()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -182,12 +182,10 @@ class ViewManager:
|
||||
"""
|
||||
Builds the GTK interface
|
||||
"""
|
||||
try:
|
||||
width = Config.get_width()
|
||||
height = Config.get_height()
|
||||
except:
|
||||
width = 775
|
||||
height = 500
|
||||
width = Config.get(Config.WIDTH)
|
||||
height = Config.get(Config.HEIGHT)
|
||||
|
||||
print width, height, type(width), type(height)
|
||||
|
||||
self.window = gtk.Window()
|
||||
self.window.set_icon_from_file(const.icon)
|
||||
@ -207,12 +205,8 @@ class ViewManager:
|
||||
hbox.pack_start(self.ebox, False)
|
||||
hbox.show_all()
|
||||
|
||||
self.show_sidebar = Config.get_view()
|
||||
if self.show_sidebar == None:
|
||||
self.show_sidebar = True
|
||||
self.show_toolbar = Config.get_toolbar()
|
||||
if self.show_toolbar == None:
|
||||
self.show_toolbar = True
|
||||
self.show_sidebar = Config.get(Config.VIEW)
|
||||
self.show_toolbar = Config.get(Config.TOOLBAR)
|
||||
|
||||
self.notebook = gtk.Notebook()
|
||||
self.notebook.set_show_tabs(False)
|
||||
@ -382,15 +376,15 @@ class ViewManager:
|
||||
self.uistate.status_text(_('Loading plugins...'))
|
||||
error |= load_plugins(const.pluginsDir)
|
||||
error |= load_plugins(os.path.join(const.home_dir, "plugins"))
|
||||
if Config.get_pop_plugin_status() and error:
|
||||
if Config.get(Config.POP_PLUGIN_STATUS) and error:
|
||||
PluginStatus.PluginStatus(self.state, self.uistate, [])
|
||||
self.uistate.push_message(_('Ready'))
|
||||
|
||||
def quit(self, obj=None):
|
||||
self.state.db.close()
|
||||
(width, height) = self.window.get_size()
|
||||
Config.save_width(width)
|
||||
Config.save_height(height)
|
||||
Config.set(Config.WIDTH, width)
|
||||
Config.set(Config.HEIGHT, height)
|
||||
Config.sync()
|
||||
gtk.main_quit()
|
||||
|
||||
@ -487,20 +481,20 @@ class ViewManager:
|
||||
if obj.get_active():
|
||||
self.ebox.show()
|
||||
self.notebook.set_show_tabs(False)
|
||||
Config.save_view(True)
|
||||
Config.set(Config.VIEW)
|
||||
else:
|
||||
self.ebox.hide()
|
||||
self.notebook.set_show_tabs(True)
|
||||
Config.save_view(False)
|
||||
Config.set(Config.VIEW)
|
||||
Config.sync()
|
||||
|
||||
def toolbar_toggle(self, obj):
|
||||
if obj.get_active():
|
||||
self.toolbar.show()
|
||||
Config.save_toolbar(True)
|
||||
Config.set(Config.TOOLBAR)
|
||||
else:
|
||||
self.toolbar.hide()
|
||||
Config.save_toolbar(False)
|
||||
Config.set(Config.TOOLBAR)
|
||||
Config.sync()
|
||||
|
||||
def register_view(self, view):
|
||||
@ -635,11 +629,11 @@ class ViewManager:
|
||||
|
||||
# Suggested folder: try last open file, last import, last export,
|
||||
# then home.
|
||||
default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep
|
||||
default_dir = os.path.split(Config.get(Config.RECENT_FILE))[0] + os.path.sep
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_import_dir()
|
||||
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_export_dir()
|
||||
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = '~/'
|
||||
|
||||
@ -690,11 +684,11 @@ class ViewManager:
|
||||
|
||||
# Suggested folder: try last open file, import, then last export,
|
||||
# then home.
|
||||
default_dir = os.path.split(Config.get_lastfile())[0] + os.path.sep
|
||||
default_dir = os.path.split(Config.get(Config.RECENT_FILE))[0] + os.path.sep
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_import_dir()
|
||||
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_export_dir()
|
||||
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = '~/'
|
||||
|
||||
@ -738,7 +732,7 @@ class ViewManager:
|
||||
"""
|
||||
|
||||
(the_path, the_file) = os.path.split(filename)
|
||||
Config.save_last_import_dir(the_path)
|
||||
Config.set(Config.RECENT_IMPORT_DIR,the_path)
|
||||
|
||||
factory = GrampsDb.gramps_db_factory
|
||||
success = False
|
||||
@ -815,7 +809,7 @@ class ViewManager:
|
||||
msg = "%s - GRAMPS" % name
|
||||
self.uistate.window.set_title(msg)
|
||||
else:
|
||||
Config.save_last_file("")
|
||||
Config.set(Config.RECENT_FILE,"")
|
||||
QuestionDialog.ErrorDialog(
|
||||
_('Cannot open database'),
|
||||
_('The database file specified could not be opened.'))
|
||||
@ -866,7 +860,7 @@ class ViewManager:
|
||||
|
||||
self.state.db.request_rebuild()
|
||||
|
||||
Config.save_last_file(name)
|
||||
Config.set(Config.RECENT_FILE,name)
|
||||
|
||||
self.relationship = self.RelClass(self.state.db)
|
||||
self.state.change_active_person(self.state.db.find_initial_person())
|
||||
@ -976,12 +970,12 @@ class ViewManager:
|
||||
|
||||
# Suggested folder: try last open file, import, then last export,
|
||||
# then home.
|
||||
default_dir = Config.get_last_import_dir()
|
||||
default_dir = Config.get(Config.RECENT_IMPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
base_path = os.path.split(Config.get_lastfile())[0]
|
||||
base_path = os.path.split(Config.get(Config.RECENT_FILE))[0]
|
||||
default_dir = base_path + os.path.sep
|
||||
if len(default_dir)<=1:
|
||||
default_dir = Config.get_last_export_dir()
|
||||
default_dir = Config.get(Config.RECENT_EXPORT_DIR)
|
||||
if len(default_dir)<=1:
|
||||
default_dir = '~/'
|
||||
|
||||
@ -1010,7 +1004,7 @@ class ViewManager:
|
||||
|
||||
# Then we try all the known plugins
|
||||
(the_path, the_file) = os.path.split(filename)
|
||||
Config.save_last_import_dir(the_path)
|
||||
Config.set(Config.RECENT_IMPORT_DIR,the_path)
|
||||
for (importData, mime_filter, mime_type,
|
||||
native_format, format_name) in import_list:
|
||||
if filetype == mime_type or the_file == mime_type:
|
||||
|
@ -171,7 +171,7 @@ class Gramps:
|
||||
# Config.client.notify_add("/apps/gramps/preferences/date-format",
|
||||
# self.date_format_key_update)
|
||||
|
||||
if Config.get_usetips():
|
||||
if Config.get(Config.USE_TIPS):
|
||||
TipOfDay.TipOfDay(self.vm.uistate)
|
||||
|
||||
## # FIXME: THESE will have to be added (ViewManager?)
|
||||
@ -185,18 +185,18 @@ class Gramps:
|
||||
|
||||
def researcher_key_update(self,client,cnxn_id,entry,data):
|
||||
pass
|
||||
# self.db.set_person_id_prefix(Config.get_person_id_prefix())
|
||||
# self.db.set_family_id_prefix(Config.get_family_id_prefix())
|
||||
# self.db.set_source_id_prefix(Config.get_source_id_prefix())
|
||||
# self.db.set_object_id_prefix(Config.get_object_id_prefix())
|
||||
# self.db.set_place_id_prefix(Config.get_place_id_prefix())
|
||||
# self.db.set_event_id_prefix(Config.get_event_id_prefix())
|
||||
# self.db.set_person_id_prefix(Config.get(Config.IPREFIX))
|
||||
# self.db.set_family_id_prefix(Config.get(Config.FPREFIX))
|
||||
# self.db.set_source_id_prefix(Config.get(Config.SPREFIX))
|
||||
# self.db.set_object_id_prefix(Config.get(Config.OPREFIX))
|
||||
# self.db.set_place_id_prefix(Config.get(Config.PPREFIX))
|
||||
# self.db.set_event_id_prefix(Config.get(Config.EPREFIX))
|
||||
|
||||
def statusbar_key_update(self,client,cnxn_id,entry,data):
|
||||
self.vm.uistate.modify_statusbar()
|
||||
|
||||
def toolbar_key_update(self,client,cnxn_id,entry,data):
|
||||
the_style = Config.get_toolbar()
|
||||
the_style = Config.get(Config.TOOLBAR)
|
||||
if the_style == -1:
|
||||
self.vm.toolbar.unset_style()
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user