From cafdafe047121901cc701ab9a081facd02f23d29 Mon Sep 17 00:00:00 2001 From: Joe R Date: Tue, 24 Dec 2024 22:39:45 -0500 Subject: [PATCH] Add topmost logic to solver dialog --- pysollib/actions.py | 3 +++ pysollib/app.py | 2 ++ pysollib/kivy/solverdialog.py | 4 ++++ pysollib/pysolgtk/solverdialog.py | 4 ++++ pysollib/tile/solverdialog.py | 11 +++++++++++ 5 files changed, 24 insertions(+) diff --git a/pysollib/actions.py b/pysollib/actions.py index 318bfb5ef0..1b9efb2219 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -47,6 +47,7 @@ from pysollib.pysoltk import create_solver_dialog from pysollib.pysoltk import raise_find_card_dialog from pysollib.pysoltk import raise_full_picture_dialog +from pysollib.pysoltk import raise_solver_dialog from pysollib.settings import DEBUG from pysollib.settings import PACKAGE_URL, TITLE from pysollib.settings import TOP_SIZE @@ -544,6 +545,7 @@ def mFullPicture(self, *args): def mSolver(self, *args): create_solver_dialog(self.game.top, self.app) + raise_solver_dialog(self.game) def mEditGameComment(self, *args): if self._cancelDrag(break_pause=False): @@ -835,6 +837,7 @@ def mOptTimeouts(self, *args): def raiseAll(self): raise_find_card_dialog(self.game) raise_full_picture_dialog(self.game) + raise_solver_dialog(self.game) # # Help menu diff --git a/pysollib/app.py b/pysollib/app.py index 3237e90df3..99db78c21b 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -57,6 +57,7 @@ from pysollib.pysoltk import loadImage, wm_withdraw from pysollib.pysoltk import raise_find_card_dialog from pysollib.pysoltk import raise_full_picture_dialog +from pysollib.pysoltk import raise_solver_dialog from pysollib.resource import CSI, CardsetManager from pysollib.resource import Music, MusicManager from pysollib.resource import Sample, SampleManager @@ -517,6 +518,7 @@ def wm_toggle_fullscreen(self): # Topmost dialogs need to be reset when toggling fullscreen. raise_find_card_dialog(self.game) raise_full_picture_dialog(self.game) + raise_solver_dialog(self.game) self.top.attributes('-topmost', False) def loadImages1(self): diff --git a/pysollib/kivy/solverdialog.py b/pysollib/kivy/solverdialog.py index c983b5dcbe..2e0f4b58e6 100644 --- a/pysollib/kivy/solverdialog.py +++ b/pysollib/kivy/solverdialog.py @@ -46,6 +46,10 @@ def connect_game_solver_dialog(game): pass +def raise_solver_dialog(game): + pass + + def destroy_solver_dialog(): global solver_dialog solver_dialog = None diff --git a/pysollib/pysolgtk/solverdialog.py b/pysollib/pysolgtk/solverdialog.py index 1b1f560a3a..389768e243 100644 --- a/pysollib/pysolgtk/solverdialog.py +++ b/pysollib/pysolgtk/solverdialog.py @@ -30,6 +30,10 @@ def connect_game_solver_dialog(game): pass +def raise_solver_dialog(game): + pass + + def destroy_solver_dialog(): pass # solver_dialog = None diff --git a/pysollib/tile/solverdialog.py b/pysollib/tile/solverdialog.py index 1841054f96..3f82ef237f 100644 --- a/pysollib/tile/solverdialog.py +++ b/pysollib/tile/solverdialog.py @@ -84,3 +84,14 @@ def create_solver_dialog(parent, game): except Exception: # traceback.print_exc() solver_dialog = SolverDialog(parent, game) + + +def raise_solver_dialog(game): + try: + if game.app.opt.topmost_dialogs: + solver_dialog.top.tkraise() + solver_dialog.top.attributes("-topmost", True) + else: + solver_dialog.top.attributes("-topmost", False) + except Exception: + pass