mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Extract more common functionality.
This commit is contained in:
parent
ad063a89eb
commit
d229a5a7d4
3 changed files with 29 additions and 53 deletions
|
@ -42,7 +42,7 @@ from pysollib.mfxutil import KwStruct
|
|||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||
from tkwidget import MfxDialog
|
||||
from tkwidget import PysolCombo
|
||||
from pysollib.ui.tktile.solverdialog import BaseSolverDialog
|
||||
from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog, connect_game_solver_dialog, destroy_solver_dialog, reset_solver_dialog
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
@ -193,7 +193,6 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
self.play_button.config(state='disabled')
|
||||
|
||||
|
||||
solver_dialog = None
|
||||
|
||||
def create_solver_dialog(parent, game):
|
||||
global solver_dialog
|
||||
|
@ -204,27 +203,3 @@ def create_solver_dialog(parent, game):
|
|||
##traceback.print_exc()
|
||||
solver_dialog = SolverDialog(parent, game)
|
||||
|
||||
def connect_game_solver_dialog(game):
|
||||
try:
|
||||
solver_dialog.connectGame(game)
|
||||
except:
|
||||
pass
|
||||
|
||||
def destroy_solver_dialog():
|
||||
global solver_dialog
|
||||
try:
|
||||
solver_dialog.destroy()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
solver_dialog = None
|
||||
|
||||
|
||||
def reset_solver_dialog():
|
||||
if solver_dialog:
|
||||
try:
|
||||
solver_dialog.reset()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ from pysollib.mfxutil import KwStruct
|
|||
# Toolkit imports
|
||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||
from tkwidget import MfxDialog
|
||||
from pysollib.ui.tktile.solverdialog import BaseSolverDialog
|
||||
from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog, connect_game_solver_dialog, destroy_solver_dialog, reset_solver_dialog
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
@ -187,7 +187,6 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
name = self.app.getGameTitleName(game.id)
|
||||
if name in self.gamenames:
|
||||
self.start_button.config(state='normal')
|
||||
i = self.gamenames.index(name)
|
||||
self.games_var.set(name)
|
||||
else:
|
||||
self.start_button.config(state='disabled')
|
||||
|
@ -195,7 +194,6 @@ class SolverDialog(BaseSolverDialog, MfxDialog):
|
|||
self.play_button.config(state='disabled')
|
||||
|
||||
|
||||
solver_dialog = None
|
||||
|
||||
def create_solver_dialog(parent, game):
|
||||
global solver_dialog
|
||||
|
@ -206,27 +204,3 @@ def create_solver_dialog(parent, game):
|
|||
##traceback.print_exc()
|
||||
solver_dialog = SolverDialog(parent, game)
|
||||
|
||||
def connect_game_solver_dialog(game):
|
||||
try:
|
||||
solver_dialog.connectGame(game)
|
||||
except:
|
||||
pass
|
||||
|
||||
def destroy_solver_dialog():
|
||||
global solver_dialog
|
||||
try:
|
||||
solver_dialog.destroy()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
solver_dialog = None
|
||||
|
||||
|
||||
def reset_solver_dialog():
|
||||
if solver_dialog:
|
||||
try:
|
||||
solver_dialog.reset()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
|
||||
|
|
|
@ -79,3 +79,30 @@ class BaseSolverDialog:
|
|||
if 'states' in kw:
|
||||
self.states_label['text'] = kw['states']
|
||||
self.top.update_idletasks()
|
||||
|
||||
solver_dialog = None
|
||||
|
||||
def connect_game_solver_dialog(game):
|
||||
try:
|
||||
solver_dialog.connectGame(game)
|
||||
except:
|
||||
pass
|
||||
|
||||
def destroy_solver_dialog():
|
||||
global solver_dialog
|
||||
try:
|
||||
solver_dialog.destroy()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
solver_dialog = None
|
||||
|
||||
|
||||
def reset_solver_dialog():
|
||||
if solver_dialog:
|
||||
try:
|
||||
solver_dialog.reset()
|
||||
except:
|
||||
##traceback.print_exc()
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue