mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* improved mahjongg tile highlighting
git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@201 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
3319f877a1
commit
1464034191
3 changed files with 41 additions and 8 deletions
|
@ -158,15 +158,15 @@ class SpanishPatience(BakersDozen):
|
||||||
|
|
||||||
|
|
||||||
class PortugueseSolitaire(BakersDozen):
|
class PortugueseSolitaire(BakersDozen):
|
||||||
RowStack_Class = StackWrapper(RK_RowStack, base_rank=KING)
|
RowStack_Class = StackWrapper(RK_RowStack, base_rank=KING, max_move=1)
|
||||||
Solver_Class = FreeCellSolverWrapper(sbb='rank', esf='kings')
|
Solver_Class = FreeCellSolverWrapper(sbb='rank', esf='kings')
|
||||||
def _shuffleHook(self, cards):
|
def _shuffleHook(self, cards):
|
||||||
return cards
|
return cards
|
||||||
|
|
||||||
|
|
||||||
class SpanishPatienceII(PortugueseSolitaire):
|
class SpanishPatienceII(PortugueseSolitaire):
|
||||||
RowStack_Class = RK_RowStack
|
RowStack_Class = StackWrapper(RK_RowStack, max_move=1)
|
||||||
Solver_Class = FreeCellSolverWrapper(sbb='rank', sm='unlimited')
|
Solver_Class = FreeCellSolverWrapper(sbb='rank')
|
||||||
|
|
||||||
|
|
||||||
# /***********************************************************************
|
# /***********************************************************************
|
||||||
|
|
|
@ -35,7 +35,7 @@ from gettext import ungettext
|
||||||
# PySol imports
|
# PySol imports
|
||||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||||
from pysollib.util import *
|
from pysollib.util import *
|
||||||
from pysollib.mfxutil import kwdefault, Struct
|
from pysollib.mfxutil import kwdefault, Struct, Image
|
||||||
from pysollib.stack import *
|
from pysollib.stack import *
|
||||||
from pysollib.game import Game
|
from pysollib.game import Game
|
||||||
from pysollib.layout import Layout
|
from pysollib.layout import Layout
|
||||||
|
@ -884,8 +884,41 @@ a solvable configuration.'''),
|
||||||
return ((self.s.rows, 1),)
|
return ((self.s.rows, 1),)
|
||||||
|
|
||||||
def _highlightCards(self, info, sleep=1.5, delta=(1,1,1,1)):
|
def _highlightCards(self, info, sleep=1.5, delta=(1,1,1,1)):
|
||||||
delta = (-self._delta_x, 0, 0, -self._delta_y)
|
if not Image:
|
||||||
Game._highlightCards(self, info, sleep=sleep, delta=delta)
|
delta = (-self._delta_x, 0, 0, -self._delta_y)
|
||||||
|
return Game._highlightCards(self, info, sleep=sleep, delta=delta)
|
||||||
|
|
||||||
|
if not info:
|
||||||
|
return 0
|
||||||
|
if self.pause:
|
||||||
|
return 0
|
||||||
|
self.stopWinAnimation()
|
||||||
|
items = []
|
||||||
|
for s, c1, c2, color in info:
|
||||||
|
assert c1 is c2
|
||||||
|
assert c1 in s.cards
|
||||||
|
tkraise = False
|
||||||
|
x, y = s.x, s.y
|
||||||
|
img = self.app.images.getShadowCard(c1.deck, c1.suit, c1.rank)
|
||||||
|
if img is None:
|
||||||
|
continue
|
||||||
|
img = MfxCanvasImage(self.canvas, x, y, image=img,
|
||||||
|
anchor=ANCHOR_NW, group=s.group)
|
||||||
|
img.tkraise(c1.item)
|
||||||
|
items.append(img)
|
||||||
|
if not items:
|
||||||
|
return 0
|
||||||
|
self.canvas.update_idletasks()
|
||||||
|
if sleep:
|
||||||
|
self.sleep(sleep)
|
||||||
|
items.reverse()
|
||||||
|
for r in items:
|
||||||
|
r.delete()
|
||||||
|
self.canvas.update_idletasks()
|
||||||
|
return EVENT_HANDLED
|
||||||
|
else:
|
||||||
|
# remove items later (find_card_dialog)
|
||||||
|
return items
|
||||||
|
|
||||||
def getCardFaceImage(self, deck, suit, rank):
|
def getCardFaceImage(self, deck, suit, rank):
|
||||||
if suit == 3:
|
if suit == 3:
|
||||||
|
|
|
@ -229,8 +229,8 @@ class Stack:
|
||||||
# moving a subpile around.
|
# moving a subpile around.
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
MIN_VISIBLE_XOFFSET = 5
|
MIN_VISIBLE_XOFFSET = 3
|
||||||
MIN_VISIBLE_YOFFSET = 5
|
MIN_VISIBLE_YOFFSET = 3
|
||||||
SHRINK_FACTOR = 2.
|
SHRINK_FACTOR = 2.
|
||||||
|
|
||||||
def __init__(self, x, y, game, cap={}):
|
def __init__(self, x, y, game, cap={}):
|
||||||
|
|
Loading…
Add table
Reference in a new issue