Phoenix Logo

phoenix_title 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

Tag Handlers


class_hierarchy Class Hierarchy

Inheritance diagram for class HtmlWinParser:

method_summary Methods Summary

__init__ Constructor.
CloseContainer Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers).
CreateCurrentFont Creates font based on current setting (see SetFontSize , SetFontBold , SetFontItalic , SetFontFixed , wx.html.HtmlWinParser.SetFontUnderlined ) and returns pointer to it.
GetActualColor Returns actual text colour.
GetAlign Returns default horizontal alignment.
GetCharHeight Returns (average) int height in standard font.
GetCharWidth Returns average int width in standard font.
GetContainer Returns pointer to the currently opened container (see Cells and Containers).
GetDC Returns pointer to the DC used during parsing.
GetFontBold Returns True if actual font is bold, False otherwise.
GetFontFace Returns actual font face name.
GetFontFixed Returns True if actual font is fixed face, False otherwise.
GetFontItalic Returns True if actual font is italic, False otherwise.
GetFontSize Returns actual font size (HTML size varies from -2 to +4)
GetFontUnderlined Returns True if actual font is underlined, False otherwise.
GetLink Returns actual hypertext link.
GetLinkColor Returns the colour of hypertext link text.
GetWindowInterface Returns associated window ( wx.html.HtmlWindow).
OpenContainer Opens new container and returns pointer to it (see Cells and Containers).
SetActualColor Sets actual text colour.
SetAlign Sets default horizontal alignment (see wx.html.HtmlContainerCell.SetAlignHor ).
SetContainer Allows you to directly set opened container.
SetDC Sets the DC.
SetFontBold Sets bold flag of actualfont.
SetFontFace Sets current font face to face.
SetFontFixed Sets fixed face flag of actualfont.
SetFontItalic Sets italic flag of actualfont.
SetFontSize Sets actual font size (HTML size varies from 1 to 7).
SetFontUnderlined Sets underlined flag of actualfont.
SetFonts Sets fonts.
SetLink Sets actual hypertext link.
SetLinkColor Sets colour of hypertext link.

api Class API



class wx.html.HtmlWinParser(HtmlParser)

Possible constructors:

HtmlWinParser(wndIface=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) –


CloseContainer(self)

Closes the container, sets actual container to the parent one and returns pointer to it (see Cells and Containers).

Return type: wx.html.HtmlContainerCell


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: wx.html.HtmlContainerCell


GetDC(self)

Returns pointer to the DC used during parsing.

Return type:DC


GetFontBold(self)

Returns True if actual font is bold, False otherwise.

Return type:int


GetFontFace(self)

Returns actual font face name.

Return type:string


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


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: wx.html.HtmlLinkInfo


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 not None. For example TITLE handler sets window title only if some window is associated, otherwise it does nothing.

Return type: wx.html.HtmlWindowInterface


OpenContainer(self)

Opens new container and returns pointer to it (see Cells and Containers).

Return type: wx.html.HtmlContainerCell


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) –


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) –


SetContainer(self, c)

Allows you to directly set opened container.

This is not recommended - you should use OpenContainer wherever possible.

Parameters:c (wx.html.HtmlContainerCell) –
Return type: wx.html.HtmlContainerCell


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

Parameters:
  • dc (wx.DC) –
  • pixel_scale (float) –


SetFontBold(self, x)

Sets bold flag of actualfont.

x is either True of False.

Parameters:x (int) –


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) –


SetFontFixed(self, x)

Sets fixed face flag of actualfont.

x is either True of False.

Parameters:x (int) –


SetFontItalic(self, x)

Sets italic flag of actualfont.

x is either True of False.

Parameters:x (int) –


SetFontSize(self, s)

Sets actual font size (HTML size varies from 1 to 7).

Parameters:s (int) –


SetFontUnderlined(self, x)

Sets underlined flag of actualfont.

x is either True of False.

Parameters:x (int) –


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) –


Sets actual hypertext link.

Empty link is represented by wx.html.HtmlLinkInfo with Href equal to “”.

Parameters:link (wx.html.HtmlLinkInfo) –


SetLinkColor(self, clr)

Sets colour of hypertext link.

Parameters:clr (wx.Colour) –

Properties



ActualColor

See GetActualColor and SetActualColor



Align

See GetAlign and SetAlign



CharHeight

See GetCharHeight



CharWidth

See GetCharWidth



Container

See GetContainer and SetContainer



DC

See GetDC and SetDC



FontBold

See GetFontBold and SetFontBold



FontFace

See GetFontFace and SetFontFace



FontFixed

See GetFontFixed and SetFontFixed



FontItalic

See GetFontItalic and SetFontItalic



FontSize

See GetFontSize and SetFontSize



FontUnderlined

See GetFontUnderlined and SetFontUnderlined



See GetLink and SetLink



LinkColor

See GetLinkColor and SetLinkColor



WindowInterface

See GetWindowInterface