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

- removed `closeStackMove'

* bugs fixes


git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@73 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
skomoroh 2006-09-27 21:12:16 +00:00
parent fbc7c4ad68
commit 15466ca7e3
7 changed files with 21 additions and 55 deletions

View file

@ -60,7 +60,7 @@ from pysoltk import Card
from move import AMoveMove, AFlipMove, ATurnStackMove
from move import ANextRoundMove, ASaveSeedMove, AShuffleStackMove
from move import AUpdateStackMove, AFlipAllMove, ASaveStateMove
from move import ACloseStackMove, ASingleCardMove
from move import ASingleCardMove
from hint import DefaultHint
from help import help_about
@ -2155,14 +2155,6 @@ for %d moves.
am.do(self)
##self.hints.list = None
# move type 10
def closeStackMove(self, stack):
assert stack
am = ACloseStackMove(stack)
# don't store this move (???)
##self.__storeMove(am)
am.do(self)
# for ArbitraryStack
def singleCardMove(self, from_stack, to_stack, position, frames=-1, shadow=-1):
am = ASingleCardMove(from_stack, to_stack, position, frames, shadow)

View file

@ -143,9 +143,10 @@ class PictureGallery_Foundation(RK_FoundationStack):
def getBottomImage(self):
return self.game.app.images.getLetter(ACE)
def closeStackMove(self):
def closeStack(self):
if len(self.cards) == 8:
self.game.flipAllMove(self)
if not self.game.moves.state == self.game.S_REDO:
self.game.flipAllMove(self)
def canFlipCard(self):
return False
@ -168,13 +169,6 @@ class PictureGallery_TableauStack(SS_RowStack):
def getBottomImage(self):
return self.game.app.images.getLetter(self.cap.base_rank)
## def closeStackMove(self):
## if len(self.cards) == self.cap.max_cards:
## self.game.closeStackMove(self)
## ##self.game.flipAllMove(self)
## def canFlipCard(self):
## return False
class PictureGallery_RowStack(BasicRowStack):
def acceptsCards(self, from_stack, cards):

View file

@ -50,9 +50,10 @@ class PileOn_RowStack(RK_RowStack):
def getBottomImage(self):
return self.game.app.images.getReserveBottom()
def closeStackMove(self):
def closeStack(self):
if len(self.cards) == 4 and isRankSequence(self.cards, dir=0):
self.game.flipAllMove(self)
if not self.game.moves.state == self.game.S_REDO:
self.game.flipAllMove(self)
def canFlipCard(self):
return False

View file

@ -46,7 +46,7 @@ class TakeAway_Foundation(AbstractFoundationStack):
return (c1.rank == (c2.rank + 1) % mod or
c2.rank == (c1.rank + 1) % mod)
def closeStackMove(self):
def closeStack(self):
pass
@ -101,9 +101,13 @@ class TakeAway(Game):
# // Four Stacks
# ************************************************************************/
class FourStacks_Foundation(AC_FoundationStack):
def closeStack(self):
pass
class FourStacks(TakeAway):
RowStack_Class = StackWrapper(AC_RowStack, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS)
Foundation_Class = StackWrapper(AC_FoundationStack, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1)
Foundation_Class = StackWrapper(FourStacks_Foundation, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1)
shallHighlightMatch = Game._shallHighlightMatch_AC

View file

@ -438,31 +438,6 @@ class AShuffleStackMove(AtomicMove):
cmp(self.state, other.state))
# /***********************************************************************
# // ACloseStackMove
# ************************************************************************/
class ACloseStackMove(AtomicMove):
def __init__(self, stack):
self.stack_id = stack.id
def redo(self, game):
stack = game.allstacks[self.stack_id]
assert stack.cards
stack.is_filled = True
stack._shadeStack()
def undo(self, game):
stack = game.allstacks[self.stack_id]
assert stack.cards
stack.is_filled = False
stack._unshadeStack()
def cmpForRedo(self, other):
return cmp(self.stack_id, other.stack_id)
# /***********************************************************************
# // ASingleCardMove - move single card from *anyone* position
# // (for ArbitraryStack)

View file

@ -438,7 +438,7 @@ class Stack:
view._position(card)
if update:
view.updateText()
self.closeStackMove()
self.closeStack()
return card
def insertCard(self, card, positon, unhide=1, update=1):
@ -454,8 +454,7 @@ class Stack:
view._position(c)
if update:
view.updateText()
if not self.game.moves.state == self.game.S_REDO:
self.closeStackMove()
self.closeStack()
return card
# Remove a card from the stack. Also update display. {model -> view}
@ -663,7 +662,7 @@ class Stack:
def fillStack(self):
self.game.fillStack(self)
def closeStackMove(self):
def closeStack(self):
pass
#
@ -1251,7 +1250,7 @@ class Stack:
drag.stack.group.tkraise()
# for closeStackMove
# for closeStack
def _shadeStack(self):
if not self.game.app.opt.shade_filled_stacks:
return
@ -1966,9 +1965,10 @@ class AbstractFoundationStack(OpenStack):
def getBaseCard(self):
return self._getBaseCard()
def closeStackMove(self):
def closeStack(self):
if len(self.cards) == self.cap.max_cards:
self.game.closeStackMove(self)
self.is_filled = True
self._shadeStack()
def getHelp(self):
return _('Foundation.')

View file

@ -75,7 +75,7 @@ def createToolbarMenu(menubar, menu):
submenu = MfxMenu(menu, label=n_('Style'), tearoff=tearoff)
for f in os.listdir(data_dir):
d = os.path.join(data_dir, f)
if os.path.isdir(d):
if os.path.isdir(d) and os.path.exists(os.path.join(d, 'small')):
name = f.replace('_', ' ').capitalize()
submenu.add_radiobutton(label=name,
variable=menubar.tkopt.toolbar_style,