Issue #3500 back port of loadConfig.py to fix gfe starup issue
Change-Id: I841af0ac81b86e499c0b52dedab64431e7f1ecd7 Former-commit-id: 2a0af03242692708b3e752417ca7d60d28520768
This commit is contained in:
parent
9f7905b58d
commit
cf671dcda8
1 changed files with 13 additions and 9 deletions
|
@ -26,31 +26,35 @@
|
|||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 12/11/09 njensen Initial Creation.
|
||||
# 08/21/14 3500 bclement fixed loadPreferences except block
|
||||
#
|
||||
# 12/11/09 njensen Initial Creation.
|
||||
# 04/02/2014 #2729 randerso Fixed error handling in loadPreferences
|
||||
#
|
||||
#
|
||||
|
||||
import types
|
||||
import LogStream
|
||||
from java.util import HashMap, ArrayList
|
||||
from java.lang import String, Float, Integer, Boolean
|
||||
|
||||
def loadPreferences(config):
|
||||
try:
|
||||
# import the config file
|
||||
if type(config) is types.StringType:
|
||||
globals = loadConfig(config)
|
||||
elif type(config) is types.ModuleType:
|
||||
globals = getGlobals(config)
|
||||
if type(config) is types.StringType:
|
||||
configName = config
|
||||
mod = __import__(config)
|
||||
elif type(config) is types.ModuleType:
|
||||
configName = config.__name__
|
||||
mod = config
|
||||
|
||||
globals = getGlobals(mod)
|
||||
|
||||
from com.raytheon.viz.gfe import Activator, PythonPreferenceStore
|
||||
prefs = PythonPreferenceStore(globals)
|
||||
Activator.getDefault().setPreferenceStore(prefs)
|
||||
return prefs
|
||||
except Exception, e:
|
||||
LogStream.logProblem("Unknown or improper config file: ", config)
|
||||
import LogStream
|
||||
import traceback
|
||||
LogStream.logProblem("Unknown or invalid config file: %s\n%s" % (configName, traceback.format_exc()))
|
||||
raise Exception, e
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue