Skip to content

Commit c185999

Browse files
authored
Add files via upload
1 parent 4b09926 commit c185999

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
from resources.runtime import savestate
3+
from resources.runtime.Settings.logfunctions import logWrite
4+
from resources.runtime.Settings.save import writeToAutosave
5+
6+
7+
def saveCurrentState():
8+
"""
9+
Saves the lists to the autosave file
10+
11+
:return: None
12+
"""
13+
logWrite("Saving contents to the autosave...")
14+
thisSave = {
15+
"txtlist": savestate.txtlist
16+
}
17+
writeToAutosave("eSports", thisSave)
18+
19+
20+
def loadTexts():
21+
success = []
22+
for element in savestate.lineedit_list:
23+
try:
24+
savestate.lineedit_list[element].setText(savestate.txtlist[element])
25+
success.append(True)
26+
except KeyError as e:
27+
logWrite("Error occurred while loading texts from the savestate!")
28+
print(str(e) + " not found!")
29+
success.append(False)
30+
except AttributeError:
31+
# This should happen if there is no lineedit ( SpinBox for score )
32+
try:
33+
savestate.lineedit_list[element].setValue(int(savestate.txtlist[element]))
34+
except KeyError as e:
35+
logWrite("Error occurred while loading texts from the savestate!")
36+
print(str(e) + " not found!")
37+
except ValueError:
38+
# Happens when the program is opened up the first time
39+
pass
40+
if False in success:
41+
print("The autosave seems to be incomplete or corrupted")

0 commit comments

Comments
 (0)