bacommon.cloudui package

Common CloudUI bits.

class bacommon.cloudui.CloudUI[source]

Bases: IOMultiType[CloudUITypeID]

UI defined by the cloud.

Conceptually similar to a basic html page, except using app UI.

classmethod get_type(type_id: CloudUITypeID) type[CloudUI][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() CloudUITypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() CloudUI[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

class bacommon.cloudui.CloudUITypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

UNKNOWN = 'u'
V1 = 'v1'
class bacommon.cloudui.UnknownCloudUI[source]

Bases: CloudUI

Fallback type for unrecognized UI types.

Will show the client a ‘cannot display this UI’ placeholder page.

classmethod get_type_id() CloudUITypeID[source]

Return the type-id for this subclass.

Submodules

bacommon.cloudui.v1 module

Full UIs defined in the cloud - similar to a basic form of html

class bacommon.cloudui.v1.Button(label: str | None = None, size: tuple[float, float] | None = None, color: tuple[float, float, float] | None = None, text_color: tuple[float, float, float, float] | None = None, text_flatness: float | None = None, text_scale: float | None = None, decorations: list[~bacommon.cloudui.v1.Decoration] = <factory>, scale: float = 1.0)[source]

Bases: object

A button in our cloud ui.

color: tuple[float, float, float] | None = None
decorations: list[Decoration]
label: str | None = None
scale: float = 1.0
size: tuple[float, float] | None = None
text_color: tuple[float, float, float, float] | None = None
text_flatness: float | None = None
text_scale: float | None = None
class bacommon.cloudui.v1.Decoration[source]

Bases: IOMultiType[DecorationTypeID]

Top level class for our multitype.

classmethod get_type(type_id: DecorationTypeID) type[Decoration][source]

Return the subclass for each of our type-ids.

classmethod get_type_id() DecorationTypeID[source]

Return the type-id for this subclass.

classmethod get_unknown_type_fallback() Decoration[source]

Return a fallback object in cases of unrecognized types.

This can allow newer data to remain readable in older environments. Use caution with this option, however, as it effectively modifies data.

class bacommon.cloudui.v1.DecorationTypeID(*values)[source]

Bases: Enum

Type ID for each of our subclasses.

TEXT = 't'
UNKNOWN = 'u'
class bacommon.cloudui.v1.Row(buttons: list[Button], title: str | None = None, subtitle: str | None = None, button_spacing: float = 5.0, padding_left: float = 10.0, padding_right: float = 10.0, padding_top: float = 10.0, padding_bottom: float = 10.0, center: bool = False)[source]

Bases: object

A row in our cloud ui.

button_spacing: float = 5.0
buttons: list[Button]
center: bool = False
padding_bottom: float = 10.0
padding_left: float = 10.0
padding_right: float = 10.0
padding_top: float = 10.0
subtitle: str | None = None
title: str | None = None
class bacommon.cloudui.v1.Text(text: str)[source]

Bases: Decoration

Text decoration.

classmethod get_type_id() DecorationTypeID[source]

Return the type-id for this subclass.

text: str
class bacommon.cloudui.v1.UI(title: str, rows: list[Row])[source]

Bases: CloudUI

Version 1 of our cloud-defined UI type.

classmethod get_type_id() CloudUITypeID[source]

Return the type-id for this subclass.

rows: list[Row]
title: str
class bacommon.cloudui.v1.UnknownDecoration[source]

Bases: Decoration

An unknown decoration.

In practice these should never show up since the master-server generates these on the fly for the client and so should not send clients one they can’t digest.

classmethod get_type_id() DecorationTypeID[source]

Return the type-id for this subclass.