diff --git a/wxPython/src/gtk/gdi.cpp b/wxPython/src/gtk/gdi.cpp index fcbd24f8b7..a021fa20d3 100644 --- a/wxPython/src/gtk/gdi.cpp +++ b/wxPython/src/gtk/gdi.cpp @@ -185,7 +185,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { } wxCursor* wxCursorFromImage(const wxImage& image) { + #ifndef __WXMAC__ return new wxCursor(image); + #else + return NULL; + #endif } // Alternate 'constructor' wxColour* wxNamedColour(const wxString& colorName) { diff --git a/wxPython/src/gtk/wx.cpp b/wxPython/src/gtk/wx.cpp index 9f3141e83d..950e26538c 100644 --- a/wxPython/src/gtk/wx.cpp +++ b/wxPython/src/gtk/wx.cpp @@ -1449,9 +1449,9 @@ static PyObject *_wrap_wxPyApp_Yield(PyObject *self, PyObject *args, PyObject *k PyObject * _resultobj; bool _result; wxPyApp * _arg0; - bool _arg1 = (bool ) (0); + bool _arg1 = (bool ) FALSE; PyObject * _argo0 = 0; - int tempbool1 = (int) (0); + int tempbool1 = (int) FALSE; char *_kwnames[] = { "self","onlyIfNeeded", NULL }; self = self; @@ -2575,10 +2575,6 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxHT_WINDOW_HORZ_SCROLLBAR", PyInt_FromLong((long) wxHT_WINDOW_HORZ_SCROLLBAR)); PyDict_SetItemString(d,"wxHT_WINDOW_CORNER", PyInt_FromLong((long) wxHT_WINDOW_CORNER)); PyDict_SetItemString(d,"wxHT_MAX", PyInt_FromLong((long) wxHT_MAX)); - PyDict_SetItemString(d,"FALSE", PyInt_FromLong((long) 0)); - PyDict_SetItemString(d,"false", PyInt_FromLong((long) 0)); - PyDict_SetItemString(d,"TRUE", PyInt_FromLong((long) 1)); - PyDict_SetItemString(d,"true", PyInt_FromLong((long) 1)); PyDict_SetItemString(d,"wxEVT_NULL", PyInt_FromLong((long) wxEVT_NULL)); PyDict_SetItemString(d,"wxEVT_FIRST", PyInt_FromLong((long) wxEVT_FIRST)); PyDict_SetItemString(d,"wxEVT_COMMAND_BUTTON_CLICKED", PyInt_FromLong((long) wxEVT_COMMAND_BUTTON_CLICKED)); diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index 42a661dc8c..8703a96f97 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -46,7 +46,7 @@ class wxPyAppPtr(wxEvtHandlerPtr): def __init__(self,this): self.this = this self.thisown = 0 - def __del__(self,delfunc=wxc.delete_wxPyApp): + def __del__(self, delfunc=wxc.delete_wxPyApp): if self.thisown == 1: delfunc(self) def _setCallbackInfo(self, *_args, **_kwargs): @@ -803,10 +803,6 @@ wxHT_WINDOW_VERT_SCROLLBAR = wxc.wxHT_WINDOW_VERT_SCROLLBAR wxHT_WINDOW_HORZ_SCROLLBAR = wxc.wxHT_WINDOW_HORZ_SCROLLBAR wxHT_WINDOW_CORNER = wxc.wxHT_WINDOW_CORNER wxHT_MAX = wxc.wxHT_MAX -FALSE = wxc.FALSE -false = wxc.false -TRUE = wxc.TRUE -true = wxc.true wxEVT_NULL = wxc.wxEVT_NULL wxEVT_FIRST = wxc.wxEVT_FIRST wxEVT_COMMAND_BUTTON_CLICKED = wxc.wxEVT_COMMAND_BUTTON_CLICKED @@ -1535,14 +1531,25 @@ wxPen = wxPyPen wxScrollbar = wxScrollBar wxPoint2D = wxPoint2DDouble +# Use Python's bool constants if available, make aliases if not +try: + True +except NameError: + True = 1==1 + False = 1==0 + + # backwards compatibility -wxNoRefBitmap = wxBitmap -wxPyDefaultPosition = wxDefaultPosition -wxPyDefaultSize = wxDefaultSize -NULL = None +wxNoRefBitmap = wxBitmap +wxPyDefaultPosition = wxDefaultPosition +wxPyDefaultSize = wxDefaultSize +NULL = None wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric +false = FALSE = False +true = TRUE = True + # workarounds for bad wxRTTI names __wxPyPtrTypeMap['wxGauge95'] = 'wxGauge' @@ -1619,8 +1626,8 @@ def wxPy_isinstance(obj, klasses): import types if sys.version[:3] < "2.2" and type(klasses) in [types.TupleType, types.ListType]: for klass in klasses: - if isinstance(obj, klass): return true - return false + if isinstance(obj, klass): return True + return False else: return isinstance(obj, klasses) @@ -1710,7 +1717,7 @@ class wxPyOnDemandOutputWindow: self.text = wxTextCtrl(self.frame, -1, "", style = wxTE_MULTILINE|wxTE_READONLY) self.frame.SetSize(wxSize(450, 300)) - self.frame.Show(true) + self.frame.Show(True) EVT_CLOSE(self.frame, self.OnCloseWindow) self.text.AppendText(str) @@ -1731,7 +1738,7 @@ class wxApp(wxPyApp): error = 'wxApp.error' outputWindowClass = wxPyOnDemandOutputWindow - def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=false): + def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False): wxPyApp.__init__(self) self.stdioWin = None self.saveStdio = (sys.stdout, sys.stderr) @@ -1783,7 +1790,7 @@ class wxPySimpleApp(wxApp): wxApp.__init__(self, flag) def OnInit(self): wxInitAllImageHandlers() - return true + return True class wxPyWidgetTester(wxApp): @@ -1794,11 +1801,11 @@ class wxPyWidgetTester(wxApp): def OnInit(self): self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size) self.SetTopWindow(self.frame) - return true + return True def SetWidget(self, widgetClass, *args): w = apply(widgetClass, (self.frame,) + args) - self.frame.Show(true) + self.frame.Show(True) #---------------------------------------------------------------------------- # DO NOT hold any other references to this object. This is how we