From 812c5b706df2d23ef0b8bdc4b560bc45622eaac9 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 1 Oct 2011 00:36:25 +0000 Subject: [PATCH] Undo last commit for etg/accel.py, it was supposed to be part of a different changeset git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etg/accel.py | 79 ++++------------------------------------------------ 1 file changed, 5 insertions(+), 74 deletions(-) diff --git a/etg/accel.py b/etg/accel.py index c13f40b5..7a9edea5 100644 --- a/etg/accel.py +++ b/etg/accel.py @@ -29,82 +29,13 @@ def run(): #----------------------------------------------------------------- # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - - c = module.find('wxAcceleratorEntry') - assert isinstance(c, etgtools.ClassDef) - tools.removeVirtuals(c) - + c = module.find('wxAcceleratorTable') - assert isinstance(c, etgtools.ClassDef) - tools.removeVirtuals(c) - - # Replace the implementation of the AcceleratorTable ctor so it can - # accept a Python sequence of tuples or AcceleratorEntry objects like - # Classic does. Using the arraySize and array annotations does let us - # pass a list of entries, but they have to already be AccelertorEntry - # obejcts. We want to allow Items in the list to be either - # wx.AcceleratorEntry items or a 3-tuple containing the values to pass to - # the wx.AcceleratorEntry ctor. - - # See EXPERIMENTAL in object.py... - # First ignore the fact that this class derives from wxObject. This is - # so there will not be any inherited virtuals, so SIP will not generate a - # derived class. That makes the adding of a new ctor easier. - #c.bases = [] - - # Ignore the current constructor - c.find('wxAcceleratorTable').findOverload('entries').ignore() - - # and add the code for the new constructor - c.addCppCtor( - briefDoc="TODO", - argsString='(PyObject* entries)', - body="""\ - const char* errmsg = "Expected a sequence of 3-tuples or wx.AcceleratorEntry objects."; - if (!PySequence_Check(entries)) { - PyErr_SetString(PyExc_TypeError, errmsg); - return NULL; - } - int count = PySequence_Size(entries); - wxAcceleratorEntry* tmpEntries = new wxAcceleratorEntry[count]; - if (! tmpEntries) { - PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array"); - return NULL; - } - int idx; - for (idx=0; idx( - sipConvertToType(obj, sipType_wxAcceleratorEntry, NULL, 0, 0, &err)); - tmpEntries[idx] = *entryPtr; - } - else if (PySequence_Check(obj) && PySequence_Size(obj) == 3) { - PyObject* o1 = PySequence_ITEM(obj, 0); - PyObject* o2 = PySequence_ITEM(obj, 1); - PyObject* o3 = PySequence_ITEM(obj, 2); - tmpEntries[idx].Set(PyInt_AsLong(o1), PyInt_AsLong(o2), PyInt_AsLong(o3)); - Py_DECREF(o1); - Py_DECREF(o2); - Py_DECREF(o3); - } - else { - PyErr_SetString(PyExc_TypeError, errmsg); - return NULL; - } - Py_DECREF(obj); - } - - wxAcceleratorTable* table = new wxAcceleratorTable(count, tmpEntries); - delete tmpEntries; - return table; - """) - - # Mac doesn't have this, and we don't real with resource files from - # wxPython anyway. + # Mac doesn't have this? c.find('wxAcceleratorTable').findOverload('resource').ignore() - + c.find('wxAcceleratorTable.n').arraySize = True + c.find('wxAcceleratorTable.entries').array = True + c.find('wxAcceleratorTable.entries').type += '*' #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.addGetterSetterProps(module)