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

Added check to ensure that all necessary cardset types are available.

This commit is contained in:
Joe R 2023-09-17 20:01:01 -04:00
parent e7a1979477
commit 3649bbb661
9 changed files with 361 additions and 6 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: 2023-09-03 19:05-0400\n" "PO-Revision-Date: 2023-09-17 19:51-0400\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"
@ -725,6 +725,12 @@ msgstr ""
"\n" "\n"
"Bitte überprüfen Sie die Installation von %(app)s.\n" "Bitte überprüfen Sie die Installation von %(app)s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -919,6 +925,39 @@ msgstr "Nur Trumpf"
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Erwachsene" msgstr "Erwachsene"

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: 2023-09-03 19:06-0400\n" "PO-Revision-Date: 2023-09-17 19:51-0400\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"
@ -755,6 +755,12 @@ msgstr ""
"\n" "\n"
"Vérifiez votre installation de %(app)s.\n" "Vérifiez votre installation de %(app)s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -949,6 +955,39 @@ msgstr "Atouts seulement"
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Adulte" msgstr "Adulte"

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: 2023-09-03 19:07-0400\n" "PO-Revision-Date: 2023-09-17 19:52-0400\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"
@ -763,6 +763,12 @@ msgstr ""
"\n" "\n"
"Verificare l'installazione di %s.\n" "Verificare l'installazione di %s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -957,6 +963,39 @@ msgstr "Solo Trionfi"
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Adulti" msgstr "Adulti"

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: 2023-09-03 19:07-0400\n" "PO-Revision-Date: 2023-09-17 19:52-0400\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"
@ -755,6 +755,12 @@ msgstr ""
"\n" "\n"
"Proszę sprawdzić poprawność instalacji %(app)s.\n" "Proszę sprawdzić poprawność instalacji %(app)s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -954,6 +960,39 @@ msgstr "Tylko Atu"
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Dla dorosłych" msgstr "Dla dorosłych"

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: 2023-09-03 19:07-0400\n" "PO-Revision-Date: 2023-09-17 19:53-0400\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"
@ -754,6 +754,12 @@ msgstr ""
"\n" "\n"
"Por favor verifique a instalação do %(app)s.\n" "Por favor verifique a instalação do %(app)s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -948,6 +954,39 @@ msgstr "Apenas trunfos"
msgid "Matching" msgid "Matching"
msgstr "Combinados" msgstr "Combinados"
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Adulto" msgstr "Adulto"

View file

@ -697,6 +697,14 @@ msgid ""
"Please check your %(app)s installation.\n" "Please check your %(app)s installation.\n"
msgstr "" msgstr ""
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\n
This may make games that use those types of cardsets unplayable. Please\n
ensure that your Cardsets package is up to date."
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -863,6 +871,39 @@ msgstr ""
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
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: 2023-09-03 19:08-0400\n" "PO-Revision-Date: 2023-09-17 19:54-0400\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"
@ -750,6 +750,12 @@ msgstr ""
"\n" "\n"
"Пожалуйста проверьте установку %(app)s.\n" "Пожалуйста проверьте установку %(app)s.\n"
msgid "PySol cannot find cardsets of the following types:"
msgstr ""
msgid "\\"
msgstr ""
#: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313 #: pysollib/main.py:66 pysollib/main.py:78 pysollib/main.py:313
#: pysollib/ui/tktile/menubar.py:346 #: pysollib/ui/tktile/menubar.py:346
msgid "&Quit" msgid "&Quit"
@ -944,6 +950,39 @@ msgstr "Без мастей"
msgid "Matching" msgid "Matching"
msgstr "" msgstr ""
msgid "No Jokers"
msgstr ""
msgid "Joker Deck"
msgstr ""
msgid "3x3"
msgstr ""
msgid "4x4"
msgstr ""
msgid "5x5"
msgstr ""
msgid "6x6"
msgstr ""
msgid "7x7"
msgstr ""
msgid "8x8"
msgstr ""
msgid "9x9"
msgstr ""
msgid "10x10"
msgstr ""
msgid "With %(cards)d or more cards"
msgstr ""
#: pysollib/resource.py:219 #: pysollib/resource.py:219
msgid "Adult" msgid "Adult"
msgstr "Для взрослых" msgstr "Для взрослых"

View file

@ -324,6 +324,18 @@ Please check your %(app)s installation.
if app.cardset_manager.len() == 0: if app.cardset_manager.len() == 0:
fatal_no_cardsets(app) fatal_no_cardsets(app)
return 3 return 3
missing = app.cardset_manager.identify_missing_cardsets()
if len(missing) > 0:
error_text = \
_('''PySol cannot find cardsets of the following types:''')
error_text += "\n\n"
for missingtype in missing:
error_text += missingtype + "\n"
error_text += _('''
This may make games that use those types of cardsets unplayable. Please
ensure that your Cardsets package is up to date.''')
MfxMessageDialog(top, title=_("Cardset error"), text=error_text,
bitmap="error")
if not cardset: if not cardset:
MfxMessageDialog(top, title=_("Cardset error"), MfxMessageDialog(top, title=_("Cardset error"),
text=_(''' text=_('''

View file

@ -223,6 +223,18 @@ class CSI:
11: _("Puzzle") 11: _("Puzzle")
} }
SUBTYPE_NAME = {
1: {0: _("No Jokers"), 1: _("Joker Deck")},
11: {3: _("3x3"),
4: _("4x4"),
5: _("5x5"),
6: _("6x6"),
7: _("7x7"),
8: _("8x8"),
9: _("9x9"),
10: _("10x10")}
}
TYPE_ID = { TYPE_ID = {
1: "french", 1: "french",
2: "hanafuda", 2: "hanafuda",
@ -465,6 +477,8 @@ class CardsetManager(ResourceManager):
def __init__(self): def __init__(self):
ResourceManager.__init__(self) ResourceManager.__init__(self)
self.registered_types = {} self.registered_types = {}
self.registered_subtypes = {}
self.type_max_cards = {}
self.registered_sizes = {} self.registered_sizes = {}
self.registered_styles = {} self.registered_styles = {}
self.registered_nationalities = {} self.registered_nationalities = {}
@ -569,11 +583,65 @@ class CardsetManager(ResourceManager):
# #
s = cs.si.type s = cs.si.type
self.registered_types[s] = self.registered_types.get(s, 0) + 1 self.registered_types[s] = self.registered_types.get(s, 0) + 1
if self.registered_types[s] == 1:
self.registered_subtypes[s] = {}
ss = cs.si.subtype
self.registered_subtypes[s][ss] = \
self.registered_subtypes.get(s, 0).get(ss, 0) + 1
if s not in self.type_max_cards or self.type_max_cards[s] < cs.ncards:
self.type_max_cards[s] = cs.ncards
s = cs.si.size s = cs.si.size
self.registered_sizes[s] = self.registered_sizes.get(s, 0) + 1 self.registered_sizes[s] = self.registered_sizes.get(s, 0) + 1
cs.updateCardback() cs.updateCardback()
ResourceManager.register(self, cs) ResourceManager.register(self, cs)
def identify_missing_cardsets(self):
missing = []
# This object should list the bare minimum cardset requirements
# for a PySol install that can play all games.
required_types = {
CSI.TYPE_FRENCH: {
CSI.SUBTYPE_JOKER_DECK
},
CSI.TYPE_HANAFUDA: {},
CSI.TYPE_TAROCK: {},
CSI.TYPE_MAHJONGG: {},
CSI.TYPE_HEXADECK: {},
CSI.TYPE_MUGHAL_GANJIFA: {},
CSI.TYPE_DASHAVATARA_GANJIFA: {},
CSI.TYPE_TRUMP_ONLY: {},
CSI.TYPE_PUZZLE: {
CSI.SUBTYPE_3X3,
CSI.SUBTYPE_4X4,
CSI.SUBTYPE_5X5,
CSI.SUBTYPE_6X6,
CSI.SUBTYPE_7X7,
CSI.SUBTYPE_8X8,
CSI.SUBTYPE_9X9,
CSI.SUBTYPE_10X10
}
}
required_cards_needed = {
CSI.TYPE_TRUMP_ONLY: 100
}
for t in required_types.keys():
if t not in self.registered_types:
missing.append(CSI.TYPE_NAME[t])
else:
if len(required_types[t]) > 0:
for tt in required_types[t]:
if tt not in self.registered_subtypes[t]:
missing.append(CSI.TYPE_NAME[t] + " (" +
CSI.SUBTYPE_NAME[t][tt] + ")")
if t in required_cards_needed:
if self.type_max_cards[t] < required_cards_needed[t]:
missing.append(CSI.TYPE_NAME[t] + " (" +
_("With %(cards)d or more cards" + ")")
% {'cards': required_cards_needed[t]})
missing.sort()
return missing
# ************************************************************************ # ************************************************************************
# * Tile # * Tile