# 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
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):
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)
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)
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) ))
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):
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',
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
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)
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)
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
import pprint, string, os
from wxPython.wx import *
from mimetypes_wdr import *
+from Main import opj
#----------------------------------------------------------------------------
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
from wxPython.wx import *
+from Main import opj
import string
import images
# (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.",
from wxPython.wx import *
+from Main import opj
#----------------------------------------------------------------------
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")
'%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,
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) {
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; }
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)
{
_arg3 = &temp;
_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;
Py_INCREF(Py_None);
_resultobj = Py_None;
}
-{
- if (_obj2)
- delete _arg2;
-}
-{
- if (_obj6)
- delete _arg6;
-}
return _resultobj;
}
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; }
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)
{
_arg4 = &temp;
_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;
}
#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 };
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- _result = (wxWindow *)wxHtmlWinParser_GetWindow(_arg0);
+ _result = (wxHtmlWindow *)wxHtmlWinParser_GetWindow(_arg0);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) return NULL;
%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); }