developing settings system
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,4 +4,5 @@
|
|||||||
/.idea/
|
/.idea/
|
||||||
/tests/
|
/tests/
|
||||||
env.py
|
env.py
|
||||||
/client/dist/
|
/client/dist/
|
||||||
|
settings.json
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"animation": "InOutQuart"
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,20 @@ import json
|
|||||||
|
|
||||||
|
|
||||||
class Settings:
|
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
|
@staticmethod
|
||||||
def animation():
|
def animation():
|
||||||
from PyQt5.QtCore import QEasingCurve
|
from PyQt5.QtCore import QEasingCurve
|
||||||
|
|||||||
@@ -8,10 +8,15 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from gui.gui import Ui_MainWindow
|
from gui.gui import Ui_MainWindow
|
||||||
|
|
||||||
|
settings = Settings.get_settings()
|
||||||
|
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
MainWindow = QtWidgets.QMainWindow()
|
MainWindow = QtWidgets.QMainWindow()
|
||||||
ui = Ui_MainWindow()
|
ui = Ui_MainWindow()
|
||||||
ui.setupUi(MainWindow)
|
ui.setupUi(MainWindow)
|
||||||
|
|
||||||
|
ui.chooseAnimationBox.setCurrentText(settings["animation"])
|
||||||
|
|
||||||
MainWindow.show()
|
MainWindow.show()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user