1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

feature: made the current solver preset persistent.

let it stick.
This commit is contained in:
Shlomi Fish 2018-09-01 19:07:00 +03:00
parent 11bafeba44
commit 77bd206a4e
4 changed files with 10 additions and 1 deletions

View file

@ -112,6 +112,7 @@ solver_presets = string_list
solver_show_progress = boolean
solver_max_iterations = integer
solver_iterations_output_step = integer
solver_preset = string
display_win_message = boolean
[sound_samples]
@ -249,6 +250,7 @@ class Options:
('solver_show_progress', 'bool'),
('solver_max_iterations', 'int'),
('solver_iterations_output_step', 'int'),
('solver_preset', 'string'),
# ('toolbar_vars', 'list'),
# ('recent_gameid', 'list'),
# ('favorite_gameid', 'list'),
@ -433,6 +435,7 @@ class Options:
self.solver_show_progress = True
self.solver_max_iterations = 100000
self.solver_iterations_output_step = 100
self.solver_preset = 'video-editing'
def setDefaults(self, top=None):
WIN_SYSTEM = pysollib.settings.WIN_SYSTEM

View file

@ -47,7 +47,8 @@ class SolverDialog(BaseSolverDialog, BaseTileMfxDialog):
return cb
def _createPresetVar(self, frame, row):
cb = PysolCombo(frame, values=tuple(self.presets), state='readonly')
cb = PysolCombo(frame, values=tuple(self.presets), state='readonly',
selectcommand=self._OnAssignToPreset)
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
cb.current(0)
return cb

View file

@ -57,6 +57,7 @@ class SolverDialog(BaseSolverDialog, BaseTkMfxDialog):
var.set('none')
om = tkinter.OptionMenu(frame, var, *(self.presets))
om.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
var.trace('w', self._OnAssignToPreset)
return var
def _createShowProgressButton(self, frame):

View file

@ -19,6 +19,9 @@ class BaseSolverDialog:
def _OnAssignToMaxIters(self, *args):
self.app.opt.solver_max_iterations = self._getMaxIters()
def _OnAssignToPreset(self, *args):
self.app.opt.solver_preset = self.preset_var.get()
def __init__(self, parent, app, **kw):
self.parent = parent
self.app = app
@ -58,6 +61,7 @@ class BaseSolverDialog:
presets = app.opt.solver_presets
self.presets = presets
self.preset_var = self._createPresetVar(frame, row)
self.preset_var.set(self.app.opt.solver_preset)
#
row += 1