bacommon.cloudui package¶
Common CloudUI bits.
- class bacommon.cloudui.CloudUIPage[source]¶
Bases:
IOMultiType[CloudUIPageTypeID]UI defined by the cloud.
Conceptually similar to a basic html page, except using app UI.
- classmethod get_type(type_id: CloudUIPageTypeID) type[CloudUIPage][source]¶
Return the subclass for each of our type-ids.
- classmethod get_type_id() CloudUIPageTypeID[source]¶
Return the type-id for this subclass.
- classmethod get_type_id_storage_name() str[source]¶
Return the key used to store type id in serialized data.
The default is an obscure value so that it does not conflict with members of individual type attrs, but in some cases one might prefer to serialize it to something simpler like ‘type’ by overriding this call. One just needs to make sure that no encompassed types serialize anything to ‘type’ themself.
- classmethod get_unknown_type_fallback() CloudUIPage[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.CloudUIPageTypeID(*values)[source]¶
Bases:
EnumType ID for each of our subclasses.
- UNKNOWN = 'u'¶
- V1 = 'v1'¶
- class bacommon.cloudui.UnknownCloudUIPage[source]¶
Bases:
CloudUIPageFallback type for unrecognized UI types.
Will show the client a ‘cannot display this UI’ placeholder page.
- classmethod get_type_id() CloudUIPageTypeID[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, opacity: float | None = None, text_color: tuple[float, float, float, float] | None = None, text_flatness: float | None = None, text_scale: float | None = None, texture: str | None = None, scale: float = 1.0, padding_left: float = 0.0, padding_top: float = 0.0, padding_right: float = 0.0, padding_bottom: float = 0.0, decorations: list[~bacommon.cloudui.v1.Decoration] = <factory>, debug: bool = False)[source]¶
Bases:
objectA button in our cloud ui.
- decorations: list[Decoration]¶
- label: str | None = None¶
Note that cloud-ui accepts only raw
strvalues for text; usebabase.Lstr.evaluate()or whatnot for multi-language support.
- 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 a specific subclass given a type-id.
- classmethod get_type_id() DecorationTypeID[source]¶
Return the type-id for this subclass.
- classmethod get_type_id_storage_name() str[source]¶
Return the key used to store type id in serialized data.
The default is an obscure value so that it does not conflict with members of individual type attrs, but in some cases one might prefer to serialize it to something simpler like ‘type’ by overriding this call. One just needs to make sure that no encompassed types serialize anything to ‘type’ themself.
- 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:
EnumType ID for each of our subclasses.
- IMAGE = 'i'¶
- TEXT = 't'¶
- UNKNOWN = 'u'¶
- class bacommon.cloudui.v1.HAlign(*values)[source]¶
Bases:
EnumHorizontal alignment.
- CENTER = 'c'¶
- LEFT = 'l'¶
- RIGHT = 'r'¶
- class bacommon.cloudui.v1.Image(texture: str, position: tuple[float, float], size: tuple[float, float], color: tuple[float, float, float] | None = None, opacity: float | None = None, h_align: HAlign = HAlign.CENTER, v_align: VAlign = VAlign.CENTER, tint_texture: str | None = None, tint_color: tuple[float, float, float] | None = None, tint2_color: tuple[float, float, float] | None = None, mask_texture: str | None = None, mesh_opaque: str | None = None, mesh_transparent: str | None = None)[source]¶
Bases:
DecorationImage decoration.
- classmethod get_type_id() DecorationTypeID[source]¶
Return the type-id for this subclass.
- class bacommon.cloudui.v1.Page(title: str, rows: list[Row], center_vertically: bool = False, simple_culling_v: float = 100.0)[source]¶
Bases:
CloudUIPageCloud-UI page version 1.
- center_vertically: bool = False¶
If True, content smaller than the available height will be centered vertically. This can look natural for certain types of content such as confirmation dialogs.
- classmethod get_type_id() CloudUIPageTypeID[source]¶
Return the type-id for this subclass.
- title: str¶
Note that cloud-ui accepts only raw
strvalues for text; usebabase.Lstr.evaluate()or whatnot for multi-language support.
- class bacommon.cloudui.v1.Row(buttons: list[Button], title: str | None = None, title_color: tuple[float, float, float, float] | None = None, title_flatness: float | None = None, title_shadow: float | None = None, subtitle: str | None = None, subtitle_color: tuple[float, float, float, float] | None = None, subtitle_flatness: float | None = None, subtitle_shadow: float | 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_content: bool = False, center_title: bool = False, simple_culling_h: float = 100.0, debug: bool = False)[source]¶
Bases:
objectA row in our cloud ui.
- title: str | None = None¶
Note that cloud-ui accepts only raw
strvalues for text; usebabase.Lstr.evaluate()or whatnot for multi-language support.
- class bacommon.cloudui.v1.Text(text: str, position: tuple[float, float], max_width: float, max_height: float = 32.0, scale: float = 1.0, h_align: HAlign = HAlign.CENTER, v_align: VAlign = VAlign.CENTER, flatness: float | None = None, shadow: float | None = None, debug: bool = False)[source]¶
Bases:
DecorationText decoration.
- classmethod get_type_id() DecorationTypeID[source]¶
Return the type-id for this subclass.
- text: str¶
Note that cloud-ui accepts only raw
strvalues for text; usebabase.Lstr.evaluate()or whatnot for multi-language support.
- class bacommon.cloudui.v1.UnknownDecoration[source]¶
Bases:
DecorationAn 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.