wx.html.HtmlWinParser¶
This class is derived from wx.html.HtmlParser and its main goal is to parse HTML input so that it can be displayed in wx.html.HtmlWindow.
It uses a special wx.html.HtmlWinTagHandler.
Note
The product of parsing is a wx.html.HtmlCell (resp. HtmlContainer) object.
See also
Class Hierarchy¶
Methods Summary¶
Constructor. |
|
Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers). |
|
Creates font based on current setting (see |
|
Returns actual text colour. |
|
Returns default horizontal alignment. |
|
Returns (average) int height in standard font. |
|
Returns average int width in standard font. |
|
Returns pointer to the currently opened container (see Cells and Containers). |
|
Returns pointer to the DC used during parsing. |
|
Returns |
|
Returns actual font face name. |
|
Returns |
|
Returns |
|
Returns actual font size (HTML size varies from -2 to +4) |
|
Returns |
|
Returns actual hypertext link. |
|
Returns the colour of hypertext link text. |
|
Returns associated window ( wx.html.HtmlWindow). |
|
Opens new container and returns pointer to it (see Cells and Containers). |
|
Sets actual text colour. |
|
Sets default horizontal alignment (see |
|
Allows you to directly set opened container. |
|
Sets the DC. |
|
Sets bold flag of actualfont. |
|
Sets current font face to face. |
|
Sets fixed face flag of actualfont. |
|
Sets italic flag of actualfont. |
|
Sets actual font size (HTML size varies from 1 to 7). |
|
Sets underlined flag of actualfont. |
|
Sets fonts. |
|
Sets actual hypertext link. |
|
Sets colour of hypertext link. |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
Class API¶
- class wx.html.HtmlWinParser(HtmlParser)¶
Possible constructors:
HtmlWinParser(wndIface=None) -> None
This class is derived from HtmlParser and its main goal is to parse HTML input so that it can be displayed in HtmlWindow.
Methods¶
- __init__(self, wndIface=None)¶
Constructor.
Don’t use the default one, use the constructor with wndIface parameter (wndIface is a pointer to interface object for the associated wx.html.HtmlWindow or other HTML rendering window such as wx.html.HtmlListBox).
- Parameters:
wndIface (wx.html.HtmlWindowInterface)
- Return type:
None
- CloseContainer(self)¶
Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers).
- Return type:
- CreateCurrentFont(self)¶
Creates font based on current setting (see
SetFontSize
,SetFontBold
,SetFontItalic
,SetFontFixed
,wx.html.HtmlWinParser.SetFontUnderlined
) and returns pointer to it.If the font was already created only a pointer is returned.
- Return type:
Font
- GetActualColor(self)¶
Returns actual text colour.
- Return type:
Colour
- GetAlign(self)¶
Returns default horizontal alignment.
- Return type:
int
- GetCharHeight(self)¶
Returns (average) int height in standard font.
It is used as DC-independent metrics.
- Return type:
int
Note
This function doesn’t return the actual height. If you want to know the height of the current font, call GetDC->
GetCharHeight
.
- GetCharWidth(self)¶
Returns average int width in standard font.
It is used as DC-independent metrics.
- Return type:
int
Note
This function doesn’t return the actual width. If you want to know the height of the current font, call GetDC->
GetCharWidth
.
- GetContainer(self)¶
Returns pointer to the currently opened container (see Cells and Containers).
Common use:
self.WParser.GetContainer().InsertCell(html_cell)
- Return type:
- GetFontBold(self)¶
Returns
True
if actual font is bold,False
otherwise.- Return type:
int
- GetFontFace(self)¶
Returns actual font face name.
- Return type:
str
- GetFontFixed(self)¶
Returns
True
if actual font is fixed face,False
otherwise.- Return type:
int
- GetFontItalic(self)¶
Returns
True
if actual font is italic,False
otherwise.- Return type:
int
- GetFontSize(self)¶
Returns actual font size (HTML size varies from -2 to +4)
- Return type:
int
- GetFontUnderlined(self)¶
Returns
True
if actual font is underlined,False
otherwise.- Return type:
int
- GetLink(self)¶
Returns actual hypertext link.
(This value has a non-empty
wx.html.HtmlLinkInfo.GetHref
Href string if the parser is between <A> and </A> tags, “” otherwise.)- Return type:
- GetLinkColor(self)¶
Returns the colour of hypertext link text.
- Return type:
Colour
- GetWindowInterface(self)¶
Returns associated window ( wx.html.HtmlWindow).
This may be
None
! (You should always test if it is notNone
. For exampleTITLE
handler sets window title only if some window is associated, otherwise it does nothing.- Return type:
- OpenContainer(self)¶
Opens new container and returns pointer to it (see Cells and Containers).
- Return type:
- SetActualColor(self, clr)¶
Sets actual text colour.
Note: this DOESN’T change the colour! You must create wx.html.HtmlColourCell yourself.
- Parameters:
clr (wx.Colour)
- Return type:
None
- SetAlign(self, a)¶
Sets default horizontal alignment (see
wx.html.HtmlContainerCell.SetAlignHor
).Alignment of newly opened container is set to this value.
- Parameters:
a (int)
- Return type:
None
- SetContainer(self, c)¶
Allows you to directly set opened container.
This is not recommended - you should use
OpenContainer
wherever possible.- Parameters:
- Return type:
- SetDC(self, dc, pixel_scale=1.0e+0)¶
Sets the DC.
This must be called before
wx.html.HtmlParser.Parse
!pixel_scale can be used when rendering to high-resolution DCs (e.g. printer) to adjust size of pixel metrics. (Many dimensions in HTML are given in pixels – e.g. image sizes. 300x300 image would be only one inch wide on typical printer. With pixel_scale = 3.0 it would be 3 inches.)
- Parameters:
dc (wx.DC)
pixel_scale (float)
- Return type:
None
- SetFontBold(self, x)¶
Sets bold flag of actualfont.
x is either
True
ofFalse
.- Parameters:
x (int)
- Return type:
None
- SetFontFace(self, face)¶
Sets current font face to face.
This affects either fixed size font or proportional, depending on context (whether the parser is inside
<TT>
tag or not).- Parameters:
face (string)
- Return type:
None
- SetFontFixed(self, x)¶
Sets fixed face flag of actualfont.
x is either
True
ofFalse
.- Parameters:
x (int)
- Return type:
None
- SetFontItalic(self, x)¶
Sets italic flag of actualfont.
x is either
True
ofFalse
.- Parameters:
x (int)
- Return type:
None
- SetFontSize(self, s)¶
Sets actual font size (HTML size varies from 1 to 7).
- Parameters:
s (int)
- Return type:
None
- SetFontUnderlined(self, x)¶
Sets underlined flag of actualfont.
x is either
True
ofFalse
.- Parameters:
x (int)
- Return type:
None
- SetFonts(self, normal_face, fixed_face, sizes)¶
Sets fonts.
See
wx.html.HtmlWindow.SetFonts
for detailed description.- Parameters:
normal_face (string)
fixed_face (string)
sizes (list of integers)
- Return type:
None
- SetLink(self, link)¶
Sets actual hypertext link.
Empty link is represented by wx.html.HtmlLinkInfo with Href equal to “”.
- Parameters:
link (wx.html.HtmlLinkInfo)
- Return type:
None
- SetLinkColor(self, clr)¶
Sets colour of hypertext link.
- Parameters:
clr (wx.Colour)
- Return type:
None
Properties¶
- ActualColor¶
See
GetActualColor
andSetActualColor
- CharHeight¶
See
GetCharHeight
- CharWidth¶
See
GetCharWidth
- Container¶
See
GetContainer
andSetContainer
- FontBold¶
See
GetFontBold
andSetFontBold
- FontFace¶
See
GetFontFace
andSetFontFace
- FontFixed¶
See
GetFontFixed
andSetFontFixed
- FontItalic¶
See
GetFontItalic
andSetFontItalic
- FontSize¶
See
GetFontSize
andSetFontSize
- FontUnderlined¶
See
GetFontUnderlined
andSetFontUnderlined
- LinkColor¶
See
GetLinkColor
andSetLinkColor
- WindowInterface¶