mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Track size of table tiles and add option to search them by size
This commit is contained in:
parent
fd230df4f2
commit
18f8e3e32b
9 changed files with 126 additions and 9 deletions
|
@ -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 <Holger.Schaekel@web.de>\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"
|
||||
|
|
|
@ -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 <neelix570@gmail.com>\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"
|
||||
|
|
|
@ -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 <giuliano.colla@gmail.com>\n"
|
||||
"Language-Team: Italiano <it@li.org>\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"
|
||||
|
|
|
@ -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 <artusek@wp.pl>\n"
|
||||
"Language-Team: Polish <pl@li.org>\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"
|
||||
|
|
|
@ -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 <mtknack555@gmail.com>\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"
|
||||
|
|
|
@ -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 ""
|
||||
|
|
|
@ -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 <skomoroh@gmail.com>\n"
|
||||
"Language-Team: Russian <ru@li.org>\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 "Показывать прогресс"
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue