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

* improved mahjongg tile highlighting

git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@201 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2007-08-28 21:18:37 +00:00
parent 4ab072798e
commit 870f10b1e6
3 changed files with 41 additions and 8 deletions

View file

@ -158,15 +158,15 @@ class SpanishPatience(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')
def _shuffleHook(self, cards):
return cards
class SpanishPatienceII(PortugueseSolitaire):
RowStack_Class = RK_RowStack
Solver_Class = FreeCellSolverWrapper(sbb='rank', sm='unlimited')
RowStack_Class = StackWrapper(RK_RowStack, max_move=1)
Solver_Class = FreeCellSolverWrapper(sbb='rank')
# /***********************************************************************

View file

@ -35,7 +35,7 @@ from gettext import ungettext
# PySol imports
from pysollib.gamedb import registerGame, GameInfo, GI
from pysollib.util import *
from pysollib.mfxutil import kwdefault, Struct
from pysollib.mfxutil import kwdefault, Struct, Image
from pysollib.stack import *
from pysollib.game import Game
from pysollib.layout import Layout
@ -884,8 +884,41 @@ a solvable configuration.'''),
return ((self.s.rows, 1),)
def _highlightCards(self, info, sleep=1.5, delta=(1,1,1,1)):
delta = (-self._delta_x, 0, 0, -self._delta_y)
Game._highlightCards(self, info, sleep=sleep, delta=delta)
if not Image:
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):
if suit == 3:

View file

@ -229,8 +229,8 @@ class Stack:
# moving a subpile around.
# constants
MIN_VISIBLE_XOFFSET = 5
MIN_VISIBLE_YOFFSET = 5
MIN_VISIBLE_XOFFSET = 3
MIN_VISIBLE_YOFFSET = 3
SHRINK_FACTOR = 2.
def __init__(self, x, y, game, cap={}):