mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* bugfixes
git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@180 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
parent
6c30899fd9
commit
adcf65dca4
10 changed files with 39 additions and 15 deletions
|
@ -966,6 +966,8 @@ class Application:
|
|||
# try Klondike if current game fails
|
||||
if id == 2:
|
||||
raise # internal error?
|
||||
if DEBUG:
|
||||
raise
|
||||
traceback.print_exc()
|
||||
self.nextgame.id = 2
|
||||
self.freeGame()
|
||||
|
|
|
@ -142,7 +142,7 @@ class CustomGame(Game):
|
|||
else:
|
||||
layout_kw['reserve_class'] = StackWrapper(OpenStack, **kw)
|
||||
if s['talon'] is DealReserveRedealTalonStack or \
|
||||
s['reserves_max_accept'] > 1:
|
||||
s['reserves_max_accept'] > 1 or s['deal_to_reserves'] > 1:
|
||||
layout_kw['reserve_texts'] = True
|
||||
|
||||
# waste
|
||||
|
|
|
@ -1444,7 +1444,7 @@ class Game:
|
|||
return self.app.images.getFace(deck, suit, rank)
|
||||
|
||||
def getCardBackImage(self, deck, suit, rank):
|
||||
return self.app.images.getBack(deck, suit, rank)
|
||||
return self.app.images.getBack()
|
||||
|
||||
def getCardShadeImage(self):
|
||||
return self.app.images.getShade()
|
||||
|
@ -2276,11 +2276,15 @@ for %d moves.
|
|||
status = 2
|
||||
elif player_moves == 0:
|
||||
self.playSample("autopilotwon", priority=1000)
|
||||
s = self.app.miscrandom.choice((_("&Great"), _("&Cool"), _("&Yeah"), _("&Wow"))) # ??? accelerators
|
||||
s = self.app.miscrandom.choice((_("&Great"), _("&Cool"),
|
||||
_("&Yeah"), _("&Wow")))
|
||||
d = MfxMessageDialog(self.top, title=PACKAGE+_(" Autopilot"),
|
||||
text=_("\nGame solved in %d moves.\n") % self.moves.index,
|
||||
image=self.app.gimages.logos[4], strings=(s,),
|
||||
separatorwidth=2, timeout=timeout)
|
||||
text=_("\nGame solved in %d moves.\n") %
|
||||
self.moves.index,
|
||||
image=self.app.gimages.logos[4],
|
||||
strings=(s,),
|
||||
separator=True,
|
||||
timeout=timeout)
|
||||
status = d.status
|
||||
else:
|
||||
##s = self.app.miscrandom.choice((_("&OK"), _("&OK")))
|
||||
|
|
|
@ -90,6 +90,7 @@ class Images:
|
|||
self._xshadow = []
|
||||
self._shade = []
|
||||
self._shadow_cards = {} # key: (suit, rank)
|
||||
self._shadow_back = None
|
||||
self._pil_shadow = {} # key: (width, height)
|
||||
self._pil_shadow_image = None
|
||||
|
||||
|
@ -252,7 +253,9 @@ class Images:
|
|||
##print "getFace:", suit, rank, index
|
||||
return self._card[index % self.cs.ncards]
|
||||
|
||||
def getBack(self, deck, suit, rank):
|
||||
def getBack(self, update=False):
|
||||
if update:
|
||||
self._shadow_back = None
|
||||
index = self.cs.backindex % len(self._back)
|
||||
return self._back[index].image
|
||||
|
||||
|
@ -372,6 +375,14 @@ class Images:
|
|||
return self.getShade()
|
||||
return shade
|
||||
|
||||
def getShadowBack(self):
|
||||
if self._shadow_back:
|
||||
return self._shadow_back
|
||||
image = self.getBack()
|
||||
shade = shadowImage(image)
|
||||
self._shadow_back = shade
|
||||
return shade
|
||||
|
||||
def getCardbacks(self):
|
||||
return self._back
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class _OneImageCard(_HideableCard):
|
|||
_HideableCard.__init__(self, id, deck, suit, rank, game, x=x, y=y)
|
||||
images = game.app.images
|
||||
self.__face_image = images.getFace(deck, suit, rank)
|
||||
self.__back_image = images.getBack(deck, suit, rank)
|
||||
self.__back_image = images.getBack()
|
||||
self.__image = MfxCanvasImage(game.canvas, self.x, self.y,
|
||||
image=self.__back_image,
|
||||
anchor=gtk.ANCHOR_NW)
|
||||
|
@ -106,8 +106,12 @@ class _TwoImageCard(_HideableCard):
|
|||
_HideableCard.__init__(self, id, deck, suit, rank, game, x=x, y=y)
|
||||
images = game.app.images
|
||||
self.item = MfxCanvasGroup(game.canvas)
|
||||
self.__face = MfxCanvasImage(game.canvas, self.x, self.y, image=images.getFace(deck, suit, rank), anchor='nw')
|
||||
self.__back = MfxCanvasImage(game.canvas, self.x, self.y, image=images.getBack(deck, suit, rank), anchor='nw')
|
||||
self.__face = MfxCanvasImage(game.canvas, self.x, self.y,
|
||||
image=images.getFace(deck, suit, rank),
|
||||
anchor='nw')
|
||||
self.__back = MfxCanvasImage(game.canvas, self.x, self.y,
|
||||
image=images.getBack(),
|
||||
anchor='nw')
|
||||
self.__face.addtag(self.item)
|
||||
self.__back.addtag(self.item)
|
||||
self.__face.hide()
|
||||
|
|
|
@ -375,7 +375,7 @@ class Cardset(Resource):
|
|||
|
||||
def updateCardback(self, backname=None, backindex=None):
|
||||
# update default back
|
||||
if isinstance(backname, str):
|
||||
if isinstance(backname, basestring):
|
||||
if backname in self.backnames:
|
||||
backindex = self.backnames.index(backname)
|
||||
if isinstance(backindex, int):
|
||||
|
|
|
@ -1352,7 +1352,10 @@ class Stack:
|
|||
drag.shade_stack = sstack
|
||||
if sstack.cards:
|
||||
card = sstack.cards[-1]
|
||||
img = images.getShadowCard(card.deck, card.suit, card.rank)
|
||||
if card.face_up:
|
||||
img = images.getShadowCard(card.deck, card.suit, card.rank)
|
||||
else:
|
||||
img = images.getShadowBack()
|
||||
else:
|
||||
img = images.getShade()
|
||||
if not img:
|
||||
|
|
|
@ -1172,8 +1172,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
if cs.backindex == old_index:
|
||||
return
|
||||
self.app.updateCardset(self.game.id)
|
||||
image = self.app.images.getBack(update=True)
|
||||
for card in self.game.cards:
|
||||
image = self.app.images.getBack(card.deck, card.suit, card.rank)
|
||||
card.updateCardBackground(image=image)
|
||||
self.app.canvas.update_idletasks()
|
||||
self.tkopt.cardback.set(cs.backindex)
|
||||
|
|
|
@ -1181,8 +1181,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
if cs.backindex == old_index:
|
||||
return
|
||||
self.app.updateCardset(self.game.id)
|
||||
image = self.app.images.getBack(update=True)
|
||||
for card in self.game.cards:
|
||||
image = self.app.images.getBack(card.deck, card.suit, card.rank)
|
||||
card.updateCardBackground(image=image)
|
||||
self.app.canvas.update_idletasks()
|
||||
self.tkopt.cardback.set(cs.backindex)
|
||||
|
|
|
@ -284,7 +284,7 @@ DealFaceUp = WizSetting(
|
|||
var_name = 'deal_face_up',
|
||||
)
|
||||
DealToReseves = WizSetting(
|
||||
values_map = (0, 20),
|
||||
values_map = (0, 208),
|
||||
default = 0,
|
||||
widget = 'spin',
|
||||
label = _('# of cards dealt to the reserve:'),
|
||||
|
|
Loading…
Add table
Reference in a new issue