settings - docs and fixes

This commit is contained in:
ingvar1995 2016-05-14 13:35:31 +03:00
parent 1734ea02f9
commit c5ec90a8a4

View file

@ -7,6 +7,9 @@ import pyaudio
class Settings(Singleton, dict):
"""
Settings of current profile + global app settings
"""
def __init__(self, name):
self.path = ProfileHelper.get_path() + str(name) + '.json'
@ -47,6 +50,9 @@ class Settings(Singleton, dict):
@staticmethod
def get_default_settings():
"""
Default profile settings
"""
return {
'theme': 'default',
'ipv6_enabled': True,
@ -108,6 +114,9 @@ class Settings(Singleton, dict):
fl.write(data)
def set_active_profile(self):
"""
Mark current profile as active
"""
path = Settings.get_default_path() + 'toxygen.json'
if os.path.isfile(path):
with open(path) as fl:
@ -176,6 +185,9 @@ class ProfileHelper(Singleton):
@staticmethod
def find_profiles():
"""
Find available tox profiles
"""
path = Settings.get_default_path()
result = []
# check default path
@ -203,7 +215,6 @@ class ProfileHelper(Singleton):
data = json.loads(data)
if 'active_profile' in data:
return path in data['active_profile']
else:
return False
@staticmethod