diff --git a/pysollib/games/montana.py b/pysollib/games/montana.py index a003ee99..e489f463 100644 --- a/pysollib/games/montana.py +++ b/pysollib/games/montana.py @@ -395,6 +395,16 @@ class SpacesAndAces(BlueMoon): def createGame(self): Montana.createGame(self, round_text=False) + def startGame(self): + frames = 0 + for i in range(self.RLEN): + if i == self.RLEN-self.RSTEP: # last row + self.startDealSample() + frames = -1 + if i % self.RSTEP == 0: # left column + continue + self.s.talon.dealRow(rows=(self.s.rows[i],), frames=frames) + # /*********************************************************************** # // Paganini # ************************************************************************/ diff --git a/pysollib/hint.py b/pysollib/hint.py index 1ae2316d..22868272 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -841,11 +841,13 @@ class FreeCellSolver_Hint: command = FCS_COMMAND+' '+' '.join([str(i) for i in args]) if DEBUG: print command - p = subprocess.Popen(command, shell=True, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - close_fds=True) + kw = {'shell': True, + 'stdin': subprocess.PIPE, + 'stdout': subprocess.PIPE, + 'stderr': subprocess.PIPE} + if os.name != 'nt': + kw['close_fds'] = True + p = subprocess.Popen(command, **kw) pin, pout, perr = p.stdin, p.stdout, p.stderr pin.write(board) pin.close() diff --git a/pysollib/images.py b/pysollib/images.py index f9cbe04a..ee95ab44 100644 --- a/pysollib/images.py +++ b/pysollib/images.py @@ -196,9 +196,10 @@ class Images: pass if progress: progress.update(step=pstep) # shadow - if 0 and TOOLKIT == 'tk' and Image: - fn = self.d.findImage('shadow', 'images') - self._pil_shadow_image = Image.open(fn).convert('RGBA') + if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7': + if 0: + fn = self.d.findImage('shadow', 'images') + self._pil_shadow_image = Image.open(fn).convert('RGBA') else: for i in range(self.cs.nshadows): if fast: @@ -292,8 +293,8 @@ class Images: x1, y1 = stack.getPositionFor(cards[-1]) x0, x1 = min(x1, x0), max(x1, x0) y0, y1 = min(y1, y0), max(y1, y0) - x1 = x1 + self.CARDW - y1 = y1 + self.CARDH + x1 += self.CARDW + y1 += self.CARDH w, h = x1-x0, y1-y0 if (w,h) in self._pil_shadow: return self._pil_shadow[(w,h)] diff --git a/pysollib/init.py b/pysollib/init.py index e39425d0..98a85e2d 100644 --- a/pysollib/init.py +++ b/pysollib/init.py @@ -155,9 +155,12 @@ def init(): ##os.environ['FREECELL_SOLVER_PRESETRC'] = f # defined in prefix.h if os.name in ('posix', 'nt'): try: - p = subprocess.Popen(settings.FCS_COMMAND+' --help', shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, close_fds=True) + kw = {'shell': True, + 'stdout': subprocess.PIPE, + 'stderr': subprocess.PIPE} + if os.name != 'nt': + kw['close_fds'] = True + p = subprocess.Popen(settings.FCS_COMMAND+' --help', **kw) if p.stdout.readline().startswith('fc-solve'): settings.USE_FREECELL_SOLVER = True if os.name == 'posix': diff --git a/pysollib/move.py b/pysollib/move.py index dee37dc4..bb230e76 100644 --- a/pysollib/move.py +++ b/pysollib/move.py @@ -235,6 +235,8 @@ class ATurnStackMove(AtomicMove): to_stack.addCard(card, unhide=unhide, update=0) card.showBack(unhide=unhide) ##print 3, unhide, to_stack.getCard().__dict__ + from_stack.updateText() + to_stack.updateText() def undo(self, game): from_stack = game.allstacks[self.to_stack_id] @@ -249,6 +251,8 @@ class ATurnStackMove(AtomicMove): assert not card.face_up card.showFace(unhide=unhide) to_stack.addCard(card, unhide=unhide, update=0) + from_stack.updateText() + to_stack.updateText() def cmpForRedo(self, other): return (cmp(self.from_stack_id, other.from_stack_id) or diff --git a/pysollib/stack.py b/pysollib/stack.py index bcbb5afd..88f26299 100644 --- a/pysollib/stack.py +++ b/pysollib/stack.py @@ -755,11 +755,11 @@ class Stack: x += self.CARD_XOFFSET[ix] y += self.CARD_YOFFSET[iy] else: - x += int(self.CARD_XOFFSET[ix]/d) - y += int(self.CARD_YOFFSET[iy]/d) + x += self.CARD_XOFFSET[ix]/d + y += self.CARD_YOFFSET[iy]/d ix = (ix + 1) % lx iy = (iy + 1) % ly - return (x, y) + return int(x), int(y) def getPositionForNextCard(self): model, view = self, self @@ -775,11 +775,11 @@ class Stack: x += self.CARD_XOFFSET[ix] y += self.CARD_YOFFSET[iy] else: - x += int(self.CARD_XOFFSET[ix]/d) - y += int(self.CARD_YOFFSET[iy]/d) + x += self.CARD_XOFFSET[ix]/d + y += self.CARD_YOFFSET[iy]/d ix = (ix + 1) % lx iy = (iy + 1) % ly - return (x, y) + return int(x), int(y) def getOffsetFor(self, card): model, view = self, self @@ -1313,7 +1313,7 @@ class Stack: images = self.game.app.images cx, cy = cards[0].x, cards[0].y ddx, ddy = cx-cards[-1].x, cy-cards[-1].y - if 0 and TOOLKIT == 'tk' and Image: # use PIL + if TOOLKIT == 'tk' and Image and Image.VERSION > '1.1.7': # use PIL c0 = cards[-1] if self.CARD_XOFFSET[0] < 0: c0 = cards[0] if self.CARD_YOFFSET[0] < 0: c0 = cards[0]