Added Utils.update_constants() that is run after changing preferences.

svn: r12817
This commit is contained in:
Doug Blank 2009-07-19 20:50:46 +00:00
parent 4a2fa50abb
commit ffe12ceceb
2 changed files with 17 additions and 2 deletions

View File

@ -159,6 +159,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
self.show()
def done(self, obj, value):
Utils.update_constants()
self.close()
def add_researcher_panel(self):

View File

@ -56,7 +56,7 @@ from TransUtils import sgettext as _
# Constants from config .ini keys
#
#-------------------------------------------------------------------------
#obtain the values once, they do not change!
# cache values; use refresh_constants() if they change
try:
import Config
_MAX_AGE_PROB_ALIVE = Config.get(Config.MAX_AGE_PROB_ALIVE)
@ -962,7 +962,7 @@ def get_translations():
#-------------------------------------------------------------------------
#
#
# Config-based functions
#
#-------------------------------------------------------------------------
def get_researcher():
@ -989,3 +989,17 @@ def get_researcher():
owner.set_email(e)
return owner
def update_constants():
"""
Used to update the constants that are cached in this module.
"""
import Config
global _MAX_AGE_PROB_ALIVE, _MAX_SIB_AGE_DIFF, _MIN_GENERATION_YEARS, \
_AVG_GENERATION_GAP
_MAX_AGE_PROB_ALIVE = Config.get(Config.MAX_AGE_PROB_ALIVE)
_MAX_SIB_AGE_DIFF = Config.get(Config.MAX_SIB_AGE_DIFF)
_MIN_GENERATION_YEARS = Config.get(Config.MIN_GENERATION_YEARS)
_AVG_GENERATION_GAP = Config.get(Config.AVG_GENERATION_GAP)