mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
+ 2 new settings options: redeal animation' and
winning animation'
+ auto generation cards shadow (needs PIL) * update russian translation * cleanup code (removed `apply') git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@132 39dd0a4e-7c14-0410-91b3-c4f2d318f732
This commit is contained in:
parent
e0616a2509
commit
887f53f6cf
62 changed files with 2134 additions and 1939 deletions
BIN
data/images/shadow.gif
Normal file
BIN
data/images/shadow.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 601 B |
53
po/games.pot
53
po/games.pot
|
@ -5,7 +5,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PySol 0.0.1\n"
|
||||
"POT-Creation-Date: Thu Dec 7 15:25:59 2006\n"
|
||||
"POT-Creation-Date: Fri Jan 12 13:34:09 2007\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -255,6 +255,9 @@ msgstr ""
|
|||
msgid "Betsy Ross"
|
||||
msgstr ""
|
||||
|
||||
msgid "Big Ben"
|
||||
msgstr ""
|
||||
|
||||
msgid "Big Bertha"
|
||||
msgstr ""
|
||||
|
||||
|
@ -426,6 +429,9 @@ msgstr ""
|
|||
msgid "Busy Aces"
|
||||
msgstr ""
|
||||
|
||||
msgid "Busy Cards"
|
||||
msgstr ""
|
||||
|
||||
msgid "Butterfly"
|
||||
msgstr ""
|
||||
|
||||
|
@ -438,6 +444,9 @@ msgstr ""
|
|||
msgid "Camelot"
|
||||
msgstr ""
|
||||
|
||||
msgid "Can Can"
|
||||
msgstr ""
|
||||
|
||||
msgid "Canfield"
|
||||
msgstr ""
|
||||
|
||||
|
@ -570,6 +579,9 @@ msgstr ""
|
|||
msgid "Clink"
|
||||
msgstr ""
|
||||
|
||||
msgid "Clock"
|
||||
msgstr ""
|
||||
|
||||
msgid "Clover Leaf"
|
||||
msgstr ""
|
||||
|
||||
|
@ -804,6 +816,9 @@ msgstr ""
|
|||
msgid "Double Klondike by Threes"
|
||||
msgstr ""
|
||||
|
||||
msgid "Double Line"
|
||||
msgstr ""
|
||||
|
||||
msgid "Double Mahjongg Big Castle"
|
||||
msgstr ""
|
||||
|
||||
|
@ -831,6 +846,9 @@ msgstr ""
|
|||
msgid "Double Measure"
|
||||
msgstr ""
|
||||
|
||||
msgid "Double Pyramid"
|
||||
msgstr ""
|
||||
|
||||
msgid "Double Rail"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1143,6 +1161,9 @@ msgstr ""
|
|||
msgid "Four Winds"
|
||||
msgstr ""
|
||||
|
||||
msgid "Four by Four"
|
||||
msgstr ""
|
||||
|
||||
msgid "Foursome"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1356,6 +1377,9 @@ msgstr ""
|
|||
msgid "Harvestman"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hawaiian"
|
||||
msgstr ""
|
||||
|
||||
msgid "Hayagriva"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2631,6 +2655,9 @@ msgstr ""
|
|||
msgid "Ox"
|
||||
msgstr ""
|
||||
|
||||
msgid "Paganini"
|
||||
msgstr ""
|
||||
|
||||
msgid "Pagat"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2922,21 +2949,6 @@ msgstr ""
|
|||
msgid "Robin"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper 6x6"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper 7x7"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper Cross 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper Cross 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rocket"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3003,6 +3015,9 @@ msgstr ""
|
|||
msgid "Russian Spider"
|
||||
msgstr ""
|
||||
|
||||
msgid "S Patience"
|
||||
msgstr ""
|
||||
|
||||
msgid "Salic Law"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3552,6 +3567,9 @@ msgstr ""
|
|||
msgid "Trefoil"
|
||||
msgstr ""
|
||||
|
||||
msgid "Triangle"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trika"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3636,6 +3654,9 @@ msgstr ""
|
|||
msgid "Unlimited"
|
||||
msgstr ""
|
||||
|
||||
msgid "Up and Down"
|
||||
msgstr ""
|
||||
|
||||
msgid "Usk"
|
||||
msgstr ""
|
||||
|
||||
|
|
1716
po/pysol.pot
1716
po/pysol.pot
File diff suppressed because it is too large
Load diff
|
@ -5,8 +5,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PySol 0.0.1\n"
|
||||
"POT-Creation-Date: Thu Dec 7 15:25:59 2006\n"
|
||||
"PO-Revision-Date: 2006-12-07 15:51+0300\n"
|
||||
"POT-Creation-Date: Fri Jan 12 13:34:09 2007\n"
|
||||
"PO-Revision-Date: 2007-01-13 20:30+0300\n"
|
||||
"Last-Translator: Скоморох <skomoroh@gmail.com>\n"
|
||||
"Language-Team: Russian <ru@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
@ -256,6 +256,9 @@ msgstr "Бельведер"
|
|||
msgid "Betsy Ross"
|
||||
msgstr "Бетси Росс"
|
||||
|
||||
msgid "Big Ben"
|
||||
msgstr "Большой Бен"
|
||||
|
||||
msgid "Big Bertha"
|
||||
msgstr "Большая Берта"
|
||||
|
||||
|
@ -428,6 +431,9 @@ msgstr "Клоп"
|
|||
msgid "Busy Aces"
|
||||
msgstr "Занятые тузы"
|
||||
|
||||
msgid "Busy Cards"
|
||||
msgstr "Занятые карты"
|
||||
|
||||
msgid "Butterfly"
|
||||
msgstr "Бабочка"
|
||||
|
||||
|
@ -440,6 +446,9 @@ msgstr "Вычисление"
|
|||
msgid "Camelot"
|
||||
msgstr "Камелот"
|
||||
|
||||
msgid "Can Can"
|
||||
msgstr "Канкан"
|
||||
|
||||
msgid "Canfield"
|
||||
msgstr "Кенфилд"
|
||||
|
||||
|
@ -573,6 +582,9 @@ msgstr "Цитадель"
|
|||
msgid "Clink"
|
||||
msgstr "Застенок"
|
||||
|
||||
msgid "Clock"
|
||||
msgstr "Часы"
|
||||
|
||||
msgid "Clover Leaf"
|
||||
msgstr "Лепесток клевера"
|
||||
|
||||
|
@ -810,6 +822,9 @@ msgstr "Двойной Клондайк"
|
|||
msgid "Double Klondike by Threes"
|
||||
msgstr "Двойной Клондайк по три"
|
||||
|
||||
msgid "Double Line"
|
||||
msgstr "Двойной ряд"
|
||||
|
||||
msgid "Double Mahjongg Big Castle"
|
||||
msgstr "Двойной Маджонг Большой замок"
|
||||
|
||||
|
@ -837,6 +852,9 @@ msgstr "Двойной Маджонг Два квадрата"
|
|||
msgid "Double Measure"
|
||||
msgstr "Двойная Мера"
|
||||
|
||||
msgid "Double Pyramid"
|
||||
msgstr "Двойная пирамида"
|
||||
|
||||
msgid "Double Rail"
|
||||
msgstr "Двойные рельсы"
|
||||
|
||||
|
@ -1155,8 +1173,11 @@ msgstr "Четыре кучи"
|
|||
msgid "Four Winds"
|
||||
msgstr "Четыре ветра"
|
||||
|
||||
msgid "Four by Four"
|
||||
msgstr "Четыре по четыре"
|
||||
|
||||
msgid "Foursome"
|
||||
msgstr "Четвёрки"
|
||||
msgstr "По четыре"
|
||||
|
||||
msgid "Fourteen"
|
||||
msgstr "Четырнадцать"
|
||||
|
@ -1373,6 +1394,9 @@ msgstr "Заяц"
|
|||
msgid "Harvestman"
|
||||
msgstr "Сенокосец"
|
||||
|
||||
msgid "Hawaiian"
|
||||
msgstr "Гавайский"
|
||||
|
||||
msgid "Hayagriva"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1389,7 +1413,7 @@ msgid "Helios"
|
|||
msgstr "Гелиос"
|
||||
|
||||
msgid "Hemispheres"
|
||||
msgstr ""
|
||||
msgstr "Полушария"
|
||||
|
||||
msgid "Hex A Klon"
|
||||
msgstr "Шестнадцатиричный Клондайк"
|
||||
|
@ -2663,6 +2687,9 @@ msgstr "Сова"
|
|||
msgid "Ox"
|
||||
msgstr "Бык"
|
||||
|
||||
msgid "Paganini"
|
||||
msgstr "Паганини"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Pagat"
|
||||
msgstr "Пагода"
|
||||
|
@ -2955,21 +2982,6 @@ msgstr "Роберт"
|
|||
msgid "Robin"
|
||||
msgstr "Робин"
|
||||
|
||||
msgid "Rock Hopper"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper 6x6"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper 7x7"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper Cross 1"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rock Hopper Cross 2"
|
||||
msgstr ""
|
||||
|
||||
msgid "Rocket"
|
||||
msgstr "Ракета"
|
||||
|
||||
|
@ -3037,6 +3049,9 @@ msgstr "Русский солитер"
|
|||
msgid "Russian Spider"
|
||||
msgstr "Русский паук"
|
||||
|
||||
msgid "S Patience"
|
||||
msgstr "S-пасьянс"
|
||||
|
||||
msgid "Salic Law"
|
||||
msgstr "Салический закон"
|
||||
|
||||
|
@ -3602,6 +3617,9 @@ msgstr "Древо жизни"
|
|||
msgid "Trefoil"
|
||||
msgstr "Клевер"
|
||||
|
||||
msgid "Triangle"
|
||||
msgstr "Треугольник"
|
||||
|
||||
msgid "Trika"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3687,6 +3705,9 @@ msgstr "Объединённый квадрата"
|
|||
msgid "Unlimited"
|
||||
msgstr "Неограниченный"
|
||||
|
||||
msgid "Up and Down"
|
||||
msgstr "Вверх и вниз"
|
||||
|
||||
msgid "Usk"
|
||||
msgstr ""
|
||||
|
||||
|
|
1734
po/ru_pysol.po
1734
po/ru_pysol.po
File diff suppressed because it is too large
Load diff
|
@ -126,7 +126,7 @@ class PysolMenubarActions:
|
|||
|
||||
def changed(self, *args, **kw):
|
||||
assert self.game is not None
|
||||
return apply(self.game.changed, args, kw)
|
||||
return self.game.changed(*args, **kw)
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -43,6 +43,7 @@ from mfxutil import destruct, Struct
|
|||
from mfxutil import pickle, unpickle, UnpicklingError
|
||||
from mfxutil import getusername, gethomedir, getprefdir, EnvError
|
||||
from mfxutil import latin1_to_ascii
|
||||
from mfxutil import Image
|
||||
from util import Timer
|
||||
from util import CARDSET, IMAGE_EXTENSIONS
|
||||
from settings import PACKAGE, VERSION, VERSION_TUPLE, WIN_SYSTEM
|
||||
|
@ -250,7 +251,6 @@ class Options:
|
|||
|
||||
# not changeable options
|
||||
def setConstants(self):
|
||||
self.win_animation = True
|
||||
self.dragcursor = True
|
||||
self.randomize_place = False
|
||||
|
||||
|
|
|
@ -1168,12 +1168,12 @@ class Game:
|
|||
return False
|
||||
|
||||
def winAnimation(self, perfect=0):
|
||||
### if not self.app.opt.win_animation:
|
||||
### return
|
||||
if self.preview:
|
||||
return
|
||||
if not self.app.opt.animations:
|
||||
return
|
||||
if not self.app.opt.win_animation:
|
||||
return
|
||||
if TOOLKIT == 'gtk':
|
||||
return
|
||||
if not Image:
|
||||
|
|
|
@ -62,7 +62,7 @@ class CastlesInSpain(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=13, playcards=9)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
|
|
@ -88,7 +88,7 @@ class BakersGame(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, reserves=4, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = InitialDealTalonStack(l.s.talon.x, l.s.talon.y, self)
|
||||
|
|
|
@ -200,7 +200,7 @@ class Fortress(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=0, texts=0, playcards=16)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -251,7 +251,7 @@ class Bastion(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, reserves=2, texts=0, playcards=16)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -379,7 +379,7 @@ class CastlesEnd(Bastion):
|
|||
class Chessboard_Foundation(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=13, min_cards=1, max_move=0)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not self.cards:
|
||||
|
|
|
@ -59,7 +59,7 @@ class Braid_Hint(DefaultHint):
|
|||
class Braid_Foundation(AbstractFoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=13, dir=0, base_rank=NO_RANK, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -294,7 +294,7 @@ class Fort(Braid):
|
|||
|
||||
class Backbone_BraidStack(OpenStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = self.game.app.images.CARD_YOFFSET
|
||||
|
||||
def basicIsBlocked(self):
|
||||
|
|
|
@ -92,7 +92,7 @@ class FreeCell(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, reserves=4, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -340,7 +340,7 @@ class Spidercells(FreeCell):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, reserves=4, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
|
|
@ -93,7 +93,7 @@ class Golf_Talon(WasteTalonStack):
|
|||
class Golf_Waste(WasteStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=0, max_accept=1)
|
||||
apply(WasteStack.__init__, (self, x, y, game), cap)
|
||||
WasteStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not WasteStack.acceptsCards(self, from_stack, cards):
|
||||
|
|
|
@ -63,7 +63,7 @@ class Gypsy(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=0, texts=1)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
|
|
@ -63,7 +63,7 @@ class DoubleKlondike(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=9, waste=1, texts=1, playcards=19)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = WasteTalonStack(l.s.talon.x, l.s.talon.y, self,
|
||||
|
|
|
@ -63,7 +63,7 @@ class Klondike(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, waste=1, texts=1, playcards=16)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self,
|
||||
|
@ -440,7 +440,7 @@ class Batsford_ReserveStack(ReserveStack):
|
|||
class Batsford(Klondike):
|
||||
def createGame(self, **layout):
|
||||
kwdefault(layout, rows=10, max_rounds=1, playcards=22)
|
||||
l = apply(Klondike.createGame, (self,), layout)
|
||||
l = Klondike.createGame(self, **layout)
|
||||
s = self.s
|
||||
x, y = l.XM, self.height - l.YS
|
||||
s.reserves.append(Batsford_ReserveStack(x, y, self, max_cards=3))
|
||||
|
|
|
@ -169,7 +169,7 @@ class LarasGame_Talon(WasteTalonStack):
|
|||
|
||||
class LarasGame_RowStack(OpenStack):
|
||||
def __init__(self, x, y, game, yoffset = 1, **cap):
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
|
||||
|
|
|
@ -85,8 +85,7 @@ class Mahjongg_Foundation(OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, suit=ANY_SUIT, **cap):
|
||||
kwdefault(cap, max_move=0, max_accept=0, max_cards=game.NCARDS)
|
||||
#apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
# We do not accept any cards - pairs will get
|
||||
|
@ -125,7 +124,7 @@ class Mahjongg_RowStack(OpenStack):
|
|||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1, max_cards=2,
|
||||
base_rank=NO_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def basicIsBlocked(self):
|
||||
# any of above blocks
|
||||
|
|
|
@ -71,7 +71,7 @@ class Shisen_Hint(AbstractHint):
|
|||
class Shisen_Foundation(AbstractFoundationStack):
|
||||
def __init__(self, x, y, game, suit=ANY_SUIT, **cap):
|
||||
kwdefault(cap, max_move=0, max_accept=0, max_cards=game.NCARDS)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
# We do not accept any cards - pairs will get
|
||||
|
|
|
@ -60,7 +60,7 @@ class Napoleon_RowStack(UD_SS_RowStack):
|
|||
class Napoleon_ReserveStack(BasicRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=0)
|
||||
apply(BasicRowStack.__init__, (self, x, y, game), cap)
|
||||
BasicRowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
|
||||
class Napoleon_SingleFreeCell(ReserveStack):
|
||||
|
|
|
@ -250,7 +250,7 @@ class PussInTheCorner_Talon(OpenTalonStack):
|
|||
class PussInTheCorner_Foundation(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, base_suit=ANY_SUIT)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, ANY_SUIT), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, ANY_SUIT, **cap)
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
|
||||
return False
|
||||
|
|
|
@ -84,7 +84,7 @@ class Ponytail_Foundation(Braid_Foundation):
|
|||
class Tarock_OpenStack(OpenStack):
|
||||
def __init__(self, x, y, game, yoffset=-1, **cap):
|
||||
kwdefault(cap, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
if yoffset < 0:
|
||||
yoffset = game.app.images.CARD_YOFFSET
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
@ -845,7 +845,7 @@ class Cavalier(AbstractTarockGame):
|
|||
# Create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=18, playcards=19)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create foundations
|
||||
|
|
|
@ -85,7 +85,7 @@ class Spider_SS_Foundation(AbstractFoundationStack):
|
|||
def __init__(self, x, y, game, suit=ANY_SUIT, **cap):
|
||||
kwdefault(cap, dir=-1, base_rank=KING,
|
||||
min_accept=13, max_accept=13, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -128,7 +128,7 @@ class RelaxedSpider(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=0, texts=1, playcards=23)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -466,7 +466,7 @@ class RougeEtNoir(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=0, texts=1, playcards=23)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -724,7 +724,7 @@ class ScorpionHead(Scorpion):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, reserves=4)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# create stacks
|
||||
|
|
|
@ -57,7 +57,7 @@ class Terrace_Talon(WasteTalonStack):
|
|||
class Terrace_AC_Foundation(AC_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=13, min_cards=1, max_move=0)
|
||||
apply(AC_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AC_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if self.game.getState() == 0:
|
||||
|
@ -72,7 +72,7 @@ class Terrace_AC_Foundation(AC_FoundationStack):
|
|||
class Terrace_SS_Foundation(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=13, min_cards=1, max_move=0)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if self.game.getState() == 0:
|
||||
|
@ -87,7 +87,7 @@ class Terrace_SS_Foundation(SS_FoundationStack):
|
|||
class Terrace_RowStack(AC_RowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, mod=13, max_move=1)
|
||||
apply(AC_RowStack.__init__, (self, x, y, game), cap)
|
||||
AC_RowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if self.game.getState() == 0:
|
||||
|
|
|
@ -78,7 +78,7 @@ class ThreePeaks_RowStack(OpenStack):
|
|||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=0, max_cards=1,
|
||||
base_rank=ANY_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def basicIsBlocked(self):
|
||||
r, step = self.game.s.rows, (3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9)
|
||||
|
|
|
@ -49,7 +49,7 @@ class Dashavatara_FoundationStack(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_move=0, max_cards=12)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def updateText(self):
|
||||
AbstractFoundationStack.updateText(self)
|
||||
|
@ -60,7 +60,7 @@ class Journey_Foundation(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=12, dir=0, base_rank=NO_RANK, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -80,7 +80,7 @@ class AppachansWaterfall_Foundation(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, base_suit=0, mod=12, max_cards=120, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not (from_stack in self.game.s.rows and
|
||||
|
@ -106,7 +106,7 @@ class Dashavatara_OpenStack(OpenStack):
|
|||
def __init__(self, x, y, game, yoffset, **cap):
|
||||
kwdefault(cap, max_move=UNLIMITED_MOVES, max_cards=UNLIMITED_CARDS,
|
||||
max_accept=UNLIMITED_ACCEPTS, base_rank=0, dir=-1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def currentForce(self, card):
|
||||
|
@ -296,7 +296,7 @@ class Dashavatara_TableauStack(Dashavatara_OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, base_rank, yoffset, **cap):
|
||||
kwdefault(cap, dir=3, max_move=99, max_cards=4, max_accept=1, base_rank=base_rank)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
@ -318,7 +318,7 @@ class Dashavatara_ReserveStack(ReserveStack):
|
|||
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_cards=1, max_accept=1, base_rank=ANY_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
return (ReserveStack.acceptsCards(self, from_stack, cards)
|
||||
|
@ -524,7 +524,7 @@ class Balarama(AbstractDashavataraGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=16, reserves=4, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create foundations
|
||||
|
@ -670,7 +670,7 @@ class Matsya(AbstractDashavataraGame):
|
|||
def createGame(self, max_rounds=1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=1)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
|
|
@ -223,7 +223,7 @@ class Oonsoo(AbstractFlowerGame):
|
|||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=self.Rows, reserves=self.Reserves,
|
||||
texts=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -636,7 +636,7 @@ class Sumo(AbstractFlowerGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, reserves=2, texts=0, playcards=16)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -681,7 +681,7 @@ class BigSumo(AbstractFlowerGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, reserves=4, texts=0, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -727,7 +727,7 @@ class Samuri(AbstractFlowerGame):
|
|||
def createGame(self, max_rounds=1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=self.Rows, waste=1, texts=1, playcards=21)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -808,7 +808,7 @@ class LittleEasy(AbstractFlowerGame):
|
|||
def createGame(self, max_rounds=-1, num_deal=3, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=self.Rows, waste=1, texts=1, playcards=self.PlayCards)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -899,7 +899,7 @@ class JustForFun(AbstractFlowerGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=self.Rows, reserves=self.Reserves, texts=0, playcards=22)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create stacks
|
||||
|
@ -976,7 +976,7 @@ class Paulownia(AbstractFlowerGame):
|
|||
def createGame(self, max_rounds=-1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
|
|
@ -61,7 +61,7 @@ class Paulownia(AbstractFlowerGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -585,7 +585,7 @@ class FlowerArrangement_Hint(AbstractHint):
|
|||
class FlowerArrangement_TableauStack(Flower_OpenStack):
|
||||
def __init__(self, x, y, game, yoffset, **cap):
|
||||
kwdefault(cap, dir=-1, max_move=1, max_cards=4, max_accept=1, base_rank=3)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
|
|
@ -85,7 +85,7 @@ class Flower_FoundationStack(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_cards=12, max_move=0, base_rank=ANY_RANK, base_suit=ANY_SUIT)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def updateText(self):
|
||||
AbstractFoundationStack.updateText(self)
|
||||
|
@ -143,7 +143,7 @@ class Gaji_Foundation(Flower_FoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_move=1, min_cards=1, max_accept=1, base_suit=ANY_SUIT)
|
||||
apply(Flower_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
Flower_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
self.CARD_YOFFSET = self.game.app.images.CARD_YOFFSET
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
@ -181,7 +181,7 @@ class MatsuKiri_Foundation(Flower_FoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_move=0, max_cards=48, max_accept=4, min_accept=4)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
self.CARD_YOFFSET = self.game.app.images.CARDH / 10
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
@ -202,7 +202,7 @@ class GreatWall_FoundationStack(Flower_FoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_cards=48, max_move=1, min_accept=1, max_accept=1)
|
||||
apply(Flower_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
Flower_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
self.CARD_YOFFSET = self.game.app.images.CARDH / 20
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
@ -239,7 +239,7 @@ class FourWinds_Foundation(Flower_FoundationStack):
|
|||
class Queue_Foundation(AbstractFoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=12, dir=0, base_suit=ANY_SUIT, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -267,7 +267,7 @@ class Flower_OpenStack(OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, yoffset, **cap):
|
||||
kwdefault(cap, max_move=99, max_cards=99, max_accept=99, base_rank=0, dir=1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def isHanafudaSequence(self, cards, strictness=1):
|
||||
|
|
|
@ -48,7 +48,7 @@ from pysollib.pysoltk import MfxCanvasText
|
|||
class HexADeck_FoundationStack(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_move=0, max_cards=12)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
|
||||
class HexATrump_Foundation(HexADeck_FoundationStack):
|
||||
|
@ -64,7 +64,7 @@ class HexATrump_Foundation(HexADeck_FoundationStack):
|
|||
class Merlins_Foundation(AbstractFoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=16, dir=0, base_rank=NO_RANK, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not AbstractFoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -87,7 +87,7 @@ class HexADeck_OpenStack(OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, yoffset, **cap):
|
||||
kwdefault(cap, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def isRankSequence(self, cards, dir=None):
|
||||
|
@ -405,7 +405,7 @@ class HexAKlon(Game):
|
|||
def createGame(self, max_rounds=-1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -464,7 +464,7 @@ class HexAKlonByThrees(Game):
|
|||
def createGame(self, max_rounds=-1, num_deal=3, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -523,7 +523,7 @@ class KingOnlyHexAKlon(Game):
|
|||
def createGame(self, max_rounds=-1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -593,7 +593,7 @@ class KlondikePlus16(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -649,7 +649,7 @@ class TheFamiliar(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -711,7 +711,7 @@ class TwoFamiliars(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=12, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -773,7 +773,7 @@ class TenByEight(Game):
|
|||
def createGame(self, max_rounds=-1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=1, playcards=30)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -831,7 +831,7 @@ class Drawbridge(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -887,7 +887,7 @@ class DoubleDrawbridge(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -943,7 +943,7 @@ class HiddenPassages(Game):
|
|||
def createGame(self, max_rounds=2, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -1012,7 +1012,7 @@ class CluitjarsLair(Game):
|
|||
def createGame(self, max_rounds=1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, waste=1, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -1219,7 +1219,7 @@ class MagesGame(Game):
|
|||
def createGame(self, max_rounds=1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=12, texts=0, playcards=20)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
|
|
@ -50,7 +50,7 @@ class Matrix_RowStack(OpenStack):
|
|||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1, max_cards=1,
|
||||
base_rank=ANY_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def canFlipCard(self):
|
||||
return 0
|
||||
|
|
|
@ -48,7 +48,7 @@ class Mughal_FoundationStack(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, max_move=0)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def updateText(self):
|
||||
AbstractFoundationStack.updateText(self)
|
||||
|
@ -59,7 +59,7 @@ class Triumph_Foundation(AbstractFoundationStack):
|
|||
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, mod=12, dir=0, base_rank=NO_RANK, max_move=0)
|
||||
apply(AbstractFoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
AbstractFoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
||||
|
@ -85,7 +85,7 @@ class Mughal_OpenStack(OpenStack):
|
|||
def __init__(self, x, y, game, yoffset, **cap):
|
||||
kwdefault(cap, max_move=UNLIMITED_MOVES, max_cards=UNLIMITED_CARDS,
|
||||
max_accept=UNLIMITED_ACCEPTS, base_rank=0, dir=-1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def isRankSequence(self, cards, dir=None):
|
||||
|
@ -436,7 +436,7 @@ class Shamsher(AbstractMughalGame):
|
|||
def createGame(self, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=14, reserves=4, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create foundations
|
||||
|
@ -537,7 +537,7 @@ class Tipati(AbstractMughalGame):
|
|||
def createGame(self, max_rounds=1, num_deal=1, **layout):
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=8, waste=1)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
|
||||
# Create talon
|
||||
|
@ -953,7 +953,7 @@ class Dikapala_TableauStack(Mughal_OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, base_rank, yoffset, **cap):
|
||||
kwdefault(cap, dir=3, max_move=99, max_cards=4, max_accept=1, base_rank=base_rank)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
@ -975,7 +975,7 @@ class Dikapala_ReserveStack(ReserveStack):
|
|||
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_cards=1, max_accept=1, base_rank=ANY_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
return (ReserveStack.acceptsCards(self, from_stack, cards)
|
||||
|
|
|
@ -50,7 +50,7 @@ class Tarock_OpenStack(OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, yoffset=-1, **cap):
|
||||
kwdefault(cap, max_move=UNLIMITED_MOVES, max_accept=UNLIMITED_ACCEPTS, dir=-1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
if yoffset < 0:
|
||||
yoffset = game.app.images.CARD_YOFFSET
|
||||
self.CARD_YOFFSET = yoffset
|
||||
|
|
|
@ -62,7 +62,7 @@ class UnionSquare_RowStack(OpenStack):
|
|||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, mod=8192, dir=0, base_rank=ANY_RANK,
|
||||
max_accept=1, max_move=1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
#self.CARD_YOFFSET = 1
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
|
|
|
@ -91,7 +91,7 @@ class Yukon(Game):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=7, texts=0, playcards=25)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = self.Talon_Class(l.s.talon.x, l.s.talon.y, self)
|
||||
|
@ -299,7 +299,7 @@ class RussianPoint(Rushdike):
|
|||
class Abacus_Foundation(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, base_rank=suit, mod=13, dir=suit+1, max_move=0)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, suit), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, suit, **cap)
|
||||
|
||||
|
||||
class Abacus_RowStack(Yukon_SS_RowStack):
|
||||
|
@ -407,7 +407,7 @@ class TenAcross(Yukon):
|
|||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
kwdefault(layout, rows=10, reserves=2, texts=0)
|
||||
apply(self.Layout_Method, (l,), layout)
|
||||
self.Layout_Method(l, **layout)
|
||||
self.setSize(l.size[0], l.size[1])
|
||||
# create stacks
|
||||
s.talon = InitialDealTalonStack(l.s.talon.x, l.s.talon.y, self)
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
import os
|
||||
|
||||
# PySol imports
|
||||
from settings import TOOLKIT
|
||||
from mfxutil import Image, ImageTk
|
||||
|
||||
# Toolkit imports
|
||||
from pysoltk import tkversion, loadImage, copyImage, createImage, shadowImage
|
||||
|
@ -87,7 +89,9 @@ class Images:
|
|||
self._shadow = []
|
||||
self._xshadow = []
|
||||
self._shade = []
|
||||
self._shadow_cards = {} # key: (suit, rank)
|
||||
self._shadow_cards = {} # key: (suit, rank)
|
||||
self._pil_shadow = {} # key: (width, height)
|
||||
self._pil_shadow_image = None
|
||||
|
||||
def destruct(self):
|
||||
pass
|
||||
|
@ -202,28 +206,32 @@ class Images:
|
|||
pass
|
||||
if progress: progress.update(step=pstep)
|
||||
# shadow
|
||||
for i in range(self.cs.nshadows):
|
||||
if fast:
|
||||
self._shadow.append(None)
|
||||
else:
|
||||
name = "shadow%02d.%s" % (i, ext)
|
||||
try:
|
||||
im = self.__loadCard(name, check_w=0, check_h=0)
|
||||
except:
|
||||
im = None
|
||||
self._shadow.append(im)
|
||||
if TOOLKIT == 'tk' and Image:
|
||||
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:
|
||||
self._shadow.append(None)
|
||||
else:
|
||||
name = "shadow%02d.%s" % (i, ext)
|
||||
try:
|
||||
im = self.__loadCard(name, check_w=0, check_h=0)
|
||||
except:
|
||||
im = None
|
||||
self._shadow.append(im)
|
||||
|
||||
if fast:
|
||||
self._xshadow.append(None)
|
||||
elif i > 0: # skip 0
|
||||
name = "xshadow%02d.%s" % (i, ext)
|
||||
try:
|
||||
im = self.__loadCard(name, check_w=0, check_h=0)
|
||||
except:
|
||||
im = None
|
||||
self._xshadow.append(im)
|
||||
if fast:
|
||||
self._xshadow.append(None)
|
||||
elif i > 0: # skip 0
|
||||
name = "xshadow%02d.%s" % (i, ext)
|
||||
try:
|
||||
im = self.__loadCard(name, check_w=0, check_h=0)
|
||||
except:
|
||||
im = None
|
||||
self._xshadow.append(im)
|
||||
|
||||
if progress: progress.update(step=pstep)
|
||||
if progress: progress.update(step=pstep)
|
||||
# shade
|
||||
if fast:
|
||||
self._shade.append(None)
|
||||
|
@ -235,6 +243,8 @@ class Images:
|
|||
#
|
||||
self._bottom = self._bottom_positive
|
||||
self._letter = self._letter_positive
|
||||
#
|
||||
|
||||
return 1
|
||||
|
||||
def getFace(self, deck, suit, rank):
|
||||
|
@ -285,6 +295,46 @@ class Images:
|
|||
return None
|
||||
return self._xshadow[ncards]
|
||||
|
||||
def getShadowPIL(self, stack, cards):
|
||||
x0, y0 = stack.getPositionFor(cards[0])
|
||||
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
|
||||
#xx0, yy0 = x0, y0
|
||||
w, h = x1-x0, y1-y0
|
||||
if (w,h) in self._pil_shadow:
|
||||
return self._pil_shadow[(w,h)]
|
||||
# create mask
|
||||
mask = Image.new('RGBA', (w, h))
|
||||
for c in cards:
|
||||
x, y = stack.getPositionFor(c)
|
||||
x, y = x-x0, y-y0
|
||||
im = c._active_image._pil_image
|
||||
mask.paste(im, (x, y), im)
|
||||
# create shadow
|
||||
sh = self._pil_shadow_image
|
||||
shw, shh = sh.size
|
||||
shadow = Image.new('RGBA', (w, h))
|
||||
x = 0
|
||||
while x < w:
|
||||
y = 0
|
||||
while y < h:
|
||||
shadow.paste(sh, (x,y))
|
||||
y += shh
|
||||
x += shw
|
||||
shadow = Image.composite(shadow, mask, mask)
|
||||
# crop image (for speed)
|
||||
sx, sy = self.SHADOW_XOFFSET, self.SHADOW_YOFFSET
|
||||
mask = mask.crop((sx,sy,w,h))
|
||||
tmp = Image.new('RGBA', (w-sx,h-sy))
|
||||
shadow.paste(tmp, (0,0), mask)
|
||||
#
|
||||
shadow = ImageTk.PhotoImage(shadow)
|
||||
self._pil_shadow[(w,h)] = shadow
|
||||
return shadow
|
||||
|
||||
def getShade(self):
|
||||
return self._shade[self._shade_index]
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ class Layout:
|
|||
if layout_stack is None or not layout_stack.text_args:
|
||||
return None
|
||||
layout_stack.text_args["font"] = self.game.app.getFont("canvas_default")
|
||||
t = apply(MfxCanvasText, (self.game.canvas,), layout_stack.text_args)
|
||||
t = MfxCanvasText(self.game.canvas, **layout_stack.text_args)
|
||||
t.text_format = layout_stack.text_format
|
||||
return t
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ def openURL(url):
|
|||
import webbrowser
|
||||
webbrowser.open(url)
|
||||
return 1
|
||||
except:
|
||||
except ImportError: # FIXME
|
||||
return 0
|
||||
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ class MfxExceptionDialog(MfxDialog):
|
|||
else:
|
||||
t = str(ex)
|
||||
kw.text = text + t
|
||||
apply(MfxDialog.__init__, (self, parent, title), kw.__dict__)
|
||||
MfxDialog.__init__(self, parent, title, **kw.__dict__)
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -226,7 +226,7 @@ class _MfxToplevel(gtk.Window):
|
|||
|
||||
class MfxRoot(_MfxToplevel):
|
||||
def __init__(self, **kw):
|
||||
apply(_MfxToplevel.__init__, (self,), kw)
|
||||
_MfxToplevel.__init__(self, **kw)
|
||||
self.app = None
|
||||
self.connect("delete_event", self.wmDeleteWindow)
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Resource(Struct):
|
|||
index = -1,
|
||||
error = 0, # error while loading this resource
|
||||
)
|
||||
apply(Struct.__init__, (self,), kw.getKw())
|
||||
Struct.__init__(self, **kw.getKw())
|
||||
|
||||
def getSortKey(self):
|
||||
return self.name.lower()
|
||||
|
@ -327,7 +327,7 @@ class Cardset(Resource):
|
|||
def __init__(self, **kw):
|
||||
# start with all fields from CardsetConfig
|
||||
config = CardsetConfig()
|
||||
kw = apply(KwStruct, (config.__dict__,), kw)
|
||||
kw = KwStruct(config.__dict__, **kw)
|
||||
# si is the SelectionInfo struct that will be queried by
|
||||
# the "select cardset" dialogs. It can be freely modified.
|
||||
si = Struct(type=0, size=0, styles=[], nationalities=[], dates=[])
|
||||
|
@ -345,7 +345,7 @@ class Cardset(Resource):
|
|||
backname = None,
|
||||
dir = "",
|
||||
)
|
||||
apply(Resource.__init__, (self,), kw.getKw())
|
||||
Resource.__init__(self, **kw.getKw())
|
||||
|
||||
def getFaceCardNames(self):
|
||||
names = []
|
||||
|
@ -496,12 +496,10 @@ class CardsetManager(ResourceManager):
|
|||
|
||||
class Tile(Resource):
|
||||
def __init__(self, **kw):
|
||||
kw = KwStruct(kw,
|
||||
color = None,
|
||||
text_color = "#000000",
|
||||
stretch = 0,
|
||||
)
|
||||
apply(Resource.__init__, (self,), kw.getKw())
|
||||
kw['color'] = None
|
||||
kw['text_color'] = "#000000"
|
||||
kw['stretch'] = 0
|
||||
Resource.__init__(self, **kw)
|
||||
|
||||
|
||||
class TileManager(ResourceManager):
|
||||
|
@ -514,10 +512,8 @@ class TileManager(ResourceManager):
|
|||
|
||||
class Sample(Resource):
|
||||
def __init__(self, **kw):
|
||||
kw = KwStruct(kw,
|
||||
volume = -1,
|
||||
)
|
||||
apply(Resource.__init__, (self,), kw.getKw())
|
||||
kw['volume'] = -1
|
||||
Resource.__init__(self, **kw)
|
||||
|
||||
|
||||
class SampleManager(ResourceManager):
|
||||
|
|
|
@ -1154,6 +1154,17 @@ 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 TOOLKIT == 'tk' and Image: # use PIL
|
||||
c0 = cards[-1]
|
||||
if self.CARD_XOFFSET[0] < 0: c0 = cards[0]
|
||||
if self.CARD_YOFFSET[0] < 0: c0 = cards[0]
|
||||
img = images.getShadowPIL(self, cards)
|
||||
cx, cy = c0.x + images.CARDW + dx, c0.y + images.CARDH + dy
|
||||
s = MfxCanvasImage(self.game.canvas, cx, cy,
|
||||
image=img, anchor=ANCHOR_SE)
|
||||
s.lower(c0.item)
|
||||
return (s,)
|
||||
|
||||
if ddx == 0: # vertical
|
||||
for c in cards[1:]:
|
||||
if c.x != cx or abs(c.y - cy) != images.CARD_YOFFSET:
|
||||
|
@ -1285,6 +1296,8 @@ class Stack:
|
|||
#
|
||||
x0, y0 = self.getPositionFor(cards[0])
|
||||
x1, y1 = self.getPositionFor(cards[-1])
|
||||
x0, x1 = min(x1, x0), max(x1, x0)
|
||||
y0, y1 = min(y1, y0), max(y1, y0)
|
||||
x1 = x1 + self.game.app.images.CARDW
|
||||
y1 = y1 + self.game.app.images.CARDH
|
||||
xx0, yy0 = x0, y0
|
||||
|
@ -1926,7 +1939,7 @@ class AbstractFoundationStack(OpenStack):
|
|||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, suit=suit, base_suit=suit, base_rank=ACE,
|
||||
dir=1, max_accept=1, max_cards=13)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def canDropCards(self, stacks):
|
||||
return (None, 0)
|
||||
|
@ -1976,7 +1989,7 @@ class SS_FoundationStack(AbstractFoundationStack):
|
|||
# A Rank_FoundationStack builds up in rank and ignores color and suit.
|
||||
class RK_FoundationStack(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit=ANY_SUIT, **cap):
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, ANY_SUIT), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, ANY_SUIT, **cap)
|
||||
|
||||
def assertStack(self):
|
||||
SS_FoundationStack.assertStack(self)
|
||||
|
@ -1994,7 +2007,7 @@ class RK_FoundationStack(SS_FoundationStack):
|
|||
class AC_FoundationStack(SS_FoundationStack):
|
||||
def __init__(self, x, y, game, suit, **cap):
|
||||
kwdefault(cap, base_suit=suit)
|
||||
apply(SS_FoundationStack.__init__, (self, x, y, game, ANY_SUIT), cap)
|
||||
SS_FoundationStack.__init__(self, x, y, game, ANY_SUIT, **cap)
|
||||
|
||||
def acceptsCards(self, from_stack, cards):
|
||||
if not SS_FoundationStack.acceptsCards(self, from_stack, cards):
|
||||
|
@ -2046,7 +2059,7 @@ class SequenceStack_StackMethods:
|
|||
class BasicRowStack(OpenStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, dir=-1, base_rank=ANY_RANK)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = game.app.images.CARD_YOFFSET
|
||||
|
||||
def getHelp(self):
|
||||
|
@ -2062,7 +2075,7 @@ class BasicRowStack(OpenStack):
|
|||
class SequenceRowStack(SequenceStack_StackMethods, BasicRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=999999, max_accept=999999)
|
||||
apply(BasicRowStack.__init__, (self, x, y, game), cap)
|
||||
BasicRowStack.__init__(self, x, y, game, **cap)
|
||||
def getBaseCard(self):
|
||||
return self._getBaseCard()
|
||||
|
||||
|
@ -2161,7 +2174,7 @@ class Spider_SS_RowStack(SS_RowStack):
|
|||
class Yukon_AC_RowStack(BasicRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=999999, max_accept=999999)
|
||||
apply(BasicRowStack.__init__, (self, x, y, game), cap)
|
||||
BasicRowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def _isSequence(self, c1, c2):
|
||||
return (c1.rank + self.cap.dir) % self.cap.mod == c2.rank and c1.color != c2.color
|
||||
|
@ -2200,24 +2213,24 @@ class Yukon_SS_RowStack(Yukon_AC_RowStack):
|
|||
class KingAC_RowStack(AC_RowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, base_rank=KING)
|
||||
apply(AC_RowStack.__init__, (self, x, y, game), cap)
|
||||
AC_RowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
class KingSS_RowStack(SS_RowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, base_rank=KING)
|
||||
apply(SS_RowStack.__init__, (self, x, y, game), cap)
|
||||
SS_RowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
class KingRK_RowStack(RK_RowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, base_rank=KING)
|
||||
apply(RK_RowStack.__init__, (self, x, y, game), cap)
|
||||
RK_RowStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
|
||||
# up or down by color
|
||||
class UD_SC_RowStack(SequenceRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1)
|
||||
apply(SequenceRowStack.__init__, (self, x, y, game), cap)
|
||||
SequenceRowStack.__init__(self, x, y, game, **cap)
|
||||
def _isSequence(self, cards):
|
||||
return (isSameColorSequence(cards, self.cap.mod, 1) or
|
||||
isSameColorSequence(cards, self.cap.mod, -1))
|
||||
|
@ -2228,7 +2241,7 @@ class UD_SC_RowStack(SequenceRowStack):
|
|||
class UD_AC_RowStack(SequenceRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1)
|
||||
apply(SequenceRowStack.__init__, (self, x, y, game), cap)
|
||||
SequenceRowStack.__init__(self, x, y, game, **cap)
|
||||
def _isSequence(self, cards):
|
||||
return (isAlternateColorSequence(cards, self.cap.mod, 1) or
|
||||
isAlternateColorSequence(cards, self.cap.mod, -1))
|
||||
|
@ -2239,7 +2252,7 @@ class UD_AC_RowStack(SequenceRowStack):
|
|||
class UD_SS_RowStack(SequenceRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1)
|
||||
apply(SequenceRowStack.__init__, (self, x, y, game), cap)
|
||||
SequenceRowStack.__init__(self, x, y, game, **cap)
|
||||
def _isSequence(self, cards):
|
||||
return (isSameSuitSequence(cards, self.cap.mod, 1) or
|
||||
isSameSuitSequence(cards, self.cap.mod, -1))
|
||||
|
@ -2250,7 +2263,7 @@ class UD_SS_RowStack(SequenceRowStack):
|
|||
class UD_RK_RowStack(SequenceRowStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1, max_accept=1)
|
||||
apply(SequenceRowStack.__init__, (self, x, y, game), cap)
|
||||
SequenceRowStack.__init__(self, x, y, game, **cap)
|
||||
def _isSequence(self, cards):
|
||||
return (isRankSequence(cards, self.cap.mod, 1) or
|
||||
isRankSequence(cards, self.cap.mod, -1))
|
||||
|
@ -2274,7 +2287,7 @@ class WasteTalonStack(TalonStack):
|
|||
# moves it face up; if we're out of cards, it moves the waste
|
||||
# back to the talon and increases the number of rounds (redeals).
|
||||
def __init__(self, x, y, game, max_rounds, num_deal=1, waste=None, **cap):
|
||||
apply(TalonStack.__init__, (self, x, y, game, max_rounds, num_deal), cap)
|
||||
TalonStack.__init__(self, x, y, game, max_rounds, num_deal, **cap)
|
||||
self.waste = waste
|
||||
|
||||
def prepareStack(self):
|
||||
|
@ -2331,7 +2344,7 @@ class OpenTalonStack(TalonStack, OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_move=1)
|
||||
apply(TalonStack.__init__, (self, x, y, game), cap)
|
||||
TalonStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def canDealCards(self):
|
||||
return 0
|
||||
|
@ -2358,7 +2371,7 @@ class OpenTalonStack(TalonStack, OpenStack):
|
|||
class ReserveStack(OpenStack):
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_accept=1, max_cards=1)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
|
||||
def getBottomImage(self):
|
||||
return self.game.app.images.getReserveBottom()
|
||||
|
@ -2405,7 +2418,7 @@ class ArbitraryStack(OpenStack):
|
|||
|
||||
def __init__(self, x, y, game, **cap):
|
||||
kwdefault(cap, max_accept=0)
|
||||
apply(OpenStack.__init__, (self, x, y, game), cap)
|
||||
OpenStack.__init__(self, x, y, game, **cap)
|
||||
self.CARD_YOFFSET = game.app.images.CARD_YOFFSET
|
||||
|
||||
def canMoveCards(self, cards):
|
||||
|
@ -2515,21 +2528,21 @@ class StackWrapper:
|
|||
def __call__(self, x, y, game, **cap):
|
||||
# must preserve self.cap, so create a shallow copy
|
||||
c = self.cap.copy()
|
||||
apply(kwdefault, (c,), cap)
|
||||
return apply(self.stack_class, (x, y, game), c)
|
||||
kwdefault(c, **cap)
|
||||
return self.stack_class(x, y, game, **c)
|
||||
|
||||
|
||||
# call-time cap override self.cap
|
||||
class WeakStackWrapper(StackWrapper):
|
||||
def __call__(self, x, y, game, **cap):
|
||||
apply(kwdefault, (cap,), self.cap)
|
||||
return apply(self.stack_class, (x, y, game), cap)
|
||||
kwdefault(cap, **self.cap)
|
||||
return self.stack_class(x, y, game, **cap)
|
||||
|
||||
|
||||
# self.cap only, call-time cap is completely ignored
|
||||
class FullStackWrapper(StackWrapper):
|
||||
def __call__(self, x, y, game, **cap):
|
||||
return apply(self.stack_class, (x, y, game), self.cap)
|
||||
return self.stack_class(x, y, game, **self.cap)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import tkFileDialog
|
|||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, kwdefault
|
||||
from pysollib.mfxutil import Image
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.settings import PACKAGE, WIN_SYSTEM
|
||||
from pysollib.settings import TOP_TITLE
|
||||
|
@ -132,7 +133,7 @@ class MfxMenubar(Tkinter.Menu):
|
|||
self.name = kw["name"]
|
||||
tearoff = 0
|
||||
self.n = kw["tearoff"] = int(kw.get("tearoff", tearoff))
|
||||
apply(Tkinter.Menu.__init__, (self, master, ), kw)
|
||||
Tkinter.Menu.__init__(self, master, **kw)
|
||||
|
||||
def labeltoname(self, label):
|
||||
#print label, type(label)
|
||||
|
@ -174,7 +175,7 @@ class MfxMenu(MfxMenubar):
|
|||
else:
|
||||
name, label, label_underline = self.labeltoname(label)
|
||||
kwdefault(kw, name=name)
|
||||
apply(MfxMenubar.__init__, (self, master,), kw)
|
||||
MfxMenubar.__init__(self, master, **kw)
|
||||
if underline is None:
|
||||
underline = label_underline
|
||||
if master:
|
||||
|
@ -236,6 +237,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
cardback = MfxRadioMenuItem(self),
|
||||
tabletile = MfxRadioMenuItem(self),
|
||||
animations = MfxRadioMenuItem(self),
|
||||
redeal_animation = MfxCheckMenuItem(self),
|
||||
win_animation = MfxCheckMenuItem(self),
|
||||
shadow = MfxCheckMenuItem(self),
|
||||
shade = MfxCheckMenuItem(self),
|
||||
shade_filled_stacks = MfxCheckMenuItem(self),
|
||||
|
@ -283,6 +286,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
tkopt.cardback.set(self.app.cardset.backindex)
|
||||
tkopt.tabletile.set(self.app.tabletile_index)
|
||||
tkopt.animations.set(opt.animations)
|
||||
tkopt.redeal_animation.set(opt.redeal_animation)
|
||||
tkopt.win_animation.set(opt.win_animation)
|
||||
tkopt.shadow.set(opt.shadow)
|
||||
tkopt.shade.set(opt.shade)
|
||||
tkopt.toolbar.set(opt.toolbar)
|
||||
|
@ -341,7 +346,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
def _createMenubar(self):
|
||||
MfxMenubar.addPath = self._addPath
|
||||
kw = { "name": "menubar" }
|
||||
self.__menubar = apply(MfxMenubar, (self.top,), kw)
|
||||
self.__menubar = MfxMenubar(self.top, **kw)
|
||||
|
||||
# init keybindings
|
||||
bind(self.top, "<KeyPress>", self._keyPressHandler)
|
||||
|
@ -480,6 +485,10 @@ class PysolMenubar(PysolMenubarActions):
|
|||
submenu.add_radiobutton(label=n_("&Fast"), variable=self.tkopt.animations, value=1, command=self.mOptAnimations)
|
||||
submenu.add_radiobutton(label=n_("&Slow"), variable=self.tkopt.animations, value=3, command=self.mOptAnimations)
|
||||
submenu.add_radiobutton(label=n_("&Very slow"), variable=self.tkopt.animations, value=4, command=self.mOptAnimations)
|
||||
submenu.add_separator()
|
||||
submenu.add_checkbutton(label=n_("&Redeal animation"), variable=self.tkopt.redeal_animation, command=self.mRedealAnimation)
|
||||
if Image:
|
||||
submenu.add_checkbutton(label=n_("&Winning animation"), variable=self.tkopt.win_animation, command=self.mWinAnimation)
|
||||
submenu = MfxMenu(menu, label=n_("&Mouse"))
|
||||
submenu.add_radiobutton(label=n_("&Drag-and-Drop"), variable=self.tkopt.mouse_type, value='drag-n-drop', command=self.mOptMouseType)
|
||||
submenu.add_radiobutton(label=n_("&Point-and-Click"), variable=self.tkopt.mouse_type, value='point-n-click', command=self.mOptMouseType)
|
||||
|
@ -1084,6 +1093,14 @@ class PysolMenubar(PysolMenubarActions):
|
|||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.animations = self.tkopt.animations.get()
|
||||
|
||||
def mRedealAnimation(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.redeal_animation = self.tkopt.redeal_animation.get()
|
||||
|
||||
def mWinAnimation(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.win_animation = self.tkopt.win_animation.get()
|
||||
|
||||
def mOptShadow(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.shadow = self.tkopt.shadow.get()
|
||||
|
|
|
@ -110,7 +110,7 @@ class MfxStatusbar:
|
|||
kw['foreground'] = kw['fg']
|
||||
del kw['fg']
|
||||
label = getattr(self, name + "_label")
|
||||
apply(label.config, (), kw)
|
||||
label.config(**kw)
|
||||
|
||||
def show(self, show=True, resize=False):
|
||||
if self._show == show:
|
||||
|
|
|
@ -126,7 +126,7 @@ class MfxCanvasText(Canvas.CanvasText):
|
|||
|
||||
class MfxCanvas(Tkinter.Canvas):
|
||||
def __init__(self, *args, **kw):
|
||||
apply(Tkinter.Canvas.__init__, (self,) + args, kw)
|
||||
Tkinter.Canvas.__init__(self, *args, **kw)
|
||||
self.preview = 0
|
||||
# this is also used by lib-tk/Canvas.py
|
||||
self.items = {}
|
||||
|
|
|
@ -317,7 +317,7 @@ class HTMLViewer:
|
|||
self.parent = None
|
||||
|
||||
def _yview(self, *args):
|
||||
apply(self.text.yview, args, {})
|
||||
self.text.yview(*args)
|
||||
return 'break'
|
||||
|
||||
def page_up(self, *event):
|
||||
|
|
|
@ -542,37 +542,37 @@ class _TopDialog(MfxDialog):
|
|||
cnf = {'master': top_frame,
|
||||
'padding': (4, 1),
|
||||
}
|
||||
frame = apply(Tkinter.Frame, (), cnf)
|
||||
frame = Tkinter.Frame(**cnf)
|
||||
frame.pack(expand=Tkinter.YES, fill=Tkinter.BOTH, padx=10, pady=10)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
cnf['master'] = frame
|
||||
cnf['text'] = _('N')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=0, sticky='ew')
|
||||
cnf['text'] = _('Game number')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=1, sticky='ew')
|
||||
cnf['text'] = _('Started at')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=2, sticky='ew')
|
||||
cnf['text'] = _('Result')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=3, sticky='ew')
|
||||
|
||||
row = 1
|
||||
for i in top:
|
||||
# N
|
||||
cnf['text'] = str(row)
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=0, sticky='ew')
|
||||
# Game number
|
||||
cnf['text'] = '#'+str(i.game_number)
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=1, sticky='ew')
|
||||
# Start time
|
||||
t = time.strftime('%Y-%m-%d %H:%M', time.localtime(i.game_start_time))
|
||||
cnf['text'] = t
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=2, sticky='ew')
|
||||
# Result
|
||||
if isinstance(i.value, float):
|
||||
|
@ -582,7 +582,7 @@ class _TopDialog(MfxDialog):
|
|||
# moves
|
||||
s = str(i.value)
|
||||
cnf['text'] = s
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=3, sticky='ew')
|
||||
row += 1
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ class MfxTreeInCanvas(MfxScrolledCanvas):
|
|||
def __init__(self, parent, rootnodes, **kw):
|
||||
kw['bd'] = 0
|
||||
kw['bg'] = 'white'
|
||||
apply(MfxScrolledCanvas.__init__, (self, parent,), kw)
|
||||
MfxScrolledCanvas.__init__(self, parent, **kw)
|
||||
#
|
||||
self.rootnodes = rootnodes
|
||||
self.updateNodesWithTree(self.rootnodes, self)
|
||||
|
|
|
@ -241,12 +241,12 @@ def unbind_destroy(widget):
|
|||
# ************************************************************************/
|
||||
|
||||
def after(widget, ms, func, *args):
|
||||
timer = apply(widget.after, (ms, func) + args)
|
||||
timer = widget.after(ms, func, *args)
|
||||
command = widget._tclCommands[-1]
|
||||
return (timer, command, widget)
|
||||
|
||||
def after_idle(widget, func, *args):
|
||||
return apply(after, (widget, "idle", func) + args)
|
||||
return after(widget, "idle", func, *args)
|
||||
|
||||
def after_cancel(t):
|
||||
if t is not None:
|
||||
|
@ -293,7 +293,7 @@ def makeImage(file=None, data=None, dither=None, alpha=None):
|
|||
# fromstring(mode, size, data, decoder_name='raw', *args)
|
||||
else:
|
||||
return Tkinter.PhotoImage(data=data)
|
||||
return apply(Tkinter.PhotoImage, (), kw)
|
||||
return Tkinter.PhotoImage(**kw)
|
||||
|
||||
loadImage = makeImage
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ class MfxExceptionDialog(MfxMessageDialog):
|
|||
else:
|
||||
t = str(ex)
|
||||
kw.text = text + unicode(t, errors='replace')
|
||||
apply(MfxMessageDialog.__init__, (self, parent, title), kw.getKw())
|
||||
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
@ -474,10 +474,10 @@ class MfxScrolledCanvas:
|
|||
self.frame.destroy()
|
||||
|
||||
def pack(self, **kw):
|
||||
apply(self.frame.pack, (), kw)
|
||||
self.frame.pack(**kw)
|
||||
|
||||
def grid(self, **kw):
|
||||
apply(self.frame.grid, (), kw)
|
||||
self.frame.grid(**kw)
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -536,8 +536,7 @@ class MfxScrolledCanvas:
|
|||
self.frame = Tkinter.Frame(self.parent, width=width, height=height, bg=None)
|
||||
|
||||
def createCanvas(self, kw):
|
||||
#self.canvas = apply(Tkinter.Canvas, (self.frame,), kw)
|
||||
self.canvas = apply(MfxCanvas, (self.frame,), kw)
|
||||
self.canvas = MfxCanvas(self.frame, **kw)
|
||||
self.canvas.grid(row=0, column=0, sticky="news")
|
||||
def createHbar(self):
|
||||
self.hbar = Tkinter.Scrollbar(self.frame, name="hbar",
|
||||
|
@ -584,15 +583,13 @@ class MfxScrolledCanvas:
|
|||
top.wm_geometry(g)
|
||||
|
||||
def _setHbar(self, *args):
|
||||
##apply(self.hbar.set, args)
|
||||
self.canvas.update()
|
||||
apply(self.hbar.set, self.canvas.xview())
|
||||
self.hbar.set(*self.canvas.xview())
|
||||
self.showHbar()
|
||||
##self.hbar.update_idletasks()
|
||||
def _setVbar(self, *args):
|
||||
##apply(self.vbar.set, args)
|
||||
self.canvas.update()
|
||||
apply(self.vbar.set, self.canvas.yview())
|
||||
self.vbar.set(*self.canvas.yview())
|
||||
self.showVbar()
|
||||
##self.vbar.update_idletasks()
|
||||
|
||||
|
@ -637,10 +634,10 @@ class MfxScrolledCanvas:
|
|||
return 1
|
||||
|
||||
def _xview(self, *args):
|
||||
if self.hbar_show: apply(self.canvas.xview, args, {})
|
||||
if self.hbar_show: self.canvas.xview(*args)
|
||||
return 'break'
|
||||
def _yview(self, *args):
|
||||
if self.vbar_show: apply(self.canvas.yview, args, {})
|
||||
if self.vbar_show: self.canvas.yview(*args)
|
||||
return 'break'
|
||||
|
||||
def page_up(self, *event):
|
||||
|
@ -754,14 +751,17 @@ class MyPysolScale:
|
|||
kw['command'] = self._scale_command
|
||||
if 'label' in kw:
|
||||
self.label_text = kw['label']
|
||||
width = len(self.label_text)+4
|
||||
del kw['label']
|
||||
else:
|
||||
self.label_text = None
|
||||
width = 3
|
||||
|
||||
# create widgets
|
||||
side = 'left' # 'top'
|
||||
self.frame = Tkinter.Frame(parent)
|
||||
self.label = Tkinter.Label(self.frame, anchor='w', padding=(5,0))
|
||||
self.label = Tkinter.Label(self.frame, anchor='w',
|
||||
width=width, padding=(5,0))
|
||||
self.label.pack(side=side, expand=False, fill='x')
|
||||
self.scale = Tkinter.Scale(self.frame, **kw)
|
||||
self.scale.pack(side=side, expand=True, fill='both', pady=4)
|
||||
|
|
|
@ -85,7 +85,7 @@ StringVar = Tkinter.StringVar
|
|||
|
||||
class MfxRoot(Tkinter.Tk):
|
||||
def __init__(self, **kw):
|
||||
apply(Tkinter.Tk.__init__, (self,), kw)
|
||||
Tkinter.Tk.__init__(self, **kw)
|
||||
self.app = None
|
||||
self.wm_protocol('WM_DELETE_WINDOW', self.wmDeleteWindow)
|
||||
# for interruptible sleep
|
||||
|
|
|
@ -42,6 +42,7 @@ import Tkinter, tkFileDialog
|
|||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import destruct, Struct, kwdefault
|
||||
from pysollib.mfxutil import Image
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.settings import PACKAGE, WIN_SYSTEM
|
||||
from pysollib.settings import TOP_TITLE
|
||||
|
@ -131,7 +132,7 @@ class MfxMenubar(Tkinter.Menu):
|
|||
self.name = kw["name"]
|
||||
tearoff = 0
|
||||
self.n = kw["tearoff"] = int(kw.get("tearoff", tearoff))
|
||||
apply(Tkinter.Menu.__init__, (self, master, ), kw)
|
||||
Tkinter.Menu.__init__(self, master, **kw)
|
||||
|
||||
def labeltoname(self, label):
|
||||
#print label, type(label)
|
||||
|
@ -173,7 +174,7 @@ class MfxMenu(MfxMenubar):
|
|||
else:
|
||||
name, label, label_underline = self.labeltoname(label)
|
||||
kwdefault(kw, name=name)
|
||||
apply(MfxMenubar.__init__, (self, master,), kw)
|
||||
MfxMenubar.__init__(self, master, **kw)
|
||||
if underline is None:
|
||||
underline = label_underline
|
||||
if master:
|
||||
|
@ -235,6 +236,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
cardback = MfxRadioMenuItem(self),
|
||||
tabletile = MfxRadioMenuItem(self),
|
||||
animations = MfxRadioMenuItem(self),
|
||||
redeal_animation = MfxCheckMenuItem(self),
|
||||
win_animation = MfxCheckMenuItem(self),
|
||||
shadow = MfxCheckMenuItem(self),
|
||||
shade = MfxCheckMenuItem(self),
|
||||
shade_filled_stacks = MfxCheckMenuItem(self),
|
||||
|
@ -281,6 +284,8 @@ class PysolMenubar(PysolMenubarActions):
|
|||
tkopt.cardback.set(self.app.cardset.backindex)
|
||||
tkopt.tabletile.set(self.app.tabletile_index)
|
||||
tkopt.animations.set(opt.animations)
|
||||
tkopt.redeal_animation.set(opt.redeal_animation)
|
||||
tkopt.win_animation.set(opt.win_animation)
|
||||
tkopt.shadow.set(opt.shadow)
|
||||
tkopt.shade.set(opt.shade)
|
||||
tkopt.toolbar.set(opt.toolbar)
|
||||
|
@ -338,7 +343,7 @@ class PysolMenubar(PysolMenubarActions):
|
|||
def _createMenubar(self):
|
||||
MfxMenubar.addPath = self._addPath
|
||||
kw = { "name": "menubar" }
|
||||
self.__menubar = apply(MfxMenubar, (self.top,), kw)
|
||||
self.__menubar = MfxMenubar(self.top, **kw)
|
||||
|
||||
# init keybindings
|
||||
bind(self.top, "<KeyPress>", self._keyPressHandler)
|
||||
|
@ -477,6 +482,10 @@ class PysolMenubar(PysolMenubarActions):
|
|||
submenu.add_radiobutton(label=n_("&Fast"), variable=self.tkopt.animations, value=1, command=self.mOptAnimations)
|
||||
submenu.add_radiobutton(label=n_("&Slow"), variable=self.tkopt.animations, value=3, command=self.mOptAnimations)
|
||||
submenu.add_radiobutton(label=n_("&Very slow"), variable=self.tkopt.animations, value=4, command=self.mOptAnimations)
|
||||
submenu.add_separator()
|
||||
submenu.add_checkbutton(label=n_("&Redeal animation"), variable=self.tkopt.redeal_animation, command=self.mRedealAnimation)
|
||||
if Image:
|
||||
submenu.add_checkbutton(label=n_("&Winning animation"), variable=self.tkopt.win_animation, command=self.mWinAnimation)
|
||||
submenu = MfxMenu(menu, label=n_("&Mouse"))
|
||||
submenu.add_radiobutton(label=n_("&Drag-and-Drop"), variable=self.tkopt.mouse_type, value='drag-n-drop', command=self.mOptMouseType)
|
||||
submenu.add_radiobutton(label=n_("&Point-and-Click"), variable=self.tkopt.mouse_type, value='point-n-click', command=self.mOptMouseType)
|
||||
|
@ -1080,6 +1089,14 @@ class PysolMenubar(PysolMenubarActions):
|
|||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.animations = self.tkopt.animations.get()
|
||||
|
||||
def mRedealAnimation(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.redeal_animation = self.tkopt.redeal_animation.get()
|
||||
|
||||
def mWinAnimation(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.win_animation = self.tkopt.win_animation.get()
|
||||
|
||||
def mOptShadow(self, *args):
|
||||
if self._cancelDrag(break_pause=False): return
|
||||
self.app.opt.shadow = self.tkopt.shadow.get()
|
||||
|
|
|
@ -96,7 +96,7 @@ class PysolProgressBar:
|
|||
|
||||
def pack(self, **kw):
|
||||
self.canvas.pack(fill=Tkinter.X, expand=0)
|
||||
apply(self.frame.pack, (), kw)
|
||||
self.frame.pack(**kw)
|
||||
|
||||
def reset(self, percent=0):
|
||||
self.percent = percent
|
||||
|
|
|
@ -121,7 +121,7 @@ class MfxStatusbar:
|
|||
|
||||
def configLabel(self, name, **kw):
|
||||
label = getattr(self, name + "_label")
|
||||
apply(label.config, (), kw)
|
||||
label.config(**kw)
|
||||
|
||||
def show(self, show=True, resize=False):
|
||||
if self._show == show:
|
||||
|
|
|
@ -125,7 +125,7 @@ class MfxCanvasText(Canvas.CanvasText):
|
|||
|
||||
class MfxCanvas(Tkinter.Canvas):
|
||||
def __init__(self, *args, **kw):
|
||||
apply(Tkinter.Canvas.__init__, (self,) + args, kw)
|
||||
Tkinter.Canvas.__init__(self, *args, **kw)
|
||||
self.preview = 0
|
||||
# this is also used by lib-tk/Canvas.py
|
||||
self.items = {}
|
||||
|
|
|
@ -316,7 +316,7 @@ class HTMLViewer:
|
|||
self.parent = None
|
||||
|
||||
def _yview(self, *args):
|
||||
apply(self.text.yview, args, {})
|
||||
self.text.yview(*args)
|
||||
return 'break'
|
||||
|
||||
def page_up(self, *event):
|
||||
|
|
|
@ -658,37 +658,37 @@ class _TopDialog(MfxDialog):
|
|||
'highlightthickness': 1,
|
||||
'highlightbackground': 'black',
|
||||
}
|
||||
frame = apply(Tkinter.Frame, (), cnf)
|
||||
frame = Tkinter.Frame(**cnf)
|
||||
frame.pack(expand=Tkinter.YES, fill=Tkinter.BOTH, padx=10, pady=10)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
cnf['master'] = frame
|
||||
cnf['text'] = _('N')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=0, sticky='ew')
|
||||
cnf['text'] = _('Game number')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=1, sticky='ew')
|
||||
cnf['text'] = _('Started at')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=2, sticky='ew')
|
||||
cnf['text'] = _('Result')
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=0, column=3, sticky='ew')
|
||||
|
||||
row = 1
|
||||
for i in top:
|
||||
# N
|
||||
cnf['text'] = str(row)
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=0, sticky='ew')
|
||||
# Game number
|
||||
cnf['text'] = '#'+str(i.game_number)
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=1, sticky='ew')
|
||||
# Start time
|
||||
t = time.strftime('%Y-%m-%d %H:%M', time.localtime(i.game_start_time))
|
||||
cnf['text'] = t
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=2, sticky='ew')
|
||||
# Result
|
||||
if isinstance(i.value, float):
|
||||
|
@ -698,7 +698,7 @@ class _TopDialog(MfxDialog):
|
|||
# moves
|
||||
s = str(i.value)
|
||||
cnf['text'] = s
|
||||
l = apply(Tkinter.Label, (), cnf)
|
||||
l = Tkinter.Label(**cnf)
|
||||
l.grid(row=row, column=3, sticky='ew')
|
||||
row += 1
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ class MfxTreeInCanvas(MfxScrolledCanvas):
|
|||
def __init__(self, parent, rootnodes, **kw):
|
||||
bg = kw["bg"] = kw.get("bg") or parent.cget("bg")
|
||||
kw['bd'] = 0
|
||||
apply(MfxScrolledCanvas.__init__, (self, parent,), kw)
|
||||
MfxScrolledCanvas.__init__(self, parent, **kw)
|
||||
#
|
||||
self.rootnodes = rootnodes
|
||||
self.updateNodesWithTree(self.rootnodes, self)
|
||||
|
|
|
@ -241,12 +241,12 @@ def unbind_destroy(widget):
|
|||
# ************************************************************************/
|
||||
|
||||
def after(widget, ms, func, *args):
|
||||
timer = apply(widget.after, (ms, func) + args)
|
||||
timer = widget.after(ms, func, *args)
|
||||
command = widget._tclCommands[-1]
|
||||
return (timer, command, widget)
|
||||
|
||||
def after_idle(widget, func, *args):
|
||||
return apply(after, (widget, "idle", func) + args)
|
||||
return after(widget, "idle", func, *args)
|
||||
|
||||
def after_cancel(t):
|
||||
if t is not None:
|
||||
|
@ -293,7 +293,7 @@ def makeImage(file=None, data=None, dither=None, alpha=None):
|
|||
# fromstring(mode, size, data, decoder_name='raw', *args)
|
||||
else:
|
||||
return Tkinter.PhotoImage(data=data)
|
||||
return apply(Tkinter.PhotoImage, (), kw)
|
||||
return Tkinter.PhotoImage(**kw)
|
||||
|
||||
loadImage = makeImage
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class MfxExceptionDialog(MfxMessageDialog):
|
|||
else:
|
||||
t = str(ex)
|
||||
kw.text = text + unicode(t, errors='replace')
|
||||
apply(MfxMessageDialog.__init__, (self, parent, title), kw.getKw())
|
||||
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
@ -474,10 +474,10 @@ class MfxScrolledCanvas:
|
|||
self.frame.destroy()
|
||||
|
||||
def pack(self, **kw):
|
||||
apply(self.frame.pack, (), kw)
|
||||
self.frame.pack(**kw)
|
||||
|
||||
def grid(self, **kw):
|
||||
apply(self.frame.grid, (), kw)
|
||||
self.frame.grid(**kw)
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -533,11 +533,10 @@ class MfxScrolledCanvas:
|
|||
def createFrame(self, kw):
|
||||
width = kw.get("width")
|
||||
height = kw.get("height")
|
||||
self.frame = Tkinter.Frame(self.parent, width=width, height=height, bg=None)
|
||||
self.frame = Tkinter.Frame(self.parent, width=width, height=height)
|
||||
|
||||
def createCanvas(self, kw):
|
||||
#self.canvas = apply(Tkinter.Canvas, (self.frame,), kw)
|
||||
self.canvas = apply(MfxCanvas, (self.frame,), kw)
|
||||
self.canvas = MfxCanvas(self.frame, **kw)
|
||||
self.canvas.grid(row=0, column=0, sticky="news")
|
||||
def createHbar(self):
|
||||
self.hbar = Tkinter.Scrollbar(self.frame, name="hbar",
|
||||
|
@ -585,15 +584,13 @@ class MfxScrolledCanvas:
|
|||
top.wm_geometry(g)
|
||||
|
||||
def _setHbar(self, *args):
|
||||
##apply(self.hbar.set, args)
|
||||
self.canvas.update()
|
||||
apply(self.hbar.set, self.canvas.xview())
|
||||
self.hbar.set(*self.canvas.xview())
|
||||
self.showHbar()
|
||||
##self.hbar.update_idletasks()
|
||||
def _setVbar(self, *args):
|
||||
##apply(self.vbar.set, args)
|
||||
self.canvas.update()
|
||||
apply(self.vbar.set, self.canvas.yview())
|
||||
self.vbar.set(*self.canvas.yview())
|
||||
self.showVbar()
|
||||
##self.vbar.update_idletasks()
|
||||
|
||||
|
@ -638,10 +635,10 @@ class MfxScrolledCanvas:
|
|||
return 1
|
||||
|
||||
def _xview(self, *args):
|
||||
if self.hbar_show: apply(self.canvas.xview, args, {})
|
||||
if self.hbar_show: self.canvas.xview(*args)
|
||||
return 'break'
|
||||
def _yview(self, *args):
|
||||
if self.vbar_show: apply(self.canvas.yview, args, {})
|
||||
if self.vbar_show: self.canvas.yview(*args)
|
||||
return 'break'
|
||||
|
||||
def page_up(self, *event):
|
||||
|
|
|
@ -86,7 +86,7 @@ StringVar = Tkinter.StringVar
|
|||
|
||||
class MfxRoot(Tkinter.Tk):
|
||||
def __init__(self, **kw):
|
||||
apply(Tkinter.Tk.__init__, (self,), kw)
|
||||
Tkinter.Tk.__init__(self, **kw)
|
||||
self.app = None
|
||||
self.wm_protocol('WM_DELETE_WINDOW', self.wmDeleteWindow)
|
||||
# for interruptible sleep
|
||||
|
|
Loading…
Add table
Reference in a new issue