mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Enhanced higher resolution cardset support.
This commit is contained in:
parent
7436b7193b
commit
0e1ecd1c1e
8 changed files with 33 additions and 32 deletions
|
@ -997,7 +997,7 @@ class Game(object):
|
||||||
vw, vh = self.app.opt.game_geometry
|
vw, vh = self.app.opt.game_geometry
|
||||||
if not vw:
|
if not vw:
|
||||||
# first run of the game
|
# first run of the game
|
||||||
return 1, 1
|
return 1, 1, 1, 1
|
||||||
# requested size of canvas (createGame -> setSize)
|
# requested size of canvas (createGame -> setSize)
|
||||||
iw, ih = self.init_size
|
iw, ih = self.init_size
|
||||||
# calculate factor of resizing
|
# calculate factor of resizing
|
||||||
|
@ -1045,7 +1045,7 @@ class Game(object):
|
||||||
else:
|
else:
|
||||||
stack.resize(xf, yf0)
|
stack.resize(xf, yf0)
|
||||||
else:
|
else:
|
||||||
stack.resize(xf, yf0)
|
stack.resize(xf, yf)
|
||||||
stack.updatePositions()
|
stack.updatePositions()
|
||||||
self.regions.calc_info(xf, yf)
|
self.regions.calc_info(xf, yf)
|
||||||
# texts
|
# texts
|
||||||
|
@ -1862,7 +1862,10 @@ class Game(object):
|
||||||
# for InvisibleStack, etc
|
# for InvisibleStack, etc
|
||||||
# x, y = -500, -500 - len(game.allstacks)
|
# x, y = -500, -500 - len(game.allstacks)
|
||||||
cardw, cardh = self.app.images.CARDW, self.app.images.CARDH
|
cardw, cardh = self.app.images.CARDW, self.app.images.CARDH
|
||||||
x, y = cardw + self.canvas.xmargin, cardh + self.canvas.ymargin
|
xoffset = self.app.images.CARD_XOFFSET
|
||||||
|
yoffset = self.app.images.CARD_YOFFSET
|
||||||
|
x = cardw + xoffset + self.canvas.xmargin
|
||||||
|
y = cardh + yoffset + self.canvas.ymargin
|
||||||
return -x-10, -y-10
|
return -x-10, -y-10
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -115,10 +115,9 @@ class HitOrMiss(Game):
|
||||||
x += layout.XS * 1.1
|
x += layout.XS * 1.1
|
||||||
y = layout.YM + 1.4 * layout.YS
|
y = layout.YM + 1.4 * layout.YS
|
||||||
if self.preview <= 1:
|
if self.preview <= 1:
|
||||||
self.texts.rank = \
|
self.texts.base_rank = \
|
||||||
MfxCanvasText(self.canvas, x, y, anchor="nw",
|
MfxCanvasText(self.canvas, x, y, anchor="nw",
|
||||||
font=self.app.getFont("canvas_default"),
|
font=self.app.getFont("canvas_large"))
|
||||||
text=_(""))
|
|
||||||
|
|
||||||
# define stack-groups
|
# define stack-groups
|
||||||
layout.defaultStackGroups()
|
layout.defaultStackGroups()
|
||||||
|
@ -133,7 +132,7 @@ class HitOrMiss(Game):
|
||||||
def updateText(self):
|
def updateText(self):
|
||||||
if self.preview > 1:
|
if self.preview > 1:
|
||||||
return
|
return
|
||||||
self.texts.rank.config(text=RANKS[self.rank])
|
self.texts.base_rank.config(text=RANKS[self.rank])
|
||||||
|
|
||||||
def _restoreGameHook(self, game):
|
def _restoreGameHook(self, game):
|
||||||
self.rank = game.loadinfo.dval.get('Rank')
|
self.rank = game.loadinfo.dval.get('Rank')
|
||||||
|
|
|
@ -72,16 +72,16 @@ class PokerSquare(Game):
|
||||||
text=_('''\
|
text=_('''\
|
||||||
Royal Flush
|
Royal Flush
|
||||||
Straight Flush
|
Straight Flush
|
||||||
Four of a Kind
|
4 of a Kind
|
||||||
Full House
|
Full House
|
||||||
Flush
|
Flush
|
||||||
Straight
|
Straight
|
||||||
Three of a Kind
|
3 of a Kind
|
||||||
Two Pair
|
Two Pair
|
||||||
One Pair'''))
|
One Pair'''))
|
||||||
self.texts.list.append(t)
|
self.texts.list.append(t)
|
||||||
bb = t.bbox()
|
bb = t.bbox()
|
||||||
x = bb[1][0] + 16
|
x = bb[1][0] + l.CW * 1.3
|
||||||
h = bb[1][1] - bb[0][1]
|
h = bb[1][1] - bb[0][1]
|
||||||
if h >= 2*l.YS:
|
if h >= 2*l.YS:
|
||||||
ta = "e"
|
ta = "e"
|
||||||
|
@ -91,7 +91,7 @@ One Pair'''))
|
||||||
font=self.app.getFont("canvas_default"),
|
font=self.app.getFont("canvas_default"),
|
||||||
text="100\n75\n50\n25\n20\n15\n10\n5\n2")
|
text="100\n75\n50\n25\n20\n15\n10\n5\n2")
|
||||||
self.texts.list.append(t)
|
self.texts.list.append(t)
|
||||||
x = t.bbox()[1][0] + 16
|
x = t.bbox()[1][0] + l.CW * .6
|
||||||
self.texts.misc = MfxCanvasText(
|
self.texts.misc = MfxCanvasText(
|
||||||
self.canvas, x, y, anchor="nw",
|
self.canvas, x, y, anchor="nw",
|
||||||
font=self.app.getFont("canvas_default"),
|
font=self.app.getFont("canvas_default"),
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.mfxutil import Struct
|
from pysollib.mfxutil import Struct
|
||||||
from pysollib.pysoltk import MfxCanvasText
|
from pysollib.pysoltk import MfxCanvasText
|
||||||
from pysollib.resource import CSI
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -68,22 +67,11 @@ class Layout:
|
||||||
self.regions = []
|
self.regions = []
|
||||||
# set visual constants
|
# set visual constants
|
||||||
images = self.game.app.images
|
images = self.game.app.images
|
||||||
cardset_size = images.cs.si.size
|
|
||||||
if cardset_size in (CSI.SIZE_TINY, CSI.SIZE_SMALL):
|
layout_x_margin = images.CARDW // 9
|
||||||
layout_x_margin = 6
|
layout_y_margin = layout_x_margin
|
||||||
layout_y_margin = 6
|
layout_card_x_space = images.CARDW // 9
|
||||||
layout_card_x_space = 6
|
layout_card_y_space = images.CARDH // 8
|
||||||
layout_card_y_space = 10
|
|
||||||
elif cardset_size in (CSI.SIZE_MEDIUM,):
|
|
||||||
layout_x_margin = 8
|
|
||||||
layout_y_margin = 8
|
|
||||||
layout_card_x_space = 8
|
|
||||||
layout_card_y_space = 12
|
|
||||||
else: # CSI.SIZE_LARGE, CSI.SIZE_XLARGE
|
|
||||||
layout_x_margin = 10
|
|
||||||
layout_y_margin = 10
|
|
||||||
layout_card_x_space = 10
|
|
||||||
layout_card_y_space = 14
|
|
||||||
|
|
||||||
self.CW = images.CARDW
|
self.CW = images.CARDW
|
||||||
self.CH = images.CARDH
|
self.CH = images.CARDH
|
||||||
|
|
|
@ -161,7 +161,9 @@ class SelectCardsetDialogWithPreview(MfxDialog):
|
||||||
(_("Small cardsets"), lambda cs: cs.si.size == CSI.SIZE_SMALL),
|
(_("Small cardsets"), lambda cs: cs.si.size == CSI.SIZE_SMALL),
|
||||||
(_("Medium cardsets"), lambda cs: cs.si.size == CSI.SIZE_MEDIUM),
|
(_("Medium cardsets"), lambda cs: cs.si.size == CSI.SIZE_MEDIUM),
|
||||||
(_("Large cardsets"), lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
(_("Large cardsets"), lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
||||||
(_("XLarge cardsets"), lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
(_("Extra Large cardsets"),
|
||||||
|
lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
||||||
|
(_("Hi-Res cardsets"), lambda cs: cs.si.size == CSI.SIZE_HIRES),
|
||||||
):
|
):
|
||||||
cs = self._selectCardset(all_cardsets, selecter)
|
cs = self._selectCardset(all_cardsets, selecter)
|
||||||
if cs:
|
if cs:
|
||||||
|
|
|
@ -168,6 +168,7 @@ class CSI:
|
||||||
SIZE_MEDIUM = 3
|
SIZE_MEDIUM = 3
|
||||||
SIZE_LARGE = 4
|
SIZE_LARGE = 4
|
||||||
SIZE_XLARGE = 5
|
SIZE_XLARGE = 5
|
||||||
|
SIZE_HIRES = 6
|
||||||
|
|
||||||
# cardset types
|
# cardset types
|
||||||
TYPE_FRENCH = 1
|
TYPE_FRENCH = 1
|
||||||
|
@ -477,8 +478,10 @@ class CardsetManager(ResourceManager):
|
||||||
cs.si.size = CSI.SIZE_MEDIUM
|
cs.si.size = CSI.SIZE_MEDIUM
|
||||||
elif CW <= 90 and CH <= 125:
|
elif CW <= 90 and CH <= 125:
|
||||||
cs.si.size = CSI.SIZE_LARGE
|
cs.si.size = CSI.SIZE_LARGE
|
||||||
else:
|
elif CW <= 150 and CH <= 210:
|
||||||
cs.si.size = CSI.SIZE_XLARGE
|
cs.si.size = CSI.SIZE_XLARGE
|
||||||
|
else:
|
||||||
|
cs.si.size = CSI.SIZE_HIRES
|
||||||
#
|
#
|
||||||
keys = cs.styles[:]
|
keys = cs.styles[:]
|
||||||
cs.si.styles = tuple([s for s in keys if s in CSI.STYLE])
|
cs.si.styles = tuple([s for s in keys if s in CSI.STYLE])
|
||||||
|
|
|
@ -152,8 +152,11 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, _("Large cardsets"),
|
None, _("Large cardsets"),
|
||||||
lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
||||||
SelectCardsetNode(
|
SelectCardsetNode(
|
||||||
None, _("XLarge cardsets"),
|
None, _("Extra Large cardsets"),
|
||||||
lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
||||||
|
SelectCardsetNode(
|
||||||
|
None, _("Hi-Res cardsets"),
|
||||||
|
lambda cs: cs.si.size == CSI.SIZE_HIRES),
|
||||||
), expanded=1),
|
), expanded=1),
|
||||||
select_by_type,
|
select_by_type,
|
||||||
select_by_style,
|
select_by_style,
|
||||||
|
|
|
@ -150,8 +150,11 @@ class SelectCardsetData(SelectDialogTreeData):
|
||||||
None, _("Large cardsets"),
|
None, _("Large cardsets"),
|
||||||
lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
lambda cs: cs.si.size == CSI.SIZE_LARGE),
|
||||||
SelectCardsetNode(
|
SelectCardsetNode(
|
||||||
None, _("XLarge cardsets"),
|
None, _("Extra Large cardsets"),
|
||||||
lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
lambda cs: cs.si.size == CSI.SIZE_XLARGE),
|
||||||
|
SelectCardsetNode(
|
||||||
|
None, _("Hi-Res cardsets"),
|
||||||
|
lambda cs: cs.si.size == CSI.SIZE_HIRES),
|
||||||
), expanded=1),
|
), expanded=1),
|
||||||
select_by_type,
|
select_by_type,
|
||||||
select_by_style,
|
select_by_style,
|
||||||
|
|
Loading…
Add table
Reference in a new issue