mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
- removed `closeStackMove'
* bugs fixes git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@73 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
bc799023c4
commit
5e588ab8bc
7 changed files with 21 additions and 55 deletions
|
@ -60,7 +60,7 @@ from pysoltk import Card
|
||||||
from move import AMoveMove, AFlipMove, ATurnStackMove
|
from move import AMoveMove, AFlipMove, ATurnStackMove
|
||||||
from move import ANextRoundMove, ASaveSeedMove, AShuffleStackMove
|
from move import ANextRoundMove, ASaveSeedMove, AShuffleStackMove
|
||||||
from move import AUpdateStackMove, AFlipAllMove, ASaveStateMove
|
from move import AUpdateStackMove, AFlipAllMove, ASaveStateMove
|
||||||
from move import ACloseStackMove, ASingleCardMove
|
from move import ASingleCardMove
|
||||||
from hint import DefaultHint
|
from hint import DefaultHint
|
||||||
from help import help_about
|
from help import help_about
|
||||||
|
|
||||||
|
@ -2155,14 +2155,6 @@ for %d moves.
|
||||||
am.do(self)
|
am.do(self)
|
||||||
##self.hints.list = None
|
##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
|
# for ArbitraryStack
|
||||||
def singleCardMove(self, from_stack, to_stack, position, frames=-1, shadow=-1):
|
def singleCardMove(self, from_stack, to_stack, position, frames=-1, shadow=-1):
|
||||||
am = ASingleCardMove(from_stack, to_stack, position, frames, shadow)
|
am = ASingleCardMove(from_stack, to_stack, position, frames, shadow)
|
||||||
|
|
|
@ -143,9 +143,10 @@ class PictureGallery_Foundation(RK_FoundationStack):
|
||||||
def getBottomImage(self):
|
def getBottomImage(self):
|
||||||
return self.game.app.images.getLetter(ACE)
|
return self.game.app.images.getLetter(ACE)
|
||||||
|
|
||||||
def closeStackMove(self):
|
def closeStack(self):
|
||||||
if len(self.cards) == 8:
|
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):
|
def canFlipCard(self):
|
||||||
return False
|
return False
|
||||||
|
@ -168,13 +169,6 @@ class PictureGallery_TableauStack(SS_RowStack):
|
||||||
def getBottomImage(self):
|
def getBottomImage(self):
|
||||||
return self.game.app.images.getLetter(self.cap.base_rank)
|
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):
|
class PictureGallery_RowStack(BasicRowStack):
|
||||||
def acceptsCards(self, from_stack, cards):
|
def acceptsCards(self, from_stack, cards):
|
||||||
|
|
|
@ -50,9 +50,10 @@ class PileOn_RowStack(RK_RowStack):
|
||||||
def getBottomImage(self):
|
def getBottomImage(self):
|
||||||
return self.game.app.images.getReserveBottom()
|
return self.game.app.images.getReserveBottom()
|
||||||
|
|
||||||
def closeStackMove(self):
|
def closeStack(self):
|
||||||
if len(self.cards) == 4 and isRankSequence(self.cards, dir=0):
|
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):
|
def canFlipCard(self):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -46,7 +46,7 @@ class TakeAway_Foundation(AbstractFoundationStack):
|
||||||
return (c1.rank == (c2.rank + 1) % mod or
|
return (c1.rank == (c2.rank + 1) % mod or
|
||||||
c2.rank == (c1.rank + 1) % mod)
|
c2.rank == (c1.rank + 1) % mod)
|
||||||
|
|
||||||
def closeStackMove(self):
|
def closeStack(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,9 +101,13 @@ class TakeAway(Game):
|
||||||
# // Four Stacks
|
# // Four Stacks
|
||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
|
class FourStacks_Foundation(AC_FoundationStack):
|
||||||
|
def closeStack(self):
|
||||||
|
pass
|
||||||
|
|
||||||
class FourStacks(TakeAway):
|
class FourStacks(TakeAway):
|
||||||
RowStack_Class = StackWrapper(AC_RowStack, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS)
|
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
|
shallHighlightMatch = Game._shallHighlightMatch_AC
|
||||||
|
|
||||||
|
|
|
@ -438,31 +438,6 @@ class AShuffleStackMove(AtomicMove):
|
||||||
cmp(self.state, other.state))
|
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
|
# // ASingleCardMove - move single card from *anyone* position
|
||||||
# // (for ArbitraryStack)
|
# // (for ArbitraryStack)
|
||||||
|
|
|
@ -438,7 +438,7 @@ class Stack:
|
||||||
view._position(card)
|
view._position(card)
|
||||||
if update:
|
if update:
|
||||||
view.updateText()
|
view.updateText()
|
||||||
self.closeStackMove()
|
self.closeStack()
|
||||||
return card
|
return card
|
||||||
|
|
||||||
def insertCard(self, card, positon, unhide=1, update=1):
|
def insertCard(self, card, positon, unhide=1, update=1):
|
||||||
|
@ -454,8 +454,7 @@ class Stack:
|
||||||
view._position(c)
|
view._position(c)
|
||||||
if update:
|
if update:
|
||||||
view.updateText()
|
view.updateText()
|
||||||
if not self.game.moves.state == self.game.S_REDO:
|
self.closeStack()
|
||||||
self.closeStackMove()
|
|
||||||
return card
|
return card
|
||||||
|
|
||||||
# Remove a card from the stack. Also update display. {model -> view}
|
# Remove a card from the stack. Also update display. {model -> view}
|
||||||
|
@ -663,7 +662,7 @@ class Stack:
|
||||||
def fillStack(self):
|
def fillStack(self):
|
||||||
self.game.fillStack(self)
|
self.game.fillStack(self)
|
||||||
|
|
||||||
def closeStackMove(self):
|
def closeStack(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1251,7 +1250,7 @@ class Stack:
|
||||||
drag.stack.group.tkraise()
|
drag.stack.group.tkraise()
|
||||||
|
|
||||||
|
|
||||||
# for closeStackMove
|
# for closeStack
|
||||||
def _shadeStack(self):
|
def _shadeStack(self):
|
||||||
if not self.game.app.opt.shade_filled_stacks:
|
if not self.game.app.opt.shade_filled_stacks:
|
||||||
return
|
return
|
||||||
|
@ -1966,9 +1965,10 @@ class AbstractFoundationStack(OpenStack):
|
||||||
def getBaseCard(self):
|
def getBaseCard(self):
|
||||||
return self._getBaseCard()
|
return self._getBaseCard()
|
||||||
|
|
||||||
def closeStackMove(self):
|
def closeStack(self):
|
||||||
if len(self.cards) == self.cap.max_cards:
|
if len(self.cards) == self.cap.max_cards:
|
||||||
self.game.closeStackMove(self)
|
self.is_filled = True
|
||||||
|
self._shadeStack()
|
||||||
|
|
||||||
def getHelp(self):
|
def getHelp(self):
|
||||||
return _('Foundation.')
|
return _('Foundation.')
|
||||||
|
|
|
@ -75,7 +75,7 @@ def createToolbarMenu(menubar, menu):
|
||||||
submenu = MfxMenu(menu, label=n_('Style'), tearoff=tearoff)
|
submenu = MfxMenu(menu, label=n_('Style'), tearoff=tearoff)
|
||||||
for f in os.listdir(data_dir):
|
for f in os.listdir(data_dir):
|
||||||
d = os.path.join(data_dir, f)
|
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()
|
name = f.replace('_', ' ').capitalize()
|
||||||
submenu.add_radiobutton(label=name,
|
submenu.add_radiobutton(label=name,
|
||||||
variable=menubar.tkopt.toolbar_style,
|
variable=menubar.tkopt.toolbar_style,
|
||||||
|
|
Loading…
Add table
Reference in a new issue