fishyboteso/fishy/systems/config.py
DESKTOP-JVKHS7I\Adam 6a708e55e6 auto install addon, dc function added and more,
- moved config to documents
- reduced readme
- updated requirements
- action key implemented
- when non saved config is get for the first time, default is saved
- added icon
- added unhandled exception logging
- added debug mode
- made dark mode and debug mode check buttons instead of command
- created manifest
- moved addon to a zip
2020-04-20 01:21:49 +05:30

32 lines
772 B
Python

import json
import os
from threading import Thread
filename = os.path.expanduser(r"~/Documents/fishy_config.json")
class Config:
def __init__(self):
self.config_dict = json.loads(open(filename).read()) if os.path.exists(filename) else dict()
def get(self, key, default=None, save=True):
if key in self.config_dict:
return self.config_dict[key]
if save:
self.set(key, default)
return default
def set(self, key, value, save=True):
self.config_dict[key] = value
if save:
self.save_config()
def save_config(self):
def save():
with open(filename, 'w') as f:
f.write(json.dumps(self.config_dict))
Thread(target=save).start()