diff --git a/po/de_pysol.po b/po/de_pysol.po index 24492e4e..d71fe1d8 100644 --- a/po/de_pysol.po +++ b/po/de_pysol.po @@ -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-07-04 17:03-0400\n" +"PO-Revision-Date: 2024-08-04 20:21-0400\n" "Last-Translator: H. Schaekel \n" "Language-Team: German\n" "Language: de\n" @@ -4175,6 +4175,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Fortschritt anzeigen" diff --git a/po/fr_pysol.po b/po/fr_pysol.po index 5d0d31b2..5c0c388e 100644 --- a/po/fr_pysol.po +++ b/po/fr_pysol.po @@ -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-07-04 17:03-0400\n" +"PO-Revision-Date: 2024-08-04 20:20-0400\n" "Last-Translator: Eric Rausch \n" "Language-Team: French\n" "Language: fr\n" @@ -4226,6 +4226,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Progrès" diff --git a/po/it_pysol.po b/po/it_pysol.po index e077362c..212c6436 100644 --- a/po/it_pysol.po +++ b/po/it_pysol.po @@ -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-07-04 17:03-0400\n" +"PO-Revision-Date: 2024-08-04 20:19-0400\n" "Last-Translator: Giuliano Colla \n" "Language-Team: Italiano \n" "Language: it\n" @@ -4290,6 +4290,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Mostra l'avanzamento" diff --git a/po/pl_pysol.po b/po/pl_pysol.po index bc846de3..1b250938 100644 --- a/po/pl_pysol.po +++ b/po/pl_pysol.po @@ -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-07-04 17:03-0400\n" +"PO-Revision-Date: 2024-08-04 20:19-0400\n" "Last-Translator: Jerzy Trzeciak \n" "Language-Team: Polish \n" "Language: pl\n" @@ -4243,6 +4243,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Pokaż postęp" diff --git a/po/pt_BR_pysol.po b/po/pt_BR_pysol.po index 623af9ba..117e877a 100644 --- a/po/pt_BR_pysol.po +++ b/po/pt_BR_pysol.po @@ -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-07-04 17:04-0400\n" +"PO-Revision-Date: 2024-08-04 20:18-0400\n" "Last-Translator: Matheus Knack \n" "Language-Team: \n" "Language: pt_BR\n" @@ -4249,6 +4249,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Mostrar progresso" diff --git a/po/pysol.pot b/po/pysol.pot index ffb30e3c..864976d5 100644 --- a/po/pysol.pot +++ b/po/pysol.pot @@ -4031,6 +4031,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "" diff --git a/po/ru_pysol.po b/po/ru_pysol.po index 1cab798d..9423dac1 100644 --- a/po/ru_pysol.po +++ b/po/ru_pysol.po @@ -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-07-04 17:04-0400\n" +"PO-Revision-Date: 2024-08-04 20:17-0400\n" "Last-Translator: Skomoroh \n" "Language-Team: Russian \n" "Language: ru\n" @@ -4299,6 +4299,15 @@ msgstr "" msgid "Images" msgstr "" +msgid "SD" +msgstr "" + +msgid "HD" +msgstr "" + +msgid "4K" +msgstr "" + #: pysollib/tile/solverdialog.py:54 pysollib/tk/solverdialog.py:62 msgid "Show progress" msgstr "Показывать прогресс" diff --git a/pysollib/resource.py b/pysollib/resource.py index d6e72b27..33176484 100644 --- a/pysollib/resource.py +++ b/pysollib/resource.py @@ -25,7 +25,7 @@ import glob import os import traceback -from pysollib.mfxutil import KwStruct, Struct +from pysollib.mfxutil import Image, KwStruct, Struct, USE_PIL from pysollib.mygettext import _ from pysollib.settings import DEBUG @@ -677,16 +677,45 @@ class CardsetManager(ResourceManager): # * Tile # ************************************************************************ +# TableTileInfo constants +class TTI: + # tile size + SIZE_UNKNOWN = 0 + SIZE_TILE = 1 + SIZE_SD = 2 + SIZE_HD = 3 + SIZE_4K = 4 + + class Tile(Resource): def __init__(self, **kw): kw['color'] = None kw['stretch'] = 0 kw['save_aspect'] = 0 + kw['size'] = 0 Resource.__init__(self, **kw) class TileManager(ResourceManager): - pass + def register(self, tile): + if USE_PIL: + try: + img = Image.open(tile.filename) + TW, TH = img.size + if TW < 640 or TH < 480: + tile.size = TTI.SIZE_TILE + elif TW < 1280 or TH < 720: + tile.size = TTI.SIZE_SD + elif TW < 3840 or TH < 2160: + tile.size = TTI.SIZE_HD + else: + tile.size = TTI.SIZE_4K + except AttributeError: + tile.size = TTI.SIZE_UNKNOWN + else: + tile.size = TTI.SIZE_UNKNOWN + + ResourceManager.register(self, tile) # ************************************************************************ diff --git a/pysollib/tile/selecttile.py b/pysollib/tile/selecttile.py index 6e4a604a..3536dd29 100644 --- a/pysollib/tile/selecttile.py +++ b/pysollib/tile/selecttile.py @@ -25,6 +25,7 @@ import os from pysollib.mfxutil import KwStruct, USE_PIL from pysollib.mygettext import _ +from pysollib.resource import TTI from pysollib.ui.tktile.selecttree import SelectDialogTreeData from pysollib.ui.tktile.tkutil import bind @@ -324,10 +325,13 @@ class SelectTileDialogWithPreview(MfxDialog): ('stretch', 'save-aspect', 'stretch-4k', 'save-aspect-4k')): continue - if (self.criteria.type == "Tiles" and os.path.basename( os.path.dirname(tile.filename)) != 'tiles'): continue + if (self.criteria.size != "" + and self.criteria.sizeOptions[self.criteria.size] + != tile.size): + continue if self.app.checkSearchString(self.criteria.name, tile.name): @@ -348,6 +352,7 @@ class SelectTileDialogWithPreview(MfxDialog): self.list_searchtext.insert(0, d.name.get()) self.criteria.type = d.type.get() + self.criteria.size = d.size.get() self.performSearch() @@ -401,6 +406,13 @@ class SearchCriteria: def __init__(self): self.name = "" self.type = "" + self.size = "" + + self.sizeOptions = {"": -1, + "Tile": TTI.SIZE_TILE, + "SD": TTI.SIZE_SD, + "HD": TTI.SIZE_HD, + "4K": TTI.SIZE_4K} self.typeOptions = ("", "Images", "Tiles") @@ -416,6 +428,8 @@ class SelectTileAdvancedSearch(MfxDialog): self.name.set(criteria.name) self.type = tkinter.StringVar() self.type.set(criteria.type) + self.size = tkinter.StringVar() + self.size.set(criteria.size) # row = 0 @@ -437,6 +451,17 @@ class SelectTileAdvancedSearch(MfxDialog): textType.grid(row=row, column=1, columnspan=4, sticky='ew', padx=1, pady=1) row += 1 + if USE_PIL: + sizeValues = list(criteria.sizeOptions.keys()) + + labelSize = tkinter.Label(top_frame, text="Size:", anchor="w") + labelSize.grid(row=row, column=0, columnspan=1, sticky='ew', + padx=1, pady=1) + textSize = PysolCombo(top_frame, values=sizeValues, + textvariable=self.size, state='readonly') + textSize.grid(row=row, column=1, columnspan=4, sticky='ew', + padx=1, pady=1) + row += 1 focus = self.createButtons(bottom_frame, kw) # focus = text_w