Zum Inhalt springen
Weitere Sprachen

Automatisch aus Englisch übersetzen. Bilder und Suchbegriffe bleiben Englisch.

Nach deiner Auswahl wird Google Translate geladen.

English original

skin.py functions and value parsers

Use this index to interpret XML values or locate the engine’s loading and screen-building stages. Functions run inside Enigma2; the enigma module and application state are required. Do not run global loading/reloading helpers for every widget update.

Option tokens are extracted from dictionaries and match cases in each parser. A token list does not replace the documented grammar: some tokens belong to separate subfields. See coordinates, colours and pixmaps for practical combinations.

Source snapshot: skin.py @ f4135659cb. The catalogue lists source capabilities; support also depends on the receiver build and native widget class.

InitSkins

Load emergency, subtitle, primary, display, optional skin parts and user overrides; configure desktop resolution and templates. Startup operation, not a per-widget helper.

InitSkins()

Read the implementation at line 99 ↗

loadSkin

Read one XML skin and register its global resources and named screens. Returns True on a readable parsed skin, False otherwise; does not open a screen.

loadSkin(filename, scope=SCOPE_SKINS, desktop=getDesktop(GUI_SKIN_ID), screenID=GUI_SKIN_ID)

Read the implementation at line 180 ↗

reloadSkins

Reload global skin state and window styles. This is a broad application operation, not needed for opening an isolated example.

reloadSkins()

Read the implementation at line 223 ↗

loadSkinTemplates

Load component XML template definitions from the supplied filenames.

loadSkinTemplates(skinTemplatesFileNames)

Read the implementation at line 265 ↗

reloadSkinTemplates

Rebuild component template definitions; clear=True resets previously registered definitions.

reloadSkinTemplates(clear=False)

Read the implementation at line 286 ↗

addCallback

Register a callback to be notified when skin loading invokes its callback list.

addCallback(callback)

Read the implementation at line 299 ↗

removeCallback

Remove a previously registered skin callback.

removeCallback(callback)

Read the implementation at line 305 ↗

getParentSize

Find a widget parent's size or use the desktop, for relative coordinate calculations.

getParentSize(object, desktop)

Read the implementation at line 311 ↗

skinError

Write a skin error to the Enigma2 log; does not itself raise an exception.

skinError(errorMessage)

Read the implementation at line 330 ↗

attribDeprecationWarning

Write a deprecated-attribute warning and its replacement to the log.

attribDeprecationWarning(attribute, replacement)

Read the implementation at line 334 ↗

parseOptions

Look up a string in an allowed-options dictionary; log and return the given default for an invalid value.

parseOptions(options, attribute, value, default)

Read the implementation at line 338 ↗

parseValuePair

Parse a comma-separated x,y pair, with variables, axis-specific scaling and optional parent/widget dimensions. Returns a tuple.

parseValuePair(value, scale, object=None, desktop=None, size=None)

Read the implementation at line 351 ↗

parseAlphaTest

Map off/on/blend to native pixmap alpha flags. Invalid input falls back to off.

parseAlphaTest(value)

Tokens found in the parser: on, off, blend. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 366 ↗

parseAnimationMode

Map window-animation strings to native show/hide flags.

parseAnimationMode(value)

Tokens found in the parser: disable, off, offshow, offhide, onshow, onhide, disable_onshow, disable_onhide. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 375 ↗

parseBoolean

Return True for 1, the supplied attribute name, enabled, on, true or yes (case-insensitive); other strings are False.

parseBoolean(attribute, value)

Read the implementation at line 389 ↗

parseColor

Resolve #AARRGGBB or a registered colour name to gRGB; invalid input logs and uses the specified fallback.

parseColor(value, default=16777215)

Read the implementation at line 393 ↗

parseCoordinate

Evaluate one design coordinate with scaling, center/c/e/percent and font-relative terms. Returns an integer, or None for the wildcard. It is not a CSS expression parser.

parseCoordinate(value, parent, size=0, font=None, scale=(1, 1))

Read the implementation at line 431 ↗

parseErrorCorrection

Map QR recovery-level names to eQRCode constants; default medium.

parseErrorCorrection(value)

Tokens found in the parser: low, medium, quartile, high. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 515 ↗

parseFont

Resolve face/alias and optional ;size to a gFont. Font size is scaled on the vertical axis; an unknown face falls back to Body.

parseFont(value, scale=((1, 1), (1, 1)))

Read the implementation at line 525 ↗

parseFontScale

Parse size;offset or width;offset into a scale mode and vertically scaled offset.

parseFontScale(value, scale=((1, 1), (1, 1)))

Read the implementation at line 554 ↗

parseGradient

Parse start[,middle],end,horizontal-or-vertical[,alphaBlend]; return three colours, direction and blending flag.

parseGradient(value)

Tokens found in the parser: horizontal, vertical. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 570 ↗

parseHorizontalAlignment

Map left, center, right or block to native text alignment; invalid input defaults to left.

parseHorizontalAlignment(value)

Tokens found in the parser: left, center, right, block. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 604 ↗

parseInteger

Convert to int; log and return the supplied default on TypeError or ValueError.

parseInteger(value, default=0)

Read the implementation at line 614 ↗

parseItemAlignment

Map item alignment names to native listbox alignment constants.

parseItemAlignment(value)

Tokens found in the parser: default, center, justify, leftTop, leftMiddle, leftBottom, rightTop, rightMiddle, rightBottom, centerTop, centerMiddle, centerBottom, justifyTop, justifyMiddle, justifyBottom, justifyLeft, justifyRight. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 623 ↗

parseListOrientation

Map vertical/horizontal/grid to listbox orientation bits; invalid input falls back to vertical.

parseListOrientation(value)

Tokens found in the parser: vertical, horizontal, grid. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 646 ↗

parseOrientation

Map slider direction names to orientation and reverse-direction flags.

parseOrientation(value)

Tokens found in the parser: orHorizontal, orLeftToRight, orRightToLeft, orVertical, orTopToBottom, orBottomToTop. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 655 ↗

parseParameter

Convert a parameter token to string, colour integer, hex integer, float, named colour, font list or integer according to its prefix/content.

parseParameter(value)

Read the implementation at line 680 ↗

parsePixmap

Load an existing resolved image path through LoadPixmap; strip a # suffix and log missing or unreadable files. Returns a pixmap or None.

parsePixmap(path, desktop)

Read the implementation at line 700 ↗

parsePosition

Parse an x,y pair and return an ePoint.

parsePosition(value, scale, object=None, desktop=None, size=None)

Read the implementation at line 714 ↗

parseRadius

Parse radius[;edge,edge] into a radius and corner bitmask. Plain radius applies to all corners.

parseRadius(value)

Tokens found in the parser: topLeft, topRight, top, bottomLeft, bottomRight, bottom, left, right. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 718 ↗

parseScrollbarLength

Parse a numeric length, full (0) or auto (-1), otherwise return the caller's default.

parseScrollbarLength(value, default)

Tokens found in the parser: full, auto. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 741 ↗

parseSize

Parse a width,height pair and return an eSize.

parseSize(value, scale, object=None, desktop=None)

Read the implementation at line 753 ↗

parseTabWidth

Parse a numeric tab width or auto (-1), otherwise return the caller's default.

parseTabWidth(value, default)

Tokens found in the parser: auto. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 757 ↗

parseScale

Map pixmap scaling/alignment names to native blit flags; preserves numerous compatibility spellings.

parseScale(value)

Tokens found in the parser: none, 0, scale, 1, keepAspect, leftTop, leftCenter, leftMiddle, leftBottom, centerTop, middleTop, centerScaled, middleScaled, centerBottom, middleBottom, rightTop, rightCenter, rightMiddle, rightBottom, scaleKeepAspect, scaleLeftTop, scaleLeftCenter, scaleLeftMiddle, scaleLeftBottom, scaleCenterTop, scaleMiddleTop, scaleCenter, scaleMiddle, scaleCenterBottom, scaleMiddleBottom, scaleRightTop, scaleRightCenter, scaleRightMiddle, scaleRightBottom, moveLeftTop, moveLeftCenter, moveLeftMiddle, moveLeftBottom, moveCenterTop, moveMiddleTop, moveCenter, moveMiddle, moveCenterBottom, moveMiddleBottom, moveRightTop, moveRightCenter, moveRightMiddle, moveRightBottom, off, on, aspect, center, width, height, stretch, fill. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 768 ↗

parseScrollbarMode

Map visibility/side names to native listbox scrollbar constants.

parseScrollbarMode(value)

Tokens found in the parser: showOnDemand, showAlways, showNever, showLeft, showLeftOnDemand, showLeftAlways, showTopOnDemand, showTopAlways, showOnDemandShrink. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 835 ↗

parseScrollbarScroll

Map byPage/byLine to the native scrolling policy.

parseScrollbarScroll(value)

Tokens found in the parser: byPage, byLine. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 850 ↗

parseScrollText

Parse comma-separated key=value text-scrolling options into direction, delays, repeat, step size and mode.

parseScrollText(value)

Tokens found in the parser: left, right, top, bottom, cached, bounce, bounceCached, roll, direction, endDelay, mode, repeat, startDelay, stepDelay, stepSize. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 858 ↗

parseSeparator

Expand 1/2/4 separator values into left,top,width,height; supports automatic -1 fields.

parseSeparator(attribute, value)

Read the implementation at line 901 ↗

parsePadding

Expand 1/2/4 integers into left,top,right,bottom. Two values become x,y,x,y; it is not CSS top/right order.

parsePadding(attribute, value)

Read the implementation at line 924 ↗

parseVerticalAlignment

Map top, center/middle or bottom to native text alignment; invalid input defaults to center.

parseVerticalAlignment(value)

Tokens found in the parser: top, center, middle, bottom. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 939 ↗

parseWrap

Map ellipsis/noWrap/wrap to 2/0/1; otherwise parse an integer with fallback 1.

parseWrap(value)

Tokens found in the parser: ellipsis, noWrap, wrap. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 949 ↗

parseZoom

Map a list selection zoom mode to native listbox constants.

parseZoom(mode, zoomType)

Tokens found in the parser: zoomContent, moveContent, ignoreContent. These can belong to different sub-options; use the syntax explained above.

Read the implementation at line 962 ↗

collectAttributes

Resolve XML attributes, filenames, position, size, fonts and layout context before applying them to native objects. Mutates the supplied attribute list.

collectAttributes(skinAttributes, node, context, skinPath=None, ignore=(), filenames=frozenset(('pixmap', 'pointer', 'seekPointer', 'seek_pointer', 'backgroundPixmap', 'selectionPixmap', 'sliderPixmap', 'scrollbarBackgroundPixmap', 'scrollbarForegroundPixmap', 'scrollbarbackgroundPixmap', 'scrollbarBackgroundPicture', 'scrollbarSliderPicture')))

Read the implementation at line 971 ↗

applyAllAttributes

Construct an AttributeParser for a native object and apply the collected name/value pairs.

applyAllAttributes(guiObject, desktop, attributes, scale=((1, 1), (1, 1)))

Read the implementation at line 1494 ↗

loadSingleSkinData

Process global skin data such as output, includes, colours, fonts, parameters, layouts, subtitle styles and window styles.

loadSingleSkinData(desktop, screenID, domSkin, pathSkin, scope=SCOPE_GUISKIN)

Read the implementation at line 1498 ↗

reloadWindowStyles

Reapply stored window-style definitions.

reloadWindowStyles()

Read the implementation at line 1786 ↗

readSkin

Choose a named or embedded screen, build its layout contexts, connect sources/converters/renderers and collect component attributes. Called by Screen.

readSkin(screen, skin, names, desktop)

Read the implementation at line 2300 ↗

findSkinScreen

Return the first registered name found in a name or list of names, otherwise None.

findSkinScreen(names)

Read the implementation at line 2750 ↗

findWidgets

Return names of widgets/sources/addon connections from a registered screen, expanding named panels; this is an XML scan, not screen execution.

findWidgets(name)

Read the implementation at line 2764 ↗

getcomponentTemplate

Return the registered XML component template for component/name (spelling is case-sensitive).

getcomponentTemplate(component, name)

Read the implementation at line 2792 ↗

getcomponentTemplateNames

Return names of registered component templates for a component.

getcomponentTemplateNames(component)

Read the implementation at line 2799 ↗

getScrollLabelStyle

Return one stored ScrollLabel default by key, or None if absent.

getScrollLabelStyle(element)

Read the implementation at line 2805 ↗

getSkinFactor

Return desktop height divided by 720. Deprecated for OpenATV; prefer the screen resolution attribute for new layouts.

getSkinFactor(screen=GUI_SKIN_ID)

Read the implementation at line 2816 ↗

applySkinFactor

Legacy helper multiplying numeric arguments by getSkinFactor; returns an int for one argument or tuple for multiple arguments.

applySkinFactor(*d)

Read the implementation at line 2823 ↗