2007-07-22 Don Allingham <don@gramps-project.org>

* configure.in: remove gconf requirement
	* src/Config/_GrampsConfigKeys.py: pylint
	* src/Config/__init__.py: drop gconf, provide upgrade to .ini
	* src/Config/_GrampsGconfKeys.py: pylint
	* src/Config/_GrampsIniKeys.py: pylint
	* src/plugins/ExtractCity.py: fix name
	* src/plugins/EventNames.py: fix name
	* src/Spell.py: pylint
	* data/Makefile.am: remove gconf schema installation



svn: r8755
This commit is contained in:
Don Allingham
2007-07-22 21:03:52 +00:00
parent 6bf7eb10c6
commit abf7019a63
12 changed files with 305 additions and 356 deletions

View File

@@ -8,7 +8,7 @@
# 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,
# 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.
@@ -25,205 +25,205 @@
# python gen_schema_keys.py ../../data/gramps.schemas.in
# in the src/Config directory.
DEFAULT_SOURCE = ('preferences','default-source', 0)
RELATION_SHADE = ('preferences','relation-shade', 0)
ONLINE_MAPS = ('preferences','online-maps', 0)
FAMILY_DETAILS = ('preferences','family-details', 0)
COMPLETE_COLOR = ('preferences','complete-color', 2)
TODO_COLOR = ('preferences','todo-color', 2)
CUSTOM_MARKER_COLOR = ('preferences','custom-marker-color', 2)
FAMILY_WARN = ('preferences','family-warn', 0)
HIDE_EP_MSG = ('preferences','hide-ep-msg', 0)
LAST_VIEW = ('preferences','last-view', 1)
USE_LAST_VIEW = ('preferences','use-last-view', 0)
FAMILY_SIBLINGS = ('preferences','family-siblings', 0)
AUTOLOAD = ('behavior','autoload', 0)
ENABLE_AUTOBACKUP = ('behavior','enable-autobackup', 0)
SPELLCHECK = ('behavior','spellcheck', 0)
BETAWARN = ('behavior','betawarn', 0)
WELCOME = ('behavior','welcome', 1)
DATE_FORMAT = ('preferences','date-format', 1)
DONT_ASK = ('interface','dont-ask', 0)
RELEDITBTN = ('interface','releditbtn', 0)
HEIGHT = ('interface','height', 1)
WIDTH = ('interface','width', 1)
FAMILY_HEIGHT = ('interface','family-height', 1)
FAMILY_WIDTH = ('interface','family-width', 1)
NOTE_HEIGHT = ('interface','note-height', 1)
NOTE_WIDTH = ('interface','note-width', 1)
PERSON_HEIGHT = ('interface','person-height', 1)
PERSON_WIDTH = ('interface','person-width', 1)
EVENT_HEIGHT = ('interface','event-height', 1)
EVENT_WIDTH = ('interface','event-width', 1)
EVENT_REF_HEIGHT = ('interface','event-ref-height', 1)
EVENT_REF_WIDTH = ('interface','event-ref-width', 1)
PLACE_HEIGHT = ('interface','place-height', 1)
PLACE_WIDTH = ('interface','place-width', 1)
REPO_HEIGHT = ('interface','repo-height', 1)
REPO_WIDTH = ('interface','repo-width', 1)
MEDIA_HEIGHT = ('interface','media-height', 1)
MEDIA_WIDTH = ('interface','media-width', 1)
ADDRESS_HEIGHT = ('interface','address-height', 1)
ADDRESS_WIDTH = ('interface','address-width', 1)
ATTRIBUTE_HEIGHT = ('interface','attribute-height', 1)
ATTRIBUTE_WIDTH = ('interface','attribute-width', 1)
NAME_HEIGHT = ('interface','name-height', 1)
NAME_WIDTH = ('interface','name-width', 1)
SOURCE_HEIGHT = ('interface','source-height', 1)
SOURCE_WIDTH = ('interface','source-width', 1)
SOURCE_REF_HEIGHT = ('interface','source-ref-height', 1)
SOURCE_REF_WIDTH = ('interface','source-ref-width', 1)
FILTER = ('interface','filter', 0)
DATABASE_PATH = ('behavior','database-path', 2)
FPREFIX = ('preferences','fprefix', 2)
EPREFIX = ('preferences','eprefix', 2)
RPREFIX = ('preferences','rprefix', 2)
NPREFIX = ('preferences','nprefix', 2)
IPREFIX = ('preferences','iprefix', 2)
OPREFIX = ('preferences','oprefix', 2)
PPREFIX = ('preferences','pprefix', 2)
SPREFIX = ('preferences','sprefix', 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)
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)
STARTUP = ('behavior','startup', 1)
SIZE_CHECKED = ('interface','size-checked', 0)
STATUSBAR = ('interface','statusbar', 1)
SURNAME_GUESSING = ('behavior','surname-guessing', 1)
TOOLBAR_ON = ('interface','toolbar-on', 0)
USE_TIPS = ('behavior','use-tips', 0)
POP_PLUGIN_STATUS = ('behavior','pop-plugin-status', 0)
VIEW = ('interface','view', 0)
SIDEBAR_TEXT = ('interface','sidebar-text', 0)
WEBSITE_DIRECTORY = ('paths','website-directory', 2)
PORT_WARN = ('preferences','port-warn', 0)
TRANSACTIONS = ('behavior','transactions', 0)
LDS_HEIGHT = ('interface','lds-height', 1)
LDS_WIDTH = ('interface','lds-width', 1)
LOCATION_HEIGHT = ('interface','location-height', 1)
LOCATION_WIDTH = ('interface','location-width', 1)
MEDIA_REF_HEIGHT = ('interface','media-ref-height', 1)
MEDIA_REF_WIDTH = ('interface','media-ref-width', 1)
URL_HEIGHT = ('interface','url-height', 1)
URL_WIDTH = ('interface','url-width', 1)
PERSON_REF_HEIGHT = ('interface','person-ref-height', 1)
PERSON_REF_WIDTH = ('interface','person-ref-width', 1)
REPO_REF_HEIGHT = ('interface','repo-ref-height', 1)
REPO_REF_WIDTH = ('interface','repo-ref-width', 1)
OWNER_WARN = ('behavior','owner-warn', 0)
DEFAULT_SOURCE = ('preferences', 'default-source', 0)
RELATION_SHADE = ('preferences', 'relation-shade', 0)
ONLINE_MAPS = ('preferences', 'online-maps', 0)
FAMILY_DETAILS = ('preferences', 'family-details', 0)
COMPLETE_COLOR = ('preferences', 'complete-color', 2)
TODO_COLOR = ('preferences', 'todo-color', 2)
CUSTOM_MARKER_COLOR = ('preferences', 'custom-marker-color', 2)
FAMILY_WARN = ('preferences', 'family-warn', 0)
HIDE_EP_MSG = ('preferences', 'hide-ep-msg', 0)
LAST_VIEW = ('preferences', 'last-view', 1)
USE_LAST_VIEW = ('preferences', 'use-last-view', 0)
FAMILY_SIBLINGS = ('preferences', 'family-siblings', 0)
AUTOLOAD = ('behavior', 'autoload', 0)
ENABLE_AUTOBACKUP = ('behavior', 'enable-autobackup', 0)
SPELLCHECK = ('behavior', 'spellcheck', 0)
BETAWARN = ('behavior', 'betawarn', 0)
WELCOME = ('behavior', 'welcome', 1)
DATE_FORMAT = ('preferences', 'date-format', 1)
DONT_ASK = ('interface', 'dont-ask', 0)
RELEDITBTN = ('interface', 'releditbtn', 0)
HEIGHT = ('interface', 'height', 1)
WIDTH = ('interface', 'width', 1)
FAMILY_HEIGHT = ('interface', 'family-height', 1)
FAMILY_WIDTH = ('interface', 'family-width', 1)
NOTE_HEIGHT = ('interface', 'note-height', 1)
NOTE_WIDTH = ('interface', 'note-width', 1)
PERSON_HEIGHT = ('interface', 'person-height', 1)
PERSON_WIDTH = ('interface', 'person-width', 1)
EVENT_HEIGHT = ('interface', 'event-height', 1)
EVENT_WIDTH = ('interface', 'event-width', 1)
EVENT_REF_HEIGHT = ('interface', 'event-ref-height', 1)
EVENT_REF_WIDTH = ('interface', 'event-ref-width', 1)
PLACE_HEIGHT = ('interface', 'place-height', 1)
PLACE_WIDTH = ('interface', 'place-width', 1)
REPO_HEIGHT = ('interface', 'repo-height', 1)
REPO_WIDTH = ('interface', 'repo-width', 1)
MEDIA_HEIGHT = ('interface', 'media-height', 1)
MEDIA_WIDTH = ('interface', 'media-width', 1)
ADDRESS_HEIGHT = ('interface', 'address-height', 1)
ADDRESS_WIDTH = ('interface', 'address-width', 1)
ATTRIBUTE_HEIGHT = ('interface', 'attribute-height', 1)
ATTRIBUTE_WIDTH = ('interface', 'attribute-width', 1)
NAME_HEIGHT = ('interface', 'name-height', 1)
NAME_WIDTH = ('interface', 'name-width', 1)
SOURCE_HEIGHT = ('interface', 'source-height', 1)
SOURCE_WIDTH = ('interface', 'source-width', 1)
SOURCE_REF_HEIGHT = ('interface', 'source-ref-height', 1)
SOURCE_REF_WIDTH = ('interface', 'source-ref-width', 1)
FILTER = ('interface', 'filter', 0)
DATABASE_PATH = ('behavior', 'database-path', 2)
FPREFIX = ('preferences', 'fprefix', 2)
EPREFIX = ('preferences', 'eprefix', 2)
RPREFIX = ('preferences', 'rprefix', 2)
NPREFIX = ('preferences', 'nprefix', 2)
IPREFIX = ('preferences', 'iprefix', 2)
OPREFIX = ('preferences', 'oprefix', 2)
PPREFIX = ('preferences', 'pprefix', 2)
SPREFIX = ('preferences', 'sprefix', 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)
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)
STARTUP = ('behavior', 'startup', 1)
SIZE_CHECKED = ('interface', 'size-checked', 0)
STATUSBAR = ('interface', 'statusbar', 1)
SURNAME_GUESSING = ('behavior', 'surname-guessing', 1)
TOOLBAR_ON = ('interface', 'toolbar-on', 0)
USE_TIPS = ('behavior', 'use-tips', 0)
POP_PLUGIN_STATUS = ('behavior', 'pop-plugin-status', 0)
VIEW = ('interface', 'view', 0)
SIDEBAR_TEXT = ('interface', 'sidebar-text', 0)
WEBSITE_DIRECTORY = ('paths', 'website-directory', 2)
PORT_WARN = ('preferences', 'port-warn', 0)
TRANSACTIONS = ('behavior', 'transactions', 0)
LDS_HEIGHT = ('interface', 'lds-height', 1)
LDS_WIDTH = ('interface', 'lds-width', 1)
LOCATION_HEIGHT = ('interface', 'location-height', 1)
LOCATION_WIDTH = ('interface', 'location-width', 1)
MEDIA_REF_HEIGHT = ('interface', 'media-ref-height', 1)
MEDIA_REF_WIDTH = ('interface', 'media-ref-width', 1)
URL_HEIGHT = ('interface', 'url-height', 1)
URL_WIDTH = ('interface', 'url-width', 1)
PERSON_REF_HEIGHT = ('interface', 'person-ref-height', 1)
PERSON_REF_WIDTH = ('interface', 'person-ref-width', 1)
REPO_REF_HEIGHT = ('interface', 'repo-ref-height', 1)
REPO_REF_WIDTH = ('interface', 'repo-ref-width', 1)
OWNER_WARN = ('behavior', 'owner-warn', 0)
default_value = {
DEFAULT_SOURCE : False,
RELATION_SHADE : True,
ONLINE_MAPS : False,
FAMILY_DETAILS : True,
COMPLETE_COLOR : '#008b00',
TODO_COLOR : '#ff0000',
CUSTOM_MARKER_COLOR : '#8b008b',
FAMILY_WARN : True,
HIDE_EP_MSG : False,
LAST_VIEW : 0,
USE_LAST_VIEW : True,
FAMILY_SIBLINGS : True,
AUTOLOAD : False,
ENABLE_AUTOBACKUP : True,
SPELLCHECK : False,
BETAWARN : False,
WELCOME : 100,
DATE_FORMAT : 0,
DONT_ASK : False,
RELEDITBTN : False,
HEIGHT : 500,
WIDTH : 775,
FAMILY_HEIGHT : 500,
FAMILY_WIDTH : 700,
NOTE_HEIGHT : 500,
NOTE_WIDTH : 700,
PERSON_HEIGHT : 550,
PERSON_WIDTH : 750,
EVENT_HEIGHT : 450,
EVENT_WIDTH : 600,
EVENT_REF_HEIGHT : 450,
EVENT_REF_WIDTH : 600,
PLACE_HEIGHT : 450,
PLACE_WIDTH : 650,
REPO_HEIGHT : 450,
REPO_WIDTH : 650,
MEDIA_HEIGHT : 450,
MEDIA_WIDTH : 650,
ADDRESS_HEIGHT : 450,
ADDRESS_WIDTH : 650,
ATTRIBUTE_HEIGHT : 350,
ATTRIBUTE_WIDTH : 600,
NAME_HEIGHT : 350,
NAME_WIDTH : 600,
SOURCE_HEIGHT : 450,
SOURCE_WIDTH : 600,
SOURCE_REF_HEIGHT : 450,
SOURCE_REF_WIDTH : 600,
FILTER : False,
DATABASE_PATH : '~/.gramps/grampsdb',
FPREFIX : 'F%04d',
EPREFIX : 'E%04d',
RPREFIX : 'R%04d',
NPREFIX : 'N%04d',
IPREFIX : 'I%04d',
OPREFIX : 'O%04d',
PPREFIX : 'P%04d',
SPREFIX : 'S%04d',
GOUTPUT_PREFERENCE : 'No default format',
OUTPUT_PREFERENCE : 'No default format',
PAPER_PREFERENCE : 'Letter',
RECENT_FILE : '',
RECENT_IMPORT_DIR : '',
RECENT_EXPORT_DIR : '',
NAME_FORMAT : 1,
REPORT_DIRECTORY : './',
RESEARCHER_ADDR : '',
RESEARCHER_CITY : '',
RESEARCHER_COUNTRY : '',
RESEARCHER_EMAIL : '',
RESEARCHER_NAME : '',
RESEARCHER_PHONE : '',
RESEARCHER_POSTAL : '',
RESEARCHER_STATE : '',
STARTUP : 0,
SIZE_CHECKED : False,
STATUSBAR : 1,
SURNAME_GUESSING : 0,
TOOLBAR_ON : True,
USE_TIPS : False,
POP_PLUGIN_STATUS : False,
VIEW : True,
SIDEBAR_TEXT : True,
WEBSITE_DIRECTORY : './',
PORT_WARN : False,
TRANSACTIONS : True,
LDS_HEIGHT : 450,
LDS_WIDTH : 600,
LOCATION_HEIGHT : 250,
LOCATION_WIDTH : 600,
MEDIA_REF_HEIGHT : 450,
MEDIA_REF_WIDTH : 600,
URL_HEIGHT : 150,
URL_WIDTH : 600,
PERSON_REF_HEIGHT : 350,
PERSON_REF_WIDTH : 600,
REPO_REF_HEIGHT : 450,
REPO_REF_WIDTH : 600,
OWNER_WARN : False,
DEFAULT_SOURCE : False,
RELATION_SHADE : True,
ONLINE_MAPS : False,
FAMILY_DETAILS : True,
COMPLETE_COLOR : '#008b00',
TODO_COLOR : '#ff0000',
CUSTOM_MARKER_COLOR : '#8b008b',
FAMILY_WARN : True,
HIDE_EP_MSG : False,
LAST_VIEW : 0,
USE_LAST_VIEW : True,
FAMILY_SIBLINGS : True,
AUTOLOAD : False,
ENABLE_AUTOBACKUP : True,
SPELLCHECK : False,
BETAWARN : False,
WELCOME : 100,
DATE_FORMAT : 0,
DONT_ASK : False,
RELEDITBTN : False,
HEIGHT : 500,
WIDTH : 775,
FAMILY_HEIGHT : 500,
FAMILY_WIDTH : 700,
NOTE_HEIGHT : 500,
NOTE_WIDTH : 700,
PERSON_HEIGHT : 550,
PERSON_WIDTH : 750,
EVENT_HEIGHT : 450,
EVENT_WIDTH : 600,
EVENT_REF_HEIGHT : 450,
EVENT_REF_WIDTH : 600,
PLACE_HEIGHT : 450,
PLACE_WIDTH : 650,
REPO_HEIGHT : 450,
REPO_WIDTH : 650,
MEDIA_HEIGHT : 450,
MEDIA_WIDTH : 650,
ADDRESS_HEIGHT : 450,
ADDRESS_WIDTH : 650,
ATTRIBUTE_HEIGHT : 350,
ATTRIBUTE_WIDTH : 600,
NAME_HEIGHT : 350,
NAME_WIDTH : 600,
SOURCE_HEIGHT : 450,
SOURCE_WIDTH : 600,
SOURCE_REF_HEIGHT : 450,
SOURCE_REF_WIDTH : 600,
FILTER : False,
DATABASE_PATH : '~/.gramps/grampsdb',
FPREFIX : 'F%04d',
EPREFIX : 'E%04d',
RPREFIX : 'R%04d',
NPREFIX : 'N%04d',
IPREFIX : 'I%04d',
OPREFIX : 'O%04d',
PPREFIX : 'P%04d',
SPREFIX : 'S%04d',
GOUTPUT_PREFERENCE : 'No default format',
OUTPUT_PREFERENCE : 'No default format',
PAPER_PREFERENCE : 'Letter',
RECENT_FILE : '',
RECENT_IMPORT_DIR : '',
RECENT_EXPORT_DIR : '',
NAME_FORMAT : 1,
REPORT_DIRECTORY : './',
RESEARCHER_ADDR : '',
RESEARCHER_CITY : '',
RESEARCHER_COUNTRY : '',
RESEARCHER_EMAIL : '',
RESEARCHER_NAME : '',
RESEARCHER_PHONE : '',
RESEARCHER_POSTAL : '',
RESEARCHER_STATE : '',
STARTUP : 0,
SIZE_CHECKED : False,
STATUSBAR : 1,
SURNAME_GUESSING : 0,
TOOLBAR_ON : True,
USE_TIPS : False,
POP_PLUGIN_STATUS : False,
VIEW : True,
SIDEBAR_TEXT : True,
WEBSITE_DIRECTORY : './',
PORT_WARN : False,
TRANSACTIONS : True,
LDS_HEIGHT : 450,
LDS_WIDTH : 600,
LOCATION_HEIGHT : 250,
LOCATION_WIDTH : 600,
MEDIA_REF_HEIGHT : 450,
MEDIA_REF_WIDTH : 600,
URL_HEIGHT : 150,
URL_WIDTH : 600,
PERSON_REF_HEIGHT : 350,
PERSON_REF_WIDTH : 600,
REPO_REF_HEIGHT : 450,
REPO_REF_WIDTH : 600,
OWNER_WARN : False,
}

View File

@@ -8,7 +8,7 @@
# 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,
# 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.
@@ -41,7 +41,7 @@ import Errors
from _GrampsConfigKeys import default_value
client = gconf.client_get_default()
client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
client.add_dir("/apps/gramps", gconf.CLIENT_PRELOAD_NONE)
#-------------------------------------------------------------------------
@@ -54,19 +54,19 @@ client.add_dir("/apps/gramps",gconf.CLIENT_PRELOAD_NONE)
#-------------------------------------------------------------------------
def get_date_format(date_format_list):
return get_int("/apps/gramps/preferences/date-format",
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,
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",
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,
def save_name_format(val, _name_format_list):
set_int("/apps/gramps/preferences/name-format", val,
range(len(_name_format_list)))
#-------------------------------------------------------------------------
@@ -76,16 +76,16 @@ def save_name_format(val,_name_format_list):
#-------------------------------------------------------------------------
def set(key, value):
token = "/apps/gramps/%s/%s" % (key[0],key[1])
token = "/apps/gramps/%s/%s" % (key[0], key[1])
if key[2] == 0:
set_bool(token,value)
set_bool(token, value)
elif key[2] == 1:
set_int(token,value)
set_int(token, value)
else:
set_string(token,value)
set_string(token, value)
def get(key):
token = "/apps/gramps/%s/%s" % (key[0],key[1])
token = "/apps/gramps/%s/%s" % (key[0], key[1])
if key[2] == 0:
val = get_bool(token)
elif key[2] == 1:
@@ -101,7 +101,7 @@ def get_bool(key):
val = client.get_bool(key)
except gobject.GError:
val = None
if val in (True,False):
if val in (True, False):
return val
else:
val = client.get_default_from_schema(key)
@@ -109,11 +109,11 @@ def get_bool(key):
raise Errors.GConfSchemaError("No default value for key "+key)
return val.get_bool()
def set_bool(key,val):
if val in (True,False):
client.set_bool(key,val)
def set_bool(key, val):
if val in (True, False):
client.set_bool(key, val)
def get_int(key,correct_tuple=None):
def get_int(key, correct_tuple=None):
try:
val = client.get_int(key)
except gobject.GError:
@@ -126,11 +126,11 @@ def get_int(key,correct_tuple=None):
raise Errors.GConfSchemaError("No default value for key "+key)
return val.get_int()
def set_int(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(key,val)
client.set_int(key, val)
def get_string(key,test_func=None):
def get_string(key, test_func=None):
try:
val = client.get_string(key)
except gobject.GError:
@@ -143,19 +143,19 @@ def get_string(key,test_func=None):
raise Errors.GConfSchemaError("No default value for key "+key)
return val.get_string()
def set_string(key,val,test_func=None):
def set_string(key, val, test_func=None):
if not test_func or test_func(val):
client.set_string(key,val)
client.set_string(key, val)
def sync():
client.suggest_sync()
def get_default(key,sample=''):
token = "/apps/gramps/%s/%s" % (key[0],key[1])
def get_default(key, sample=''):
token = "/apps/gramps/%s/%s" % (key[0], key[1])
value = client.get_default_from_schema(token)
if value == None:
raise Errors.GConfSchemaError("No default value for key "+key[1])
if type(sample) in (str,unicode):
if type(sample) in (str, unicode):
return value.get_string()
elif type(sample) == int:
return value.get_int()

View File

@@ -33,6 +33,8 @@ from _GrampsConfigKeys import *
NL = "\n" # FIX: newlines on Mac/Windows, if different?
INIFILE = os.path.join(const.home_dir,"keys.ini")
def make_bool(val):
""" Function to turn strings into booleans. """
# these are the possible strings that should be considered False
@@ -158,7 +160,7 @@ class IniKeyClient:
def suggest_sync(self):
self.save_ini() # save back to default file, if named
client = IniKeyClient(os.path.join(const.home_dir,"keys.ini"))
client = IniKeyClient(INIFILE)
#-------------------------------------------------------------------------
#

View File

@@ -25,14 +25,24 @@ This package implements access to GRAMPS configuration.
It provides the choice between different storage backends.
"""
import const
from _GrampsConfigKeys import *
from _GrampsIniKeys import *
if const.no_gconf:
from _GrampsIniKeys import *
else:
import os
def __upgrade_gconf():
import _GrampsGconfKeys as GconfKeys
print "Upgrading INI file"
for key in default_value.keys():
data = GconfKeys.get(key)
set(key, data)
if not os.path.exists(INIFILE):
try:
from _GrampsGconfKeys import *
except:
from _GrampsIniKeys import *
__upgrade_gconf()
except ImportError:
print "Cannot upgrade GCONF settings"

View File

@@ -41,7 +41,7 @@ import locale
#
#-------------------------------------------------------------------------
import logging
log = logging.getLogger(".Spell")
LOG = logging.getLogger(".Spell")
#-------------------------------------------------------------------------
#
@@ -53,7 +53,7 @@ try:
import gtkspell
HAVE_GTKSPELL = True
except ImportError:
log.warn(_("Spelling checker is not installed"))
LOG.warn(_("Spelling checker is not installed"))
HAVE_GTKSPELL = False
#-------------------------------------------------------------------------
@@ -162,7 +162,7 @@ LANGUAGES = {
class Spell:
"""Attach a gtkspell instance to the passed TextView instance.
"""
_LANG = locale.getlocale()[0]
lang = locale.getlocale()[0]
_installed_languages = {'off': _('None')}
@@ -177,19 +177,19 @@ class Spell:
def __init__(self, textview):
self.textview = textview
if self._LANG and Config.get(Config.SPELLCHECK):
if self.lang and Config.get(Config.SPELLCHECK):
# if LANG is not a correct key (pt_BR or pt_PT),
# try only the language part of LANG
if self._LANG not in self._installed_languages.keys():
self._LANG = self._LANG.split('_')[0]
if self.lang not in self._installed_languages.keys():
self.lang = self.lang.split('_')[0]
# if this still doesn't work we fall back to 'off'
if self._LANG not in self._installed_languages.keys():
self._LANG = 'off'
if self.lang not in self._installed_languages.keys():
self.lang = 'off'
else:
self._LANG = 'off'
self.lang = 'off'
self._active_language = 'off'
self._real_set_active_language(self._LANG)
self._real_set_active_language(self.lang)
def _real_set_active_language(self, lang_code):
"""Set the active language by it's code."""
@@ -208,26 +208,10 @@ class Spell:
gtkspell_spell.set_language(lang_code)
self._active_language = lang_code
def _sort_languages(self, lang_a, lang_b):
"""Put language names in alphabetical order.
Except 'None', which should be always the first.
"""
if lang_a == _('None'):
return -1
if lang_b == _('None'):
return 1
if lang_a < lang_b:
return -1
if lang_a > lang_b:
return 1
return 0
def get_all_languages(self):
"""Get the list of installed language names."""
langs = self._installed_languages.values()
langs.sort(self._sort_languages)
langs.sort(sort_languages)
return langs
def set_active_language(self, language):
@@ -240,3 +224,20 @@ class Spell:
def get_active_language(self):
"""Get the name of the active language."""
return self._installed_languages[self._active_language]
def sort_languages(lang_a, lang_b):
"""Put language names in alphabetical order.
Except 'None', which should be always the first.
"""
if lang_a == _('None'):
return -1
if lang_b == _('None'):
return 1
if lang_a < lang_b:
return -1
if lang_a > lang_b:
return 1
return 0

View File

@@ -159,9 +159,9 @@ register_tool(
tool_class = EventNames,
options_class = EventNamesOptions,
modes = Tool.MODE_GUI,
translated_name = _("Extract event names from data"),
translated_name = _("Extract event descriptions from event data"),
status = _("Stable"),
author_name = "Donald N. Allingham",
author_email = "don@gramps-project.org",
description = _("Extracts event names from the event data")
description = _("Extracts event descriptions from the event data")
)

View File

@@ -377,10 +377,10 @@ register_tool(
tool_class = ExtractCity,
options_class = ExtractCityOptions,
modes = Tool.MODE_GUI,
translated_name = _("Extract city and state information from a place"),
translated_name = _("Extract place data from a place title"),
status = _("Stable"),
author_name = "Donald N. Allingham",
author_email = "don@gramps-project.org",
description = _("Attempts to extract city and state/province "
"from a place name")
"from a place title")
)