mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Extract a method in solverdialog.
As a precursor to consolidating the code.
This commit is contained in:
parent
6ffefe1db5
commit
66d91c872c
2 changed files with 14 additions and 8 deletions
|
@ -100,10 +100,7 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
).grid(row=row, column=0, sticky='ew', padx=2, pady=2)
|
||||
presets = app.opt.solver_presets
|
||||
self.presets = presets
|
||||
cb = PysolCombo(frame, values=tuple(presets), state='readonly')
|
||||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
cb.current(0)
|
||||
self.preset_var = cb
|
||||
self.preset_var = self._createPresetVar(frame, row)
|
||||
|
||||
#
|
||||
row += 1
|
||||
|
@ -171,6 +168,11 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
self.connectGame(self.app.game)
|
||||
self.mainloop(focus, kw.timeout, transient=False)
|
||||
|
||||
def _createPresetVar(self, frame, row):
|
||||
cb = PysolCombo(frame, values=tuple(self.presets), state='readonly')
|
||||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
cb.current(0)
|
||||
return cb
|
||||
def _createShowProgressButton(self, frame):
|
||||
return self._calcToolkit().Checkbutton(frame, variable=self.progress_var,
|
||||
text=_('Show progress'))
|
||||
|
|
|
@ -102,10 +102,7 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
).grid(row=row, column=0, sticky='ew', padx=2, pady=2)
|
||||
presets = app.opt.solver_presets
|
||||
self.presets = presets
|
||||
self.preset_var = var = Tkinter.StringVar()
|
||||
var.set('none')
|
||||
om = Tkinter.OptionMenu(frame, var, *presets)
|
||||
om.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
self.preset_var = self._createPresetVar(frame, row)
|
||||
|
||||
#
|
||||
row += 1
|
||||
|
@ -173,6 +170,13 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
self.connectGame(self.app.game)
|
||||
self.mainloop(focus, kw.timeout, transient=False)
|
||||
|
||||
def _createPresetVar(self, frame, row):
|
||||
var = Tkinter.StringVar()
|
||||
var.set('none')
|
||||
om = Tkinter.OptionMenu(frame, var, *(self.presets))
|
||||
om.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
return var
|
||||
|
||||
def _createShowProgressButton(self, frame):
|
||||
return self._calcToolkit().Checkbutton(frame, variable=self.progress_var,
|
||||
text=_('Show progress'), anchor='w')
|
||||
|
|
Loading…
Add table
Reference in a new issue