mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Extract a different method in the solverdialogs.
This commit is contained in:
parent
66d91c872c
commit
970e37ffe6
2 changed files with 21 additions and 14 deletions
|
@ -88,11 +88,7 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
||||||
self.games[name] = id
|
self.games[name] = id
|
||||||
gamenames.sort()
|
gamenames.sort()
|
||||||
self.gamenames = gamenames
|
self.gamenames = gamenames
|
||||||
cb = PysolCombo(frame, values=tuple(gamenames),
|
self.games_var = self._createGamesVar(frame, row)
|
||||||
selectcommand=self.gameSelected,
|
|
||||||
state='readonly', width=40)
|
|
||||||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
|
||||||
self.games_var = cb
|
|
||||||
|
|
||||||
#
|
#
|
||||||
row += 1
|
row += 1
|
||||||
|
@ -168,6 +164,13 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
||||||
self.connectGame(self.app.game)
|
self.connectGame(self.app.game)
|
||||||
self.mainloop(focus, kw.timeout, transient=False)
|
self.mainloop(focus, kw.timeout, transient=False)
|
||||||
|
|
||||||
|
def _createGamesVar(self, frame, row):
|
||||||
|
cb = PysolCombo(frame, values=tuple(self.gamenames),
|
||||||
|
selectcommand=self.gameSelected,
|
||||||
|
state='readonly', width=40)
|
||||||
|
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||||
|
return cb
|
||||||
|
|
||||||
def _createPresetVar(self, frame, row):
|
def _createPresetVar(self, frame, row):
|
||||||
cb = PysolCombo(frame, values=tuple(self.presets), state='readonly')
|
cb = PysolCombo(frame, values=tuple(self.presets), state='readonly')
|
||||||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||||
|
|
|
@ -86,15 +86,7 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
||||||
self.games[name] = id
|
self.games[name] = id
|
||||||
gamenames.sort()
|
gamenames.sort()
|
||||||
self.gamenames = gamenames
|
self.gamenames = gamenames
|
||||||
self.games_var = var = Tkinter.StringVar()
|
self.games_var = self._createGamesVar(frame, row)
|
||||||
om = Tkinter.OptionMenu(frame, var, command=self.gameSelected,
|
|
||||||
*gamenames)
|
|
||||||
om.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
|
||||||
n = len(gamenames)
|
|
||||||
cb_max = int(self.top.winfo_screenheight()/23)
|
|
||||||
cb_max = n / (n/cb_max+1)
|
|
||||||
for i in xrange(cb_max, n, cb_max):
|
|
||||||
om['menu'].entryconfig(i, columnbreak=True)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
row += 1
|
row += 1
|
||||||
|
@ -170,6 +162,18 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
||||||
self.connectGame(self.app.game)
|
self.connectGame(self.app.game)
|
||||||
self.mainloop(focus, kw.timeout, transient=False)
|
self.mainloop(focus, kw.timeout, transient=False)
|
||||||
|
|
||||||
|
def _createGamesVar(self, frame, row):
|
||||||
|
var = Tkinter.StringVar()
|
||||||
|
om = Tkinter.OptionMenu(frame, var, command=self.gameSelected,
|
||||||
|
*(self.gamenames))
|
||||||
|
om.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||||
|
n = len(gamenames)
|
||||||
|
cb_max = int(self.top.winfo_screenheight()/23)
|
||||||
|
cb_max = n / (n/cb_max+1)
|
||||||
|
for i in xrange(cb_max, n, cb_max):
|
||||||
|
om['menu'].entryconfig(i, columnbreak=True)
|
||||||
|
return var
|
||||||
|
|
||||||
def _createPresetVar(self, frame, row):
|
def _createPresetVar(self, frame, row):
|
||||||
var = Tkinter.StringVar()
|
var = Tkinter.StringVar()
|
||||||
var.set('none')
|
var.set('none')
|
||||||
|
|
Loading…
Add table
Reference in a new issue