Test implementation of eos settings

This commit is contained in:
blitzman
2017-03-05 01:53:19 -05:00
parent ab34b31219
commit 9befaf7c91
4 changed files with 30 additions and 1 deletions

View File

@@ -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

View File

@@ -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()))

View File

@@ -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

View File

@@ -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?