2021-04-02 20:53:19 +05:30
|
|
|
# Released under the MIT License. See LICENSE for details.
|
2021-04-17 13:22:30 +05:30
|
|
|
import _ba, json
|
|
|
|
|
|
|
|
|
|
settings_path = _ba.env()["python_directory_user"]+"/setting.json"
|
|
|
|
|
|
2021-11-10 17:26:07 +05:30
|
|
|
settings=None
|
2021-04-17 13:22:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_settings_data():
|
2021-11-10 17:26:07 +05:30
|
|
|
global settings
|
|
|
|
|
if settings==None:
|
|
|
|
|
with open(settings_path, "r") as f:
|
|
|
|
|
data = json.load(f)
|
|
|
|
|
settings=data
|
|
|
|
|
return settings
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
return settings
|
2021-04-17 13:22:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def commit(data):
|
|
|
|
|
with open(settings_path, "w") as f:
|
|
|
|
|
json.dump(data, f, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sendError(msg : str, client_id : int = None):
|
|
|
|
|
if client_id == None:
|
|
|
|
|
_ba.screenmessage(msg, color=(1,0,0))
|
|
|
|
|
else:
|
|
|
|
|
_ba.screenmessage(msg, color=(1,0,0), transient=True, clients=[client_id])
|
2021-04-03 20:54:32 +05:30
|
|
|
|