mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-03-12 04:07:01 -04:00
Configure topmost dialogs to not stay on top when PySol loses focus
This commit is contained in:
parent
9773eee2d6
commit
e7e9f0ff87
13 changed files with 74 additions and 2 deletions
|
@ -35,7 +35,8 @@ from pysollib.app_stat_result import GameStatResult
|
|||
from pysollib.app_statistics import Statistics
|
||||
from pysollib.cardsetparser import read_cardset_config
|
||||
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.mfxutil import Struct, destruct
|
||||
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_full_picture_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 Music, MusicManager
|
||||
from pysollib.resource import Sample, SampleManager
|
||||
|
@ -525,6 +529,12 @@ class Application:
|
|||
raise_solver_dialog(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):
|
||||
# load dialog images
|
||||
dirname = os.path.join("images", "logos")
|
||||
|
|
|
@ -591,6 +591,8 @@ class Game(object):
|
|||
self.initBindings()
|
||||
# self.top.bind('<ButtonPress>', 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
|
||||
self.canvas.busy = True
|
||||
# geometry
|
||||
|
|
|
@ -175,6 +175,13 @@ def raise_help_html(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_help_html():
|
||||
try:
|
||||
help_html_viewer.parent.attributes("-topmost", False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def destroy_help_html():
|
||||
try:
|
||||
help_html_viewer.destroy()
|
||||
|
|
|
@ -73,6 +73,10 @@ def raise_find_card_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_find_card_dialog():
|
||||
pass
|
||||
|
||||
|
||||
def destroy_find_card_dialog():
|
||||
pass
|
||||
'''
|
||||
|
|
|
@ -112,6 +112,10 @@ def raise_full_picture_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_full_picture_dialog():
|
||||
pass
|
||||
|
||||
|
||||
def destroy_full_picture_dialog():
|
||||
pass
|
||||
'''
|
||||
|
|
|
@ -50,6 +50,10 @@ def raise_solver_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_solver_dialog():
|
||||
pass
|
||||
|
||||
|
||||
def destroy_solver_dialog():
|
||||
global solver_dialog
|
||||
solver_dialog = None
|
||||
|
|
|
@ -54,5 +54,9 @@ def raise_find_card_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_find_card_dialog():
|
||||
pass
|
||||
|
||||
|
||||
def destroy_find_card_dialog():
|
||||
pass
|
||||
|
|
|
@ -50,7 +50,11 @@ def connect_game_full_picture_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def raise_find_card_dialog(game):
|
||||
def raise_full_picture_dialog(game):
|
||||
pass
|
||||
|
||||
|
||||
def unraise_full_picture_dialog():
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ def raise_solver_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_solver_dialog():
|
||||
pass
|
||||
|
||||
|
||||
def destroy_solver_dialog():
|
||||
pass
|
||||
# solver_dialog = None
|
||||
|
|
|
@ -95,3 +95,10 @@ def raise_solver_dialog(game):
|
|||
solver_dialog.top.attributes("-topmost", False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def unraise_solver_dialog():
|
||||
try:
|
||||
solver_dialog.top.attributes("-topmost", False)
|
||||
except Exception:
|
||||
pass
|
||||
|
|
|
@ -254,6 +254,13 @@ def raise_find_card_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_find_card_dialog():
|
||||
try:
|
||||
find_card_dialog.attributes("-topmost", False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def destroy_find_card_dialog():
|
||||
global find_card_dialog
|
||||
try:
|
||||
|
|
|
@ -146,6 +146,13 @@ def raise_full_picture_dialog(game):
|
|||
pass
|
||||
|
||||
|
||||
def unraise_full_picture_dialog():
|
||||
try:
|
||||
full_picture_dialog.attributes("-topmost", False)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def destroy_full_picture_dialog():
|
||||
global full_picture_dialog
|
||||
try:
|
||||
|
|
|
@ -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):
|
||||
tkinter.Tk.update(self)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue