3272: Proposal for updating config settings

svn: r13346
This commit is contained in:
Doug Blank
2009-10-08 01:12:51 +00:00
parent 3959b59d40
commit 99282aa715
94 changed files with 1220 additions and 1230 deletions

View File

@@ -57,7 +57,7 @@ from gen.lib.calendar import (gregorian_sdn, julian_sdn, hebrew_sdn,
gregorian_ymd, julian_ymd, hebrew_ymd,
french_ymd, persian_ymd, islamic_ymd,
swedish_ymd)
import Config
import config
#-------------------------------------------------------------------------
#
@@ -82,9 +82,9 @@ class Span(object):
minmax = (min days, max days)
"""
BEFORE = Config.get(Config.DATE_BEFORE_RANGE)
AFTER = Config.get(Config.DATE_AFTER_RANGE)
ABOUT = Config.get(Config.DATE_ABOUT_RANGE)
BEFORE = config.get('behavior.date-before-range')
AFTER = config.get('behavior.date-after-range')
ABOUT = config.get('behavior.date-about-range')
def __init__(self, date1, date2):
self.valid = (date1.sortval != 0 and date2.sortval != 0)
self.date1 = date1
@@ -934,15 +934,15 @@ class Date(object):
# if BEFORE, AFTER, or ABOUT/EST, adjust:
if self.modifier == Date.MOD_BEFORE:
stopmax = date_offset(startmin, -1)
fdiff = Config.get(Config.DATE_BEFORE_RANGE)
fdiff = config.get('behavior.date-before-range')
startmin = (stopmax[0] - fdiff, stopmax[1], stopmax[2])
elif self.modifier == Date.MOD_AFTER:
startmin = date_offset(stopmax, 1)
fdiff = Config.get(Config.DATE_AFTER_RANGE)
fdiff = config.get('behavior.date-after-range')
stopmax = (startmin[0] + fdiff, startmin[1], startmin[2])
elif (self.modifier == Date.MOD_ABOUT or
self.quality == Date.QUAL_ESTIMATED):
fdiff = Config.get(Config.DATE_ABOUT_RANGE)
fdiff = config.get('behavior.date-about-range')
startmin = (startmin[0] - fdiff, startmin[1], startmin[2])
stopmax = (stopmax[0] + fdiff, stopmax[1], stopmax[2])
# return tuples not lists, for comparisons

View File

@@ -45,7 +45,7 @@ except ValueError:
from test import test_util
test_util.path_append_parent()
import Config
import config
import DateHandler
from DateHandler import parser as _dp
from DateHandler import displayer as _dd
@@ -291,9 +291,9 @@ class Tester(unittest.TestCase):
def suite():
""" interface to automated test runner test/regrtest.py """
Config.set(Config.DATE_BEFORE_RANGE, 9999)
Config.set(Config.DATE_AFTER_RANGE, 9999)
Config.set(Config.DATE_ABOUT_RANGE, 10)
config.set('behavior.date-before-range', 9999)
config.set('behavior.date-after-range', 9999)
config.set('behavior.date-about-range', 10)
# most are symmetric: #date1, date2, does d1 match d2? does d2 match d1?
tests = [("before 1960", "before 1961", True),
("before 1960", "before 1960", True),
@@ -386,9 +386,9 @@ class Assert(unittest.TestCase):
def suite2():
""" interface to automated test runner test/regrtest.py """
Config.set(Config.DATE_BEFORE_RANGE, 9999)
Config.set(Config.DATE_AFTER_RANGE, 9999)
Config.set(Config.DATE_ABOUT_RANGE, 10)
config.set('behavior.date-before-range', 9999)
config.set('behavior.date-after-range', 9999)
config.set('behavior.date-about-range', 10)
tests = [
# Date +/- int/tuple -> Date
("Date(2008, 1, 1) - 1", "Date(2007, 1, 1)"),

View File

@@ -38,7 +38,7 @@ Proxy class for the GRAMPS databases. Filter out all living people.
from proxybase import ProxyDbBase
from gen.lib import Date, Person, Name
from Utils import probably_alive
import Config
import config
#-------------------------------------------------------------------------
#
@@ -251,7 +251,7 @@ class LivingProxyDb(ProxyDbBase):
new_name.set_surname_prefix(old_name.get_surname_prefix())
new_name.set_type(old_name.get_type())
if self.mode == self.MODE_INCLUDE_LAST_NAME_ONLY:
new_name.set_first_name(Config.get(Config.PRIVATE_GIVEN_TEXT))
new_name.set_first_name(config.get('preferences.private-given-text'))
else: # self.mode == self.MODE_INCLUDE_FULL_NAME_ONLY
new_name.set_first_name(old_name.get_first_name())
new_name.set_suffix(old_name.get_suffix())