@@ -129,10 +129,6 @@ def __init__(self, levelEditor, parent = None, **kw):
129129 label = 'Injector' ,
130130 command = self .showInjector )
131131 menuBar .addmenuitem ('Advanced' , 'separator' )
132- menuBar .addmenuitem ('Advanced' , 'checkbutton' ,
133- 'Toggle Auto-saver On/Off' ,
134- label = 'Toggle Auto Saver' ,
135- command = self .toggleAutoSaver )
136132 menuBar .addmenuitem ('Advanced' , 'command' ,
137133 'User Set Auto Saver Options' ,
138134 label = 'Auto Saver Options' ,
@@ -192,23 +188,32 @@ def __init__(self, levelEditor, parent = None, **kw):
192188 command = self .setAutoSaverInterval )
193189 self .autoSaverDialog .withdraw ()
194190
191+ self .autoSaverEnabled = IntVar ()
192+ self .autoSaverEnabled .set (settings ['autosave-enabled' ])
193+ self .autoSaverEnable = ttk .Checkbutton (
194+ self .autoSaverDialog .interior (),
195+ text = 'Enable Autosaving' , width = 20 ,
196+ variable = self .autoSaverEnabled )
197+
195198 self .autoSaverDialogInterval = Pmw .Counter (self .autoSaverDialog .interior (),
196199 labelpos = 'w' ,
197200 label_text = 'Auto save interval in minutes:' ,
198201 entry_width = 10 ,
199- entryfield_value = int (AutoSaver . autoSaverInterval ),
202+ entryfield_value = int (settings [ 'autosave-interval' ] ),
200203 entryfield_validate = {'validator' : 'real' ,
201- 'min' : 1 , 'max' : 60 })
202-
203- self .autoSaverDialogMax = Pmw .Counter (self .autoSaverDialog .interior (),
204- labelpos = 'w' ,
205- label_text = 'Max auto save files:' ,
206- entry_width = 10 ,
207- entryfield_value = int (AutoSaver .maxAutoSaveCount ),
208- entryfield_validate = {'validator' : 'numeric' ,
209- 'min' : 0 , 'max' : 99 })
210-
211- counters = (self .autoSaverDialogInterval , self .autoSaverDialogMax )
204+ 'min' : 1 , 'max' : 60
205+ })
206+
207+ #self.autoSaverDialogMax = Pmw.Counter(self.autoSaverDialog.interior(),
208+ # labelpos = 'w',
209+ # label_text = 'Max auto save files:',
210+ # entry_width = 10,
211+ # entryfield_value = int(settings['autosave-max-files']),
212+ # entryfield_validate = {'validator': 'numeric',
213+ # 'min': 0, 'max': 99
214+ # })
215+
216+ counters = (self .autoSaverEnable , self .autoSaverDialogInterval )#, self.autoSaverDialogMax)
212217 Pmw .alignlabels (counters )
213218 for counter in counters :
214219 counter .pack (fill = 'both' , expand = 1 )
@@ -412,7 +417,7 @@ def __init__(self, levelEditor, parent = None, **kw):
412417 landmarkBuildingsPage , width = 24 ,
413418 textvariable = self .landmarkBuildingNameString )
414419 self .landmarkBuildingNameBox .pack (expand = 0 , fill = X )
415-
420+
416421 self .bldgLabels = IntVar ()
417422 self .bldgLabels .set (0 )
418423 self .bldgLabelsButton = ttk .Checkbutton (
@@ -999,9 +1004,6 @@ def toggleWidgetHandles(s = self):
9991004 # Make sure input variables processed
10001005 self .initialiseoptions (LevelEditorPanel )
10011006
1002- # Initializes auto saver for use
1003- AutoSaver .initializeAutoSaver ()
1004-
10051007 def updateInfo (self , page ):
10061008 if page == 'Signs' :
10071009 self .updateSignPage ()
@@ -1509,8 +1511,11 @@ def setBattleCellType(self, name):
15091511 def setAutoSaverInterval (self , i ):
15101512 if i == 'Save Options' :
15111513 try :
1512- AutoSaver .autoSaverInterval = float (self .autoSaverDialogInterval .get ())
1513- AutoSaver .maxAutoSaveCount = float (self .autoSaverDialogMax .get ())
1514+ settings ['autosave-enabled' ] = bool (self .autoSaverEnabled .get ())
1515+ settings ['autosave-interval' ] = int (self .autoSaverDialogInterval .get ())
1516+ #settings['autosave-max-files'] = float(self.autoSaverDialogMax.get())
1517+ # Reset the autosaver
1518+ AutoSaver .initializeAutoSaver ()
15141519 except ValueError as e :
15151520 # Non-float was passed
15161521 raise e
@@ -1585,16 +1590,3 @@ def toggleDrive(self):
15851590 self .levelEditor .useDriveMode ()
15861591 else :
15871592 self .levelEditor .useDirectFly ()
1588-
1589- def toggleAutoSaver (self ):
1590- if AutoSaver .autoSaverToggled is False :
1591- # If no working DNA outputFile is selected, one is chosen here
1592- if DNASerializer .outputFile is None :
1593- DNASerializer .saveToSpecifiedDNAFile ()
1594- print (f'Starting auto saver on an interval of { AutoSaver .autoSaverInterval } minutes' )
1595- # Toggles auto saver to begin auto saving loop
1596- AutoSaver .autoSaverToggled = True
1597- else :
1598- print ('Stopping auto saver...' )
1599- # Stops auto saving loop
1600- AutoSaver .autoSaverToggled = False
0 commit comments