Fix problems with the wxHtmpTagHandler wrappers and related
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -329,15 +329,17 @@ public:
|
|||||||
|
|
||||||
// First, make a new instance of the tag handler
|
// First, make a new instance of the tag handler
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
PyObject* arg = Py_BuildValue("()");
|
PyObject* arg = PyTuple_New(0);
|
||||||
PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
|
PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
|
||||||
Py_DECREF(arg);
|
Py_DECREF(arg);
|
||||||
wxPyEndBlockThreads();
|
|
||||||
|
|
||||||
// now figure out where it's C++ object is...
|
// now figure out where it's C++ object is...
|
||||||
wxPyHtmlWinTagHandler* thPtr;
|
wxPyHtmlWinTagHandler* thPtr;
|
||||||
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler")))
|
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
|
||||||
|
wxPyEndBlockThreads();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
wxPyEndBlockThreads();
|
||||||
|
|
||||||
// add it,
|
// add it,
|
||||||
parser->AddTagHandler(thPtr);
|
parser->AddTagHandler(thPtr);
|
||||||
|
@@ -372,15 +372,17 @@ public:
|
|||||||
|
|
||||||
// First, make a new instance of the tag handler
|
// First, make a new instance of the tag handler
|
||||||
wxPyBeginBlockThreads();
|
wxPyBeginBlockThreads();
|
||||||
PyObject* arg = Py_BuildValue("()");
|
PyObject* arg = PyTuple_New(0);
|
||||||
PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
|
PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
|
||||||
Py_DECREF(arg);
|
Py_DECREF(arg);
|
||||||
wxPyEndBlockThreads();
|
|
||||||
|
|
||||||
// now figure out where it's C++ object is...
|
// now figure out where it's C++ object is...
|
||||||
wxPyHtmlWinTagHandler* thPtr;
|
wxPyHtmlWinTagHandler* thPtr;
|
||||||
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler")))
|
if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
|
||||||
|
wxPyEndBlockThreads();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
wxPyEndBlockThreads();
|
||||||
|
|
||||||
// add it,
|
// add it,
|
||||||
parser->AddTagHandler(thPtr);
|
parser->AddTagHandler(thPtr);
|
||||||
|
@@ -100,14 +100,17 @@ PARAMTAG = 'PARAM'
|
|||||||
|
|
||||||
class wxpTagHandler(wxHtmlWinTagHandler):
|
class wxpTagHandler(wxHtmlWinTagHandler):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
print 'wxpTagHandler'
|
||||||
wxHtmlWinTagHandler.__init__(self)
|
wxHtmlWinTagHandler.__init__(self)
|
||||||
self.ctx = None
|
self.ctx = None
|
||||||
|
|
||||||
def GetSupportedTags(self):
|
def GetSupportedTags(self):
|
||||||
|
print 'wxpTagHandler.GetSupportedTags'
|
||||||
return WXPTAG+','+PARAMTAG
|
return WXPTAG+','+PARAMTAG
|
||||||
|
|
||||||
|
|
||||||
def HandleTag(self, tag):
|
def HandleTag(self, tag):
|
||||||
|
print 'wxpTagHandler.HandleTag'
|
||||||
name = tag.GetName()
|
name = tag.GetName()
|
||||||
if name == WXPTAG:
|
if name == WXPTAG:
|
||||||
return self.HandleWxpTag(tag)
|
return self.HandleWxpTag(tag)
|
||||||
@@ -136,7 +139,7 @@ class wxpTagHandler(wxHtmlWinTagHandler):
|
|||||||
|
|
||||||
className = tag.GetParam('CLASS')
|
className = tag.GetParam('CLASS')
|
||||||
self.ctx.classObj = getattr(self.ctx.classMod, className)
|
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"
|
raise TypeError, "WXP tag attribute CLASS must name a class"
|
||||||
|
|
||||||
# now look for width and height
|
# now look for width and height
|
||||||
|
Reference in New Issue
Block a user