Added wxNotifyEvent.Allow()
+Fixed GOBS of reference leaks.
+
New in 2.2.2
shift
set CMD=%SETUP% %FLAGS% FINAL=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
+rem "h" --> HYBRID
+elseiff "%1" == "h" then
+ shift
+ set CMD=%SETUP% %FLAGS% HYBRID=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
+
rem (no command arg) --> normal build for development
else
- set CMD=%SETUP% %FLAGS% HYBRID=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
+ set CMD=%SETUP% %FLAGS% HYBRID=0 build_ext --inplace --debug %1 %2 %3 %4 %5 %6 %7 %8 %9
endiff
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_class_wxPyCircleShape","_wxPyCircleShape",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_class_wxPyCircleShape","_wxPyCircleShape",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxGauge","_class_wxGauge",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent},
{ "_class_wxCommandEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
menubar.Append(menu, "&File")
self.SetMenuBar(menubar)
- #self.CreateStatusBar()
+ self.CreateStatusBar()
EVT_MENU(self, 5000, self.OnNewWindow)
EVT_MENU(self, 5001, self.OnExit)
--- /dev/null
+#!/usr/bin/env python
+
+from wxPython.wx import *
+from wxScrolledWindow import MyCanvas
+
+#----------------------------------------------------------------------
+
+class MyParentFrame(wxMDIParentFrame):
+ ID_WINDOW_TOP = 5100
+ ID_WINDOW_LEFT1 = 5101
+ ID_WINDOW_LEFT2 = 5102
+ ID_WINDOW_BOTTOM = 5103
+
+ def __init__(self):
+ wxMDIParentFrame.__init__(self, None, -1, "MDI Parent", size=(600,400),
+ style = wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL)
+
+ self.winCount = 0
+ menu = wxMenu()
+ menu.Append(5000, "&New Window")
+ menu.AppendSeparator()
+ menu.Append(5001, "E&xit")
+
+ menubar = wxMenuBar()
+ menubar.Append(menu, "&File")
+ self.SetMenuBar(menubar)
+
+ #self.CreateStatusBar()
+
+ EVT_MENU(self, 5000, self.OnNewWindow)
+ EVT_MENU(self, 5001, self.OnExit)
+
+
+ EVT_SASH_DRAGGED_RANGE(self,
+ self.ID_WINDOW_TOP, self.ID_WINDOW_BOTTOM,
+ self.OnSashDrag)
+ EVT_SIZE(self, self.OnSize)
+
+
+ # Create some layout windows
+ # A window like a toolbar
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_TOP, style = wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize((1000, 30))
+ win.SetOrientation(wxLAYOUT_HORIZONTAL)
+ win.SetAlignment(wxLAYOUT_TOP)
+ win.SetBackgroundColour(wxColour(255, 0, 0))
+ win.SetSashVisible(wxSASH_BOTTOM, true)
+
+ self.topWindow = win
+
+
+ # A window like a statusbar
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_BOTTOM, style = wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize((1000, 30))
+ win.SetOrientation(wxLAYOUT_HORIZONTAL)
+ win.SetAlignment(wxLAYOUT_BOTTOM)
+ win.SetBackgroundColour(wxColour(0, 0, 255))
+ win.SetSashVisible(wxSASH_TOP, true)
+
+ self.bottomWindow = win
+
+
+ # A window to the left of the client window
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT1, style = wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize((120, 1000))
+ win.SetOrientation(wxLAYOUT_VERTICAL)
+ win.SetAlignment(wxLAYOUT_LEFT)
+ win.SetBackgroundColour(wxColour(0, 255, 0))
+ win.SetSashVisible(wxSASH_RIGHT, TRUE)
+ win.SetExtraBorderSize(10)
+ textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE|wxSUNKEN_BORDER)
+ textWindow.SetValue("A sub window")
+
+ self.leftWindow1 = win
+
+
+ # Another window to the left of the client window
+ win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT2, style = wxNO_BORDER|wxSW_3D)
+ win.SetDefaultSize((120, 1000))
+ win.SetOrientation(wxLAYOUT_VERTICAL)
+ win.SetAlignment(wxLAYOUT_LEFT)
+ win.SetBackgroundColour(wxColour(0, 255, 255))
+ win.SetSashVisible(wxSASH_RIGHT, TRUE)
+
+ self.leftWindow2 = win
+
+
+ def OnSashDrag(self, event):
+ if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
+ return
+
+ eID = event.GetId()
+ if eID == self.ID_WINDOW_TOP:
+ self.topWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+ elif eID == self.ID_WINDOW_LEFT1:
+ self.leftWindow1.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+
+ elif eID == self.ID_WINDOW_LEFT2:
+ self.leftWindow2.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+ elif eID == self.ID_WINDOW_BOTTOM:
+ self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+ wxLayoutAlgorithm().LayoutMDIFrame(self)
+ self.GetClientWindow().Refresh()
+
+
+ def OnSize(self, event):
+ wxLayoutAlgorithm().LayoutMDIFrame(self)
+
+
+ def OnExit(self, evt):
+ self.Close(true)
+
+
+ def OnNewWindow(self, evt):
+ self.winCount = self.winCount + 1
+ win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
+ canvas = MyCanvas(win)
+ win.Show(true)
+
+
+#----------------------------------------------------------------------
+
+class MyApp(wxApp):
+ def OnInit(self):
+ frame = MyParentFrame()
+ frame.Show(true)
+ self.SetTopWindow(frame)
+ return true
+
+
+app = MyApp(0)
+app.MainLoop()
+
+
+
self.log = log
+ # will accupy the space not uised by the Layout Algorithm
+ self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
+
EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
self.ID_WINDOW_BOTTOM, self.OnSashDrag)
EVT_SIZE(self, self.OnSize)
win.SetBackgroundColour(wxColour(0, 255, 0))
win.SetSashVisible(wxSASH_RIGHT, TRUE)
win.SetExtraBorderSize(10)
-
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxSUNKEN_BORDER)
- textWindow.SetValue("A help window")
+ textWindow.SetValue("A sub window")
self.leftWindow1 = win
elif eID == self.ID_WINDOW_BOTTOM:
self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
- wxLayoutAlgorithm().LayoutWindow(self)
-
+ wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
+ self.remainingSpace.Refresh()
def OnSize(self, event):
- wxLayoutAlgorithm().LayoutWindow(self)
+ wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
#---------------------------------------------------------------------------
overview = """\
-wxSashLayoutWindow responds to OnCalculateLayout events generated by wxLayoutAlgorithm. It allows the application to use simple accessors to specify how the window should be laid out, rather than having to respond to events. The fact that the class derives from wxSashWindow allows sashes to be used if required, to allow the windows to be user-resizable.
-
-wxSashLayoutWindow()
--------------------------------------------
-
-Default constructor.
-
-wxSashLayoutWindow(wxSashLayoutWindow* parent, wxSashLayoutWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, const wxString& name = "layoutWindow")
-
-Constructs a sash layout window, which can be a child of a frame, dialog or any other non-control window.
-
-Parameters
--------------------
-
-parent = Pointer to a parent window.
-
-id = Window identifier. If -1, will automatically create an identifier.
-
-pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxSashLayoutWindows should generate a default position for the window. If using the wxSashLayoutWindow class directly, supply an actual position.
-
-size = Window size. wxDefaultSize is (-1, -1) which indicates that wxSashLayoutWindows should generate a default size for the window.
-
-style = Window style. For window styles, please see wxSashLayoutWindow.
-
-name = Window name.
"""
event.Skip()
- def OnClearSB(self, event):
+ def OnClearSB(self, event): # called for the timer event handler
self.SetStatusText("")
self.timer.Stop()
self.timer = None
# flags and values that affect this script
#----------------------------------------------------------------------
-VERSION = "2.3.0b1"
+VERSION = "2.3b1"
DESCRIPTION = "Cross platform GUI toolkit for Python"
AUTHOR = "Robin Dunn"
AUTHOR_EMAIL = "robin@alldunn.com"
print 'Preparing CORE...'
swig_force = force
-swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dascii',
+swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dnone', #'-dascii',
'-I./src', '-D'+WXPLAT]
swig_deps = ['src/my_typemaps.i']
-ver = '2.3.0b1'
+ver = '2.3b1'
// Py_DECREF(arg);
// // set ThisOwn
-// PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
+// PyObject* one = PyInt_FromLong(1);
+// PyObject_SetAttrString($target, "thisown", one);
+// Py_DECREF(one);
// }
// } else {
// Py_INCREF(Py_None);
};
%new wxColour* wxNamedColour(const wxString& colorName);
+
%{ // Alternate 'constructor'
wxColour* wxNamedColour(const wxString& colorName) {
return new wxColour(colorName);
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback( \
- Py_BuildValue("(Oii)", \
- wxPyConstructObject((void*)attr, "wxGridCellAttr"), \
- a, b)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+ m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(attr, a, b); \
wxPySaveThread(doSave); \
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
void CBNAME(wxGridCellAttr *attr, int val) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback( \
- Py_BuildValue("(Oi)", \
- wxPyConstructObject((void*)attr, "wxGridCellAttr"), \
- val)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+ m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(attr, val); \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a, b); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyFloat_AsDouble(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyFloat_AsDouble(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a, b); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a); \
PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
-
wxString GetValue(int row, int col) {
bool doSave = wxPyRestoreThread();
wxString rval;
PyObject* ro;
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col));
if (ro) {
- rval = PyString_AsString(PyObject_Str(ro));
+ PyObject* str = PyObject_Str(ro);
+ rval = PyString_AsString(str);
Py_DECREF(ro);
+ Py_DECREF(str);
}
}
wxPySaveThread(doSave);
//---------------------------------------------------------------------
//----------------------------------------------------------------------
+#ifdef __WXMSW__
+#include "wx/msw/msvcrt.h"
+#endif
+
+
int WXDLLEXPORT wxEntryStart( int argc, char** argv );
int WXDLLEXPORT wxEntryInitGui();
void WXDLLEXPORT wxEntryCleanup();
// wxcmodule is imported. (Before there is a wxApp object.)
void __wxPreStart()
{
+
+#ifdef __WXMSW__
+// wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
+#endif
+
#ifdef WXP_WITH_THREAD
PyEval_InitThreads();
wxPyEventThreadState = PyThreadState_Get();
if (!PyArg_ParseTuple(args, "O", &onInitFunc))
return NULL;
+#if 0 // Try it out without this check, soo how it does...
if (wxTopLevelWindows.Number() > 0) {
PyErr_SetString(PyExc_TypeError, "Only 1 wxApp per process!");
return NULL;
}
-
+#endif
// This is the next part of the wxEntry functionality...
PyObject* sysargv = PySys_GetObject("argv");
Py_DECREF(arg);
if (setThisOwn) {
- PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+ PyObject* one = PyInt_FromLong(1);
+ PyObject_SetAttrString(obj, "thisown", one);
+ Py_DECREF(one);
}
return obj;
// If the object (m_self) has an attibute of the given name, and if that
// attribute is a method, and if that method's class is not from a base class,
// then we'll save a pointer to the method so callCallback can call it.
-bool wxPyCallbackHelper::findCallback(const wxString& name) const {
+bool wxPyCallbackHelper::findCallback(const char* name) const {
wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const
self->m_lastFound = NULL;
- if (m_self && PyObject_HasAttrString(m_self, (char*)name.c_str())) {
+ if (m_self && PyObject_HasAttrString(m_self, (char*)name)) {
PyObject* method;
- method = PyObject_GetAttrString(m_self, (char*)name.c_str());
+ method = PyObject_GetAttrString(m_self, (char*)name);
if (PyMethod_Check(method) &&
((PyMethod_GET_CLASS(method) == m_class) ||
self->m_lastFound = method;
}
+ else {
+ Py_DECREF(method);
+ }
}
return m_lastFound != NULL;
}
// Invoke the Python callable object, returning the raw PyObject return
// value. Caller should DECREF the return value and also call PyEval_SaveThread.
PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
- PyObject* result;
+ wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const
+ PyObject* result;
- result = PyEval_CallObject(m_lastFound, argTuple);
+ // Save a copy of the pointer in case the callback generates another
+ // callback. In that case m_lastFound will have a different value when
+ // it gets back here...
+ PyObject* method = m_lastFound;
+
+ result = PyEval_CallObject(method, argTuple);
Py_DECREF(argTuple);
+ Py_DECREF(method);
if (!result) {
PyErr_Print();
}
}
error:
- PyErr_SetString(PyExc_TypeError, "Expected a wxColour object or a string containing a colour name or #RRGGBB.");
+ PyErr_SetString(PyExc_TypeError, "Expected a wxColour object or a string containing a colour name or '#RRGGBB'.");
return FALSE;
}
+
#include <wx/wx.h>
-
//----------------------------------------------------------------------
// if we want to handle threads and Python threads are available...
void setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
- bool findCallback(const wxString& name) const;
+ bool findCallback(const char* name) const;
int callCallback(PyObject* argTuple) const;
PyObject* callCallbackObj(PyObject* argTuple) const;
#define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject(&a, "wxDC"))); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a, bool b) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oi)", \
- wxPyConstructObject(&a, "wxDC"), (int)b)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a, bool b) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oi)", \
- wxPyConstructObject(&a, "wxDC"), (int)b)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oddddi)", \
- wxPyConstructObject(&a, "wxDC"), \
- b, c, d, e, (int)f)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b, c, d, e, f); \
wxPySaveThread(doSave); \
bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
bool doSave = wxPyRestoreThread(); \
bool rval; \
- if (m_myInst.findCallback(#CBNAME)) \
- rval = m_myInst.callCallback(Py_BuildValue("(Oddddi)", \
- wxPyConstructObject(&a, "wxDC"), \
- b, c, d, e, (int)f)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ rval = m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
+ Py_DECREF(obj); \
+ } \
else \
rval = PCLASS::CBNAME(a, b, c, d, e, f); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Odddd)", \
- wxPyConstructObject(&a, "wxDC"), \
- b, c, d, e)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b, c, d, e); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxDC& a, bool b) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oi)", \
- wxPyConstructObject(&a, "wxDC"), \
- (int)b)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(&a, "wxDC"); \
+ m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b); \
wxPySaveThread(doSave); \
void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
int e, int f) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oiddii)", \
- wxPyConstructObject(a, "wxPyControlPoint"), \
- (int)b, c, d, e, f)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint"); \
+ m_myInst.callCallback(Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b, c, d, e, f); \
wxPySaveThread(doSave); \
#define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(Oddii)", \
- wxPyConstructObject(a, "wxPyControlPoint"), \
- b, c, d, e)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint"); \
+ m_myInst.callCallback(Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(a, b, c, d, e); \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(s)", a.c_str())); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(si)", a.c_str(),b)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("()")); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
else \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("()")); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
wxPySaveThread(doSave); \
bool CLASS::CBNAME(const wxHtmlTag& a) { \
bool rval = FALSE; \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- rval = m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject((void*)&a,"wxHtmlTag"))); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)&a,"wxHtmlTag"); \
+ rval = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
wxPySaveThread(doSave); \
return rval; \
}
bool CLASS::CBNAME(wxWindow* a) { \
bool rval; \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- rval = m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject((void*)a,"wxWindow"))); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)a,"wxWindow"); \
+ rval = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
else \
rval = PCLASS::CBNAME(a); \
wxPySaveThread(doSave); \
wxFSFile* rval=0; \
if (m_myInst.findCallback(#CBNAME)) { \
PyObject* ro; \
- ro=m_myInst.callCallbackObj(Py_BuildValue("(Os)", \
- wxPyConstructObject(&a, "(wxFileSystemC"),b.c_str())); \
+ PyObject* obj = wxPyConstructObject(&a, "(wxFileSystem"); \
+ ro = m_myInst.callCallbackObj(Py_BuildValue("(Os)", \
+ obj, b.c_str())); \
if (ro) { \
SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
Py_DECREF(ro); \
} \
- } \
+ Py_DECREF(obj); \
+ } \
wxPySaveThread(doSave); \
return rval; \
};
void base_##CBNAME(const Type& a);
-#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
- void CLASS::CBNAME(const Type& a) { \
- bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject((void*)&a, #Type))); \
- else \
- PCLASS::CBNAME(a); \
- wxPySaveThread(doSave); \
- } \
- void CLASS::base_##CBNAME(const Type& a) { \
- PCLASS::CBNAME(a); \
+#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
+ void CLASS::CBNAME(const Type& a) { \
+ bool doSave = wxPyRestoreThread(); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)&a, #Type); \
+ m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
+ else \
+ PCLASS::CBNAME(a); \
+ wxPySaveThread(doSave); \
+ } \
+ void CLASS::base_##CBNAME(const Type& a) { \
+ PCLASS::CBNAME(a); \
}
void base_##CBNAME(Type& a);
-#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
- void CLASS::CBNAME(Type& a) { \
- bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject(&a, #Type))); \
- else \
- PCLASS::CBNAME(a); \
- wxPySaveThread(doSave); \
- } \
- void CLASS::base_##CBNAME(Type& a) { \
- PCLASS::CBNAME(a); \
+#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
+ void CLASS::CBNAME(Type& a) { \
+ bool doSave = wxPyRestoreThread(); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)&a, #Type); \
+ m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
+ else \
+ PCLASS::CBNAME(a); \
+ wxPySaveThread(doSave); \
+ } \
+ void CLASS::base_##CBNAME(Type& a) { \
+ PCLASS::CBNAME(a); \
}
//---------------------------------------------------------------------------
bool base_##CBNAME(Type& a);
-#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
- bool CLASS::CBNAME(Type& a) { \
- bool rv; \
- bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- rv = m_myInst.callCallback(Py_BuildValue("(O)", \
- wxPyConstructObject(&a, #Type))); \
- else \
- rv = PCLASS::CBNAME(a); \
- wxPySaveThread(doSave); \
- return rv; \
- } \
- bool CLASS::base_##CBNAME(Type& a) { \
- return PCLASS::CBNAME(a); \
+#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
+ bool CLASS::CBNAME(Type& a) { \
+ bool rv; \
+ bool doSave = wxPyRestoreThread(); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)&a, #Type); \
+ rv = m_myInst.callCallback(Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
+ else \
+ rv = PCLASS::CBNAME(a); \
+ wxPySaveThread(doSave); \
+ return rv; \
+ } \
+ bool CLASS::base_##CBNAME(Type& a) { \
+ return PCLASS::CBNAME(a); \
}
//---------------------------------------------------------------------------
}
void OnExit() {
+ bool doSave = wxPyRestoreThread();
Py_DECREF(m_tagHandlerClass);
m_tagHandlerClass = NULL;
for (size_t x=0; x < m_objArray.GetCount(); x++) {
PyObject* obj = (PyObject*)m_objArray.Item(x);
Py_DECREF(obj);
}
+ wxPySaveThread(doSave);
};
void FillHandlersTable(wxHtmlWinParser *parser) {
if (m_myInst.findCallback("OnLinkClicked")) {
PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo");
m_myInst.callCallback(Py_BuildValue("(O)", obj));
+ Py_DECREF(obj);
}
else
wxHtmlWindow::OnLinkClicked(link);
bool doSave = wxPyRestoreThread();
wxRect* newRect = new wxRect(dest);
obj = wxPyConstructObject((void*)newRect, "wxRect");
- PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+ PyObject* one = PyInt_FromLong(1);
+ PyObject_SetAttrString(obj, "thisown", one);
+ Py_DECREF(one);
wxPySaveThread(doSave);
return obj;
}
Py_DECREF(arg);
// set ThisOwn
- PyObject_SetAttrString(_resultobj, "thisown", PyInt_FromLong(1));
+ PyObject* one = PyInt_FromLong(1);
+ PyObject_SetAttrString(_resultobj, "thisown", one);
+ Py_DECREF(one);
}
} else {
Py_INCREF(Py_None);
#define PYCALLBACK__GCAINTINT(PCLASS, CBNAME) \
void CBNAME(wxGridCellAttr *attr, int a, int b) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback( \
- Py_BuildValue("(Oii)", \
- wxPyConstructObject((void*)attr, "wxGridCellAttr"), \
- a, b)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+ m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(attr, a, b); \
wxPySaveThread(doSave); \
#define PYCALLBACK__GCAINT(PCLASS, CBNAME) \
void CBNAME(wxGridCellAttr *attr, int val) { \
bool doSave = wxPyRestoreThread(); \
- if (m_myInst.findCallback(#CBNAME)) \
- m_myInst.callCallback( \
- Py_BuildValue("(Oi)", \
- wxPyConstructObject((void*)attr, "wxGridCellAttr"), \
- val)); \
+ if (m_myInst.findCallback(#CBNAME)) { \
+ PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+ m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val)); \
+ Py_DECREF(obj); \
+ } \
else \
PCLASS::CBNAME(attr, val); \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} \
wxPySaveThread(doSave); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a, b); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b)); \
if (ro) { \
- rval = PyFloat_AsDouble(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyFloat_AsDouble(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a, b); \
PyObject* ro; \
ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a)); \
if (ro) { \
- rval = PyString_AsString(PyObject_Str(ro)); \
- Py_DECREF(ro); \
+ PyObject* str = PyObject_Str(ro); \
+ rval = PyString_AsString(str); \
+ Py_DECREF(ro); Py_DECREF(str); \
} \
} else \
rval = PCLASS::CBNAME(a); \
PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
-
wxString GetValue(int row, int col) {
bool doSave = wxPyRestoreThread();
wxString rval;
PyObject* ro;
ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col));
if (ro) {
- rval = PyString_AsString(PyObject_Str(ro));
+ PyObject* str = PyObject_Str(ro);
+ rval = PyString_AsString(str);
Py_DECREF(ro);
+ Py_DECREF(str);
}
}
wxPySaveThread(doSave);
}
void OnExit() {
+ bool doSave = wxPyRestoreThread();
Py_DECREF(m_tagHandlerClass);
m_tagHandlerClass = NULL;
for (size_t x=0; x < m_objArray.GetCount(); x++) {
PyObject* obj = (PyObject*)m_objArray.Item(x);
Py_DECREF(obj);
}
+ wxPySaveThread(doSave);
};
void FillHandlersTable(wxHtmlWinParser *parser) {
if (m_myInst.findCallback("OnLinkClicked")) {
PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo");
m_myInst.callCallback(Py_BuildValue("(O)", obj));
+ Py_DECREF(obj);
}
else
wxHtmlWindow::OnLinkClicked(link);
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_wxHtmlParser","_wxHtmlWinParser",SwigwxHtmlWinParserTowxHtmlParser},
{ "_wxHtmlParser","_class_wxHtmlParser",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
{ "_wxBusyInfo","_class_wxBusyInfo",0},
{ "_class_wxMenuEvent","_wxMenuEvent",0},
{ "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+ { "_wxJoystick","_class_wxJoystick",0},
{ "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
{ "_wxClientDC","_class_wxClientDC",0},
{ "_wxMouseEvent","_class_wxMouseEvent",0},
{ "_class_wxCheckListBox","_wxCheckListBox",0},
{ "_wxHtmlParser","_class_wxHtmlParser",0},
{ "_class_wxBusyInfo","_wxBusyInfo",0},
+ { "_class_wxJoystick","_wxJoystick",0},
{ "_class_wxCommandEvent","_wxCommandEvent",0},
{ "_class_wxClientDC","_wxClientDC",0},
{ "_class_wxSizeEvent","_wxSizeEvent",0},
bool doSave = wxPyRestoreThread();
wxRect* newRect = new wxRect(dest);
obj = wxPyConstructObject((void*)newRect, "wxRect");
- PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+ PyObject* one = PyInt_FromLong(1);
+ PyObject_SetAttrString(obj, "thisown", one);
+ Py_DECREF(one);
wxPySaveThread(doSave);
return obj;
}
if (!PyObject_HasAttrString(py, name))
return NULL;
PyObject* o = PyObject_GetAttrString(py, name);
- if (!PyMethod_Check(o) && !PyCFunction_Check(o))
+ if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
+ Py_DECREF(o);
return NULL;
+ }
return o;
}
//---------------------------------------------------------------------------
// Typemap to convert strings to wxColour. Two string formats are accepted,
-// either a colour name, for a hex colour spec like "#RRGGBB"
+// either a colour name, or a hex colour spec like "#RRGGBB"
%typemap(python,in) wxColour& (wxColour temp) {
$target = &temp;
Py_DECREF(arg);
// set ThisOwn
- PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
+ PyObject* one = PyInt_FromLong(1);
+ PyObject_SetAttrString($target, "thisown", one);
+ Py_DECREF(one);
}
} else {
Py_INCREF(Py_None);
if (!PyObject_HasAttrString(py, name))
return NULL;
PyObject* o = PyObject_GetAttrString(py, name);
- if (!PyMethod_Check(o) && !PyCFunction_Check(o))
+ if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
+ Py_DECREF(o);
return NULL;
+ }
return o;
}
//---------------------------------------------------------------------------
-#define __version__ "0.0.0" // The real value is now in build.py...
+#define __version__ "0.0.0" // The real value is now in setup.py...
wxPoint wxPyDefaultPosition;
wxSize wxPyDefaultSize;