From fd69d8a0ba2433c652d5e2d0fd9128fd5402c434 Mon Sep 17 00:00:00 2001 From: skomoroh Date: Sat, 16 Dec 2006 22:43:15 +0000 Subject: [PATCH] + 1 new game * bugs fixes git-svn-id: https://pysolfc.svn.sourceforge.net/svnroot/pysolfc/PySolFC/trunk@122 39dd0a4e-7c14-0410-91b3-c4f2d318f732 --- pysollib/app.py | 4 ++-- pysollib/games/__init__.py | 2 -- pysollib/games/yukon.py | 41 +++++++++++++++++++++++++++++++++++ pysollib/main.py | 5 ----- pysollib/pysolgtk/tkwrap.py | 7 +----- pysollib/tile/tkwrap.py | 1 + pysollib/tk/tkwrap.py | 1 + pysollib/tksettings/common.py | 3 --- 8 files changed, 46 insertions(+), 18 deletions(-) diff --git a/pysollib/app.py b/pysollib/app.py index ffd6097f..44321c96 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -513,11 +513,11 @@ class Application: # visual components self.top = None # the root toplevel window self.top_bg = None # default background - self.top_palette = [None, None] # from command line [fg, bg] self.top_cursor = None # default cursor self.menubar = None self.toolbar = None - self.canvas = None + self.canvas = None # MfxCanvas + self.scrolled_canvas = None # MfxScrolledCanvas self.statusbar = None # self.game = None diff --git a/pysollib/games/__init__.py b/pysollib/games/__init__.py index ffaa96c9..5bb03ec7 100644 --- a/pysollib/games/__init__.py +++ b/pysollib/games/__init__.py @@ -61,5 +61,3 @@ import wavemotion import windmill import yukon import zodiac -from ultra import * -from special import * \ No newline at end of file diff --git a/pysollib/games/yukon.py b/pysollib/games/yukon.py index ddeb02a7..3aea10b8 100644 --- a/pysollib/games/yukon.py +++ b/pysollib/games/yukon.py @@ -657,6 +657,45 @@ class Brisbane(Yukon): shallHighlightMatch = Game._shallHighlightMatch_RK +# /*********************************************************************** +# // Hawaiian +# ************************************************************************/ + +class Hawaiian(Game): + Hint_Class = Yukon_Hint + + def createGame(self, rows=10, playcards=20): + l, s = Layout(self), self.s + self.setSize(l.XM+max(rows, 8)*l.XS, + l.YM+2*l.YS+playcards*l.YOFFSET) + x, y = l.XM, l.YM + stack = OpenStack(x, y, self, max_move=1, max_accept=0) + s.reserves.append(stack) + l.createText(stack, 'ne') + x, y = self.width-8*l.XS, l.YM + for i in range(8): + s.foundations.append(SS_FoundationStack(x, y, self, suit=i/2)) + x += l.XS + x, y = self.width-rows*l.XS, l.YM+l.YS + for i in range(rows): + s.rows.append(Yukon_AC_RowStack(x, y, self)) + x += l.XS + x, y = l.XM, self.height-l.YS + s.talon = InitialDealTalonStack(x, y, self) + + l.defaultStackGroups() + + def startGame(self): + for i in range(104-5*10): + self.s.talon.dealRow(rows=self.s.reserves, frames=0) + for i in range(4): + self.s.talon.dealRow(frames=0) + self.startDealSample() + self.s.talon.dealRow() + + shallHighlightMatch = Game._shallHighlightMatch_AC + + # register the game registerGame(GameInfo(19, Yukon, "Yukon", @@ -716,3 +755,5 @@ registerGame(GameInfo(531, DoubleRussianSpider, "Double Russian Spider", GI.GT_SPIDER | GI.GT_ORIGINAL, 2, 0, GI.SL_BALANCED)) registerGame(GameInfo(603, Brisbane, "Brisbane", GI.GT_SPIDER, 1, 0, GI.SL_BALANCED)) +registerGame(GameInfo(707, Hawaiian, "Hawaiian", + GI.GT_2DECK_TYPE | GI.GT_ORIGINAL, 2, 0, GI.SL_BALANCED)) diff --git a/pysollib/main.py b/pysollib/main.py index ba52025a..d6f26d2c 100644 --- a/pysollib/main.py +++ b/pysollib/main.py @@ -124,9 +124,6 @@ def parse_option(argv): -g --game=GAMENAME start game GAMENAME -i --gameid=GAMEID --french-only - --fg --foreground=COLOR foreground color - --bg --background=COLOR background color - --fn --font=FONT default font --sound-mod=MOD --nosound disable sound support --noplugins disable load plugins @@ -186,7 +183,6 @@ def pysol_init(app, args): # init games database import games if not opts['french-only']: - #import games.contrib import games.ultra import games.mahjongg import games.special @@ -209,7 +205,6 @@ def pysol_init(app, args): top = MfxRoot(className=PACKAGE) app.top = top app.top_bg = top.cget("bg") - app.top_palette = [None, None] # [fg, bg] app.top_cursor = top.cget("cursor") # load options diff --git a/pysollib/pysolgtk/tkwrap.py b/pysollib/pysolgtk/tkwrap.py index d10ad38f..e0f1bacc 100644 --- a/pysollib/pysolgtk/tkwrap.py +++ b/pysollib/pysolgtk/tkwrap.py @@ -186,12 +186,6 @@ class _MfxToplevel(gtk.Window): pass ##~ self.set_geometry_hints(min_width=width, min_height=height) - def wm_protocol(self, name=None, func=None): - if name == 'WM_DELETE_WINDOW': - self.connect("delete_event", func) - else: - raise AttributeError, name - def wm_title(self, title): self.set_title(title) @@ -234,6 +228,7 @@ class MfxRoot(_MfxToplevel): def __init__(self, **kw): apply(_MfxToplevel.__init__, (self,), kw) self.app = None + self.connect("delete_event", self.wmDeleteWindow) def connectApp(self, app): self.app = app diff --git a/pysollib/tile/tkwrap.py b/pysollib/tile/tkwrap.py index 91ee928a..8ee643b9 100644 --- a/pysollib/tile/tkwrap.py +++ b/pysollib/tile/tkwrap.py @@ -89,6 +89,7 @@ class MfxRoot(Tkinter.Tk): def __init__(self, **kw): apply(Tkinter.Tk.__init__, (self,), kw) self.app = None + self.wm_protocol('WM_DELETE_WINDOW', self.wmDeleteWindow) # for interruptible sleep #self.sleep_var = Tkinter.IntVar(self) #self.sleep_var.set(0) diff --git a/pysollib/tk/tkwrap.py b/pysollib/tk/tkwrap.py index 582f752c..f86c958e 100644 --- a/pysollib/tk/tkwrap.py +++ b/pysollib/tk/tkwrap.py @@ -90,6 +90,7 @@ class MfxRoot(Tkinter.Tk): def __init__(self, **kw): apply(Tkinter.Tk.__init__, (self,), kw) self.app = None + self.wm_protocol('WM_DELETE_WINDOW', self.wmDeleteWindow) # for interruptible sleep #self.sleep_var = Tkinter.IntVar(self) #self.sleep_var.set(0) diff --git a/pysollib/tksettings/common.py b/pysollib/tksettings/common.py index df3ca402..82304259 100644 --- a/pysollib/tksettings/common.py +++ b/pysollib/tksettings/common.py @@ -56,9 +56,6 @@ class baseInitRootWindow: #root.wm_group(root) root.wm_title(PACKAGE + ' ' + VERSION) root.wm_iconname(PACKAGE + ' ' + VERSION) - - root.wm_protocol('WM_DELETE_WINDOW', root.wmDeleteWindow) - # set minsize sw, sh, sd = (root.winfo_screenwidth(), root.winfo_screenheight(),