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

Compare commits

...

4 commits

21 changed files with 116 additions and 28 deletions

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PySol 0.0.1\n" "Project-Id-Version: PySol 0.0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: H. Schaekel <Holger.Schaekel@web.de>\n"
"Language-Team: German\n" "Language-Team: German\n"
"Language: de\n" "Language: de\n"
@ -5353,7 +5353,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5498,6 +5498,9 @@ msgstr ""
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Spielgeometrie speichern" msgstr "Spielgeometrie speichern"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: 1.02\n" "Project-Id-Version: 1.02\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: Eric Rausch <neelix570@gmail.com>\n"
"Language-Team: French\n" "Language-Team: French\n"
"Language: fr\n" "Language: fr\n"
@ -5399,7 +5399,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5544,6 +5544,9 @@ msgstr "Barre d'&aide"
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Enregistrer la &géométrie du jeu" msgstr "Enregistrer la &géométrie du jeu"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -12,7 +12,7 @@ msgstr ""
"Project-Id-Version: it_pysol\n" "Project-Id-Version: it_pysol\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: Giuliano Colla <giuliano.colla@gmail.com>\n"
"Language-Team: Italiano <it@li.org>\n" "Language-Team: Italiano <it@li.org>\n"
"Language: it\n" "Language: it\n"
@ -5464,7 +5464,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5609,6 +5609,9 @@ msgstr "Mostra barra di a&iuto"
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Salva gioco e &geometria" msgstr "Salva gioco e &geometria"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: PySolFC\n" "Project-Id-Version: PySolFC\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: Jerzy Trzeciak <artusek@wp.pl>\n"
"Language-Team: Polish <pl@li.org>\n" "Language-Team: Polish <pl@li.org>\n"
"Language: pl\n" "Language: pl\n"
@ -5415,7 +5415,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5560,6 +5560,9 @@ msgstr "Pokaż pasek pomocy"
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Zapisz układ &gier" msgstr "Zapisz układ &gier"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: Matheus Knack <mtknack555@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: pt_BR\n" "Language: pt_BR\n"
@ -5421,7 +5421,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5566,6 +5566,9 @@ msgstr "Mostra &barra de ajuda"
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Salvar jogos &geometria" msgstr "Salvar jogos &geometria"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -5147,7 +5147,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5292,6 +5292,9 @@ msgstr ""
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "" msgstr ""
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-10 10:19-0500\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" "Last-Translator: Skomoroh <skomoroh@gmail.com>\n"
"Language-Team: Russian <ru@li.org>\n" "Language-Team: Russian <ru@li.org>\n"
"Language: ru\n" "Language: ru\n"
@ -5489,7 +5489,7 @@ msgstr ""
msgid "&Hamming" msgid "&Hamming"
msgstr "" msgstr ""
msgid "Card la&yout" msgid "Game la&yout"
msgstr "" msgstr ""
msgid "&Spread stacks" msgid "&Spread stacks"
@ -5634,6 +5634,9 @@ msgstr "Показывать панель помощи"
msgid "Save games &geometry" msgid "Save games &geometry"
msgstr "Сохранение &геометрии игры" msgstr "Сохранение &геометрии игры"
msgid "&Keep dialogs on top"
msgstr ""
msgid "Othe&r graphics" msgid "Othe&r graphics"
msgstr "" msgstr ""

View file

@ -47,6 +47,7 @@ from pysollib.pysoltk import create_full_picture_dialog
from pysollib.pysoltk import create_solver_dialog from pysollib.pysoltk import create_solver_dialog
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.settings import DEBUG from pysollib.settings import DEBUG
from pysollib.settings import PACKAGE_URL, TITLE from pysollib.settings import PACKAGE_URL, TITLE
from pysollib.settings import TOP_SIZE from pysollib.settings import TOP_SIZE
@ -535,15 +536,16 @@ class PysolMenubar(PysolMenubarTk):
if self.game.canFindCard(): if self.game.canFindCard():
create_find_card_dialog(self.game.top, self.game, create_find_card_dialog(self.game.top, self.game,
self.app.getFindCardImagesDir()) self.app.getFindCardImagesDir())
raise_find_card_dialog() raise_find_card_dialog(self.game)
def mFullPicture(self, *args): def mFullPicture(self, *args):
if self.game.canShowFullPicture(): if self.game.canShowFullPicture():
create_full_picture_dialog(self.game.top, self.game) create_full_picture_dialog(self.game.top, self.game)
raise_full_picture_dialog() raise_full_picture_dialog(self.game)
def mSolver(self, *args): def mSolver(self, *args):
create_solver_dialog(self.game.top, self.app) create_solver_dialog(self.game.top, self.app)
raise_solver_dialog(self.game)
def mEditGameComment(self, *args): def mEditGameComment(self, *args):
if self._cancelDrag(break_pause=False): if self._cancelDrag(break_pause=False):

View file

@ -57,6 +57,7 @@ from pysollib.pysoltk import destroy_full_picture_dialog
from pysollib.pysoltk import loadImage, wm_withdraw 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.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
@ -515,10 +516,14 @@ class Application:
self.opt.wm_fullscreen = not self.opt.wm_fullscreen self.opt.wm_fullscreen = not self.opt.wm_fullscreen
self.top.attributes("-fullscreen", self.opt.wm_fullscreen) self.top.attributes("-fullscreen", self.opt.wm_fullscreen)
# Topmost dialogs need to be reset when toggling fullscreen. # Topmost dialogs need to be reset when toggling fullscreen.
raise_find_card_dialog() self.raiseAll()
raise_full_picture_dialog()
self.top.attributes('-topmost', False) self.top.attributes('-topmost', False)
def raiseAll(self):
raise_find_card_dialog(self.game)
raise_full_picture_dialog(self.game)
raise_solver_dialog(self.game)
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

@ -192,6 +192,22 @@ class AbstractHint(HintInterface):
if self.level >= 2: if self.level >= 2:
if game.canDealCards(): if game.canDealCards():
self.addHint(self.SCORE_DEAL, 0, game.s.talon, None) self.addHint(self.SCORE_DEAL, 0, game.s.talon, None)
# A few games have multiple waste stacks. In these games,
# reserves are used for the waste stacks. This logic will
# handle for those games.
if (not game.canDealCards() and game.s.waste is not None and
len(game.s.waste.cards) > 0 and len(game.s.reserves) > 0):
max_cards = 0
reserve = None
for r in game.s.reserves:
if r.acceptsCards(game.s.waste, game.s.waste.cards):
if len(r.cards) < max_cards or reserve is None:
max_cards = len(r.cards)
reserve = r
if reserve is not None:
self.addHint(self.SCORE_DEAL, 1, game.s.waste, reserve)
return self._returnHints() return self._returnHints()
# subclass # subclass

View file

@ -69,7 +69,7 @@ def connect_game_find_card_dialog(game):
''' '''
def raise_find_card_dialog(): def raise_find_card_dialog(game):
pass pass

View file

@ -108,7 +108,7 @@ def connect_game_full_picture_dialog(game):
''' '''
def raise_full_picture_dialog(): def raise_full_picture_dialog(game):
pass pass

View file

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

View file

@ -123,6 +123,7 @@ use_cardset_bottoms = boolean
dragcursor = boolean dragcursor = boolean
save_games_geometry = boolean save_games_geometry = boolean
game_geometry = int_list(min=2, max=2) game_geometry = int_list(min=2, max=2)
topmost_dialogs = boolean
sound = boolean sound = boolean
sound_mode = integer(0, 1) sound_mode = integer(0, 1)
sound_sample_volume = integer(0, 128) sound_sample_volume = integer(0, 128)
@ -300,6 +301,7 @@ class Options:
# ('save_cardsets', 'bool'), # ('save_cardsets', 'bool'),
('dragcursor', 'bool'), ('dragcursor', 'bool'),
('save_games_geometry', 'bool'), ('save_games_geometry', 'bool'),
('topmost_dialogs', 'bool'),
('sound', 'bool'), ('sound', 'bool'),
('sound_mode', 'int'), ('sound_mode', 'int'),
('sound_sample_volume', 'int'), ('sound_sample_volume', 'int'),
@ -501,6 +503,7 @@ class Options:
self.wm_maximized = 1 self.wm_maximized = 1
self.wm_fullscreen = 0 self.wm_fullscreen = 0
self.save_games_geometry = False self.save_games_geometry = False
self.topmost_dialogs = True
# saved games geometry (gameid: (width, height)) # saved games geometry (gameid: (width, height))
self.games_geometry = {} self.games_geometry = {}
self.game_geometry = (0, 0) # game geometry before exit self.game_geometry = (0, 0) # game geometry before exit

View file

@ -50,7 +50,7 @@ def connect_game_find_card_dialog(game):
pass pass
def raise_find_card_dialog(): def raise_find_card_dialog(game):
pass pass

View file

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

View file

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

View file

@ -84,3 +84,14 @@ def create_solver_dialog(parent, game):
except Exception: except Exception:
# traceback.print_exc() # traceback.print_exc()
solver_dialog = SolverDialog(parent, game) 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

View file

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

View file

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

View file

@ -317,6 +317,7 @@ class PysolMenubarTkCommon:
spread_stacks=tkinter.BooleanVar(), spread_stacks=tkinter.BooleanVar(),
center_layout=tkinter.BooleanVar(), center_layout=tkinter.BooleanVar(),
save_games_geometry=tkinter.BooleanVar(), save_games_geometry=tkinter.BooleanVar(),
topmost_dialogs=tkinter.BooleanVar(),
cardback=tkinter.IntVar(), cardback=tkinter.IntVar(),
tabletile=tkinter.IntVar(), tabletile=tkinter.IntVar(),
animations=tkinter.IntVar(), animations=tkinter.IntVar(),
@ -392,6 +393,7 @@ class PysolMenubarTkCommon:
tkopt.spread_stacks.set(opt.spread_stacks) tkopt.spread_stacks.set(opt.spread_stacks)
tkopt.center_layout.set(opt.center_layout) tkopt.center_layout.set(opt.center_layout)
tkopt.save_games_geometry.set(opt.save_games_geometry) tkopt.save_games_geometry.set(opt.save_games_geometry)
tkopt.topmost_dialogs.set(opt.topmost_dialogs)
tkopt.cardback.set(self.app.cardset.backindex) tkopt.cardback.set(self.app.cardset.backindex)
tkopt.tabletile.set(self.app.tabletile_index) tkopt.tabletile.set(self.app.tabletile_index)
tkopt.animations.set(opt.animations) tkopt.animations.set(opt.animations)
@ -756,7 +758,7 @@ class PysolMenubarTkCommon:
command=self.mOptPreserveAspectRatio) command=self.mOptPreserveAspectRatio)
submenu.add_separator() submenu.add_separator()
createResamplingMenu(self, submenu) createResamplingMenu(self, submenu)
submenu = MfxMenu(menu, label=n_("Card la&yout")) submenu = MfxMenu(menu, label=n_("Game la&yout"))
submenu.add_checkbutton( submenu.add_checkbutton(
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks, label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
command=self.mOptSpreadStacks) command=self.mOptSpreadStacks)
@ -767,6 +769,10 @@ class PysolMenubarTkCommon:
label=n_("Save games &geometry"), label=n_("Save games &geometry"),
variable=self.tkopt.save_games_geometry, variable=self.tkopt.save_games_geometry,
command=self.mOptSaveGamesGeometry) 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 # manager = self.app.cardset_manager
# n = manager.len() # n = manager.len()
menu.add_command( menu.add_command(
@ -877,6 +883,10 @@ class PysolMenubarTkCommon:
label=n_("Save games &geometry"), label=n_("Save games &geometry"),
variable=self.tkopt.save_games_geometry, variable=self.tkopt.save_games_geometry,
command=self.mOptSaveGamesGeometry) command=self.mOptSaveGamesGeometry)
submenu.add_checkbutton(
label=n_("&Keep dialogs on top"),
variable=self.tkopt.topmost_dialogs,
command=self.mOptTopmostDialogs)
# menu.add_checkbutton( # menu.add_checkbutton(
# label=n_("Startup splash sc&reen"), # label=n_("Startup splash sc&reen"),
@ -1879,6 +1889,12 @@ Unsupported game for import.
return return
self.app.opt.save_games_geometry = self.tkopt.save_games_geometry.get() 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.app.raiseAll()
def _mOptCardback(self, index): def _mOptCardback(self, index):
if self._cancelDrag(break_pause=False): if self._cancelDrag(break_pause=False):
return return