Skip to content

Commit

Permalink
Add option to keep dialogs always on top
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Dec 22, 2024
1 parent abb9605 commit 911f83d
Show file tree
Hide file tree
Showing 17 changed files with 78 additions and 28 deletions.
7 changes: 5 additions & 2 deletions po/de_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PySol 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:21-0500\n"
"PO-Revision-Date: 2024-12-22 17:14-0500\n"
"Last-Translator: H. Schaekel <Holger.Schaekel@web.de>\n"
"Language-Team: German\n"
"Language: de\n"
Expand Down Expand Up @@ -5353,7 +5353,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5498,6 +5498,9 @@ msgstr ""
msgid "Save games &geometry"
msgstr "Spielgeometrie speichern"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions po/fr_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: 1.02\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:21-0500\n"
"PO-Revision-Date: 2024-12-22 17:14-0500\n"
"Last-Translator: Eric Rausch <neelix570@gmail.com>\n"
"Language-Team: French\n"
"Language: fr\n"
Expand Down Expand Up @@ -5399,7 +5399,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5544,6 +5544,9 @@ msgstr "Barre d'&aide"
msgid "Save games &geometry"
msgstr "Enregistrer la &géométrie du jeu"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions po/it_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: it_pysol\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:21-0500\n"
"PO-Revision-Date: 2024-12-22 17:14-0500\n"
"Last-Translator: Giuliano Colla <giuliano.colla@gmail.com>\n"
"Language-Team: Italiano <it@li.org>\n"
"Language: it\n"
Expand Down Expand Up @@ -5464,7 +5464,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5609,6 +5609,9 @@ msgstr "Mostra barra di a&iuto"
msgid "Save games &geometry"
msgstr "Salva gioco e &geometria"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions po/pl_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: PySolFC\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:22-0500\n"
"PO-Revision-Date: 2024-12-22 17:13-0500\n"
"Last-Translator: Jerzy Trzeciak <artusek@wp.pl>\n"
"Language-Team: Polish <pl@li.org>\n"
"Language: pl\n"
Expand Down Expand Up @@ -5415,7 +5415,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5560,6 +5560,9 @@ msgstr "Pokaż pasek pomocy"
msgid "Save games &geometry"
msgstr "Zapisz układ &gier"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions po/pt_BR_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:23-0500\n"
"PO-Revision-Date: 2024-12-22 17:13-0500\n"
"Last-Translator: Matheus Knack <mtknack555@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
Expand Down Expand Up @@ -5421,7 +5421,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5566,6 +5566,9 @@ msgstr "Mostra &barra de ajuda"
msgid "Save games &geometry"
msgstr "Salvar jogos &geometria"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
5 changes: 4 additions & 1 deletion po/pysol.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5147,7 +5147,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5292,6 +5292,9 @@ msgstr ""
msgid "Save games &geometry"
msgstr ""

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
7 changes: 5 additions & 2 deletions po/ru_pysol.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\n"
"PO-Revision-Date: 2024-11-16 11:23-0500\n"
"PO-Revision-Date: 2024-12-22 17:13-0500\n"
"Last-Translator: Skomoroh <skomoroh@gmail.com>\n"
"Language-Team: Russian <ru@li.org>\n"
"Language: ru\n"
Expand Down Expand Up @@ -5489,7 +5489,7 @@ msgstr ""
msgid "&Hamming"
msgstr ""

msgid "Card la&yout"
msgid "Game la&yout"
msgstr ""

msgid "&Spread stacks"
Expand Down Expand Up @@ -5634,6 +5634,9 @@ msgstr "Показывать панель помощи"
msgid "Save games &geometry"
msgstr "Сохранение &геометрии игры"

msgid "&Keep dialogs on top"
msgstr ""

msgid "Othe&r graphics"
msgstr ""

Expand Down
8 changes: 6 additions & 2 deletions pysollib/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,12 @@ def mFindCard(self, *args):
if self.game.canFindCard():
create_find_card_dialog(self.game.top, self.game,
self.app.getFindCardImagesDir())
raise_find_card_dialog()
raise_find_card_dialog(self.game)

def mFullPicture(self, *args):
if self.game.canShowFullPicture():
create_full_picture_dialog(self.game.top, self.game)
raise_full_picture_dialog()
raise_full_picture_dialog(self.game)

def mSolver(self, *args):
create_solver_dialog(self.game.top, self.app)
Expand Down Expand Up @@ -832,6 +832,10 @@ def mOptTimeouts(self, *args):
self.app.opt.timeouts['highlight_samerank'] = \
d.highlight_samerank_timeout

def raiseAll(self):
raise_find_card_dialog(self.game)
raise_full_picture_dialog(self.game)

#
# Help menu
#
Expand Down
4 changes: 2 additions & 2 deletions pysollib/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ def wm_toggle_fullscreen(self):
self.opt.wm_fullscreen = not self.opt.wm_fullscreen
self.top.attributes("-fullscreen", self.opt.wm_fullscreen)
# Topmost dialogs need to be reset when toggling fullscreen.
raise_find_card_dialog()
raise_full_picture_dialog()
raise_find_card_dialog(self.game)
raise_full_picture_dialog(self.game)
self.top.attributes('-topmost', False)

def loadImages1(self):
Expand Down
2 changes: 1 addition & 1 deletion pysollib/kivy/findcarddialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def connect_game_find_card_dialog(game):
'''


def raise_find_card_dialog():
def raise_find_card_dialog(game):
pass


Expand Down
2 changes: 1 addition & 1 deletion pysollib/kivy/fullpicturedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def connect_game_full_picture_dialog(game):
'''


def raise_full_picture_dialog():
def raise_full_picture_dialog(game):
pass


Expand Down
3 changes: 3 additions & 0 deletions pysollib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def calcCustomMouseButtonsBinding(binding_format):
dragcursor = boolean
save_games_geometry = boolean
game_geometry = int_list(min=2, max=2)
topmost_dialogs = boolean
sound = boolean
sound_mode = integer(0, 1)
sound_sample_volume = integer(0, 128)
Expand Down Expand Up @@ -300,6 +301,7 @@ class Options:
# ('save_cardsets', 'bool'),
('dragcursor', 'bool'),
('save_games_geometry', 'bool'),
('topmost_dialogs', 'bool'),
('sound', 'bool'),
('sound_mode', 'int'),
('sound_sample_volume', 'int'),
Expand Down Expand Up @@ -501,6 +503,7 @@ def __init__(self):
self.wm_maximized = 1
self.wm_fullscreen = 0
self.save_games_geometry = False
self.topmost_dialogs = True
# saved games geometry (gameid: (width, height))
self.games_geometry = {}
self.game_geometry = (0, 0) # game geometry before exit
Expand Down
2 changes: 1 addition & 1 deletion pysollib/pysolgtk/findcarddialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def connect_game_find_card_dialog(game):
pass


def raise_find_card_dialog():
def raise_find_card_dialog(game):
pass


Expand Down
2 changes: 1 addition & 1 deletion pysollib/pysolgtk/fullpicturedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def connect_game_full_picture_dialog(game):
pass


def raise_find_card_dialog():
def raise_find_card_dialog(game):
pass


Expand Down
9 changes: 6 additions & 3 deletions pysollib/ui/tktile/findcarddialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,13 @@ def connect_game_find_card_dialog(game):
pass


def raise_find_card_dialog():
def raise_find_card_dialog(game):
try:
find_card_dialog.tkraise()
find_card_dialog.attributes("-topmost", True)
if game.app.opt.topmost_dialogs:
find_card_dialog.tkraise()
find_card_dialog.attributes("-topmost", True)
else:
find_card_dialog.attributes("-topmost", False)
except Exception:
pass

Expand Down
9 changes: 6 additions & 3 deletions pysollib/ui/tktile/fullpicturedialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,13 @@ def connect_game_full_picture_dialog(game):
pass


def raise_full_picture_dialog():
def raise_full_picture_dialog(game):
try:
full_picture_dialog.tkraise()
full_picture_dialog.attributes("-topmost", True)
if game.app.opt.topmost_dialogs:
full_picture_dialog.tkraise()
full_picture_dialog.attributes("-topmost", True)
else:
full_picture_dialog.attributes("-topmost", False)
except Exception:
pass

Expand Down
18 changes: 17 additions & 1 deletion pysollib/ui/tktile/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def _createTkOpt(self):
spread_stacks=tkinter.BooleanVar(),
center_layout=tkinter.BooleanVar(),
save_games_geometry=tkinter.BooleanVar(),
topmost_dialogs=tkinter.BooleanVar(),
cardback=tkinter.IntVar(),
tabletile=tkinter.IntVar(),
animations=tkinter.IntVar(),
Expand Down Expand Up @@ -392,6 +393,7 @@ def _setOptions(self):
tkopt.spread_stacks.set(opt.spread_stacks)
tkopt.center_layout.set(opt.center_layout)
tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.topmost_dialogs.set(opt.topmost_dialogs)
tkopt.cardback.set(self.app.cardset.backindex)
tkopt.tabletile.set(self.app.tabletile_index)
tkopt.animations.set(opt.animations)
Expand Down Expand Up @@ -756,7 +758,7 @@ def _createMenubar(self):
command=self.mOptPreserveAspectRatio)
submenu.add_separator()
createResamplingMenu(self, submenu)
submenu = MfxMenu(menu, label=n_("Card la&yout"))
submenu = MfxMenu(menu, label=n_("Game la&yout"))
submenu.add_checkbutton(
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
command=self.mOptSpreadStacks)
Expand All @@ -767,6 +769,10 @@ def _createMenubar(self):
label=n_("Save games &geometry"),
variable=self.tkopt.save_games_geometry,
command=self.mOptSaveGamesGeometry)
submenu.add_checkbutton(
label=n_("&Keep dialogs on top"),
variable=self.tkopt.topmost_dialogs,
command=self.mOptTopmostDialogs)
# manager = self.app.cardset_manager
# n = manager.len()
menu.add_command(
Expand Down Expand Up @@ -877,6 +883,10 @@ def _createMenubar(self):
label=n_("Save games &geometry"),
variable=self.tkopt.save_games_geometry,
command=self.mOptSaveGamesGeometry)
submenu.add_checkbutton(
label=n_("&Keep dialogs on top"),
variable=self.tkopt.topmost_dialogs,
command=self.mOptTopmostDialogs)

# menu.add_checkbutton(
# label=n_("Startup splash sc&reen"),
Expand Down Expand Up @@ -1879,6 +1889,12 @@ def mOptSaveGamesGeometry(self, *event):
return
self.app.opt.save_games_geometry = self.tkopt.save_games_geometry.get()

def mOptTopmostDialogs(self, *event):
if self._cancelDrag(break_pause=False):
return
self.app.opt.topmost_dialogs = self.tkopt.topmost_dialogs.get()
self.raiseAll()

def _mOptCardback(self, index):
if self._cancelDrag(break_pause=False):
return
Expand Down

0 comments on commit 911f83d

Please sign in to comment.