1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Configure topmost dialogs to not stay on top when PySol loses focus

This commit is contained in:
Joe R 2025-03-06 22:38:13 -05:00
parent 9773eee2d6
commit e7e9f0ff87
13 changed files with 74 additions and 2 deletions

View file

@ -35,7 +35,8 @@ from pysollib.app_stat_result import GameStatResult
from pysollib.app_statistics import Statistics from pysollib.app_statistics import Statistics
from pysollib.cardsetparser import read_cardset_config from pysollib.cardsetparser import read_cardset_config
from pysollib.gamedb import GAME_DB, GI, loadGame from pysollib.gamedb import GAME_DB, GI, loadGame
from pysollib.help import destroy_help_html, help_about, raise_help_html from pysollib.help import (destroy_help_html, help_about, raise_help_html,
unraise_help_html)
from pysollib.images import Images, SubsampledImages from pysollib.images import Images, SubsampledImages
from pysollib.mfxutil import Struct, destruct from pysollib.mfxutil import Struct, destruct
from pysollib.mfxutil import USE_PIL from pysollib.mfxutil import USE_PIL
@ -58,6 +59,9 @@ from pysollib.pysoltk import loadImage, wm_withdraw
from pysollib.pysoltk import raise_find_card_dialog from pysollib.pysoltk import raise_find_card_dialog
from pysollib.pysoltk import raise_full_picture_dialog from pysollib.pysoltk import raise_full_picture_dialog
from pysollib.pysoltk import raise_solver_dialog from pysollib.pysoltk import raise_solver_dialog
from pysollib.pysoltk import unraise_find_card_dialog
from pysollib.pysoltk import unraise_full_picture_dialog
from pysollib.pysoltk import unraise_solver_dialog
from pysollib.resource import CSI, CardsetManager from pysollib.resource import CSI, CardsetManager
from pysollib.resource import Music, MusicManager from pysollib.resource import Music, MusicManager
from pysollib.resource import Sample, SampleManager from pysollib.resource import Sample, SampleManager
@ -525,6 +529,12 @@ class Application:
raise_solver_dialog(self.game) raise_solver_dialog(self.game)
raise_help_html(self.game) raise_help_html(self.game)
def unraiseAll(self):
unraise_find_card_dialog()
unraise_full_picture_dialog()
unraise_solver_dialog()
unraise_help_html()
def loadImages1(self): def loadImages1(self):
# load dialog images # load dialog images
dirname = os.path.join("images", "logos") dirname = os.path.join("images", "logos")

View file

@ -591,6 +591,8 @@ class Game(object):
self.initBindings() self.initBindings()
# self.top.bind('<ButtonPress>', self.top._sleepEvent) # self.top.bind('<ButtonPress>', self.top._sleepEvent)
# self.top.bind('<3>', self.top._sleepEvent) # self.top.bind('<3>', self.top._sleepEvent)
self.top.bind("<FocusOut>", self.top._focusOutEvent)
self.top.bind("<FocusIn>", self.top._focusInEvent)
# update display properties # update display properties
self.canvas.busy = True self.canvas.busy = True
# geometry # geometry

View file

@ -175,6 +175,13 @@ def raise_help_html(game):
pass pass
def unraise_help_html():
try:
help_html_viewer.parent.attributes("-topmost", False)
except Exception:
pass
def destroy_help_html(): def destroy_help_html():
try: try:
help_html_viewer.destroy() help_html_viewer.destroy()

View file

@ -73,6 +73,10 @@ def raise_find_card_dialog(game):
pass pass
def unraise_find_card_dialog():
pass
def destroy_find_card_dialog(): def destroy_find_card_dialog():
pass pass
''' '''

View file

@ -112,6 +112,10 @@ def raise_full_picture_dialog(game):
pass pass
def unraise_full_picture_dialog():
pass
def destroy_full_picture_dialog(): def destroy_full_picture_dialog():
pass pass
''' '''

View file

@ -50,6 +50,10 @@ def raise_solver_dialog(game):
pass pass
def unraise_solver_dialog():
pass
def destroy_solver_dialog(): def destroy_solver_dialog():
global solver_dialog global solver_dialog
solver_dialog = None solver_dialog = None

View file

@ -54,5 +54,9 @@ def raise_find_card_dialog(game):
pass pass
def unraise_find_card_dialog():
pass
def destroy_find_card_dialog(): def destroy_find_card_dialog():
pass pass

View file

@ -50,7 +50,11 @@ def connect_game_full_picture_dialog(game):
pass pass
def raise_find_card_dialog(game): def raise_full_picture_dialog(game):
pass
def unraise_full_picture_dialog():
pass pass

View file

@ -34,6 +34,10 @@ def raise_solver_dialog(game):
pass pass
def unraise_solver_dialog():
pass
def destroy_solver_dialog(): def destroy_solver_dialog():
pass pass
# solver_dialog = None # solver_dialog = None

View file

@ -95,3 +95,10 @@ def raise_solver_dialog(game):
solver_dialog.top.attributes("-topmost", False) solver_dialog.top.attributes("-topmost", False)
except Exception: except Exception:
pass pass
def unraise_solver_dialog():
try:
solver_dialog.top.attributes("-topmost", False)
except Exception:
pass

View file

@ -254,6 +254,13 @@ def raise_find_card_dialog(game):
pass pass
def unraise_find_card_dialog():
try:
find_card_dialog.attributes("-topmost", False)
except Exception:
pass
def destroy_find_card_dialog(): def destroy_find_card_dialog():
global find_card_dialog global find_card_dialog
try: try:

View file

@ -146,6 +146,13 @@ def raise_full_picture_dialog(game):
pass pass
def unraise_full_picture_dialog():
try:
full_picture_dialog.attributes("-topmost", False)
except Exception:
pass
def destroy_full_picture_dialog(): def destroy_full_picture_dialog():
global full_picture_dialog global full_picture_dialog
try: try:

View file

@ -133,6 +133,14 @@ class MfxRoot(tkinter.Tk):
# #
# #
def _focusInEvent(self, *args):
if self.app:
self.app.raiseAll()
def _focusOutEvent(self, *args):
if self.app:
self.app.unraiseAll()
def update(self): def update(self):
tkinter.Tk.update(self) tkinter.Tk.update(self)