X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb757066dfea26412c518153f7c4af05a8a43dc9..7bdfb981a826d29e292738a27700543fa10d2bfb:/wxPython/wx/lib/wxpTag.py diff --git a/wxPython/wx/lib/wxpTag.py b/wxPython/wx/lib/wxpTag.py index 8dbb7109d4..d93a9fa9b1 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 @@ -31,11 +35,11 @@ Tags of the following form are recognised: where modulename is the name of a module (possibly in package notation) to import and classname is the name of a class in that module to create an instance of. If the module tag-attribute is not -given or is an empty string, then wxPython.wx is used. The width and -height attributes are expected to be integers and will be passed to -the __init__ method of the class as a wxSize object named size. -However, if the width attribute ends with the percent (%) symbol then -the value will be used as a percentage of the available width and the +given or is an empty string, then wx is used. The width and height +attributes are expected to be integers and will be passed to the +__init__ method of the class as a wxSize object named size. However, +if the width attribute ends with the percent (%) symbol then the value +will be used as a percentage of the available width and the wxHtmlWindow will manage the size. The name-value pairs in all the nested PARAM tags are packaged up as @@ -69,9 +73,9 @@ be converted from strings to alternate datatypes. They are: An example: - + - + 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,19 +102,16 @@ PARAMTAG = 'PARAM' #---------------------------------------------------------------------- -class wxpTagHandler(wxHtmlWinTagHandler): +class wxpTagHandler(wx.html.HtmlWinTagHandler): def __init__(self): - print 'wxpTagHandler' - wxHtmlWinTagHandler.__init__(self) + wx.html.HtmlWinTagHandler.__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) @@ -131,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'): @@ -154,7 +155,7 @@ 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) @@ -168,7 +169,7 @@ 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 @@ -201,13 +202,13 @@ class wxpTagHandler(wxHtmlWinTagHandler): except: value = saveVal - # convert to wxColour + # convert to wx.Colour elif 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 @@ -270,4 +271,4 @@ def _param2dict(param): -wxHtmlWinParser_AddTagHandler(wxpTagHandler) +wx.html.HtmlWinParser_AddTagHandler(wxpTagHandler)