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

Compare commits

...

3 commits

Author SHA1 Message Date
Joe R
d7d9bb3ea6 Add option to clear filters 2024-11-16 11:40:32 -05:00
Joe R
8cbac328a9 Trim strings in the select all games submenu 2024-11-14 23:36:50 -05:00
Joe R
b6454ce541 Add basic hint to Crossword for stuck checking 2024-11-14 17:58:17 -05:00
16 changed files with 76 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

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-10 18:26-0500\n" "PO-Revision-Date: 2024-11-16 11:21-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"
@ -111,6 +111,9 @@ msgstr "&Nächste Nummer"
msgid "&Cancel" msgid "&Cancel"
msgstr "&Abbruch" msgstr "&Abbruch"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Zufallsspiel auswählen" msgstr "Zufallsspiel auswählen"

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-10 18:25-0500\n" "PO-Revision-Date: 2024-11-16 11:21-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"
@ -116,6 +116,9 @@ msgstr "&Numéro suivant"
msgid "&Cancel" msgid "&Cancel"
msgstr "&Annuler" msgstr "&Annuler"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Jeu au hasard" msgstr "Jeu au hasard"

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-10 18:25-0500\n" "PO-Revision-Date: 2024-11-16 11:21-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"
@ -121,6 +121,9 @@ msgstr "&Numero successivo"
msgid "&Cancel" msgid "&Cancel"
msgstr "&Cancella" msgstr "&Cancella"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Un gioco a caso" msgstr "Un gioco a caso"

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-10 18:25-0500\n" "PO-Revision-Date: 2024-11-16 11:22-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"
@ -117,6 +117,9 @@ msgstr "&Następny numer"
msgid "&Cancel" msgid "&Cancel"
msgstr "Anuluj" msgstr "Anuluj"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Wybierz grę losowo" msgstr "Wybierz grę losowo"

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-10 18:26-0500\n" "PO-Revision-Date: 2024-11-16 11:23-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"
@ -116,6 +116,9 @@ msgstr "&próximo número"
msgid "&Cancel" msgid "&Cancel"
msgstr "&Cancelar" msgstr "&Cancelar"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Selecionar jogo aleatório" msgstr "Selecionar jogo aleatório"

View file

@ -113,6 +113,9 @@ msgstr ""
msgid "&Cancel" msgid "&Cancel"
msgstr "" msgstr ""
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
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-10 18:24-0500\n" "PO-Revision-Date: 2024-11-16 11:23-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"
@ -117,6 +117,9 @@ msgstr "&Следующий номер"
msgid "&Cancel" msgid "&Cancel"
msgstr "От&мена" msgstr "От&мена"
msgid "C&lear"
msgstr ""
#: pysollib/actions.py:311 #: pysollib/actions.py:311
msgid "Select random game" msgid "Select random game"
msgstr "Выбор случайной игры" msgstr "Выбор случайной игры"

View file

@ -567,6 +567,7 @@ class Application:
(_('&Next number'), 'next'), (_('&Next number'), 'next'),
(_('&Play'), 'next'), (_('&Play'), 'next'),
(_('&Play this game'), 'next'), (_('&Play this game'), 'next'),
(_('C&lear'), 'clear'),
(_('&Solid color...'), 'color'), (_('&Solid color...'), 'color'),
(_('&Save to file'), 'save'), (_('&Save to file'), 'save'),
(_('&Statistics...'), 'statistics'), (_('&Statistics...'), 'statistics'),

View file

@ -23,6 +23,7 @@
from pysollib.game import Game from pysollib.game import Game
from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.gamedb import GI, GameInfo, registerGame
from pysollib.hint import AbstractHint
from pysollib.layout import Layout from pysollib.layout import Layout
from pysollib.stack import \ from pysollib.stack import \
OpenTalonStack, \ OpenTalonStack, \
@ -36,6 +37,20 @@ from pysollib.stack import \
# ************************************************************************ # ************************************************************************
class Crossword_Hint(AbstractHint):
def computeHints(self):
game = self.game
rows = game.s.rows
for i in range(len(rows)):
r = rows[i]
if r.cards:
continue
if game.isValidPlay(r.id, game.s.talon.getCard().rank + 1):
# TODO: Check a few moves ahead to get better hints.
self.addHint(5000, 1, game.s.talon, r)
class Crossword_RowStack(ReserveStack): class Crossword_RowStack(ReserveStack):
def clickHandler(self, event): def clickHandler(self, event):
if (not self.cards and self.game.s.talon.cards and if (not self.cards and self.game.s.talon.cards and
@ -85,7 +100,7 @@ class Crossword(Game):
Talon_Class = OpenTalonStack Talon_Class = OpenTalonStack
RowStack_Class = StackWrapper(Crossword_RowStack, max_move=0) RowStack_Class = StackWrapper(Crossword_RowStack, max_move=0)
FinalCards_Class = StackWrapper(Crossword_FinalCard, max_move=0) FinalCards_Class = StackWrapper(Crossword_FinalCard, max_move=0)
Hint_Class = None Hint_Class = Crossword_Hint
# #
# game layout # game layout

View file

@ -548,6 +548,10 @@ class SelectCardsetDialogWithPreview(MfxDialog):
d = SelectCardsetAdvancedSearch(self.top, _("Advanced search"), d = SelectCardsetAdvancedSearch(self.top, _("Advanced search"),
self.criteria, self.manager) self.criteria, self.manager)
if d.status == 0 and d.button == 0: if d.status == 0 and d.button == 0:
self.criteria = SearchCriteria(self.manager)
self.performSearch()
if d.status == 0 and d.button == 1:
self.criteria.name = d.name.get() self.criteria.name = d.name.get()
self.list_searchtext.delete(0, "end") self.list_searchtext.delete(0, "end")
@ -903,11 +907,14 @@ class SelectCardsetAdvancedSearch(MfxDialog):
top_frame, variable=self.compatible, top_frame, variable=self.compatible,
text=_("Compatible with current game"), anchor="w" text=_("Compatible with current game"), anchor="w"
) )
compatCheck.grid(row=row, column=0, columnspan=2, sticky='ew', compatCheck.grid(row=row, column=0, columnspan=5, sticky='ew',
padx=1, pady=1) padx=1, pady=1)
top_frame.columnconfigure(4, weight=1)
focus = self.createButtons(bottom_frame, kw) focus = self.createButtons(bottom_frame, kw)
# focus = text_w # focus = text_w
self.mainloop(focus, kw.timeout) self.mainloop(focus, kw.timeout)
def updateSubtypes(self, *args): def updateSubtypes(self, *args):
@ -929,7 +936,7 @@ class SelectCardsetAdvancedSearch(MfxDialog):
def initKw(self, kw): def initKw(self, kw):
kw = KwStruct(kw, kw = KwStruct(kw,
strings=(_("&OK"), _("&Cancel")), default=0, strings=(_("C&lear"), 'sep', _("&OK"), _("&Cancel")),
padx=10, pady=10, default=1, padx=10, pady=10,
) )
return MfxDialog.initKw(self, kw) return MfxDialog.initKw(self, kw)

View file

@ -676,6 +676,10 @@ class SelectGameDialogWithPreview(SelectGameDialog):
d = SelectGameAdvancedSearch(self.top, _("Advanced search"), d = SelectGameAdvancedSearch(self.top, _("Advanced search"),
self.criteria) self.criteria)
if d.status == 0 and d.button == 0: if d.status == 0 and d.button == 0:
self.criteria = SearchCriteria()
self.performSearch()
if d.status == 0 and d.button == 1:
self.criteria.name = d.name.get() self.criteria.name = d.name.get()
self.list_searchtext.delete(0, "end") self.list_searchtext.delete(0, "end")
@ -1227,6 +1231,9 @@ class SelectGameAdvancedSearch(MfxDialog):
padx=1, pady=1) padx=1, pady=1)
focus = self.createButtons(bottom_frame, kw) focus = self.createButtons(bottom_frame, kw)
top_frame.config(width=bottom_frame.winfo_width())
# focus = text_w # focus = text_w
self.mainloop(focus, kw.timeout) self.mainloop(focus, kw.timeout)
@ -1249,7 +1256,7 @@ class SelectGameAdvancedSearch(MfxDialog):
def initKw(self, kw): def initKw(self, kw):
kw = KwStruct(kw, kw = KwStruct(kw,
strings=(_("&OK"), _("&Cancel")), default=0, strings=(_("C&lear"), 'sep', _("&OK"), _("&Cancel")),
padx=10, pady=10, default=1, padx=10, pady=10,
) )
return MfxDialog.initKw(self, kw) return MfxDialog.initKw(self, kw)

View file

@ -344,6 +344,10 @@ class SelectTileDialogWithPreview(MfxDialog):
d = SelectTileAdvancedSearch(self.top, _("Advanced search"), d = SelectTileAdvancedSearch(self.top, _("Advanced search"),
self.criteria) self.criteria)
if d.status == 0 and d.button == 0: if d.status == 0 and d.button == 0:
self.criteria = SearchCriteria()
self.performSearch()
if d.status == 0 and d.button == 1:
self.criteria.name = d.name.get() self.criteria.name = d.name.get()
self.list_searchtext.delete(0, "end") self.list_searchtext.delete(0, "end")
@ -461,13 +465,15 @@ class SelectTileAdvancedSearch(MfxDialog):
padx=1, pady=1) padx=1, pady=1)
row += 1 row += 1
top_frame.columnconfigure(4, weight=1)
focus = self.createButtons(bottom_frame, kw) focus = self.createButtons(bottom_frame, kw)
# focus = text_w # focus = text_w
self.mainloop(focus, kw.timeout) self.mainloop(focus, kw.timeout)
def initKw(self, kw): def initKw(self, kw):
kw = KwStruct(kw, kw = KwStruct(kw,
strings=(_("&OK"), _("&Cancel")), default=0, strings=(_("C&lear"), 'sep', _("&OK"), _("&Cancel")),
padx=10, pady=10, default=1, padx=10, pady=10,
) )
return MfxDialog.initKw(self, kw) return MfxDialog.initKw(self, kw)

View file

@ -154,7 +154,7 @@ class MfxDialog: # ex. _ToplevelDialog
separator = ttk.Separator(self._frame) separator = ttk.Separator(self._frame)
separator.pack(side='bottom', fill='x') separator.pack(side='bottom', fill='x')
top_frame = ttk.Frame(self._frame) top_frame = ttk.Frame(self._frame)
top_frame.pack(side='top', fill='both', expand=1) top_frame.pack(side='top', fill='both', expand=True)
return top_frame, bottom_frame return top_frame, bottom_frame
def createBitmaps(self, frame, kw): def createBitmaps(self, frame, kw):

View file

@ -1119,8 +1119,8 @@ class PysolMenubarTkCommon:
if not mahjongg_games[n:n + d]: if not mahjongg_games[n:n + d]:
break break
m = min(n + d - 1, len(mahjongg_games) - 1) m = min(n + d - 1, len(mahjongg_games) - 1)
label = mahjongg_games[n].short_name[:3] + ' - ' + \ label = mahjongg_games[n].short_name[:3].strip() + ' - ' + \
mahjongg_games[m].short_name[:3] mahjongg_games[m].short_name[:3].strip()
submenu = MfxMenu(menu, label=label, name=None) submenu = MfxMenu(menu, label=label, name=None)
self._addSelectGameSubSubMenu(mahjongg_games[n:n + d], submenu, self._addSelectGameSubSubMenu(mahjongg_games[n:n + d], submenu,
command, variable, short_name=True) command, variable, short_name=True)
@ -1182,7 +1182,8 @@ class PysolMenubarTkCommon:
if not games[n:n+d]: if not games[n:n+d]:
break break
m = min(n+d-1, len(games)-1) m = min(n+d-1, len(games)-1)
label = games[n].name[:3] + ' - ' + games[m].name[:3] label = games[n].name[:3].strip() + ' - ' + \
games[m].name[:3].strip()
submenu = MfxMenu(menu, label=label, name=None) submenu = MfxMenu(menu, label=label, name=None)
self._addSelectGameSubSubMenu(games[n:n+d], submenu, self._addSelectGameSubSubMenu(games[n:n+d], submenu,
command, variable) command, variable)