]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix problems with the wxHtmpTagHandler wrappers and related
authorRobin Dunn <robin@alldunn.com>
Sat, 22 Nov 2003 21:08:20 +0000 (21:08 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 22 Nov 2003 21:08:20 +0000 (21:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/html.i
wxPython/src/msw/html_wrap.cpp
wxPython/wx/lib/wxpTag.py

index 86609a3fd60a42c8c7aaf41ec3a489a582013a2b..970911807bd19b62f6a0d229b228f53b3df70398 100644 (file)
@@ -329,15 +329,17 @@ public:
 
         // First, make a new instance of the tag handler
         wxPyBeginBlockThreads();
-        PyObject* arg = Py_BuildValue("()");
-        PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
+        PyObject* arg = PyTuple_New(0);
+        PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
         Py_DECREF(arg);
-        wxPyEndBlockThreads();
-
+        
         // now figure out where it's C++ object is...
         wxPyHtmlWinTagHandler* thPtr;
-        if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler")))
+        if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
+            wxPyEndBlockThreads();
             return;
+        }
+        wxPyEndBlockThreads();
 
         // add it,
         parser->AddTagHandler(thPtr);
index a2f15dc94a6f9db900d8bb83003e6294d623bc26..ad01de3decd1c0ac9afc92c5c39e4d539ccf2cc2 100644 (file)
@@ -372,15 +372,17 @@ public:
 
         // First, make a new instance of the tag handler
         wxPyBeginBlockThreads();
-        PyObject* arg = Py_BuildValue("()");
-        PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
+        PyObject* arg = PyTuple_New(0);
+        PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
         Py_DECREF(arg);
-        wxPyEndBlockThreads();
-
+        
         // now figure out where it's C++ object is...
         wxPyHtmlWinTagHandler* thPtr;
-        if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler")))
+        if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
+            wxPyEndBlockThreads();
             return;
+        }
+        wxPyEndBlockThreads();
 
         // add it,
         parser->AddTagHandler(thPtr);
index 1981f5b02d2c0c79e77394e46d31f5bcab80467a..8dbb7109d4ab910ac16e91e7534f395f9237b1be 100644 (file)
@@ -100,14 +100,17 @@ PARAMTAG = 'PARAM'
 
 class wxpTagHandler(wxHtmlWinTagHandler):
     def __init__(self):
+        print 'wxpTagHandler'
         wxHtmlWinTagHandler.__init__(self)
         self.ctx = None
 
     def GetSupportedTags(self):
+        print 'wxpTagHandler.GetSupportedTags'
         return WXPTAG+','+PARAMTAG
 
 
     def HandleTag(self, tag):
+        print 'wxpTagHandler.HandleTag'
         name = tag.GetName()
         if name == WXPTAG:
             return self.HandleWxpTag(tag)
@@ -136,7 +139,7 @@ class wxpTagHandler(wxHtmlWinTagHandler):
 
         className = tag.GetParam('CLASS')
         self.ctx.classObj = getattr(self.ctx.classMod, className)
-        if type(self.ctx.classObj) != types.ClassType:
+        if type(self.ctx.classObj) not in [ types.ClassType, types.TypeType]:
             raise TypeError, "WXP tag attribute CLASS must name a class"
 
         # now look for width and height