Skip to content

Commit

Permalink
Option to filter by game subcategory/cardset subtype.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Mar 16, 2024
1 parent a6df894 commit d3a4548
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 9 deletions.
8 changes: 7 additions & 1 deletion 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-03-03 11:34-0500\n"
"PO-Revision-Date: 2024-03-15 23:06-0400\n"
"Last-Translator: H. Schaekel <[email protected]>\n"
"Language-Team: German\n"
"Language: de\n"
Expand Down Expand Up @@ -1801,6 +1801,9 @@ msgstr "Gründe für eine Scheidung"
msgid "Type:"
msgstr "Typ:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Keine neuen Karten"
Expand Down Expand Up @@ -3535,6 +3538,9 @@ msgstr "Alternative Namen:"
msgid "Category:"
msgstr "Kategorie:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
8 changes: 7 additions & 1 deletion 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-03-03 11:34-0500\n"
"PO-Revision-Date: 2024-03-15 23:06-0400\n"
"Last-Translator: Eric Rausch <[email protected]>\n"
"Language-Team: French\n"
"Language: fr\n"
Expand Down Expand Up @@ -1831,6 +1831,9 @@ msgstr "Grounds for a Divorce"
msgid "Type:"
msgstr "Type:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Une donne"
Expand Down Expand Up @@ -3579,6 +3582,9 @@ msgstr "Noms alternatifs:"
msgid "Category:"
msgstr "Catégorie:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
8 changes: 7 additions & 1 deletion 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-03-03 11:35-0500\n"
"PO-Revision-Date: 2024-03-15 23:06-0400\n"
"Last-Translator: Giuliano Colla <[email protected]>\n"
"Language-Team: Italiano <[email protected]>\n"
"Language: it\n"
Expand Down Expand Up @@ -1839,6 +1839,9 @@ msgstr "Grounds for a Divorce"
msgid "Type:"
msgstr "Tipi:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Nessuna ridistribuzione"
Expand Down Expand Up @@ -3641,6 +3644,9 @@ msgstr "Nomi alternativi:"
msgid "Category:"
msgstr "Categoria:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
8 changes: 7 additions & 1 deletion 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-03-03 11:35-0500\n"
"PO-Revision-Date: 2024-03-15 23:05-0400\n"
"Last-Translator: Jerzy Trzeciak <[email protected]>\n"
"Language-Team: Polish <[email protected]>\n"
"Language: pl\n"
Expand Down Expand Up @@ -1838,6 +1838,9 @@ msgstr ""
msgid "Type:"
msgstr "Typ:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Bez dodatkowych rozdań"
Expand Down Expand Up @@ -3596,6 +3599,9 @@ msgstr "Inne nazwy:"
msgid "Category:"
msgstr "Kategoria:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
8 changes: 7 additions & 1 deletion 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-03-03 11:36-0500\n"
"PO-Revision-Date: 2024-03-15 23:05-0400\n"
"Last-Translator: Matheus Knack <[email protected]>\n"
"Language-Team: \n"
"Language: pt_BR\n"
Expand Down Expand Up @@ -1849,6 +1849,9 @@ msgstr "Motivos para um divórcio"
msgid "Type:"
msgstr "Tipo:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Sem re-distribuições"
Expand Down Expand Up @@ -3602,6 +3605,9 @@ msgstr "Nomes alternativos:"
msgid "Category:"
msgstr "Categoria:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
6 changes: 6 additions & 0 deletions po/pysol.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,9 @@ msgstr ""
msgid "Type:"
msgstr ""

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr ""
Expand Down Expand Up @@ -3401,6 +3404,9 @@ msgstr ""
msgid "Category:"
msgstr ""

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
8 changes: 7 additions & 1 deletion 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-03-03 11:36-0500\n"
"PO-Revision-Date: 2024-03-15 23:05-0400\n"
"Last-Translator: Skomoroh <[email protected]>\n"
"Language-Team: Russian <[email protected]>\n"
"Language: ru\n"
Expand Down Expand Up @@ -1831,6 +1831,9 @@ msgstr ""
msgid "Type:"
msgstr "Тип:"

msgid "Subtype:"
msgstr ""

#: pysollib/wizardutil.py:151 pysollib/wizardutil.py:157
msgid "No redeals"
msgstr "Без пересдачи"
Expand Down Expand Up @@ -3651,6 +3654,9 @@ msgstr "Другие имена:"
msgid "Category:"
msgstr "Категория:"

msgid "Subcategory:"
msgstr ""

#: pysollib/pysolgtk/selectgame.py:119 pysollib/tile/selectgame.py:397
#: pysollib/tk/selectgame.py:397
msgid "Decks:"
Expand Down
55 changes: 53 additions & 2 deletions pysollib/tile/selectcardset.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ def performSearch(self):
and self.criteria.typeOptions[self.criteria.type]
!= cardset.si.type):
continue

if (self.criteria.subtype != "" and
self.criteria.subtypeOptionsAll[self.criteria.subtype]
!= cardset.si.subtype):
continue
if (self.criteria.style != ""
and self.criteria.styleOptions[self.criteria.style]
not in cardset.si.styles):
Expand Down Expand Up @@ -542,6 +545,7 @@ def advancedSearch(self):

self.criteria.size = d.size.get()
self.criteria.type = d.type.get()
self.criteria.subtype = d.subtype.get()
self.criteria.style = d.style.get()
self.criteria.date = d.date.get()
self.criteria.nationality = d.nationality.get()
Expand Down Expand Up @@ -722,6 +726,7 @@ def __init__(self, manager):
self.name = ""
self.size = ""
self.type = ""
self.subtype = ""
self.style = ""
self.date = ""
self.nationality = ""
Expand All @@ -740,6 +745,14 @@ def __init__(self, manager):
typeOptions[key] = name
self.typeOptions = dict((v, k) for k, v in typeOptions.items())

self.subtypeOptions = {"": -1}

subtypeOptionsAll = {"": -1}
for t in CSI.SUBTYPE_NAME.values():
subtypeOptionsAll.update(t)
self.subtypeOptionsAll = dict((v, k) for k, v in
subtypeOptionsAll.items())

styleOptions = {-1: ""}
for key, name in CSI.STYLE.items():
if manager.registered_styles.get(key):
Expand Down Expand Up @@ -773,6 +786,8 @@ def __init__(self, parent, title, criteria, manager, **kw):
self.size.set(criteria.size)
self.type = tkinter.StringVar()
self.type.set(criteria.type)
self.subtype = tkinter.StringVar()
self.subtype.set(criteria.subtype)
self.style = tkinter.StringVar()
self.style.set(criteria.style)
self.date = tkinter.StringVar()
Expand Down Expand Up @@ -804,15 +819,34 @@ def __init__(self, parent, title, criteria, manager, **kw):
typeValues = list(criteria.typeOptions.keys())
typeValues.sort()

self.typeValues = criteria.typeOptions

labelType = tkinter.Label(top_frame, text="Type:", anchor="w")
labelType.grid(row=row, column=0, columnspan=1, sticky='ew',
padx=1, pady=1)
textType = PysolCombo(top_frame, values=typeValues,
textvariable=self.type, state='readonly')
textvariable=self.type, state='readonly',
selectcommand=self.updateSubtypes)
textType.grid(row=row, column=1, columnspan=4, sticky='ew',
padx=1, pady=1)
row += 1

subtypeValues = list(criteria.subtypeOptions.keys())
subtypeValues.sort()

labelSubtype = tkinter.Label(top_frame, text="Subtype:",
anchor="w")
labelSubtype.grid(row=row, column=0, columnspan=1, sticky='ew',
padx=1, pady=1)
textSubtype = PysolCombo(top_frame, values=subtypeValues,
textvariable=self.subtype,
state='readonly')
textSubtype.grid(row=row, column=1, columnspan=4, sticky='ew',
padx=1, pady=1)
self.subtypeSelect = textSubtype
self.updateSubtypes()
row += 1

styleValues = list(criteria.styleOptions.keys())
styleValues.sort()

Expand Down Expand Up @@ -855,6 +889,23 @@ def __init__(self, parent, title, criteria, manager, **kw):
# focus = text_w
self.mainloop(focus, kw.timeout)

def updateSubtypes(self, *args):
subtypeOptions = {-1: ""}
key = self.typeValues[self.type.get()]
if key in CSI.SUBTYPE_NAME:
subtypeOptions.update(CSI.SUBTYPE_NAME[key])
self.subtypeSelect['state'] = 'readonly'
subtypeOptions = dict((v, k) for k, v in
subtypeOptions.items())
subtypeOptionsK = list(subtypeOptions.keys())
subtypeOptionsK.sort()
self.subtypeSelect['values'] = subtypeOptionsK
if self.subtype.get() not in subtypeOptionsK:
self.subtype.set("")
else:
self.subtypeSelect['state'] = 'disabled'
self.subtype.set("")

def initKw(self, kw):
kw = KwStruct(kw,
strings=(_("&OK"), _("&Cancel")), default=0,
Expand Down
Loading

0 comments on commit d3a4548

Please sign in to comment.