mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Compare commits
7 commits
d807f2c45c
...
81fab2028a
Author | SHA1 | Date | |
---|---|---|---|
|
81fab2028a | ||
|
80d99e508d | ||
|
032b645e0f | ||
|
00f6f70e93 | ||
|
57b9c9d41e | ||
|
2258274c77 | ||
|
0306d648fa |
6 changed files with 21 additions and 25 deletions
|
@ -183,7 +183,7 @@ class Application:
|
|||
try:
|
||||
approc = self.mainproc() # setup process
|
||||
approc.send(None) # and go
|
||||
except Exception:
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
def gameproc(self):
|
||||
|
|
|
@ -67,6 +67,8 @@ from pysollib.settings import PACKAGE, TITLE, TOOLKIT, TOP_SIZE
|
|||
from pysollib.settings import VERSION, VERSION_TUPLE
|
||||
from pysollib.struct_new import NewStruct
|
||||
|
||||
import random2
|
||||
|
||||
import six
|
||||
from six import BytesIO
|
||||
from six.moves import range
|
||||
|
@ -471,6 +473,10 @@ class GameSaveInfo(NewStruct):
|
|||
stack_caps = attr.ib(factory=list)
|
||||
|
||||
|
||||
_Game_LOAD_CLASSES = [GameGlobalSaveInfo, GameGlobalStatsStruct, GameMoves,
|
||||
GameSaveInfo, GameStatsStruct, ]
|
||||
|
||||
|
||||
class Game(object):
|
||||
# for self.gstats.updated
|
||||
U_PLAY = _GLOBAL_U_PLAY
|
||||
|
@ -3147,9 +3153,7 @@ class Game(object):
|
|||
if isinstance(t, type):
|
||||
if not isinstance(obj, t):
|
||||
# accept old storage format in case:
|
||||
if (t == GameMoves
|
||||
or t == GameGlobalStatsStruct
|
||||
or t == GameStatsStruct):
|
||||
if t in _Game_LOAD_CLASSES:
|
||||
assert isinstance(obj, Struct), err_txt
|
||||
else:
|
||||
assert False, err_txt
|
||||
|
@ -3194,7 +3198,9 @@ class Game(object):
|
|||
initial_seed = random__long2str(pload(int))
|
||||
game.random = constructRandom(initial_seed)
|
||||
state = pload()
|
||||
game.random.setstate(state)
|
||||
if not (isinstance(game.random, random2.Random) and
|
||||
isinstance(state, int)):
|
||||
game.random.setstate(state)
|
||||
# if not hasattr(game.random, "origin"):
|
||||
# game.random.origin = game.random.ORIGIN_UNKNOWN
|
||||
game.loadinfo.stacks = []
|
||||
|
@ -3215,9 +3221,9 @@ class Game(object):
|
|||
game.loadinfo.talon_round = pload()
|
||||
game.finished = pload()
|
||||
if 0 <= bookmark <= 1:
|
||||
saveinfo = pload(Struct)
|
||||
saveinfo = pload(GameSaveInfo)
|
||||
game.saveinfo.__dict__.update(saveinfo.__dict__)
|
||||
gsaveinfo = pload(Struct)
|
||||
gsaveinfo = pload(GameGlobalSaveInfo)
|
||||
game.gsaveinfo.__dict__.update(gsaveinfo.__dict__)
|
||||
moves = pload(GameMoves)
|
||||
game.moves.__dict__.update(moves.__dict__)
|
||||
|
|
|
@ -82,8 +82,10 @@ class Pyramid_StackMethods:
|
|||
def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1):
|
||||
if not self.game.demo:
|
||||
self.game.playSample("droppair", priority=200)
|
||||
assert n == 1 and self.acceptsCards(
|
||||
other_stack, [other_stack.cards[-1]])
|
||||
if not (n == 1
|
||||
and other_stack.cards
|
||||
and self.acceptsCards(other_stack, [other_stack.cards[-1]])):
|
||||
return
|
||||
old_state = self.game.enterState(self.game.S_FILL)
|
||||
f = self.game.s.foundations[0]
|
||||
self.game.moveMove(n, self, f, frames=frames, shadow=shadow)
|
||||
|
|
|
@ -2935,9 +2935,10 @@ class FaceUpWasteTalonStack(WasteTalonStack):
|
|||
self.game.fillStack(self)
|
||||
|
||||
def dealCards(self, sound=False):
|
||||
WasteTalonStack.dealCards(self, sound=sound)
|
||||
retval = WasteTalonStack.dealCards(self, sound=sound)
|
||||
if self.canFlipCard():
|
||||
self.flipMove()
|
||||
return retval
|
||||
|
||||
|
||||
class OpenTalonStack(TalonStack, OpenStack):
|
||||
|
|
|
@ -156,7 +156,7 @@ class PysolStatusbar(MfxStatusbar):
|
|||
self._createLabel(n, tooltip=t, width=w)
|
||||
#
|
||||
label = self._createLabel('info', expand=True)
|
||||
label.config(padding=(8, 0))
|
||||
label.config(padx=8)
|
||||
|
||||
|
||||
class HelpStatusbar(MfxStatusbar):
|
||||
|
|
|
@ -25,11 +25,6 @@ from pysollib.macosx.appSupport import hideTkConsole
|
|||
from pysollib.settings import TOOLKIT, USE_TILE
|
||||
from pysollib.winsystems.common import BaseTkSettings, base_init_root_window
|
||||
|
||||
from six.moves import tkinter
|
||||
|
||||
if USE_TILE:
|
||||
from pysollib.tile import ttk
|
||||
|
||||
|
||||
def init_root_window(root, app):
|
||||
base_init_root_window(root, app)
|
||||
|
@ -38,15 +33,7 @@ def init_root_window(root, app):
|
|||
if TOOLKIT == 'gtk':
|
||||
pass
|
||||
elif USE_TILE:
|
||||
style = ttk.Style(root)
|
||||
color = style.lookup('.', 'background')
|
||||
if color:
|
||||
root.tk_setPalette(color) # for non-ttk widgets
|
||||
|
||||
if app.opt.tile_theme == 'aqua':
|
||||
# standard Tk scrollbars work on OS X, but ttk ones look weird
|
||||
ttk.Scrollbar = tkinter.Scrollbar
|
||||
|
||||
pass
|
||||
else: # pure Tk
|
||||
# root.option_add(...)
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue