mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-15 02:54:09 -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:
|
try:
|
||||||
approc = self.mainproc() # setup process
|
approc = self.mainproc() # setup process
|
||||||
approc.send(None) # and go
|
approc.send(None) # and go
|
||||||
except Exception:
|
except StopIteration:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def gameproc(self):
|
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.settings import VERSION, VERSION_TUPLE
|
||||||
from pysollib.struct_new import NewStruct
|
from pysollib.struct_new import NewStruct
|
||||||
|
|
||||||
|
import random2
|
||||||
|
|
||||||
import six
|
import six
|
||||||
from six import BytesIO
|
from six import BytesIO
|
||||||
from six.moves import range
|
from six.moves import range
|
||||||
|
@ -471,6 +473,10 @@ class GameSaveInfo(NewStruct):
|
||||||
stack_caps = attr.ib(factory=list)
|
stack_caps = attr.ib(factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
_Game_LOAD_CLASSES = [GameGlobalSaveInfo, GameGlobalStatsStruct, GameMoves,
|
||||||
|
GameSaveInfo, GameStatsStruct, ]
|
||||||
|
|
||||||
|
|
||||||
class Game(object):
|
class Game(object):
|
||||||
# for self.gstats.updated
|
# for self.gstats.updated
|
||||||
U_PLAY = _GLOBAL_U_PLAY
|
U_PLAY = _GLOBAL_U_PLAY
|
||||||
|
@ -3147,9 +3153,7 @@ class Game(object):
|
||||||
if isinstance(t, type):
|
if isinstance(t, type):
|
||||||
if not isinstance(obj, t):
|
if not isinstance(obj, t):
|
||||||
# accept old storage format in case:
|
# accept old storage format in case:
|
||||||
if (t == GameMoves
|
if t in _Game_LOAD_CLASSES:
|
||||||
or t == GameGlobalStatsStruct
|
|
||||||
or t == GameStatsStruct):
|
|
||||||
assert isinstance(obj, Struct), err_txt
|
assert isinstance(obj, Struct), err_txt
|
||||||
else:
|
else:
|
||||||
assert False, err_txt
|
assert False, err_txt
|
||||||
|
@ -3194,7 +3198,9 @@ class Game(object):
|
||||||
initial_seed = random__long2str(pload(int))
|
initial_seed = random__long2str(pload(int))
|
||||||
game.random = constructRandom(initial_seed)
|
game.random = constructRandom(initial_seed)
|
||||||
state = pload()
|
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"):
|
# if not hasattr(game.random, "origin"):
|
||||||
# game.random.origin = game.random.ORIGIN_UNKNOWN
|
# game.random.origin = game.random.ORIGIN_UNKNOWN
|
||||||
game.loadinfo.stacks = []
|
game.loadinfo.stacks = []
|
||||||
|
@ -3215,9 +3221,9 @@ class Game(object):
|
||||||
game.loadinfo.talon_round = pload()
|
game.loadinfo.talon_round = pload()
|
||||||
game.finished = pload()
|
game.finished = pload()
|
||||||
if 0 <= bookmark <= 1:
|
if 0 <= bookmark <= 1:
|
||||||
saveinfo = pload(Struct)
|
saveinfo = pload(GameSaveInfo)
|
||||||
game.saveinfo.__dict__.update(saveinfo.__dict__)
|
game.saveinfo.__dict__.update(saveinfo.__dict__)
|
||||||
gsaveinfo = pload(Struct)
|
gsaveinfo = pload(GameGlobalSaveInfo)
|
||||||
game.gsaveinfo.__dict__.update(gsaveinfo.__dict__)
|
game.gsaveinfo.__dict__.update(gsaveinfo.__dict__)
|
||||||
moves = pload(GameMoves)
|
moves = pload(GameMoves)
|
||||||
game.moves.__dict__.update(moves.__dict__)
|
game.moves.__dict__.update(moves.__dict__)
|
||||||
|
|
|
@ -82,8 +82,10 @@ class Pyramid_StackMethods:
|
||||||
def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1):
|
def _dropPairMove(self, n, other_stack, frames=-1, shadow=-1):
|
||||||
if not self.game.demo:
|
if not self.game.demo:
|
||||||
self.game.playSample("droppair", priority=200)
|
self.game.playSample("droppair", priority=200)
|
||||||
assert n == 1 and self.acceptsCards(
|
if not (n == 1
|
||||||
other_stack, [other_stack.cards[-1]])
|
and other_stack.cards
|
||||||
|
and self.acceptsCards(other_stack, [other_stack.cards[-1]])):
|
||||||
|
return
|
||||||
old_state = self.game.enterState(self.game.S_FILL)
|
old_state = self.game.enterState(self.game.S_FILL)
|
||||||
f = self.game.s.foundations[0]
|
f = self.game.s.foundations[0]
|
||||||
self.game.moveMove(n, self, f, frames=frames, shadow=shadow)
|
self.game.moveMove(n, self, f, frames=frames, shadow=shadow)
|
||||||
|
|
|
@ -2935,9 +2935,10 @@ class FaceUpWasteTalonStack(WasteTalonStack):
|
||||||
self.game.fillStack(self)
|
self.game.fillStack(self)
|
||||||
|
|
||||||
def dealCards(self, sound=False):
|
def dealCards(self, sound=False):
|
||||||
WasteTalonStack.dealCards(self, sound=sound)
|
retval = WasteTalonStack.dealCards(self, sound=sound)
|
||||||
if self.canFlipCard():
|
if self.canFlipCard():
|
||||||
self.flipMove()
|
self.flipMove()
|
||||||
|
return retval
|
||||||
|
|
||||||
|
|
||||||
class OpenTalonStack(TalonStack, OpenStack):
|
class OpenTalonStack(TalonStack, OpenStack):
|
||||||
|
|
|
@ -156,7 +156,7 @@ class PysolStatusbar(MfxStatusbar):
|
||||||
self._createLabel(n, tooltip=t, width=w)
|
self._createLabel(n, tooltip=t, width=w)
|
||||||
#
|
#
|
||||||
label = self._createLabel('info', expand=True)
|
label = self._createLabel('info', expand=True)
|
||||||
label.config(padding=(8, 0))
|
label.config(padx=8)
|
||||||
|
|
||||||
|
|
||||||
class HelpStatusbar(MfxStatusbar):
|
class HelpStatusbar(MfxStatusbar):
|
||||||
|
|
|
@ -25,11 +25,6 @@ from pysollib.macosx.appSupport import hideTkConsole
|
||||||
from pysollib.settings import TOOLKIT, USE_TILE
|
from pysollib.settings import TOOLKIT, USE_TILE
|
||||||
from pysollib.winsystems.common import BaseTkSettings, base_init_root_window
|
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):
|
def init_root_window(root, app):
|
||||||
base_init_root_window(root, app)
|
base_init_root_window(root, app)
|
||||||
|
@ -38,15 +33,7 @@ def init_root_window(root, app):
|
||||||
if TOOLKIT == 'gtk':
|
if TOOLKIT == 'gtk':
|
||||||
pass
|
pass
|
||||||
elif USE_TILE:
|
elif USE_TILE:
|
||||||
style = ttk.Style(root)
|
pass
|
||||||
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
|
|
||||||
|
|
||||||
else: # pure Tk
|
else: # pure Tk
|
||||||
# root.option_add(...)
|
# root.option_add(...)
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Reference in a new issue