diff --git a/MANIFEST.in b/MANIFEST.in index 6fca5c92..5c619d34 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -30,14 +30,14 @@ include data/pysol.xbm data/pysol.xpm data/pysol.ico #graft data/music #include data/music/Astral_Dreams.COPYRIGHT #include data/music/Astral_Dreams.it -include data/music/Bye_For_Now.COPYRIGHT -include data/music/Bye_For_Now.s3m +#include data/music/Bye_For_Now.COPYRIGHT +#include data/music/Bye_For_Now.s3m #include data/music/Past_and_Future.COPYRIGHT #include data/music/Past_and_Future.it -include data/music/Ranger_Song.COPYRIGHT -include data/music/Ranger_Song.s3m -include data/music/Subsequential.COPYRIGHT -include data/music/Subsequential.mod +#include data/music/Ranger_Song.COPYRIGHT +#include data/music/Ranger_Song.s3m +#include data/music/Subsequential.COPYRIGHT +#include data/music/Subsequential.mod graft data/sound ## ## data - i18n diff --git a/pysollib/app.py b/pysollib/app.py index 03427760..d1621159 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -200,7 +200,7 @@ class Options: self.games_geometry = {} # saved games geometry (gameid: (width, height)) # self.splashscreen = True - self.sticky_mouse = False + self.mouse_type = 'drag-n-drop' # or 'sticky-mouse' or 'point-n-click' self.mouse_undo = False # use mouse for undo/redo self.negative_bottom = False self.randomize_place = False diff --git a/pysollib/games/pushpin.py b/pysollib/games/pushpin.py index f0710104..2f9d521e 100644 --- a/pysollib/games/pushpin.py +++ b/pysollib/games/pushpin.py @@ -64,7 +64,7 @@ class PushPin_Talon(DealRowTalonStack): return self.dealRowAvail(rows=[r], sound=sound) return self.dealRowAvail(rows=[self.game.s.rows[0]], sound=sound) def getBottomImage(self): - return None + return self.game.app.images.getBlankBottom() class PushPin_RowStack(ReserveStack): @@ -119,7 +119,7 @@ class PushPin_RowStack(ReserveStack): game.leaveState(old_state) def getBottomImage(self): - return None + return self.game.app.images.getBlankBottom() class PushPin(Game): diff --git a/pysollib/games/ultra/matrix.py b/pysollib/games/ultra/matrix.py index b20304aa..b36ce233 100644 --- a/pysollib/games/ultra/matrix.py +++ b/pysollib/games/ultra/matrix.py @@ -103,7 +103,7 @@ class Matrix_RowStack(OpenStack): bind(self.group, "", self._Stack__controlclickEventHandler) def getBottomImage(self): - return None + return self.game.app.images.getBlankBottom() def blockMap(self): ncards = self.game.gameinfo.ncards diff --git a/pysollib/images.py b/pysollib/images.py index 3a2995a4..264a21ac 100644 --- a/pysollib/images.py +++ b/pysollib/images.py @@ -86,6 +86,7 @@ class Images: self._bottom = [] self._bottom_negative = [] self._bottom_positive = [] + self._blank_bottom = None self._letter = [] self._letter_negative = [] self._letter_positive = [] @@ -139,6 +140,7 @@ class Images: if bottom is None: bottom = createImage(self.CARDW, self.CARDH, fill=None, outline="#ffffff") self._letter_negative.append(bottom) + self._blank_bottom = createImage(self.CARDW, self.CARDH, fill=None, outline=None) def load(self, app, progress=None, fast=0): ##fast = 1 @@ -240,6 +242,9 @@ class Images: def getReserveBottom(self): return self._bottom[0] + def getBlankBottom(self): + return self._blank_bottom + def getSuitBottom(self, suit=-1): assert type(suit) is types.IntType if suit == -1: return self._bottom[1] # any suit diff --git a/pysollib/pysolaudio.py b/pysollib/pysolaudio.py index 7ca18fd2..3363c625 100644 --- a/pysollib/pysolaudio.py +++ b/pysollib/pysolaudio.py @@ -495,7 +495,7 @@ class PyGameAudioClient(AbstractAudioClient): if self.time: self.time.wait(300) except: - if traceback: traceback.print_exc() + ##if traceback: traceback.print_exc() self.time.wait(1000) def _destroy(self): diff --git a/pysollib/pysolgtk/menubar.py b/pysollib/pysolgtk/menubar.py index 79b859d1..1e0beb51 100644 --- a/pysollib/pysolgtk/menubar.py +++ b/pysollib/pysolgtk/menubar.py @@ -156,6 +156,7 @@ class PysolMenubar(PysolMenubarActions): ('assistlevel', None, ltk2gtk('Assist &level')), ('automaticplay', None, ltk2gtk('&Automatic play')), ('animations', None, ltk2gtk('A&nimations')), + ('mouse', None, ltk2gtk('&Mouse')), ('cardview', None, ltk2gtk('Card &view')), ('toolbar', None, ltk2gtk('&Toolbar')), ('statusbar', None, ltk2gtk('Stat&usbar')), @@ -269,7 +270,6 @@ class PysolMenubar(PysolMenubarActions): ('Shade &legal moves', '', 'shade', False), ('Shrink face-down cards', '', 'shrink_face_down', True), ('Shade &filled stacks', '', 'shade_filled_stacks', True), - ('Stick&y mouse', '', 'sticky_mouse', False), ('Show &number of cards', '', 'num_cards', False), ('&Demo logo', '', 'demo_logo', False), ('Startup splash sc&reen', '', 'splashscreen', False), @@ -293,6 +293,11 @@ class PysolMenubar(PysolMenubarActions): ('animationslow', None, ltk2gtk('&Slow'), None, None, 3), ('animationveryslow', None, ltk2gtk('&Very slow'), None, None, 4), ) + mouse_entries = ( + ('draganddrop', None, ltk2gtk('&Drag-and-Drop'), None, None, 0), + ('pointandclick', None, ltk2gtk('&Point-and-Click'), None, None, 1), + ('stickymouse', None, ltk2gtk('&Sticky mouse'), None, None, 2), + ) toolbar_side_entries = ( ('toolbarhide', None, ltk2gtk('Hide'), None, None, 0), ('toolbartop', None, ltk2gtk('Top'), None, None, 1), @@ -394,7 +399,11 @@ class PysolMenubar(PysolMenubarActions): - + + + + + @@ -434,6 +443,10 @@ class PysolMenubar(PysolMenubarActions): action_group.add_radio_actions(animations_entries, self.app.opt.animations, self.mOptAnimations) + t = ['drag-n-drop', 'point-n-click', 'sticky-mouse'].index(self.app.opt.mouse_type) + action_group.add_radio_actions(mouse_entries, + t, + self.mOptMouseType) action_group.add_radio_actions(toolbar_side_entries, self.app.opt.toolbar, self.mOptToolbar) @@ -837,6 +850,12 @@ class PysolMenubar(PysolMenubarActions): self.app.opt.animations = w1.get_current_value() + def mOptMouseType(self, w1, w2): + v = w1.get_current_value() + t = ('drag-n-drop', 'point-n-click', 'sticky-mouse')[v] + self.app.opt.mouse_type = t + + def mOptToolbar(self, w1, w2): if self._cancelDrag(break_pause=False): return side = w1.get_current_value() diff --git a/pysollib/pysolgtk/tkcanvas.py b/pysollib/pysolgtk/tkcanvas.py index da2dd8ff..839370fe 100644 --- a/pysollib/pysolgtk/tkcanvas.py +++ b/pysollib/pysolgtk/tkcanvas.py @@ -368,6 +368,8 @@ class MfxCanvas(gnome.canvas.Canvas): elif k == 'cursor': if not self.window: self.realize() + if v == '': + v = gdk.LEFT_PTR self.window.set_cursor(gdk.Cursor(v)) elif k == 'height': height = v diff --git a/pysollib/pysolgtk/tkconst.py b/pysollib/pysolgtk/tkconst.py index d7a36b1e..b0a78d70 100644 --- a/pysollib/pysolgtk/tkconst.py +++ b/pysollib/pysolgtk/tkconst.py @@ -48,8 +48,9 @@ tkversion = (0, 0, 0, 0) EVENT_HANDLED = 1 EVENT_PROPAGATE = 0 -CURSOR_DRAG = gdk.HAND1 -CURSOR_WATCH = gdk.WATCH +CURSOR_DRAG = gdk.HAND1 +CURSOR_WATCH = gdk.WATCH +CURSOR_UP_ARROW = gdk.SB_UP_ARROW TOOLBAR_BUTTONS = ( "new", diff --git a/pysollib/stack.py b/pysollib/stack.py index d65103de..117feda7 100644 --- a/pysollib/stack.py +++ b/pysollib/stack.py @@ -100,10 +100,10 @@ from util import ACE, KING, SUITS from util import ANY_SUIT, ANY_COLOR, ANY_RANK, NO_RANK from util import NO_REDEAL, UNLIMITED_REDEALS, VARIABLE_REDEALS from pysoltk import EVENT_HANDLED, EVENT_PROPAGATE -from pysoltk import CURSOR_DRAG, ANCHOR_NW, ANCHOR_SE +from pysoltk import CURSOR_DRAG, CURSOR_UP_ARROW, ANCHOR_NW, ANCHOR_SE from pysoltk import bind, unbind_destroy from pysoltk import after, after_idle, after_cancel -from pysoltk import MfxCanvasGroup, MfxCanvasImage, MfxCanvasRectangle, MfxCanvasText +from pysoltk import MfxCanvasGroup, MfxCanvasImage, MfxCanvasRectangle, MfxCanvasText, MfxCanvasLine from pysoltk import Card from pysoltk import get_text_width from settings import TOOLKIT @@ -315,6 +315,7 @@ class Stack: view.is_open = -1 view.can_hide_cards = -1 view.max_shadow_cards = -1 + view.cursor_changed = False def destruct(self): # help breaking circular references @@ -396,8 +397,8 @@ class Stack: assert self.is_visible and self.images.bottom is None img = self.getBottomImage() if img is not None: - self.images.bottom = MfxCanvasImage(self.canvas,self.x, self.y, - image=img,anchor=ANCHOR_NW, + self.images.bottom = MfxCanvasImage(self.canvas, self.x, self.y, + image=img, anchor=ANCHOR_NW, group=self.group) self.top_bottom = self.images.bottom @@ -697,7 +698,7 @@ class Stack: # def getBottomImage(self): - return None + return self.game.app.images.getBlankBottom() def getPositionFor(self, card): model, view = self, self @@ -920,7 +921,8 @@ class Stack: if drag.cards: if sound: self.game.playSample("nomove") - self.moveCardsBackHandler(event, drag) + if not self.game.app.opt.mouse_type == 'point-n-click': + self.moveCardsBackHandler(event, drag) def moveCardsBackHandler(self, event, drag): for card in drag.cards: @@ -950,17 +952,17 @@ class Stack: return EVENT_HANDLED def __clickEventHandler(self, event): - if self.game.app.opt.sticky_mouse: + if self.game.app.opt.mouse_type == 'drag-n-drop': + cancel_drag = 1 + start_drag = 1 + handler = self.clickHandler + else: # sticky-mouse or point-n-click cancel_drag = 0 start_drag = not self.game.drag.stack if start_drag: handler = self.clickHandler else: handler = self.finishDrag - else: - cancel_drag = 1 - start_drag = 1 - handler = self.clickHandler return self.__defaultClickEventHandler(event, handler, start_drag, cancel_drag) def __doubleclickEventHandler(self, event): @@ -986,8 +988,11 @@ class Stack: return EVENT_PROPAGATE if self.game.demo: self.game.stopDemo(event) - if self.game.busy: return EVENT_HANDLED - if not self.game.app.opt.sticky_mouse and TOOLKIT == 'tk': + if self.game.busy: + return EVENT_HANDLED + if self.game.app.opt.mouse_type == 'point-n-click': + return EVENT_HANDLED + if self.game.app.opt.mouse_type == 'drag-n-drop' and TOOLKIT == 'tk': # use a timer to update the drag # this allows us to skip redraws on slow machines drag = self.game.drag @@ -1003,14 +1008,21 @@ class Stack: if self.game.demo: self.game.stopDemo(event) self.game.interruptSleep() - if self.game.busy: return EVENT_HANDLED - if not self.game.app.opt.sticky_mouse: + if self.game.busy: + return EVENT_HANDLED + if self.game.app.opt.mouse_type == 'drag-n-drop': self.keepDrag(event) self.finishDrag(event) return EVENT_HANDLED def __enterEventHandler(self, event): - if not self.game.drag.stack: + if self.game.drag.stack: + if self.game.app.opt.mouse_type == 'point-n-click': + if self.acceptsCards(self.game.drag.stack, + self.game.drag.cards): + self.game.canvas.config(cursor=CURSOR_UP_ARROW) + self.cursor_changed = True + else: after_idle(self.canvas, self.game.showHelp, 'help', self.getHelp(), ##+' '+self.getBaseCard(), 'info', self.getNumCards()) @@ -1019,8 +1031,11 @@ class Stack: def __leaveEventHandler(self, event): if not self.game.drag.stack: after_idle(self.canvas, self.game.showHelp) - if not self.game.app.opt.sticky_mouse: + if self.game.app.opt.mouse_type == 'drag-n-drop': return EVENT_HANDLED + if self.cursor_changed: + self.game.canvas.config(cursor='') + self.cursor_changed = False drag_stack = self.game.drag.stack if self is drag_stack: x, y = event.x, event.y @@ -1066,6 +1081,9 @@ class Stack: drag.noshade_stacks = [ self ] drag.cards = self.getDragCards(i) drag.index = i + if self.game.app.opt.mouse_type == 'point-n-click': + self._markCards(drag) + return ##if TOOLKIT == 'gtk': ## drag.stack.group.tkraise() images = game.app.images @@ -1073,7 +1091,7 @@ class Stack: ##sx, sy = 0, 0 sx, sy = -images.SHADOW_XOFFSET, -images.SHADOW_YOFFSET dx, dy = 0, 0 - if game.app.opt.sticky_mouse: + if game.app.opt.mouse_type == 'sticky-mouse': # return cards under mouse dx = event.x - (x_offset+images.CARDW+sx) - game.canvas.xmargin dy = event.y - (y_offset+images.CARDH+sy) - game.canvas.ymargin @@ -1271,6 +1289,79 @@ class Stack: self.items.shade_item.delete() self.items.shade_item = None + + def _markCards(self, drag): + cards = drag.cards + drag.stack.group.tkraise() + # + x0, y0 = self.getPositionFor(cards[0]) + x1, y1 = self.getPositionFor(cards[-1]) + x1 = x1 + self.game.app.images.CARDW + y1 = y1 + self.game.app.images.CARDH + xx0, yy0 = x0, y0 + w, h = x1-x0, y1-y0 + m = max(w, h) + # + Image = None + if TOOLKIT == 'tk': + try: + import Image, ImageTk + from ImageDraw import ImageDraw + except ImportError: + pass + ##Image = None + if TOOLKIT == 'gtk' or not Image: + color = self.game.app.opt.colors['cards_1'] + r = MfxCanvasRectangle(self.canvas, xx0, yy0, xx0+w, yy0+h, + fill="", outline=color, width=4, + group=self.group) + drag.shadows.append(r) +## l = MfxCanvasLine(self.canvas, xx0, yy0, xx0+w, yy0+h, +## fill=color, width=4) +## drag.shadows.append(l) +## l = MfxCanvasLine(self.canvas, xx0, yy0+h, xx0+w, yy0, +## fill=color, width=4) +## drag.shadows.append(l) + return + # + mask = Image.new('RGBA', (w, h)) + for c in cards: + x, y = self.getPositionFor(c) + x, y = x-xx0, y-yy0 + im = c.item._image._pil_image + mask.paste(im, (x, y), im) + # + shade = Image.new('RGBA', (w, h)) + draw = ImageDraw(shade, 'RGBA') + color = 'black' + d = 8 +## y0, y1 = 0, h +## for x0 in range(-m, m, d): +## x1 = x0+h +## draw.line((x0, y0, x1, y1), fill=color, width=1) +## draw.line((x1, y0, x0, y1), fill=color, width=1) + for i in xrange(0, m, d): + x0, x1 = i, m + y0, y1 = 0, m-i + draw.line((x0, y0, x1, y1), fill=color, width=1) + x0, x1 = 0, m-i + y0, y1 = i, m + draw.line((x0, y0, x1, y1), fill=color, width=1) + x0, x1 = m-i, 0 + y0, y1 = 0, m-i + draw.line((x0, y0, x1, y1), fill=color, width=1) + x0, x1 = m, i + y0, y1 = i, m + draw.line((x0, y0, x1, y1), fill=color, width=1) + + sh2 = Image.composite(shade, mask, mask) + tkshade = ImageTk.PhotoImage(sh2) + im = MfxCanvasImage(self.game.canvas, xx0, yy0, + image=tkshade, anchor=ANCHOR_NW, + group=self.group) + drag.shadows.append(im) + + def _stopDrag(self): drag = self.game.drag after_cancel(drag.timer) @@ -1294,8 +1385,11 @@ class Stack: drag = self.game.drag.copy() self._stopDrag() if drag.cards: - assert drag.stack is self - self.releaseHandler(event, drag) + if self.game.app.opt.mouse_type == 'point-n-click': + self.releaseHandler(event, drag) + else: + assert drag.stack is self + self.releaseHandler(event, drag) # cancel a drag operation def cancelDrag(self, event=None): @@ -1771,7 +1865,10 @@ class OpenStack(Stack): return 0 def dragMove(self, drag, stack, sound=1): - self.playMoveMove(len(drag.cards), stack, frames=0, sound=sound) + if self.game.app.opt.mouse_type == 'point-n-click': + self.playMoveMove(len(drag.cards), stack, sound=sound) + else: + self.playMoveMove(len(drag.cards), stack, frames=0, sound=sound) def releaseHandler(self, event, drag, sound=1): cards = drag.cards @@ -1784,15 +1881,21 @@ class OpenStack(Stack): return ##print dx, dy # get destination stack - stack = self.game.getClosestStack(cards[0], self) + if self.game.app.opt.mouse_type == 'point-n-click': + from_stack = drag.stack + to_stack = self + else: + from_stack = self + to_stack = self.game.getClosestStack(cards[0], self) # move cards - if not stack or stack is self or not stack.acceptsCards(self, cards): + if (not to_stack or from_stack is to_stack or + not to_stack.acceptsCards(from_stack, cards)): # move cards back to their origin stack Stack.releaseHandler(self, event, drag, sound=sound) else: # this code actually moves the cards to the new stack ##self.playMoveMove(len(cards), stack, frames=0, sound=sound) - self.dragMove(drag, stack, sound=sound) + from_stack.dragMove(drag, to_stack, sound=sound) def quickPlayHandler(self, event, from_stacks=None, to_stacks=None): # from_stacks and to_stacks are meant for possible diff --git a/pysollib/tk/menubar.py b/pysollib/tk/menubar.py index b7303f45..cbd315f9 100644 --- a/pysollib/tk/menubar.py +++ b/pysollib/tk/menubar.py @@ -258,7 +258,7 @@ class PysolMenubar(PysolMenubarActions): save_games_geometry = MfxCheckMenuItem(self), splashscreen = MfxCheckMenuItem(self), demo_logo = MfxCheckMenuItem(self), - sticky_mouse = MfxCheckMenuItem(self), + mouse_type = StringVar(), mouse_undo = MfxCheckMenuItem(self), negative_bottom = MfxCheckMenuItem(self), pause = MfxCheckMenuItem(self), @@ -303,7 +303,7 @@ class PysolMenubar(PysolMenubarActions): tkopt.save_games_geometry.set(opt.save_games_geometry) tkopt.demo_logo.set(opt.demo_logo) tkopt.splashscreen.set(opt.splashscreen) - tkopt.sticky_mouse.set(opt.sticky_mouse) + tkopt.mouse_type.set(opt.mouse_type) tkopt.mouse_undo.set(opt.mouse_undo) tkopt.negative_bottom.set(opt.negative_bottom) for w in TOOLBAR_BUTTONS: @@ -485,8 +485,12 @@ 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) - menu.add_checkbutton(label=n_("Stick&y mouse"), variable=self.tkopt.sticky_mouse, command=self.mOptStickyMouse) - menu.add_checkbutton(label=n_("Use mouse for undo/redo"), variable=self.tkopt.mouse_undo, command=self.mOptMouseUndo) + 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) + submenu.add_radiobutton(label=n_("&Sticky mouse"), variable=self.tkopt.mouse_type, value='sticky-mouse', command=self.mOptMouseType) + submenu.add_separator() + submenu.add_checkbutton(label=n_("Use mouse for undo/redo"), variable=self.tkopt.mouse_undo, command=self.mOptMouseUndo) menu.add_separator() menu.add_command(label=n_("&Fonts..."), command=self.mOptFonts) menu.add_command(label=n_("&Colors..."), command=self.mOptColors) @@ -1242,9 +1246,9 @@ class PysolMenubar(PysolMenubarActions): if self._cancelDrag(break_pause=False): return self.app.opt.splashscreen = self.tkopt.splashscreen.get() - def mOptStickyMouse(self, *event): + def mOptMouseType(self, *event): if self._cancelDrag(break_pause=False): return - self.app.opt.sticky_mouse = self.tkopt.sticky_mouse.get() + self.app.opt.mouse_type = self.tkopt.mouse_type.get() def mOptMouseUndo(self, *event): if self._cancelDrag(break_pause=False): return diff --git a/pysollib/tk/tkcanvas.py b/pysollib/tk/tkcanvas.py index 1b149a4e..855c35f8 100644 --- a/pysollib/tk/tkcanvas.py +++ b/pysollib/tk/tkcanvas.py @@ -82,6 +82,8 @@ class MfxCanvasImage(Canvas.ImageItem): if kwargs.has_key('group'): group = kwargs['group'] del kwargs['group'] + if kwargs.has_key('image'): + self._image = kwargs['image'] Canvas.ImageItem.__init__(self, canvas, *args, **kwargs) if group: self.addtag(group) @@ -262,7 +264,8 @@ class MfxCanvas(Tkinter.Canvas): ## for i in range(len(stack.cards)): ## if stack.cards[i].item.id in current: ## return i - x, y = event.x-self.xmargin, event.y-self.ymargin + x = event.x-self.xmargin+self.xview()[0]*int(self.cget('width')) + y = event.y-self.ymargin+self.yview()[0]*int(self.cget('height')) ##x, y = event.x, event.y items = list(self.find_overlapping(x,y,x,y)) items.reverse() @@ -334,8 +337,8 @@ class MfxCanvas(Tkinter.Canvas): ##ch = max(int(self.cget("height")), self.winfo_height()) ch = self.winfo_height() ###print iw, ih, cw, ch - x = (cw - iw) / 2 - y = (ch - ih) / 2 + x = (cw-iw)/2-self.xmargin+self.xview()[0]*int(self.cget('width')) + y = (ch-ih)/2-self.ymargin+self.yview()[0]*int(self.cget('height')) id = self._x_create("image", x, y, image=image, anchor="nw") self.tk.call(self._w, "raise", id) self.__tops.append(id) diff --git a/pysollib/tk/tkconst.py b/pysollib/tk/tkconst.py index f5fefcb1..fdd01cb1 100644 --- a/pysollib/tk/tkconst.py +++ b/pysollib/tk/tkconst.py @@ -39,6 +39,7 @@ __all__ = ['tkversion', 'EVENT_PROPAGATE', 'CURSOR_DRAG', 'CURSOR_WATCH', + 'CURSOR_UP_ARROW', 'ANCHOR_CENTER', 'ANCHOR_N', 'ANCHOR_NW', @@ -81,8 +82,9 @@ TK_DASH_PATCH = 0 EVENT_HANDLED = "break" EVENT_PROPAGATE = None -CURSOR_DRAG = "hand1" -CURSOR_WATCH = "watch" +CURSOR_DRAG = "hand1" +CURSOR_WATCH = "watch" +CURSOR_UP_ARROW = 'sb_up_arrow' ANCHOR_CENTER = Tkinter.CENTER ANCHOR_N = Tkinter.N diff --git a/scripts/build.bat b/scripts/build.bat index 50ff6bfb..cc9ed4cf 100755 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -5,11 +5,11 @@ rm -rf dist mkdir dist cp -r locale dist cp fc-solve.exe dist -cp smpeg.dll dist -cp ogg.dll dist -cp vorbis.dll dist -cp vorbisfile.dll dist +cp smpeg.dll ogg.dll vorbis.dll vorbisfile.dll dist python setup.py py2exe +cp -r data\music dist\data +rem rm -rf dist\tcl\tcl8.4\encoding +rem rm -rf dist\tcl\tk8.4\demos dist\tcl\tk8.4\images python scripts\create_iss.py "d:\Program Files\Inno Setup 5\ISCC.exe" setup.iss pause diff --git a/setup.py b/setup.py index 7b418d89..e10c2ae1 100644 --- a/setup.py +++ b/setup.py @@ -24,28 +24,34 @@ datas = [ for s in file('MANIFEST.in'): if s.startswith('graft data/cardset-'): datas.append(s[11:].strip()) - elif s.startswith('include data/music/'): - datas.append(s[19:].strip()) + data_files = [] + for d in datas: for root, dirs, files in os.walk(os.path.join('data', d)): + if root.find('.svn') >= 0: + continue if files: #files = map(lambda f: os.path.join(root, f), files) files = [os.path.join(root, f) for f in files] data_files.append((os.path.join(data_dir, root[5:]), files)) + if os.name == 'posix': data_files.append(('share/pixmaps', ['data/pysol.xbm', 'data/pysol.xpm'])) for l in ('ru', 'ru_RU'): data_files.append(('share/locale/%s/LC_MESSAGES' % l, ['locale/%s/LC_MESSAGES/pysol.mo' % l])) -long_description = """\ +##from pprint import pprint; pprint(data_files) + +long_description = '''\ PySol is a solitaire card game. Its features include support for many different games, very nice look and feel, multiple cardsets and backgrounds, unlimited undo & redo, load & save games, player statistics, hint system, demo games, support for user written plug-ins, -integrated HTML help browser, and it's free Open Source software. -""" +integrated HTML help browser, and it\'s free Open Source software. +''' + kw = { 'name' : 'PySolFC', 'version' : VERSION, @@ -68,7 +74,7 @@ kw = { if os.name == 'nt': kw['windows'] = [{'script': 'pysol', - 'icon_resources': [(1, "data/pysol.ico")], }] + 'icon_resources': [(1, 'data/pysol.ico')], }] kw['packages'].remove('pysollib.pysolgtk') setup(**kw)