Skip to content

Commit

Permalink
Fix path handling when frozen (__file__ should be avoided in the futu…
Browse files Browse the repository at this point in the history
…re, this is a workaround)
  • Loading branch information
kliment committed Nov 18, 2011
1 parent 2bd2318 commit 8a4bdc9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions xybuttons.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import wx, os, math
from bufferedcanvas import *

def imagefile(filename):
return os.path.join(os.path.dirname(__file__), "images", filename)

def imagefile(filename):
if os.path.exists(os.path.join(os.path.dirname(__file__), "images", filename)):
return os.path.join(os.path.dirname(__file__), "images", filename)
else:
return os.path.join(os.path.split(os.path.split(__file__)[0])[0], "images", filename)

def sign(n):
if n < 0: return -1
elif n > 0: return 1
Expand Down Expand Up @@ -254,6 +258,8 @@ def OnKey(self, evt):
self.quadrant = 2
elif evt.GetKeyCode() == wx.WXK_RIGHT:
self.quadrant = 0
elif evt.GetKeyCode() == wx.WXK_SPACE:
pass
else:
evt.Skip()
return
Expand Down
7 changes: 6 additions & 1 deletion zbuttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
from bufferedcanvas import *

def imagefile(filename):
return os.path.join(os.path.dirname(__file__), "images", filename)
if os.path.exists(os.path.join(os.path.dirname(__file__), "images", filename)):
return os.path.join(os.path.dirname(__file__), "images", filename)
else:
return os.path.join(os.path.split(os.path.split(__file__)[0])[0], "images", filename)



def sign(n):
if n < 0: return -1
Expand Down

0 comments on commit 8a4bdc9

Please sign in to comment.