mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Added image resampling option.
This commit is contained in:
parent
ee5fcbad76
commit
8d575bb747
12 changed files with 226 additions and 20 deletions
|
@ -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: 2022-06-04 21:34-0400\n"
|
"PO-Revision-Date: 2022-07-06 18:33-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"
|
||||||
|
@ -4865,6 +4865,30 @@ msgstr "automatisch skalieren"
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr "Seitenverhältnis beibehalten"
|
msgstr "Seitenverhältnis beibehalten"
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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: 2022-06-04 21:35-0400\n"
|
"PO-Revision-Date: 2022-07-06 18:33-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"
|
||||||
|
@ -4912,6 +4912,30 @@ msgstr "Échelle &automatique"
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr "Conserver le ratio"
|
msgstr "Conserver le ratio"
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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: 2022-06-04 21:35-0400\n"
|
"PO-Revision-Date: 2022-07-06 18:32-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"
|
||||||
|
@ -4976,6 +4976,30 @@ msgstr "Gira automatico"
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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: 2022-06-04 21:35-0400\n"
|
"PO-Revision-Date: 2022-07-06 18:32-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"
|
||||||
|
@ -5036,6 +5036,30 @@ msgstr "Przekładaj automatycznie"
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
24
po/pysol.pot
24
po/pysol.pot
|
@ -4663,6 +4663,30 @@ msgstr ""
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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: 2022-06-04 21:35-0400\n"
|
"PO-Revision-Date: 2022-07-06 18:31-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"
|
||||||
|
@ -5002,6 +5002,30 @@ msgstr "Автоматическое изменение размера"
|
||||||
msgid "&Preserve aspect ratio"
|
msgid "&Preserve aspect ratio"
|
||||||
msgstr "Сохранять соотношение сторон"
|
msgstr "Сохранять соотношение сторон"
|
||||||
|
|
||||||
|
msgid "R&esampling"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Nearest Neighbor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Bilinear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&icubic"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Lanczos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Antialiasing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "B&ox"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "&Hamming"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Card la&yout"
|
msgid "Card la&yout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -877,7 +877,8 @@ class Application:
|
||||||
self.opt.spread_stacks,
|
self.opt.spread_stacks,
|
||||||
self.opt.preserve_aspect_ratio) = d.scale_values
|
self.opt.preserve_aspect_ratio) = d.scale_values
|
||||||
if not self.opt.auto_scale:
|
if not self.opt.auto_scale:
|
||||||
self.images.resize(self.opt.scale_x, self.opt.scale_y)
|
self.images.resize(self.opt.scale_x, self.opt.scale_y,
|
||||||
|
resample=self.opt.resampling)
|
||||||
if d.cardset_values:
|
if d.cardset_values:
|
||||||
cs.CARD_XOFFSET, cs.CARD_YOFFSET = d.cardset_values
|
cs.CARD_XOFFSET, cs.CARD_YOFFSET = d.cardset_values
|
||||||
self.opt.offsets[cs.ident] = d.cardset_values
|
self.opt.offsets[cs.ident] = d.cardset_values
|
||||||
|
|
|
@ -1018,7 +1018,7 @@ class Game(object):
|
||||||
self.center_offset = self.getCenterOffset(vw, vh, iw, ih, xf, yf)
|
self.center_offset = self.getCenterOffset(vw, vh, iw, ih, xf, yf)
|
||||||
if (not self.app.opt.spread_stacks or manually):
|
if (not self.app.opt.spread_stacks or manually):
|
||||||
# images
|
# images
|
||||||
self.app.images.resize(xf, yf)
|
self.app.images.resize(xf, yf, resample=self.app.opt.resampling)
|
||||||
# cards
|
# cards
|
||||||
for card in self.cards:
|
for card in self.cards:
|
||||||
card.update(card.id, card.deck, card.suit, card.rank, self)
|
card.update(card.id, card.deck, card.suit, card.rank, self)
|
||||||
|
|
|
@ -53,6 +53,7 @@ class Images:
|
||||||
self.reduced = r
|
self.reduced = r
|
||||||
self._xfactor = 1.0
|
self._xfactor = 1.0
|
||||||
self._yfactor = 1.0
|
self._yfactor = 1.0
|
||||||
|
self._resampling = 0
|
||||||
if cs is None:
|
if cs is None:
|
||||||
return
|
return
|
||||||
self._setSize()
|
self._setSize()
|
||||||
|
@ -430,24 +431,26 @@ class Images:
|
||||||
return (int(self.CARD_DX * self._xfactor),
|
return (int(self.CARD_DX * self._xfactor),
|
||||||
int(self.CARD_DY * self._yfactor))
|
int(self.CARD_DY * self._yfactor))
|
||||||
|
|
||||||
def resize(self, xf, yf):
|
def resize(self, xf, yf, resample=1):
|
||||||
# print 'Images.resize:', xf, yf, self._card[0].width(), self.CARDW
|
# print 'Images.resize:', xf, yf, self._card[0].width(), self.CARDW
|
||||||
if self._xfactor == xf and self._yfactor == yf:
|
if (self._xfactor == xf and self._yfactor == yf
|
||||||
|
and self._resampling == resample):
|
||||||
# print 'no resize'
|
# print 'no resize'
|
||||||
return
|
return
|
||||||
self._xfactor = xf
|
self._xfactor = xf
|
||||||
self._yfactor = yf
|
self._yfactor = yf
|
||||||
|
self._resampling = resample
|
||||||
# ???self._setSize(xf, yf)
|
# ???self._setSize(xf, yf)
|
||||||
self.setOffsets()
|
self.setOffsets()
|
||||||
# cards
|
# cards
|
||||||
cards = []
|
cards = []
|
||||||
for c in self._card:
|
for c in self._card:
|
||||||
c = c.resize(xf, yf)
|
c = c.resize(xf, yf, resample=resample)
|
||||||
cards.append(c)
|
cards.append(c)
|
||||||
self._card = cards
|
self._card = cards
|
||||||
# back
|
# back
|
||||||
for b in self._back:
|
for b in self._back:
|
||||||
b.image = b.image.resize(xf, yf)
|
b.image = b.image.resize(xf, yf, resample=resample)
|
||||||
|
|
||||||
# stack bottom image
|
# stack bottom image
|
||||||
neg = self._bottom is self._bottom_negative # dont know
|
neg = self._bottom is self._bottom_negative # dont know
|
||||||
|
@ -455,11 +458,11 @@ class Images:
|
||||||
bottom_negative = []
|
bottom_negative = []
|
||||||
bottom_positive = []
|
bottom_positive = []
|
||||||
for c in self._bottom_negative:
|
for c in self._bottom_negative:
|
||||||
c = c.resize(xf, yf)
|
c = c.resize(xf, yf, resample=resample)
|
||||||
bottom_negative.append(c)
|
bottom_negative.append(c)
|
||||||
self._bottom_negative = bottom_negative
|
self._bottom_negative = bottom_negative
|
||||||
for c in self._bottom_positive:
|
for c in self._bottom_positive:
|
||||||
c = c.resize(xf, yf)
|
c = c.resize(xf, yf, resample=resample)
|
||||||
bottom_positive.append(c)
|
bottom_positive.append(c)
|
||||||
self._bottom_positive = bottom_positive
|
self._bottom_positive = bottom_positive
|
||||||
|
|
||||||
|
@ -467,11 +470,11 @@ class Images:
|
||||||
letter_negative = []
|
letter_negative = []
|
||||||
letter_positive = []
|
letter_positive = []
|
||||||
for c in self._letter_negative:
|
for c in self._letter_negative:
|
||||||
c = c.resize(xf, yf)
|
c = c.resize(xf, yf, resample=resample)
|
||||||
letter_negative.append(c)
|
letter_negative.append(c)
|
||||||
self._letter_negative = letter_negative
|
self._letter_negative = letter_negative
|
||||||
for c in self._letter_positive:
|
for c in self._letter_positive:
|
||||||
c = c.resize(xf, yf)
|
c = c.resize(xf, yf, resample=resample)
|
||||||
letter_positive.append(c)
|
letter_positive.append(c)
|
||||||
self._letter_positive = letter_positive
|
self._letter_positive = letter_positive
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import traceback
|
||||||
import configobj
|
import configobj
|
||||||
|
|
||||||
import pysollib.settings
|
import pysollib.settings
|
||||||
from pysollib.mfxutil import USE_PIL, print_err
|
from pysollib.mfxutil import Image, USE_PIL, print_err
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.mygettext import myGettext
|
from pysollib.mygettext import myGettext
|
||||||
from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT
|
from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT
|
||||||
|
@ -204,6 +204,7 @@ scale_y = float
|
||||||
auto_scale = boolean
|
auto_scale = boolean
|
||||||
spread_stacks = boolean
|
spread_stacks = boolean
|
||||||
preserve_aspect_ratio = boolean
|
preserve_aspect_ratio = boolean
|
||||||
|
resampling = integer(0, 10)
|
||||||
'''.splitlines()
|
'''.splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
@ -457,6 +458,9 @@ class Options:
|
||||||
self.spread_stacks = False
|
self.spread_stacks = False
|
||||||
self.center_layout = True
|
self.center_layout = True
|
||||||
self.preserve_aspect_ratio = True
|
self.preserve_aspect_ratio = True
|
||||||
|
self.resampling = 0
|
||||||
|
if USE_PIL:
|
||||||
|
self.resampling = int(Image.ANTIALIAS)
|
||||||
# solver
|
# solver
|
||||||
self.solver_presets = [
|
self.solver_presets = [
|
||||||
'none',
|
'none',
|
||||||
|
@ -611,7 +615,7 @@ class Options:
|
||||||
config['cardsets'][str(key)] = val
|
config['cardsets'][str(key)] = val
|
||||||
for key in ('scale_cards', 'scale_x', 'scale_y',
|
for key in ('scale_cards', 'scale_x', 'scale_y',
|
||||||
'auto_scale', 'spread_stacks',
|
'auto_scale', 'spread_stacks',
|
||||||
'preserve_aspect_ratio'):
|
'preserve_aspect_ratio', 'resampling'):
|
||||||
config['cardsets'][key] = getattr(self, key)
|
config['cardsets'][key] = getattr(self, key)
|
||||||
|
|
||||||
# games_geometry
|
# games_geometry
|
||||||
|
@ -782,7 +786,8 @@ class Options:
|
||||||
('scale_y', 'float'),
|
('scale_y', 'float'),
|
||||||
('auto_scale', 'bool'),
|
('auto_scale', 'bool'),
|
||||||
('spread_stacks', 'bool'),
|
('spread_stacks', 'bool'),
|
||||||
('preserve_aspect_ratio', 'bool')):
|
('preserve_aspect_ratio', 'bool'),
|
||||||
|
('resampling', 'int')):
|
||||||
val = self._getOption('cardsets', key, t)
|
val = self._getOption('cardsets', key, t)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
|
|
@ -71,6 +71,46 @@ def createToolbarMenu(menubar, menu):
|
||||||
command=menubar.mOptToolbar)
|
command=menubar.mOptToolbar)
|
||||||
|
|
||||||
|
|
||||||
|
def createResamplingMenu(menubar, menu):
|
||||||
|
tearoff = menu.cget('tearoff')
|
||||||
|
submenu = MfxMenu(menu, label=n_('R&esampling'), tearoff=tearoff)
|
||||||
|
|
||||||
|
submenu.add_radiobutton(label=n_("&Nearest Neighbor"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.NEAREST),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
if Image.BILINEAR:
|
||||||
|
submenu.add_radiobutton(label=n_("&Bilinear"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.BILINEAR),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
if Image.BICUBIC:
|
||||||
|
submenu.add_radiobutton(label=n_("B&icubic"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.BICUBIC),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
if Image.LANCZOS:
|
||||||
|
submenu.add_radiobutton(label=n_("&Lanczos"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.LANCZOS),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
elif Image.ANTIALIAS:
|
||||||
|
submenu.add_radiobutton(label=n_("&Antialiasing"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.ANTIALIAS),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
if Image.BOX:
|
||||||
|
submenu.add_radiobutton(label=n_("B&ox"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.BOX),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
if Image.HAMMING:
|
||||||
|
submenu.add_radiobutton(label=n_("&Hamming"),
|
||||||
|
variable=menubar.tkopt.resampling,
|
||||||
|
value=int(Image.HAMMING),
|
||||||
|
command=menubar.mOptResampling)
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -177,6 +217,7 @@ class PysolMenubarTkCommon:
|
||||||
sound=tkinter.BooleanVar(),
|
sound=tkinter.BooleanVar(),
|
||||||
auto_scale=tkinter.BooleanVar(),
|
auto_scale=tkinter.BooleanVar(),
|
||||||
preserve_aspect_ratio=tkinter.BooleanVar(),
|
preserve_aspect_ratio=tkinter.BooleanVar(),
|
||||||
|
resampling=tkinter.IntVar(),
|
||||||
spread_stacks=tkinter.BooleanVar(),
|
spread_stacks=tkinter.BooleanVar(),
|
||||||
center_layout=tkinter.BooleanVar(),
|
center_layout=tkinter.BooleanVar(),
|
||||||
save_games_geometry=tkinter.BooleanVar(),
|
save_games_geometry=tkinter.BooleanVar(),
|
||||||
|
@ -236,6 +277,7 @@ class PysolMenubarTkCommon:
|
||||||
tkopt.sound.set(opt.sound)
|
tkopt.sound.set(opt.sound)
|
||||||
tkopt.auto_scale.set(opt.auto_scale)
|
tkopt.auto_scale.set(opt.auto_scale)
|
||||||
tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio)
|
tkopt.preserve_aspect_ratio.set(opt.preserve_aspect_ratio)
|
||||||
|
tkopt.resampling.set(opt.resampling)
|
||||||
tkopt.spread_stacks.set(opt.spread_stacks)
|
tkopt.spread_stacks.set(opt.spread_stacks)
|
||||||
tkopt.center_layout.set(opt.center_layout)
|
tkopt.center_layout.set(opt.center_layout)
|
||||||
tkopt.save_games_geometry.set(opt.save_games_geometry)
|
tkopt.save_games_geometry.set(opt.save_games_geometry)
|
||||||
|
@ -570,6 +612,8 @@ class PysolMenubarTkCommon:
|
||||||
label=n_("&Preserve aspect ratio"),
|
label=n_("&Preserve aspect ratio"),
|
||||||
variable=self.tkopt.preserve_aspect_ratio,
|
variable=self.tkopt.preserve_aspect_ratio,
|
||||||
command=self.mOptPreserveAspectRatio)
|
command=self.mOptPreserveAspectRatio)
|
||||||
|
submenu.add_separator()
|
||||||
|
createResamplingMenu(self, submenu)
|
||||||
submenu = MfxMenu(menu, label=n_("Card la&yout"))
|
submenu = MfxMenu(menu, label=n_("Card la&yout"))
|
||||||
submenu.add_checkbutton(
|
submenu.add_checkbutton(
|
||||||
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
|
label=n_("&Spread stacks"), variable=self.tkopt.spread_stacks,
|
||||||
|
@ -1603,6 +1647,15 @@ Unsupported game for import.
|
||||||
self.tkopt.preserve_aspect_ratio.set(preserve_aspect_ratio)
|
self.tkopt.preserve_aspect_ratio.set(preserve_aspect_ratio)
|
||||||
self._updateCardSize()
|
self._updateCardSize()
|
||||||
|
|
||||||
|
def mOptResampling(self, *event):
|
||||||
|
if self._cancelDrag(break_pause=False):
|
||||||
|
return
|
||||||
|
resampling = self.tkopt.resampling.get()
|
||||||
|
self.app.opt.resampling = resampling
|
||||||
|
self.tkopt.resampling.set(resampling) # update radiobutton
|
||||||
|
self.app.opt.resampling = (self.tkopt.resampling.get())
|
||||||
|
self._updateCardSize()
|
||||||
|
|
||||||
def mOptSpreadStacks(self, *event):
|
def mOptSpreadStacks(self, *event):
|
||||||
if self._cancelDrag(break_pause=True):
|
if self._cancelDrag(break_pause=True):
|
||||||
return
|
return
|
||||||
|
|
|
@ -288,12 +288,12 @@ if Image:
|
||||||
im = PIL_Image(image=im)
|
im = PIL_Image(image=im)
|
||||||
return im
|
return im
|
||||||
|
|
||||||
def resize(self, xf, yf):
|
def resize(self, xf, yf, resample=Image.ANTIALIAS):
|
||||||
|
|
||||||
w, h = self._pil_image_orig.size
|
w, h = self._pil_image_orig.size
|
||||||
w0, h0 = int(w*xf), int(h*yf)
|
w0, h0 = int(w*xf), int(h*yf)
|
||||||
|
|
||||||
im = self._pil_image_orig.resize((w0, h0), Image.ANTIALIAS)
|
im = self._pil_image_orig.resize((w0, h0), resample)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
findsum = findfile(self._pil_image_orig.filename)
|
findsum = findfile(self._pil_image_orig.filename)
|
||||||
|
|
Loading…
Add table
Reference in a new issue