File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
resources/runtime/eSports Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 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" )
You can’t perform that action at this time.
0 commit comments