X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6a62357c175351b8e046cb5f0636a59b7c9baffb..16541a4ef4c409e27a047f898f9d770bdcfa9f30:/wxPython/wx/lib/wxpTag.py diff --git a/wxPython/wx/lib/wxpTag.py b/wxPython/wx/lib/wxpTag.py index 49e5c4475b..d362fb365f 100644 --- a/wxPython/wx/lib/wxpTag.py +++ b/wxPython/wx/lib/wxpTag.py @@ -10,6 +10,10 @@ # Copyright: (c) 1999 by Total Control Software # Licence: wxWindows license #---------------------------------------------------------------------- +# 12/13/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for V2.5 compatability +# ''' wxPython.lib.wxpTag @@ -21,7 +25,7 @@ You don\'t need to use anything in this module directly, just importing it will create the tag handler and add it to any wxHtmlWinParsers created from that time forth. -Tags of the following form are recognised: +Tags of the following form are recognised:: + - + Both the begining and ending WXP tags are required. @@ -85,11 +89,11 @@ server as is done with java applets. ''' #---------------------------------------------------------------------- -from wxPython.wx import * -from wxPython.html import * -import wxPython.wx +import types + +import wx +import wx.html -import types #---------------------------------------------------------------------- @@ -98,9 +102,9 @@ PARAMTAG = 'PARAM' #---------------------------------------------------------------------- -class wxpTagHandler(wxHtmlWinTagHandler): +class wxpTagHandler(wx.html.HtmlWinTagHandler): def __init__(self): - wxHtmlWinTagHandler.__init__(self) + wx.html.HtmlWinTagHandler.__init__(self) self.ctx = None def GetSupportedTags(self): @@ -128,7 +132,7 @@ class wxpTagHandler(wxHtmlWinTagHandler): if modName: self.ctx.classMod = _my_import(modName) else: - self.ctx.classMod = wxPython.wx + self.ctx.classMod = wx # find and verify the class if not tag.HasParam('CLASS'): @@ -151,13 +155,13 @@ class wxpTagHandler(wxHtmlWinTagHandler): width = int(width) if tag.HasParam('HEIGHT'): height = int(tag.GetParam('HEIGHT')) - self.ctx.kwargs['size'] = wxSize(width, height) + self.ctx.kwargs['size'] = wx.Size(width, height) # parse up to the closing tag, and gather any nested Param tags. self.ParseInner(tag) # create the object - parent = self.GetParser().GetWindow() + parent = self.GetParser().GetWindowInterface().GetHTMLWindow() if parent: obj = apply(self.ctx.classObj, (parent,), @@ -165,7 +169,8 @@ class wxpTagHandler(wxHtmlWinTagHandler): obj.Show(True) # add it to the HtmlWindow - self.GetParser().GetContainer().InsertCell(wxHtmlWidgetCell(obj, self.ctx.floatWidth)) + self.GetParser().GetContainer().InsertCell( + wx.html.HtmlWidgetCell(obj, self.ctx.floatWidth)) self.ctx = None return True @@ -191,24 +196,25 @@ class wxpTagHandler(wxHtmlWinTagHandler): # check for something that should be evaluated - elif value[0] in '[{(' or value[:2] == 'wx': + elif value and value[0] in '[{(' or value[:2] == 'wx': saveVal = value try: value = eval(value, self.ctx.classMod.__dict__) except: value = saveVal - # convert to wxColour - elif value[0] == '#': + # convert to wx.Colour + elif value and value[0] == '#': try: red = int('0x'+value[1:3], 16) green = int('0x'+value[3:5], 16) blue = int('0x'+value[5:], 16) - value = wxColor(red, green, blue) + value = wx.Color(red, green, blue) except: pass - self.ctx.kwargs[str(name)] = value + if self.ctx: + self.ctx.kwargs[str(name)] = value return False @@ -267,4 +273,4 @@ def _param2dict(param): -wxHtmlWinParser_AddTagHandler(wxpTagHandler) +wx.html.HtmlWinParser_AddTagHandler(wxpTagHandler)