flare.html5

Submodules

Package Contents

Classes

TextNode

Represents a piece of text inside the DOM.

_WidgetClassWrapper

Built-in mutable sequence.

_WidgetDataWrapper

dict() -> new empty dictionary

_WidgetStyleWrapper

dict() -> new empty dictionary

Widget

_attrLabel

_attrCharset

_attrCite

_attrDatetime

_attrForm

_attrAlt

_attrAutofocus

_attrDisabled

_attrChecked

_attrIndeterminate

_attrName

_attrValue

_attrAutocomplete

_attrRequired

_attrMultiple

_attrSize

_attrFor

_attrInputs

_attrFormhead

_attrHref

_attrTarget

_attrType

_attrMedia

_attrDimensions

_attrUsemap

_attrMultimedia

_attrRel

_attrSrc

A

Area

Audio

Bdo

Blockquote

BodyCls

Canvas

Command

_Del

Dialog

Abbr

Address

Article

Aside

B

Bdi

Br

Caption

Cite

Code

Datalist

Dfn

Div

Em

Embed

Figcaption

Figure

Footer

Header

H1

H2

H3

H4

H5

H6

Hr

I

Kdb

Legend

Mark

Noscript

P

Rq

Rt

Ruby

S

Samp

Section

Small

Strong

Sub

Summery

Sup

U

Var

Wbr

Button

Fieldset

Form

Input

Label

Optgroup

Option

Output

Select

Textarea

HeadCls

Iframe

Img

Ins

Keygen

Link

Ul

Ol

Li

Dl

Dt

Dd

Map

Menu

Meta

Meter

Nav

Object

Param

Progress

Q

Script

Source

Span

Details

Summary

Style

Tr

Td

Th

Thead

Tbody

ColWrapper

RowWrapper

Table

Time

Track

Video

Template

HtmlAst

Abstract syntax tree element used by parseHTML().

Functions

domCreateAttribute(tag, ns=None)

Creates a new HTML/SVG/... attribute.

domCreateElement(tag, ns=None)

Creates a new HTML/SVG/... tag.

domCreateTextNode(txt='')

domGetElementById(idTag)

domElementFromPoint(x, y)

domGetElementsByTagName(tag)

domConvertEncodedText(txt)

Convert HTML-encoded text (containing HTML entities) into its decoded string representation.

Body()

Head()

unescape(val, maxLength=0)

Unquotes several HTML-quoted characters in a string.

doesEventHitWidgetOrParents(event, widget)

Test if event 'event' hits widget 'widget' (or any of its parents).

doesEventHitWidgetOrChildren(event, widget)

Test if event 'event' hits widget 'widget' (or any of its children).

textToHtml(node, text)

Generates html nodes from text by splitting text into content and into line breaks html5.Br.

parseInt(s, ret=0)

Parses a value as int.

parseFloat(s, ret=0.0)

Parses a value as float.

getKey(event)

Returns the Key Identifier of the given event.

isArrowLeft(event)

isArrowUp(event)

isArrowRight(event)

isArrowDown(event)

isEscape(event)

isReturn(event)

isControl(event)

isShift(event)

isMeta(event)

registerTag(tagName, widgetClass, override=True)

tag(arg)

Decorator to register a sub-class of html5.Widget either under its class-name or an associated tag-name.

_buildTags(debug=False)

Generates a dictionary of all to the html5-library known tags and their associated objects and attributes.

parseHTML(html: str, debug: bool = False) → HtmlAst

Parses the provided HTML-code according to the tags registered by html5.registerTag() or components that used the html5.tag-decorator.

fromHTML(html: [str, HtmlAst], appendTo: Widget = None, bindTo: Widget = None, debug: bool = False, **kwargs) → [Widget]

Parses the provided HTML code according to the objects defined in the html5-library.

Attributes

htmlExpressionEvaluator

document

__domParser

_body

_head

__tags

__reVarReplacer

flare.html5.htmlExpressionEvaluator
flare.html5.document
flare.html5.domCreateAttribute(tag, ns=None)

Creates a new HTML/SVG/… attribute.

Parameters

ns – the namespace. Default: HTML. Possible values: HTML, SVG, XBL, XUL

flare.html5.domCreateElement(tag, ns=None)

Creates a new HTML/SVG/… tag.

Parameters

ns – the namespace. Default: HTML. Possible values: HTML, SVG, XBL, XUL

flare.html5.domCreateTextNode(txt='')
flare.html5.domGetElementById(idTag)
flare.html5.domElementFromPoint(x, y)
flare.html5.domGetElementsByTagName(tag)
flare.html5.__domParser
flare.html5.domConvertEncodedText(txt)

Convert HTML-encoded text (containing HTML entities) into its decoded string representation.

The reason for this function is the handling of HTML entities, which is not properly supported by native JavaScript.

We use the browser’s DOM parser to do this, according to https://stackoverflow.com/questions/3700326/decode-amp-back-to-in-javascript

Parameters

txt – The encoded text.

Returns

The decoded text.

class flare.html5.TextNode(txt=None, *args, **kwargs)

Bases: object

Represents a piece of text inside the DOM.

This is the only object not deriving from “Widget”, as it does not support any of its properties.

_setText(self, txt)
_getText(self)
__str__(self)

Return str(self).

onAttach(self)
onDetach(self)
_setDisabled(self, disabled)
_getDisabled(self)
children(self)
class flare.html5._WidgetClassWrapper(targetWidget)

Bases: list

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

set(self, value)
_updateElem(self)
append(self, p_object)

Append object to the end of the list.

clear(self)

Remove all items from list.

remove(self, value)

Remove first occurrence of value.

Raises ValueError if the value is not present.

extend(self, iterable)

Extend list by appending elements from the iterable.

insert(self, index, p_object)

Insert object before index.

pop(self, index=None)

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

class flare.html5._WidgetDataWrapper(targetWidget)

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__setitem__(self, key, value)

Set self[key] to value.

update(self, E=None, **F)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class flare.html5._WidgetStyleWrapper(targetWidget)

Bases: dict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

__setitem__(self, key, value)

Set self[key] to value.

update(self, E=None, **F)

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

class flare.html5.Widget(*args, appendTo=None, style=None, **kwargs)

Bases: object

_namespace
_tagName
_leafTag = False
style = []
sinkEvent(self, *args)
unsinkEvent(self, *args)
addEventListener(self, event, callback)

Adds an event listener callback to an event on a Widget.

Parameters
  • event – The event string, e.g. “click” or “mouseover”

  • callback – The callback function to be called on the given event. This callback function can either accept no parameters, receive the pure Event-object from JavaScript as one parameter, or receive both the pure Event-object from JavaScript and the Widget-instance where the event was triggered on.

removeEventListener(self, event, callback)

Removes an event listener callback from a Widget.

The event listener must be previously added by Widget.addEventListener().

Parameters
  • event – The event string, e.g. “click” or “mouseover”

  • callback – The callback function to be removed

disable(self)

Disables an element, in case it is not already disabled.

On disabled elements, events are not triggered anymore.

enable(self)

Enables an element, in case it is not already enabled.

_getTargetfuncName(self, key, type)
__getitem__(self, key)
__setitem__(self, key, value)
__str__(self)

Return str(self).

__iter__(self)
_getData(self)

Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.

Parameters

name

Returns

_getTranslate(self)

Specifies whether an elements attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

Returns

True | False

_setTranslate(self, val)

Specifies whether an elements attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

Parameters

val – True | False

_getTitle(self)

Advisory information associated with the element.

Returns

str

_setTitle(self, val)

Advisory information associated with the element.

Parameters

val – str

_getTabindex(self)

Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.

Returns

number

_setTabindex(self, val)

Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.

Parameters

val – number

_getSpellcheck(self)

Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.

Returns

True | False

_setSpellcheck(self, val)

Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.

Parameters

val – True | False

_getLang(self)

Specifies the primary language for the contents of the element and for any of the elements attributes that contain text.

Returns

language tag e.g. de|en|fr|es|it|ru|

_setLang(self, val)

Specifies the primary language for the contents of the element and for any of the elements attributes that contain text.

Parameters

val – language tag

_getHidden(self)

Specifies that the element represents an element that is not yet, or is no longer, relevant.

Returns

True | False

_setHidden(self, val)

Specifies that the element represents an element that is not yet, or is no longer, relevant.

Parameters

val – True | False

_getDisabled(self)
_setDisabled(self, disable)
_getDropzone(self)

Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

Returns

“copy” | “move” | “link”

_setDropzone(self, val)

Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

Parameters

val – “copy” | “move” | “link”

_getDraggable(self)

Specifies whether the element is draggable.

Returns

True | False | “auto”

_setDraggable(self, val)

Specifies whether the element is draggable.

Parameters

val – True | False | “auto”

_getDir(self)

Specifies the elements text directionality.

Returns

ltr | rtl | auto

_setDir(self, val)

Specifies the elements text directionality.

Parameters

val – ltr | rtl | auto

_getContextmenu(self)

The value of the id attribute on the menu with which to associate the element as a context menu.

Returns

_setContextmenu(self, val)

The value of the id attribute on the menu with which to associate the element as a context menu.

Parameters

val

_getContenteditable(self)

Specifies whether the contents of the element are editable.

Returns

True | False

_setContenteditable(self, val)

Specifies whether the contents of the element are editable.

Parameters

val – True | False

_getAccesskey(self)

A key label or list of key labels with which to associate the element; each key label represents a keyboard shortcut which UAs can use to activate the element or give focus to the element.

Parameters

self

Returns

_setAccesskey(self, val)

A key label or list of key labels with which to associate the element; each key label represents a keyboard shortcut which UAs can use to activate the element or give focus to the element.

Parameters
  • self

  • val

_getId(self)

Specifies a unique id for an element.

Parameters

self

Returns

_setId(self, val)

Specifies a unique id for an element.

Parameters
  • self

  • val

_getClass(self)

The class attribute specifies one or more classnames for an element.

Returns

_setClass(self, value)

The class attribute specifies one or more classnames for an element.

Parameters
  • self

  • value

@raise ValueError:

_getStyle(self)

The style attribute specifies an inline style for an element.

Parameters

self

Returns

_getRole(self)

Specifies a role for an element.

@param self: @return:

_setRole(self, val)

Specifies a role for an element.

@param self: @param val:

hide(self)

Hide element, if shown.

Returns

show(self)

Show element, if hidden.

Returns

isHidden(self)

Checks if a widget is hidden.

Returns

True if hidden, False otherwise.

isVisible(self)

Checks if a widget is visible.

Returns

True if visible, False otherwise.

onBind(self, widget, name)

Event function that is called on the widget when it is bound to another widget with a name.

This is only done by the HTML parser, a manual binding by the user is not triggered.

onAttach(self)
onDetach(self)
__collectChildren(self, *args, **kwargs)

Internal function for collecting children from args.

This is used by appendChild(), prependChild(), insertChild() etc.

insertBefore(self, insert, child, **kwargs)
insertAfter(self, insert, child, **kwargs)
prependChild(self, *args, **kwargs)
appendChild(self, *args, **kwargs)
replaceChild(self, *args, **kwargs)
removeChild(self, child)
removeAllChildren(self)

Removes all child widgets of the current widget.

isParentOf(self, widget)

Checks if an object is the parent of widget.

Parameters

widget (Widget) – The widget to check for.

Returns

True, if widget is a child of the object, else False.

isChildOf(self, widget)

Checks if an object is the child of widget.

Parameters

widget (Widget) – The widget to check for.

Returns

True, if object is a child of widget, else False.

hasClass(self, className)

Determine whether the current widget is assigned the given class.

Parameters

className (str) – The class name to search for.

addClass(self, *args)

Adds a class or a list of classes to the current widget.

If the widget already has the class, it is ignored.

Parameters

args (list of str | list of list of str) – A list of class names. This can also be a list.

removeClass(self, *args)

Removes a class or a list of classes from the current widget.

Parameters

args (list of str | list of list of str) – A list of class names. This can also be a list.

toggleClass(self, on, off=None)

Toggles the class on.

If the widget contains a class on, it is toggled by off. off can either be a class name that is substituted, or nothing.

Parameters
  • on (str) – Classname to test for. If on does not exist, but off, off is replaced by on.

  • off (str) – Classname to replace if on existed.

Returns

Returns True, if on was switched, else False.

Return type

bool

onBlur(self, event)
onChange(self, event)
onContextMenu(self, event)
onFocus(self, event)
onFocusIn(self, event)
onFocusOut(self, event)
onFormChange(self, event)
onFormInput(self, event)
onInput(self, event)
onInvalid(self, event)
onReset(self, event)
onSelect(self, event)
onSubmit(self, event)
onKeyDown(self, event)
onKeyPress(self, event)
onKeyUp(self, event)
onClick(self, event, wdg=None)
onDblClick(self, event)
onDrag(self, event)
onDragEnd(self, event)
onDragEnter(self, event)
onDragLeave(self, event)
onDragOver(self, event)
onDragStart(self, event)
onDrop(self, event)
onMouseDown(self, event)
onMouseMove(self, event)
onMouseOut(self, event)
onMouseOver(self, event)
onMouseUp(self, event)
onMouseWheel(self, event)
onScroll(self, event)
onTouchStart(self, event)
onTouchEnd(self, event)
onTouchMove(self, event)
onTouchCancel(self, event)
focus(self)
blur(self)
parent(self)
children(self, n=None)

Access children of widget.

If n is ommitted, it returns a list of all child-widgets; Else, it returns the N’th child, or None if its out of bounds.

Parameters

n (int) – Optional offset of child widget to return.

Returns

Returns all children or only the requested one.

Return type

list | Widget | None

sortChildren(self, key, reversed=False)

Sorts our direct children. They are rearranged on DOM level.

Key must be a function accepting one widget as parameter and must return the key used to sort these widgets.

fromHTML(self, html, appendTo=None, bindTo=None, replace=False, vars=None, **kwargs)

Parses html and constructs its elements as part of self.

Parameters
  • html – HTML code.

  • appendTo – The entity where the HTML code is constructed below. This defaults to self in usual case.

  • bindTo – The entity where the named objects are bound to. This defaults to self in usual case.

  • replace – Clear entire content of appendTo before appending.

  • vars – Deprecated; Same as kwargs.

  • **kwargs

    Additional variables provided as a dict for {{placeholders}} inside the HTML

Returns

class flare.html5._attrLabel

Bases: object

_getLabel(self)
_setLabel(self, val)
class flare.html5._attrCharset

Bases: object

_getCharset(self)
_setCharset(self, val)
class flare.html5._attrCite

Bases: object

_getCite(self)
_setCite(self, val)
class flare.html5._attrDatetime

Bases: object

_getDatetime(self)
_setDatetime(self, val)
class flare.html5._attrForm

Bases: object

_getForm(self)
_setForm(self, val)
class flare.html5._attrAlt

Bases: object

_getAlt(self)
_setAlt(self, val)
class flare.html5._attrAutofocus

Bases: object

_getAutofocus(self)
_setAutofocus(self, val)
class flare.html5._attrDisabled

Bases: object

class flare.html5._attrChecked

Bases: object

_getChecked(self)
_setChecked(self, val)
class flare.html5._attrIndeterminate

Bases: object

_getIndeterminate(self)
_setIndeterminate(self, val)
class flare.html5._attrName

Bases: object

_getName(self)
_setName(self, val)
class flare.html5._attrValue

Bases: object

_getValue(self)
_setValue(self, val)
class flare.html5._attrAutocomplete

Bases: object

_getAutocomplete(self)
_setAutocomplete(self, val)
class flare.html5._attrRequired

Bases: object

_getRequired(self)
_setRequired(self, val)
class flare.html5._attrMultiple

Bases: object

_getMultiple(self)
_setMultiple(self, val)
class flare.html5._attrSize

Bases: object

_getSize(self)
_setSize(self, val)
class flare.html5._attrFor

Bases: object

_getFor(self)
_setFor(self, val)
class flare.html5._attrInputs

Bases: _attrRequired

_getMaxlength(self)
_setMaxlength(self, val)
_getPlaceholder(self)
_setPlaceholder(self, val)
_getReadonly(self)
_setReadonly(self, val)
class flare.html5._attrFormhead

Bases: object

_getFormaction(self)
_setFormaction(self, val)
_getFormenctype(self)
_setFormenctype(self, val)
_getFormmethod(self)
_setFormmethod(self, val)
_getFormtarget(self)
_setFormtarget(self, val)
_getFormnovalidate(self)
_setFormnovalidate(self, val)
class flare.html5._attrHref

Bases: object

_getHref(self)

Url of a Page.

Parameters

self

_setHref(self, val)

Url of a Page.

Parameters

val – URL

_getHreflang(self)
_setHreflang(self, val)
class flare.html5._attrTarget

Bases: object

_getTarget(self)
_setTarget(self, val)
class flare.html5._attrType

Bases: object

_getType(self)
_setType(self, val)
class flare.html5._attrMedia

Bases: _attrType

_getMedia(self)
_setMedia(self, val)
class flare.html5._attrDimensions

Bases: object

_getWidth(self)
_setWidth(self, val)
_getHeight(self)
_setHeight(self, val)
class flare.html5._attrUsemap

Bases: object

_getUsemap(self)
_setUsemap(self, val)
class flare.html5._attrMultimedia

Bases: object

_getAutoplay(self)
_setAutoplay(self, val)
_getPlaysinline(self)
_setPlaysinline(self, val)
_getControls(self)
_setControls(self, val)
_getLoop(self)
_setLoop(self, val)
_getMuted(self)
_setMuted(self, val)
_getPreload(self)
_setPreload(self, val)
class flare.html5._attrRel

Bases: object

_getRel(self)
_setRel(self, val)
class flare.html5._attrSrc

Bases: object

_getSrc(self)
_setSrc(self, val)
class flare.html5.A(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrHref, _attrTarget, _attrMedia, _attrRel, _attrName

_tagName = a
_getDownload(self)

The download attribute specifies the path to a download.

Returns

filename

_setDownload(self, val)

The download attribute specifies the path to a download.

Parameters

val – filename

class flare.html5.Area(*args, appendTo=None, style=None, **kwargs)

Bases: A, _attrAlt

_tagName = area
_leafTag = True
_getCoords(self)
_setCoords(self, val)
_getShape(self)
_setShape(self, val)
class flare.html5.Audio(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrMultimedia

_tagName = audio
class flare.html5.Bdo(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = bdo
class flare.html5.Blockquote(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = blockquote
_getBlockquote(self)
_setBlockquote(self, val)
class flare.html5.BodyCls(*args, **kwargs)

Bases: Widget

flare.html5._body
flare.html5.Body()
class flare.html5.Canvas(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDimensions

_tagName = canvas
class flare.html5.Command(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrLabel, _attrType, _attrDisabled, _attrChecked

_tagName = command
_getIcon(self)
_setIcon(self, val)
_getRadiogroup(self)
_setRadiogroup(self, val)
class flare.html5._Del(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite, _attrDatetime

_tagName = _del
class flare.html5.Dialog(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = dialog
_getOpen(self)
_setOpen(self, val)
class flare.html5.Abbr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = abbr
class flare.html5.Address(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = address
class flare.html5.Article(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = article
class flare.html5.Aside(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = aside
class flare.html5.B(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = b
class flare.html5.Bdi(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = bdi
class flare.html5.Br(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = br
_leafTag = True
class flare.html5.Caption(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = caption
class flare.html5.Cite(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = cite
class flare.html5.Code(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = code
class flare.html5.Datalist(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = datalist
class flare.html5.Dfn(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = dfn
class flare.html5.Div(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = div
class flare.html5.Em(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = em
class flare.html5.Embed(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrType, _attrDimensions

_tagName = embed
_leafTag = True
class flare.html5.Figcaption(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = figcaption
class flare.html5.Figure(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = figure
class flare.html5.Footer(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = footer
class flare.html5.Header(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = header
class flare.html5.H1(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h1
class flare.html5.H2(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h2
class flare.html5.H3(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h3
class flare.html5.H4(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h4
class flare.html5.H5(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h5
class flare.html5.H6(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = h6
class flare.html5.Hr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = hr
_leafTag = True
class flare.html5.I(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = i
class flare.html5.Kdb(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = kdb
class flare.html5.Legend(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = legend
class flare.html5.Mark(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = mark
class flare.html5.Noscript(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = noscript
class flare.html5.P(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = p
class flare.html5.Rq(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = rq
class flare.html5.Rt(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = rt
class flare.html5.Ruby(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = ruby
class flare.html5.S(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = s
class flare.html5.Samp(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = samp
class flare.html5.Section(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = section
class flare.html5.Small(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = small
class flare.html5.Strong(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = strong
class flare.html5.Sub(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = sub
class flare.html5.Summery(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = summery
class flare.html5.Sup(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = sup
class flare.html5.U(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = u
class flare.html5.Var(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = var
class flare.html5.Wbr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = wbr
class flare.html5.Button(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrType, _attrForm, _attrAutofocus, _attrName, _attrValue, _attrFormhead

_tagName = button
class flare.html5.Fieldset(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrName

_tagName = fieldset
class flare.html5.Form(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrName, _attrTarget, _attrAutocomplete

_tagName = form
_getNovalidate(self)
_setNovalidate(self, val)
_getAction(self)
_setAction(self, val)
_getMethod(self)
_setMethod(self, val)
_getEnctype(self)
_setEnctype(self, val)
_getAccept_attrCharset(self)
_setAccept_attrCharset(self, val)
class flare.html5.Input(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrType, _attrForm, _attrAlt, _attrAutofocus, _attrChecked, _attrIndeterminate, _attrName, _attrDimensions, _attrValue, _attrFormhead, _attrAutocomplete, _attrInputs, _attrMultiple, _attrSize, _attrSrc

_tagName = input
_leafTag = True
_getAccept(self)
_setAccept(self, val)
_getList(self)
_setList(self, val)
_getMax(self)
_setMax(self, val)
_getMin(self)
_setMin(self, val)
_getPattern(self)
_setPattern(self, val)
_getStep(self)
_setStep(self, val)
class flare.html5.Label(*args, forElem=None, **kwargs)

Bases: Widget, _attrForm, _attrFor

_tagName = label
autoIdCounter = 0
class flare.html5.Optgroup(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrLabel

_tagName = optgroup
class flare.html5.Option(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrLabel, _attrValue

_tagName = option
_getSelected(self)
_setSelected(self, val)
class flare.html5.Output(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrForm, _attrName, _attrFor

_tagName = output
class flare.html5.Select(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrAutofocus, _attrName, _attrRequired, _attrMultiple, _attrSize

_tagName = select
_getSelectedIndex(self)
_getOptions(self)
class flare.html5.Textarea(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDisabled, _attrForm, _attrAutofocus, _attrName, _attrInputs, _attrValue

_tagName = textarea
_getCols(self)
_setCols(self, val)
_getRows(self)
_setRows(self, val)
_getWrap(self)
_setWrap(self, val)
class flare.html5.HeadCls(*args, **kwargs)

Bases: Widget

flare.html5._head
flare.html5.Head()
class flare.html5.Iframe(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrName, _attrDimensions

_tagName = iframe
_getSandbox(self)
_setSandbox(self, val)
_getSrcdoc(self)
_setSrcdoc(self, val)
_getSeamless(self)
_setSeamless(self, val)
class flare.html5.Img(src=None, *args, **kwargs)

Bases: Widget, _attrSrc, _attrDimensions, _attrUsemap, _attrAlt

_tagName = img
_leafTag = True
_getCrossorigin(self)
_setCrossorigin(self, val)
_getIsmap(self)
_setIsmap(self, val)
class flare.html5.Ins(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite, _attrDatetime

_tagName = ins
class flare.html5.Keygen(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrAutofocus, _attrDisabled

_tagName = keygen
_getChallenge(self)
_setChallenge(self, val)
_getKeytype(self)
_setKeytype(self, val)

Bases: Widget, _attrHref, _attrMedia, _attrRel

_tagName = link
_leafTag = True
_getSizes(self)
_setSizes(self, val)
class flare.html5.Ul(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = ul
class flare.html5.Ol(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = ol
class flare.html5.Li(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = li
class flare.html5.Dl(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = dl
class flare.html5.Dt(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = dt
class flare.html5.Dd(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = dd
class flare.html5.Map(*args, forElem=None, **kwargs)

Bases: Label, _attrType

_tagName = map
class flare.html5.Menu(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = menu
class flare.html5.Meta(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrName, _attrCharset

_tagName = meta
_leafTag = True
_getContent(self)
_setContent(self, val)
class flare.html5.Meter(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrValue

_tagName = meter
_getHigh(self)
_setHigh(self, val)
_getLow(self)
_setLow(self, val)
_getMax(self)
_setMax(self, val)
_getMin(self)
_setMin(self, val)
_getOptimum(self)
_setOptimum(self, val)
class flare.html5.Nav(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = nav
class flare.html5.Object(*args, appendTo=None, style=None, **kwargs)

Bases: Form, _attrType, _attrName, _attrDimensions, _attrUsemap

_tagName = object
class flare.html5.Param(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrName, _attrValue

_tagName = param
_leafTag = True
class flare.html5.Progress(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrValue

_tagName = progress
_getMax(self)
_setMax(self, val)
class flare.html5.Q(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrCite

_tagName = q
class flare.html5.Script(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrCharset

_tagName = script
_getAsync(self)
_setAsync(self, val)
_getDefer(self)
_setDefer(self, val)
class flare.html5.Source(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrMedia, _attrSrc

_tagName = source
_leafTag = True
class flare.html5.Span(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = span
class flare.html5.Details(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = details
_getOpen(self)
_setOpen(self, val)
class flare.html5.Summary(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = summary
class flare.html5.Style(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrMedia

_tagName = style
_getScoped(self)
_setScoped(self, val)
class flare.html5.Tr(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = tr
_getRowspan(self)
_setRowspan(self, span)
class flare.html5.Td(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = td
_getColspan(self)
_setColspan(self, span)
_getRowspan(self)
_setRowspan(self, span)
class flare.html5.Th(*args, appendTo=None, style=None, **kwargs)

Bases: Td

_tagName = th
class flare.html5.Thead(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = thead
class flare.html5.Tbody(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = tbody
class flare.html5.ColWrapper(parentElem, *args, **kwargs)

Bases: object

__getitem__(self, item)
__setitem__(self, key, value)
class flare.html5.RowWrapper(parentElem, *args, **kwargs)

Bases: object

__getitem__(self, item)
class flare.html5.Table(*args, **kwargs)

Bases: Widget

_tagName = table
prepareRow(self, row)
prepareCol(self, row, col)
prepareGrid(self, rows, cols)
clear(self)
_getCell(self)
getRowCount(self)
class flare.html5.Time(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrDatetime

_tagName = time
class flare.html5.Track(*args, forElem=None, **kwargs)

Bases: Label, _attrSrc

_tagName = track
_leafTag = True
_getKind(self)
_setKind(self, val)
_getSrclang(self)
_setSrclang(self, val)
_getDefault(self)
_setDefault(self, val)
class flare.html5.Video(*args, appendTo=None, style=None, **kwargs)

Bases: Widget, _attrSrc, _attrDimensions, _attrMultimedia

_tagName = video
_getPoster(self)
_setPoster(self, val)
class flare.html5.Template(*args, appendTo=None, style=None, **kwargs)

Bases: Widget

_tagName = template
flare.html5.unescape(val, maxLength=0)

Unquotes several HTML-quoted characters in a string.

Parameters
  • val (str) – The value to be unescaped.

  • maxLength (int) – Cut-off after maxLength characters. A value of 0 means “unlimited”. (default)

Returns

The unquoted string.

Return type

str

flare.html5.doesEventHitWidgetOrParents(event, widget)

Test if event ‘event’ hits widget ‘widget’ (or any of its parents).

flare.html5.doesEventHitWidgetOrChildren(event, widget)

Test if event ‘event’ hits widget ‘widget’ (or any of its children).

flare.html5.textToHtml(node, text)

Generates html nodes from text by splitting text into content and into line breaks html5.Br.

Parameters
  • node – The node where the nodes are appended to.

  • text – The text to be inserted.

flare.html5.parseInt(s, ret=0)

Parses a value as int.

flare.html5.parseFloat(s, ret=0.0)

Parses a value as float.

flare.html5.getKey(event)

Returns the Key Identifier of the given event.

Available Codes: https://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413/keyset.html#KeySet-Set

flare.html5.isArrowLeft(event)
flare.html5.isArrowUp(event)
flare.html5.isArrowRight(event)
flare.html5.isArrowDown(event)
flare.html5.isEscape(event)
flare.html5.isReturn(event)
flare.html5.isControl(event)
flare.html5.isShift(event)
flare.html5.isMeta(event)
flare.html5.__tags
flare.html5.__reVarReplacer
flare.html5.registerTag(tagName, widgetClass, override=True)
flare.html5.tag(arg)

Decorator to register a sub-class of html5.Widget either under its class-name or an associated tag-name.

```python # register class Foo as <foo>-Tag @html5.tag class Foo(html5.Div):

pass

# register class Bar as <baz>-Tag @html5.tag(“baz”) class Bar(html5.Div):

pass

```

flare.html5._buildTags(debug=False)

Generates a dictionary of all to the html5-library known tags and their associated objects and attributes.

class flare.html5.HtmlAst

Bases: list

Abstract syntax tree element used by parseHTML().

flare.html5.parseHTML(html: str, debug: bool = False) HtmlAst

Parses the provided HTML-code according to the tags registered by html5.registerTag() or components that used the html5.tag-decorator.

flare.html5.fromHTML(html: [str, HtmlAst], appendTo: Widget = None, bindTo: Widget = None, debug: bool = False, **kwargs) [Widget]

Parses the provided HTML code according to the objects defined in the html5-library.

html can also be pre-compiled by parseHTML() so that it executes faster.

Constructs all objects as DOM nodes. The first level is chained into appendTo. If no appendTo is provided, appendTo will be set to html5.Body().

If bindTo is provided, objects are bound to this widget.

```python from vi import html5

div = html5.Div() html5.parse.fromHTML(‘’’

<div>Yeah!

<a href=”hello world” [name]=”myLink” class=”trullman bernd” disabled> hah ala malla” bababtschga” <img src=”/static/images/icon_home.svg” style=”background-color: red;”/>st <em>ah</em>ralla <i>malla tralla</i> da </a>lala

</div>’’’, div)

div.myLink.appendChild(“appended!”) ```