developing settings system
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,4 +4,5 @@
|
||||
/.idea/
|
||||
/tests/
|
||||
env.py
|
||||
/client/dist/
|
||||
/client/dist/
|
||||
settings.json
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"animation": "InOutQuart"
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user