Skip to content

Commit

Permalink
Add topmost logic to solver dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Dec 25, 2024
1 parent 911f83d commit cafdafe
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pysollib/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pysollib/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions pysollib/kivy/solverdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions pysollib/pysolgtk/solverdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions pysollib/tile/solverdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cafdafe

Please sign in to comment.