Test implementation of eos settings
This commit is contained in:
@@ -105,3 +105,7 @@ def defPaths(customSavePath):
|
||||
# saveddata db location modifier, shouldn't ever need to touch this
|
||||
eos.config.saveddata_connectionstring = "sqlite:///" + saveDB + "?check_same_thread=False"
|
||||
eos.config.gamedata_connectionstring = "sqlite:///" + gameDB + "?check_same_thread=False"
|
||||
|
||||
# initialize the settings
|
||||
from service.settings import EOSSettings
|
||||
eos.config.settings = EOSSettings.getInstance().EOSSettings # this is kind of confusing, but whatever
|
||||
|
||||
@@ -10,6 +10,10 @@ gamedata_connectionstring = 'sqlite:///' + unicode(realpath(join(dirname(abspath
|
||||
saveddata_connectionstring = 'sqlite:///' + unicode(
|
||||
realpath(join(dirname(abspath(__file__)), "..", "saveddata", "saveddata.db")), sys.getfilesystemencoding())
|
||||
|
||||
settings = {
|
||||
"setting1": True
|
||||
}
|
||||
|
||||
# Autodetect path, only change if the autodetection bugs out.
|
||||
path = dirname(unicode(__file__, sys.getfilesystemencoding()))
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
# Used by:
|
||||
# Modules from group: Tractor Beam (4 of 4)
|
||||
type = "active"
|
||||
|
||||
from eos.config import settings
|
||||
|
||||
def handler(fit, module, context):
|
||||
print settings['setting1']
|
||||
pass
|
||||
|
||||
@@ -22,6 +22,7 @@ import os.path
|
||||
import urllib2
|
||||
|
||||
import config
|
||||
import eos.config
|
||||
from logbook import Logger
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -436,4 +437,23 @@ class ContextMenuSettings(object):
|
||||
def set(self, type, value):
|
||||
self.ContextMenuDefaultSettings[type] = value
|
||||
|
||||
class EOSSettings(object):
|
||||
_instance = None
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = EOSSettings()
|
||||
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
self.EOSSettings = SettingsProvider.getInstance().getSettings("pyfaEOSSettings", eos.config.settings)
|
||||
|
||||
def get(self, type):
|
||||
return self.EOSSettings[type]
|
||||
|
||||
def set(self, type, value):
|
||||
self.EOSSettings[type] = value
|
||||
|
||||
# @todo: migrate fit settings (from fit service) here?
|
||||
|
||||
Reference in New Issue
Block a user