]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/Main.py
corrections to dynamic loading for Darwin
[wxWidgets.git] / wxPython / demo / Main.py
index 4ee72f29a1b556dce10b09d921a860e16cf071db..db8bd91947c28ebe2bc6916f933cfbcd8cd731b7 100644 (file)
@@ -11,9 +11,8 @@
 # Licence:      wxWindows license
 #----------------------------------------------------------------------------
 
-import sys, os, time
+import sys, os, time, string
 from   wxPython.wx import *
-from   wxPython.lib.splashscreen import SplashScreen
 from   wxPython.html import wxHtmlWindow
 
 import images
@@ -95,6 +94,13 @@ class MyLog(wxPyLog):
         self.tc.AppendText(message + '\n')
 
 
+#---------------------------------------------------------------------------
+
+def opj(path):
+    """Convert paths to the platform-specific separator"""
+    return apply(os.path.join, tuple(string.split(path, '/')))
+
+
 #---------------------------------------------------------------------------
 
 class wxPythonDemo(wxFrame):
@@ -374,7 +380,6 @@ class wxPythonDemo(wxFrame):
         lead = text[:6]
         if lead != '<html>' and lead != '<HTML>':
             text = string.join(string.split(text, '\n'), '<br>')
-            #text = '<font size="-1"><pre>' + text + '</pre></font>'
         self.ovr.SetPage(text)
         self.nb.SetPageText(0, name)
 
@@ -466,7 +471,7 @@ class wxPythonDemo(wxFrame):
 
 class MySplashScreen(wxSplashScreen):
     def __init__(self):
-        bmp = wxImage('bitmaps/splash.gif').ConvertToBitmap()
+        bmp = wxImage(opj("bitmaps/splash.gif")).ConvertToBitmap()
         wxSplashScreen.__init__(self, bmp,
                                 wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
                                 4000, None, -1)
@@ -480,15 +485,15 @@ class MySplashScreen(wxSplashScreen):
 
     def ShowTip(self, frame):
         try:
-            showTipText = open("data/showTips").read()
+            showTipText = open(opj("data/showTips")).read()
             showTip, index = eval(showTipText)
         except IOError:
             showTip, index = (1, 0)
         if showTip:
-            tp = wxCreateFileTipProvider("data/tips.txt", index)
+            tp = wxCreateFileTipProvider(opj("data/tips.txt"), index)
             showTip = wxShowTip(frame, tp)
             index = tp.GetCurrentTip()
-            open("data/showTips", "w").write(str( (showTip, index) ))
+            open(opj("data/showTips"), "w").write(str( (showTip, index) ))