default profile fix
This commit is contained in:
parent
97ce2b9ceb
commit
9fe9ba4743
@ -160,6 +160,7 @@ class History:
|
|||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
def unlock_db(self):
|
def unlock_db(self):
|
||||||
|
print('Unlocking db...')
|
||||||
connection = dbapi2.connect(self._name)
|
connection = dbapi2.connect(self._name)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
connection.close()
|
connection.close()
|
||||||
|
@ -49,9 +49,9 @@ class Settings(dict, Singleton):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_auto_profile():
|
def get_auto_profile():
|
||||||
path = Settings.get_default_path() + 'toxygen.json'
|
p = Settings.get_default_path() + 'toxygen.json'
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(p):
|
||||||
with open(path) as fl:
|
with open(p) as fl:
|
||||||
data = fl.read()
|
data = fl.read()
|
||||||
auto = json.loads(data)
|
auto = json.loads(data)
|
||||||
if 'path' in auto and 'name' in auto:
|
if 'path' in auto and 'name' in auto:
|
||||||
@ -61,9 +61,12 @@ class Settings(dict, Singleton):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def set_auto_profile(path, name):
|
def set_auto_profile(path, name):
|
||||||
p = Settings.get_default_path() + 'toxygen.json'
|
p = Settings.get_default_path() + 'toxygen.json'
|
||||||
|
if os.path.isfile(p):
|
||||||
with open(p) as fl:
|
with open(p) as fl:
|
||||||
data = fl.read()
|
data = fl.read()
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
|
else:
|
||||||
|
data = {}
|
||||||
data['path'] = str(path)
|
data['path'] = str(path)
|
||||||
data['name'] = str(name)
|
data['name'] = str(name)
|
||||||
with open(p, 'w') as fl:
|
with open(p, 'w') as fl:
|
||||||
@ -72,9 +75,12 @@ class Settings(dict, Singleton):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def reset_auto_profile():
|
def reset_auto_profile():
|
||||||
p = Settings.get_default_path() + 'toxygen.json'
|
p = Settings.get_default_path() + 'toxygen.json'
|
||||||
|
if os.path.isfile(p):
|
||||||
with open(p) as fl:
|
with open(p) as fl:
|
||||||
data = fl.read()
|
data = fl.read()
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
|
else:
|
||||||
|
data = {}
|
||||||
if 'path' in data:
|
if 'path' in data:
|
||||||
del data['path']
|
del data['path']
|
||||||
del data['name']
|
del data['name']
|
||||||
|
Loading…
Reference in New Issue
Block a user