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

Improved playable preview display for large monitors and when working with high resolution cardsets.

This commit is contained in:
Joe R 2021-06-20 15:45:39 -04:00
parent dcd12cd66a
commit 5aa9071893
3 changed files with 17 additions and 16 deletions

View file

@ -1046,8 +1046,6 @@ class Game(object):
xf, yf, xf0, yf0, cw, ch = \
self.resizeImages(manually=card_size_manually)
for stack in self.allstacks:
x0, y0 = stack.init_coord
x, y = int(round(x0 * xf) + cw), int(round(y0 * yf) + ch)
if (self.app.opt.spread_stacks):
# Do not move Talons

View file

@ -378,8 +378,8 @@ class Images:
return
r = self.reduced
if r > 1:
self.CARD_XOFFSET = max(10//r, cs.CARD_XOFFSET)
self.CARD_YOFFSET = max(10//r, cs.CARD_YOFFSET)
self.CARD_XOFFSET = max(10, cs.CARD_XOFFSET // r)
self.CARD_YOFFSET = max(10, cs.CARD_YOFFSET // r)
else:
self.CARD_XOFFSET = cs.CARD_XOFFSET
self.CARD_YOFFSET = cs.CARD_YOFFSET
@ -474,6 +474,10 @@ class Images:
class SubsampledImages(Images):
def __init__(self, images, r=2):
size_cap = 100
if images.CARDW / r > size_cap or images.CARDH / r > size_cap:
r = max(images.CARDW, images.CARDH) / size_cap
Images.__init__(self, None, images.cs, r=r)
self._card = self._subsample(images._card, r)
self._bottom_positive = self._subsample(images._bottom_positive, r)
@ -482,6 +486,7 @@ class SubsampledImages(Images):
self._letter_negative = self._subsample(images._letter_negative, r)
self._bottom = self._bottom_positive
self._letter = self._letter_positive
#
for _back in images._back:
if _back is None:

View file

@ -353,16 +353,13 @@ class SelectGameDialogWithPreview(SelectGameDialog):
#
self.top.wm_minsize(400, 200)
sw = self.top.winfo_screenwidth()
if sw >= 1100:
w1, w2 = 250, 600
elif sw >= 900:
w1, w2 = 250, 500
elif sw >= 800:
w1, w2 = 220, 480
else:
w1, w2 = 200, 300
sh = self.top.winfo_screenheight()
h = sh * .8
w1, w2 = min(250, sw / 4), max(sw / 2 + ((sw / 4) - 250), sw / 2)
# print sw, w1, w2
w2 = max(200, min(w2, 10 + 12*(app.subsampled_images.CARDW+10)))
w2 = max(200, min(w2, 10 + 12 * (app.subsampled_images.CARDW + 10)))
# print sw, w1, w2
# padx, pady = kw.padx, kw.pady
# padx, pady = kw.padx/2, kw.pady/2
@ -377,7 +374,8 @@ class SelectGameDialogWithPreview(SelectGameDialog):
# Tree
font = app.getFont("default")
self.tree = self.Tree_Class(self, left_frame, key=gameid,
default=kw.default, font=font, width=w1)
default=kw.default, font=font, width=w1,
height=h)
self.tree.frame.pack(padx=padx, pady=pady, expand=True, fill='both')
# LabelFrame
info_frame = ttk.LabelFrame(right_frame, text=_('About game'))
@ -566,9 +564,9 @@ class SelectGameDialogWithPreview(SelectGameDialog):
}
skill_level = sl.get(gi.skill_level)
if gi.redeals == -2:
redeals = _('variable')
redeals = _('Variable')
elif gi.redeals == -1:
redeals = _('unlimited')
redeals = _('Unlimited')
else:
redeals = str(gi.redeals)
# stats