Demo cleanup and path issues.
other tweaks. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13775 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
# 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
|
||||
@@ -95,6 +95,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 +381,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 +472,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 +486,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) ))
|
||||
|
||||
|
||||
|
||||
|
@@ -1,10 +1,11 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.xrc import *
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
RESFILE = "data/resource_wdr.xrc"
|
||||
RESFILE = opj("data/resource_wdr.xrc")
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
|
@@ -294,7 +294,7 @@ class MyFrame(wxFrame):
|
||||
menu = wxMenu()
|
||||
#menu.Append(1010, "Internal", "Use internal dictionary", TRUE)
|
||||
menu.Append(1011, "ASCII File...")
|
||||
urls = [ 'wxPython home', 'http://alldunn.com/wxPython/main.html',
|
||||
urls = [ 'wxPython home', 'http://wxPython.org/',
|
||||
'slashdot.org', 'http://slashdot.org/',
|
||||
'cnn.com', 'http://cnn.com',
|
||||
'The New York Times', 'http://www.nytimes.com',
|
||||
|
@@ -5,6 +5,8 @@ from wxPython.wx import *
|
||||
from wxPython.html import *
|
||||
import wxPython.lib.wxpTag
|
||||
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
# This shows how to catch the OnLinkClicked non-event. (It's a virtual
|
||||
@@ -104,7 +106,7 @@ class TestHtmlPanel(wxPanel):
|
||||
|
||||
|
||||
def OnShowDefault(self, event):
|
||||
name = os.path.join(self.cwd, 'data/test.htm')
|
||||
name = os.path.join(self.cwd, opj('data/test.htm'))
|
||||
self.html.LoadPage(name)
|
||||
|
||||
|
||||
@@ -118,7 +120,7 @@ class TestHtmlPanel(wxPanel):
|
||||
|
||||
def OnWithWidgets(self, event):
|
||||
os.chdir(self.cwd)
|
||||
name = os.path.join(self.cwd, 'data/widgetTest.htm')
|
||||
name = os.path.join(self.cwd, opj('data/widgetTest.htm'))
|
||||
self.html.LoadPage(name)
|
||||
|
||||
|
||||
|
@@ -1,13 +1,14 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
bmp = wxImage('bitmaps/image.bmp', wxBITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
gif = wxImage('bitmaps/image.gif', wxBITMAP_TYPE_GIF).ConvertToBitmap()
|
||||
png = wxImage('bitmaps/image.png', wxBITMAP_TYPE_PNG).ConvertToBitmap()
|
||||
jpg = wxImage('bitmaps/image.jpg', wxBITMAP_TYPE_JPEG).ConvertToBitmap()
|
||||
bmp = wxImage(opj('bitmaps/image.bmp'), wxBITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
gif = wxImage(opj('bitmaps/image.gif'), wxBITMAP_TYPE_GIF).ConvertToBitmap()
|
||||
png = wxImage(opj('bitmaps/image.png'), wxBITMAP_TYPE_PNG).ConvertToBitmap()
|
||||
jpg = wxImage(opj('bitmaps/image.jpg'), wxBITMAP_TYPE_JPEG).ConvertToBitmap()
|
||||
|
||||
panel = wxPanel(nb, -1)
|
||||
pos = 10
|
||||
|
@@ -2,6 +2,7 @@
|
||||
import pprint, string, os
|
||||
from wxPython.wx import *
|
||||
from mimetypes_wdr import *
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -166,7 +167,7 @@ overview = """\
|
||||
import mimetypes_wdr
|
||||
|
||||
def MyBitmapsFunc( index ):
|
||||
return wxImage( "bitmaps/noicon.png", wxBITMAP_TYPE_PNG ).ConvertToBitmap()
|
||||
return wxImage( opj("bitmaps/noicon.png"), wxBITMAP_TYPE_PNG ).ConvertToBitmap()
|
||||
|
||||
mimetypes_wdr.MyBitmapsFunc = MyBitmapsFunc
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
import string
|
||||
import images
|
||||
@@ -24,7 +25,7 @@ class TestPanel(wxPanel):
|
||||
# (lots of colors so it explodes in size and takes a noticable
|
||||
# amount of time to convert back to a bitmap.) So we'll just
|
||||
# do it the old way
|
||||
bmp = wxBitmap('bitmaps/robin.jpg', wxBITMAP_TYPE_JPEG)
|
||||
bmp = wxBitmap(opj('bitmaps/robin.jpg'), wxBITMAP_TYPE_JPEG)
|
||||
wxStaticBitmap(self, -1, bmp, (80, 150))
|
||||
|
||||
wxStaticText(self, -1, "Hey, if Ousterhout can do it, so can I.",
|
||||
|
@@ -1,5 +1,6 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from Main import opj
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -15,9 +16,9 @@ class TestPanel(wxPanel):
|
||||
try:
|
||||
import time
|
||||
if int(time.time()) % 2 == 1:
|
||||
wave = wxWave('data/anykey.wav')
|
||||
wave = wxWave(opj('data/anykey.wav'))
|
||||
else:
|
||||
wave = wxWave('data/plan.wav')
|
||||
wave = wxWave(opj('data/plan.wav'))
|
||||
wave.Play()
|
||||
except NotImplementedError, v:
|
||||
wxMessageBox(str(v), "Exception Message")
|
||||
|
Reference in New Issue
Block a user