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")
|
||||
|
@@ -705,6 +705,7 @@ if not GL_ONLY and BUILD_XRC:
|
||||
'%s/xh_frame.cpp' % XMLLOC,
|
||||
|
||||
'%s/xh_gauge.cpp' % XMLLOC,
|
||||
'%s/xh_gdctl.cpp' % XMLLOC,
|
||||
'%s/xh_html.cpp' % XMLLOC,
|
||||
'%s/xh_listb.cpp' % XMLLOC,
|
||||
'%s/xh_listc.cpp' % XMLLOC,
|
||||
|
@@ -146,7 +146,7 @@ public:
|
||||
wxDC* GetDC();
|
||||
int GetCharHeight();
|
||||
int GetCharWidth();
|
||||
wxWindow* GetWindow();
|
||||
wxHtmlWindow* GetWindow();
|
||||
//void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
|
||||
%addmethods {
|
||||
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
|
||||
|
@@ -10025,25 +10025,23 @@ static PyObject *_wrap_new_wxGenericDirCtrl(PyObject *self, PyObject *args, PyOb
|
||||
wxGenericDirCtrl * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxString * _arg2 = (wxString *) &wxDirDialogDefaultFolderStr;
|
||||
char * _arg2 = (char *) wxDirDialogDefaultFolderStr;
|
||||
wxPoint * _arg3 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg4 = (wxSize *) &wxDefaultSize;
|
||||
long _arg5 = (long ) (wxDIRCTRL_3D_INTERNAL)|wxSUNKEN_BORDER;
|
||||
wxString * _arg6 = (wxString *) &wxEmptyString;
|
||||
char * _arg6 = (char *) wxEmptyString;
|
||||
int _arg7 = (int ) 0;
|
||||
char * _arg8 = (char *) "dirCtrl";
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj3 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj4 = 0;
|
||||
PyObject * _obj6 = 0;
|
||||
char *_kwnames[] = { "parent","id","dir","pos","size","style","filter","defaultFilter","name", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOOlOis:new_wxGenericDirCtrl",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_arg5,&_obj6,&_arg7,&_arg8))
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|isOOlsis:new_wxGenericDirCtrl",_kwnames,&_argo0,&_arg1,&_arg2,&_obj3,&_obj4,&_arg5,&_arg6,&_arg7,&_arg8))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
@@ -10051,25 +10049,6 @@ static PyObject *_wrap_new_wxGenericDirCtrl(PyObject *self, PyObject *args, PyOb
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxGenericDirCtrl. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg2 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj2)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
|
||||
#endif
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
@@ -10082,29 +10061,10 @@ static PyObject *_wrap_new_wxGenericDirCtrl(PyObject *self, PyObject *args, PyOb
|
||||
_arg4 = &temp0;
|
||||
if (! wxSize_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj6)
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj6) && !PyUnicode_Check(_obj6)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj6, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg6 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj6)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg6 = new wxString(PyString_AS_STRING(_obj6), PyString_GET_SIZE(_obj6));
|
||||
#endif
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxGenericDirCtrl *)new_wxGenericDirCtrl(_arg0,_arg1,*_arg2,*_arg3,*_arg4,_arg5,*_arg6,_arg7,_arg8);
|
||||
_result = (wxGenericDirCtrl *)new_wxGenericDirCtrl(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,_arg6,_arg7,_arg8);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
@@ -10115,14 +10075,6 @@ static PyObject *_wrap_new_wxGenericDirCtrl(PyObject *self, PyObject *args, PyOb
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
{
|
||||
if (_obj6)
|
||||
delete _arg6;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
@@ -10159,25 +10111,23 @@ static PyObject *_wrap_wxGenericDirCtrl_Create(PyObject *self, PyObject *args, P
|
||||
wxGenericDirCtrl * _arg0;
|
||||
wxWindow * _arg1;
|
||||
wxWindowID _arg2 = (wxWindowID ) -1;
|
||||
wxString * _arg3 = (wxString *) &wxDirDialogDefaultFolderStr;
|
||||
char * _arg3 = (char *) wxDirDialogDefaultFolderStr;
|
||||
wxPoint * _arg4 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg5 = (wxSize *) &wxDefaultSize;
|
||||
long _arg6 = (long ) (wxDIRCTRL_3D_INTERNAL)|wxSUNKEN_BORDER;
|
||||
wxString * _arg7 = (wxString *) &wxEmptyString;
|
||||
char * _arg7 = (char *) wxEmptyString;
|
||||
int _arg8 = (int ) 0;
|
||||
char * _arg9 = (char *) "dirCtrl";
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _argo1 = 0;
|
||||
PyObject * _obj3 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj4 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj5 = 0;
|
||||
PyObject * _obj7 = 0;
|
||||
char *_kwnames[] = { "self","parent","id","dir","pos","size","style","filter","defaultFilter","name", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|iOOOlOis:wxGenericDirCtrl_Create",_kwnames,&_argo0,&_argo1,&_arg2,&_obj3,&_obj4,&_obj5,&_arg6,&_obj7,&_arg8,&_arg9))
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO|isOOlsis:wxGenericDirCtrl_Create",_kwnames,&_argo0,&_argo1,&_arg2,&_arg3,&_obj4,&_obj5,&_arg6,&_arg7,&_arg8,&_arg9))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
@@ -10192,25 +10142,6 @@ static PyObject *_wrap_wxGenericDirCtrl_Create(PyObject *self, PyObject *args, P
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxGenericDirCtrl_Create. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj3) && !PyUnicode_Check(_obj3)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj3, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg3 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj3)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg3 = new wxString(PyString_AS_STRING(_obj3), PyString_GET_SIZE(_obj3));
|
||||
#endif
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
@@ -10223,41 +10154,14 @@ static PyObject *_wrap_wxGenericDirCtrl_Create(PyObject *self, PyObject *args, P
|
||||
_arg5 = &temp0;
|
||||
if (! wxSize_helper(_obj5, &_arg5))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj7)
|
||||
{
|
||||
#if PYTHON_API_VERSION >= 1009
|
||||
char* tmpPtr; int tmpSize;
|
||||
if (!PyString_Check(_obj7) && !PyUnicode_Check(_obj7)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
if (PyString_AsStringAndSize(_obj7, &tmpPtr, &tmpSize) == -1)
|
||||
return NULL;
|
||||
_arg7 = new wxString(tmpPtr, tmpSize);
|
||||
#else
|
||||
if (!PyString_Check(_obj7)) {
|
||||
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
|
||||
return NULL;
|
||||
}
|
||||
_arg7 = new wxString(PyString_AS_STRING(_obj7), PyString_GET_SIZE(_obj7));
|
||||
#endif
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxGenericDirCtrl_Create(_arg0,_arg1,_arg2,*_arg3,*_arg4,*_arg5,_arg6,*_arg7,_arg8,_arg9);
|
||||
_result = (bool )wxGenericDirCtrl_Create(_arg0,_arg1,_arg2,_arg3,*_arg4,*_arg5,_arg6,_arg7,_arg8,_arg9);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (_obj3)
|
||||
delete _arg3;
|
||||
}
|
||||
{
|
||||
if (_obj7)
|
||||
delete _arg7;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
|
@@ -1495,7 +1495,7 @@ static PyObject *_wrap_wxHtmlWinParser_GetCharWidth(PyObject *self, PyObject *ar
|
||||
#define wxHtmlWinParser_GetWindow(_swigobj) (_swigobj->GetWindow())
|
||||
static PyObject *_wrap_wxHtmlWinParser_GetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxHtmlWindow * _result;
|
||||
wxHtmlWinParser * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
@@ -1512,7 +1512,7 @@ static PyObject *_wrap_wxHtmlWinParser_GetWindow(PyObject *self, PyObject *args,
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxHtmlWinParser_GetWindow(_arg0);
|
||||
_result = (wxHtmlWindow *)wxHtmlWinParser_GetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
|
@@ -391,6 +391,7 @@
|
||||
%typemap(python, out) wxToolBar* { $target = wxPyMake_wxObject($source); }
|
||||
%typemap(python, out) wxToolBarBase* { $target = wxPyMake_wxObject($source); }
|
||||
%typemap(python, out) wxWindow* { $target = wxPyMake_wxObject($source); }
|
||||
%typemap(python, out) wxHtmlWindow* { $target = wxPyMake_wxObject($source); }
|
||||
|
||||
%typemap(python, out) wxSizer* { $target = wxPyMake_wxSizer($source); }
|
||||
|
||||
|
Reference in New Issue
Block a user