developing settings system

This commit is contained in:
BarsTiger
2022-05-17 11:41:17 +03:00
parent 4868324fbd
commit 7985c7fd63
4 changed files with 21 additions and 4 deletions

3
.gitignore vendored
View File

@@ -4,4 +4,5 @@
/.idea/
/tests/
env.py
/client/dist/
/client/dist/
settings.json

View File

@@ -1,3 +0,0 @@
{
"animation": "InOutQuart"
}

View File

@@ -2,6 +2,20 @@ import json
class Settings:
@staticmethod
def get_settings():
try:
with open("data/settings.json", "r") as file:
settings = json.load(file)
except FileNotFoundError:
settings = {
"animation": "InOutQuart"
}
with open("data/settings.json", "w") as file:
json.dump(settings, file)
return settings
@staticmethod
def animation():
from PyQt5.QtCore import QEasingCurve

View File

@@ -8,10 +8,15 @@ try:
except ImportError:
from gui.gui import Ui_MainWindow
settings = Settings.get_settings()
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
ui.chooseAnimationBox.setCurrentText(settings["animation"])
MainWindow.show()