bacommon.docui.routes package¶
Type-safe routes and local-actions layered over doc-ui v2.
The doc-ui wire format is string based (request paths, arg dicts, local-action names). The classes here let first-party code work purely in dataclasses instead; the modules alongside define the routes for individual doc-ui domains and are shared by whichever ends (client and/or server) author or handle that domain’s pages.
- class bacommon.docui.routes.DocUILocalActionBase[source]¶
Bases:
objectA local-action in a doc-ui domain, with args as dataclass fields.
The local-action analogue of
DocUIRoute: each named action a domain’s client-side controller exposes is an@iopreppeddataclass inheriting from that domain’s family class (a direct child of this class).- attach(response: bacommon.docui.v2.Response) None[source]¶
Have a response run this local-action when first received.
- classmethod from_name_and_args(name: str, args: dict) Self[source]¶
Return the local-action in this family matching a name + args.
Should be called on a family class. Raises
DocUIRouteErrorif there is no match.
- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- classmethod get_press_sound() PressSound[source]¶
What a button plays when pressed to run this local-action.
Actions that stay on the page click (the default); override to return
SWISHfor ones that go somewhere (open a window or popup). A press whose action hasdefault_soundoff plays nothing either way.
- local(*, close_window: bool = False, default_sound: bool = True, sets: Sequence[DocUIStateAssign] | None = None) bacommon.docui.v2.Local[source]¶
Return an action running this local-action immediately.
Any
setsare applied to the pressing page’s state first.
- classmethod press_sound_for_name(name: str) PressSound[source]¶
The press sound for the local-action in this family named so.
Should be called on a family class. Unknown names click.
- class bacommon.docui.routes.DocUIRoute[source]¶
Bases:
objectA page in a doc-ui domain, with its args as dataclass fields.
Doc-ui (v2) requests are a path string plus a dict of args on the wire. A route is a type-safe stand-in for one: each page a domain offers is an
@iopreppeddataclass inheriting from that domain’s family class (itself a direct child of this class). The dataclass’ fields are the page’s args; its path and request-method are given as keywords on its class line (class Foo(FooFamily, path='/foo', method=POST)).Page code never touches the path or args dict directly: authoring goes through the
browse()andreplace()verbs and handling goes throughfrom_request()(generally called on one’s behalf by a controller or request-handler base class).Paths within a family are a closed set; anything variable belongs in args (no
/item/<id>style paths). Routes are keyed on path and method, so a page and the POST that submits it can share a path.- browse(*, default_sound: bool = True, sets: Sequence[DocUIStateAssign] | None = None, state: DocUIState | None = None, layout: bacommon.docui.v2.WindowLayout | None = None) bacommon.docui.v2.Browse[source]¶
Return an action browsing to this route in a new window.
The pressing page’s state goes along with the request, with any
setsapplied to it. Passstateto send some other state entirely; generally what a different page expects. The window opens atlayout, or atget_window_layout()if not given.
- classmethod from_request(request: bacommon.docui.v2.Request) Self[source]¶
Return the route in this family that a request maps to.
Should be called on a family class. Raises
DocUIRouteErrorif the request does not map to a route in the family.
- classmethod get_method() bacommon.docui.v2.RequestMethod[source]¶
Return the request method for this route.
- classmethod get_route_types() tuple[type[DocUIRoute], ...][source]¶
Return all concrete routes in this family.
Must be overridden by each family class. A family generally defines a union alias of its routes (which also gives handlers
assert_neverexhaustiveness) and returnsfamily_members()of it here.
- get_source_request() bacommon.docui.v2.Request | None[source]¶
Return the request we were built from, if we were.
Unlike
request(), which only ever describes the route itself, this carries whatever else rode along with the request (page state, trigger). Something forwarding an incoming route elsewhere as-is wants those to go along too.
- get_state(state_type: type[S]) S | None[source]¶
Return page state that arrived with the request for us.
Only routes built from requests have any, and only when the page the request was fired from had state of this type; anything else gives None. State is always optional input, so callers need a story for that.
- classmethod get_window_layout() bacommon.docui.v2.WindowLayout[source]¶
The layout windows browsing to this route open with.
browse()uses this unless told otherwise, so a route whose page is best shown at some layout declares it once rather than at every link.
- replace(*, default_sound: bool = True, sets: Sequence[DocUIStateAssign] | None = None, state: DocUIState | None = None) bacommon.docui.v2.Replace[source]¶
Return an action replacing the current page with this route.
See
browse()forsetsandstate.
- request() bacommon.docui.v2.Request[source]¶
Return the wire request for this route.
- exception bacommon.docui.routes.DocUIRouteError[source]¶
Bases:
ExceptionA request or local-action could not be mapped to a typed form.
- class bacommon.docui.routes.DocUIState[source]¶
Bases:
objectValues belonging to a doc-ui page, as dataclass fields.
Where route args say which page something is, state is what the user is in the middle of on it: the values its input rows show and edit plus anything else it wants handed back (a draft being composed, say). A page declares its state once and the client sends the current values along with every request fired from that page, so individual links need only say what they change.
Subclasses are
@iopreppeddataclasses declaring a globally unique id on their class line (class Foo(DocUIState, state_id='mydomain.foo')). The id rides along with the values so that state arriving at a page expecting some other type reads as no state at all instead of being mis-decoded. Field storage names must not start with an underscore.State is always optional input; a page must be able to make do without any (see
DocUIRoute.get_state).- classmethod assign(field: Callable[[Self], V], value: V) DocUIStateAssign[source]¶
- classmethod assign(field: Callable[[Self], V | None], value: V) DocUIStateAssign
Return an assignment of a value to one of our fields.
For passing as
setswhen creating actions:route.replace(sets=[MyState.assign(lambda s: s.color, c)]). The value is type-checked against the field. (The second overload is what lets a plainEbe assigned to anE | Nonefield: mypy settles the type variable from the value before it looks at the lambda.)
- classmethod assign_locally(*assigns: DocUIStateAssign, default_sound: bool = True) bacommon.docui.v2.Local[source]¶
Return an action assigning values with no request involved.
The values simply go out with whatever the page sends next.
- classmethod checkbox_row(field: Callable[[Self], bool], *, label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.CheckboxRow[source]¶
Return a checkbox row editing one of our (bool) fields.
disabledshows it dimmed and not toggleable (still selectable).
- classmethod choice_row(field: Callable[[Self], E], *, choice_label: Callable[[E], LangStrSpec], choices: Sequence[E] | None = None, disabled_choices: Collection[E] = (), label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.ChoiceRow[source]¶
- classmethod choice_row(field: Callable[[Self], E | None], *, choice_label: Callable[[E], LangStrSpec], none_label: LangStrSpec, choices: Sequence[E] | None = None, disabled_choices: Collection[E] = (), label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.ChoiceRow
- classmethod choice_row(field: Callable[[Self], str], *, choices: Sequence[tuple[str, LangStrSpec]], disabled_choices: Collection[str] = (), label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.ChoiceRow
- classmethod choice_row(field: Callable[[Self], str | None], *, choices: Sequence[tuple[str, LangStrSpec]], none_label: LangStrSpec, disabled_choices: Collection[str] = (), label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.ChoiceRow
Return a choice row editing one of our enum or str fields.
For an enum field,
choice_labelgives each option’s display text; write it as amatchending inassert_neverso a new enum member can’t go unlabeled.choicesnarrows/reorders the options shown (default: every member, in definition order).For a str field there is no closed set to be exhaustive over, so
choicesinstead defines the options as(value, label)pairs, in display order;choice_labeldoes not apply. The state’s current value should be among them (a value that isn’t shows as the first option).disabled_choiceslists options to show greyed out and unpickable (enum members, or str values, matching howchoicesare given) – each must be one of the options.disabledinstead disables the whole row: shown dimmed with its menu unopenable (still selectable).A field typed
E | None/str | Nonegets a ‘nothing’ option too, listed first, whose display text isnone_label– required for such fields and not allowed for others. The type checker enforces the required halves of all this via the overloads; what it can’t express (a straynone_labelorchoice_label) is checked here at runtime along with the rest.
- classmethod color_row(field: Callable[[Self], tuple[float, float, float]], *, label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.ColorRow[source]¶
Return a color row editing one of our rgb fields.
The field must be typed
tuple[float, float, float](0-1 components).on_changefires when the picker closes with a changed color, not per intermediate change.disabledshows it dimmed with its picker unopenable (still selectable).
- classmethod decode(data: dict | None) Self | None[source]¶
Return state of this type from its wire form, if that it be.
Returns None for no data, data for some other state type, or data that fails to decode. State comes from clients and is always optional, so none of those are errors.
- classmethod key(field: Callable[[Self], Any]) str[source]¶
Return the wire key for a field, given a lambda fetching it.
MyState.key(lambda s: s.some_field)
- classmethod number_row(field: Callable[[Self], float], *, min_value: float, max_value: float, increment: float, as_percent: bool = False, decimals: int = 0, label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.NumberRow[source]¶
Return a ‘-‘/’+’ number row editing one of our float fields.
on_changefires on each press that changes the value.disabledshows it dimmed and not adjustable (still selectable). Seebacommon.docui.v2.NumberRow.
- classmethod slider_row(field: Callable[[Self], float], *, min_value: float, max_value: float, increment: float, as_percent: bool = False, decimals: int = 2, label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, on_change: bacommon.docui.v2.Action | None = None, on_drag: bacommon.docui.v2.Local | None = None, drag_interval: float = 0.25, drag_delay: float = 0.0, disabled: bool = False, debug: bool = False) bacommon.docui.v2.SliderRow[source]¶
Return a slider row editing one of our float fields.
on_changefires for a settled value (release, or a run of key/controller steps going quiet);on_drag– a local action, built viaMyAction().local()– fires during a drag (key/controller steps included) at the throttled cadencedrag_interval/drag_delaydescribe, reading the live value from the page’s state.disabledshows it dimmed and not adjustable (still selectable). Seebacommon.docui.v2.SliderRow.
- classmethod text_input_row(field: Callable[[Self], str], *, label: LangStrSpec | None = None, title: LangStrSpec | None = None, subtitle: LangStrSpec | None = None, title_align: bacommon.docui.v2.HAlign | None = None, footnote: LangStrSpec | None = None, description: LangStrSpec | None = None, max_chars: int = 64, on_change: bacommon.docui.v2.Action | None = None, on_submit: bacommon.docui.v2.Action | None = None, disabled: bool = False, debug: bool = False) bacommon.docui.v2.TextInputRow[source]¶
Return a text-input row editing one of our (str) fields.
disabledshows it dimmed and not editable (still selectable).
- class bacommon.docui.routes.DocUIStateAssign(state_type: type[DocUIState], key: str, value: Any)[source]¶
Bases:
objectA value to be assigned into a page’s state.
Create these via
DocUIState.assign().- state_type: type[DocUIState]¶
- class bacommon.docui.routes.NoLocalActions[source]¶
Bases:
DocUILocalActionBaseStock local-action family for domains that have none.
Pair with
typing.Neveras the local-action type arg.- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- class bacommon.docui.routes.PressSound(*values)[source]¶
Bases:
EnumWhat a button plays when pressed to run a local-action.
See
get_press_sound().- CLICK = 'click'¶
The standard click, for actions that stay on the page.
- NONE = 'none'¶
Nothing (the action handles any sound itself).
- SWISH = 'swish'¶
The standard ui swish, for actions that go somewhere – open a window or a popup, say – like a browse does.
- bacommon.docui.routes.family_members(alias: Any) tuple[Any, ...][source]¶
Return the classes making up a family’s union alias.
Handles the degenerate single-member case, where the ‘union’ is simply the one class.
- bacommon.docui.routes.validate_page_state(page: bacommon.docui.v2.Page) None[source]¶
Make sure a page’s use of its state hangs together.
Checks that everything referring to the page’s state by key (input rows,
setson actions) names a real field of the state type the page declares. Those are all produced by type-checked calls, but nothing static ties them to the same state type as the page’s, so that part gets checked here. Pages whose state is of no type known to us (third party ones, say) are left alone.
Submodules¶
bacommon.docui.routes.classicleaguepresidency module¶
Routes for the classic league-presidency doc-ui domain.
- class bacommon.docui.routes.classicleaguepresidency.BidState(bid: int = 0)[source]¶
Bases:
DocUIStateThe presidency page’s state: the bid being composed.
Clients that speak page state carry this; older ones carry the same value as the
bidarg on the routes.
- class bacommon.docui.routes.classicleaguepresidency.GetTokens[source]¶
Bases:
LeaguePresidencyLocalActionShow the get-tokens window.
- class bacommon.docui.routes.classicleaguepresidency.LeaguePresidencyLocalAction[source]¶
Bases:
DocUILocalActionBaseFamily class for classic league-presidency local-actions.
- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- class bacommon.docui.routes.classicleaguepresidency.LeaguePresidencyRoute[source]¶
Bases:
DocUIRouteFamily class for classic league-presidency routes.
- classmethod get_route_types() tuple[type[DocUIRoute], ...][source]¶
Return all concrete routes in this family.
Must be overridden by each family class. A family generally defines a union alias of its routes (which also gives handlers
assert_neverexhaustiveness) and returnsfamily_members()of it here.
- classmethod get_window_layout() WindowLayout[source]¶
The layout windows browsing to this route open with.
browse()uses this unless told otherwise, so a route whose page is best shown at some layout declares it once rather than at every link.
- class bacommon.docui.routes.classicleaguepresidency.Root(bid: int = 0, debug: bool = False, season: str | None = None)[source]¶
Bases:
LeaguePresidencyRouteThe presidency page for the account’s current league.
bacommon.docui.routes.classicstore module¶
Routes for the classic store and inventory doc-ui domains.
The store and inventory are two domains served by a single set of pages (the inventory is essentially the store filtered to owned things plus player-profiles), so they share one route family. Each has its own local-actions.
- class bacommon.docui.routes.classicstore.EditProfile(profile: str)[source]¶
Bases:
InventoryLocalActionOpen the (legacy) profile editor on an existing profile.
- classmethod get_press_sound() PressSound[source]¶
What a button plays when pressed to run this local-action.
Actions that stay on the page click (the default); override to return
SWISHfor ones that go somewhere (open a window or popup). A press whose action hasdefault_soundoff plays nothing either way.
- class bacommon.docui.routes.classicstore.GetTokens[source]¶
Bases:
StoreLocalActionShow the get-tokens window.
- class bacommon.docui.routes.classicstore.InventoryLocalAction[source]¶
Bases:
DocUILocalActionBaseFamily class for classic inventory local-actions.
- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- class bacommon.docui.routes.classicstore.NewProfile[source]¶
Bases:
InventoryLocalActionOpen the (legacy) profile editor on a new profile.
- classmethod get_press_sound() PressSound[source]¶
What a button plays when pressed to run this local-action.
Actions that stay on the page click (the default); override to return
SWISHfor ones that go somewhere (open a window or popup). A press whose action hasdefault_soundoff plays nothing either way.
- class bacommon.docui.routes.classicstore.ProfileDelete(profile_name: str)[source]¶
Bases:
StoreRoute(Inventory) delete a stored profile.
- class bacommon.docui.routes.classicstore.ProfileDraft(color: tuple[float, float, float], highlight: tuple[float, float, float], name: str = '', character: str = '')[source]¶
Bases:
DocUIStateThe profile editor’s working profile.
Page state for the editor and its save: what the user has composed so far. A request with no draft at all (the first visit) gets one built from the stored profile, or fresh defaults when creating; an empty name or character means the same for that field.
- class bacommon.docui.routes.classicstore.ProfileEdit(profile_name: str | None = None)[source]¶
Bases:
StoreRoute(Inventory) the cloud player-profile editor.
The draft being composed rides along as
ProfileDraftpage state; the route itself only says which stored profile (if any) is being edited.- classmethod get_window_layout() WindowLayout[source]¶
The layout windows browsing to this route open with.
browse()uses this unless told otherwise, so a route whose page is best shown at some layout declares it once rather than at every link.
- class bacommon.docui.routes.classicstore.ProfileSave(profile_name: str | None = None)[source]¶
Bases:
StoreRoute(Inventory) save the editor’s draft (its
ProfileDraft).
- class bacommon.docui.routes.classicstore.Purchase(purchase_id: str, debug: bool = False)[source]¶
Bases:
StoreRoutePurchase options for a single item.
- class bacommon.docui.routes.classicstore.PurchaseConfirm(purchase_id: str, purchase_method: PurchaseMethod, debug: bool = False)[source]¶
Bases:
StoreRouteActually purchase an item.
- purchase_method: PurchaseMethod¶
- class bacommon.docui.routes.classicstore.PurchaseMethod(*values)[source]¶
Bases:
EnumHow to purchase something.
- GOLD_PASS = 'g'¶
- PURPLE_TICKETS = 'p'¶
- TICKETS = 'k'¶
- TOKENS = 't'¶
- class bacommon.docui.routes.classicstore.RestorePurchases[source]¶
Bases:
StoreLocalActionKick off a platform purchase-restore.
- class bacommon.docui.routes.classicstore.Root(debug: bool = False, is_refresh: bool = False, legacy_profiles: bool = False, profiles_only: bool = False, unlockreqs: list[str] | None = None)[source]¶
Bases:
StoreRouteThe main store/inventory listing.
- is_refresh: bool = False¶
Set on the page’s own refresh button. One-time-use; the server does not carry it into further links.
- legacy_profiles: bool = False¶
(Inventory) the client is showing its locally-spliced legacy profiles; omit cloud profile rows.
- class bacommon.docui.routes.classicstore.ShowCloudProfiles[source]¶
Bases:
InventoryLocalActionSwitch the inventory to cloud profiles.
- class bacommon.docui.routes.classicstore.ShowLegacyProfiles[source]¶
Bases:
InventoryLocalActionSwitch the inventory to the client’s legacy profiles.
- class bacommon.docui.routes.classicstore.SpawnBot(name: str)[source]¶
Bases:
InventoryLocalActionSpawn a character in the main-menu background.
- class bacommon.docui.routes.classicstore.StoreLocalAction[source]¶
Bases:
DocUILocalActionBaseFamily class for classic store local-actions.
- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- class bacommon.docui.routes.classicstore.StoreRoute[source]¶
Bases:
DocUIRouteFamily class for classic store/inventory routes.
- classmethod get_route_types() tuple[type[DocUIRoute], ...][source]¶
Return all concrete routes in this family.
Must be overridden by each family class. A family generally defines a union alias of its routes (which also gives handlers
assert_neverexhaustiveness) and returnsfamily_members()of it here.
bacommon.docui.routes.docuitest module¶
Routes for the doc-ui test domain.
- class bacommon.docui.routes.docuitest.BoundsTests[source]¶
Bases:
TestRouteButton-style bounds tests.
- class bacommon.docui.routes.docuitest.CloudMsgTestGet[source]¶
Bases:
TestRouteA page fetched through our cloud connection via GET.
- class bacommon.docui.routes.docuitest.CloudMsgTestPost[source]¶
Bases:
TestRouteA page fetched through our cloud connection via POST.
- class bacommon.docui.routes.docuitest.ControlRowKind(*values)[source]¶
Bases:
EnumKinds of control row (for
NavTest).- BUTTON = 'button'¶
- CHECKBOX = 'checkbox'¶
- CHOICE = 'choice'¶
- COLOR = 'color'¶
- NUMBER = 'number'¶
- SLIDER = 'slider'¶
- TEXT_INPUT = 'text'¶
- class bacommon.docui.routes.docuitest.Depictions(debug: bool = False)[source]¶
Bases:
TestRouteDepiction tests.
- class bacommon.docui.routes.docuitest.DisplayItems(debug: bool = False)[source]¶
Bases:
TestRouteDisplay-item tests.
- class bacommon.docui.routes.docuitest.EmptyPage[source]¶
Bases:
TestRouteA page with nothing on it.
- class bacommon.docui.routes.docuitest.Flavor(*values)[source]¶
Bases:
EnumSomething to pick from on the widgets test page.
- CHOCOLATE = 'c'¶
- MINT = 'm'¶
- STRAWBERRY = 's'¶
- VANILLA = 'v'¶
- class bacommon.docui.routes.docuitest.Names(debug: bool = False)[source]¶
Bases:
TestRouteName depiction tests (basic and capsule forms).
Bases:
TestRouteA button row, then one control row of some kind as the last row.
For checking directional navigation on control rows: down from the last row should reach the toolbars, left should reach the back button, and right from a row’s rightmost control should do nothing.
- class bacommon.docui.routes.docuitest.Root(debug: bool = False, test_effects: bool = False, test_action: bool = False)[source]¶
Bases:
TestRouteThe root test page.
- class bacommon.docui.routes.docuitest.Sections(debug: bool = False)[source]¶
Bases:
TestRouteSections: headings, notes, backings and spacing between them.
- classmethod get_window_layout() WindowLayout[source]¶
The layout windows browsing to this route open with.
browse()uses this unless told otherwise, so a route whose page is best shown at some layout declares it once rather than at every link.
- class bacommon.docui.routes.docuitest.ShowVolume[source]¶
Bases:
TestLocalActionShow the volume slider’s live value (fired while dragging).
- class bacommon.docui.routes.docuitest.Size(*values)[source]¶
Bases:
EnumSomething else to pick from on the widgets test page.
- L = 'l'¶
- M = 'm'¶
- S = 's'¶
- XL = 'x'¶
- class bacommon.docui.routes.docuitest.Slow[source]¶
Bases:
TestRouteA page that takes a while to load.
- class bacommon.docui.routes.docuitest.TestAction(testparam: int)[source]¶
Bases:
TestLocalActionShow a message proving we got here.
- class bacommon.docui.routes.docuitest.TestLocalAction[source]¶
Bases:
DocUILocalActionBaseFamily class for doc-ui test local-actions.
- classmethod get_action_types() tuple[type[DocUILocalActionBase], ...][source]¶
Return all concrete local-actions in this family.
Must be overridden by each family class; see
get_route_types().
- class bacommon.docui.routes.docuitest.TestRoute[source]¶
Bases:
DocUIRouteFamily class for doc-ui test routes.
- classmethod get_route_types() tuple[type[DocUIRoute], ...][source]¶
Return all concrete routes in this family.
Must be overridden by each family class. A family generally defines a union alias of its routes (which also gives handlers
assert_neverexhaustiveness) and returnsfamily_members()of it here.
- class bacommon.docui.routes.docuitest.TextImages(debug: bool = False)[source]¶
Bases:
TestRouteText-with-images tests.
- class bacommon.docui.routes.docuitest.TimedActions(val: int = 5)[source]¶
Bases:
TestRouteA page that counts down via timed-actions and then closes.
- class bacommon.docui.routes.docuitest.WebTestGet[source]¶
Bases:
TestRouteA page fetched from a web server via GET.
- class bacommon.docui.routes.docuitest.WebTestPost[source]¶
Bases:
TestRouteA page fetched from a web server via POST.
- class bacommon.docui.routes.docuitest.WideFit(over: bool = False, wide_over: bool = False)[source]¶
Bases:
TestRouteA row exactly as big as wide pages get (browse at each layout).
It should fill the page’s height (wide and wider) and width (wide) with no scrolling, at every ui-scale; with
over/wide_overset it’s a hair taller / wider, which should scroll.
- class bacommon.docui.routes.docuitest.WidgetTestState(plain: bool = False, live: bool = False, checked_disabled: bool = True, unchecked_disabled: bool = False, presses: int = 0, text_short: str = '', text_medium: str = 'Some text', text_long: str = '', text_live: str = '', text_disabled: str = 'Not editable', flavor: Flavor = Flavor.VANILLA, flavor_live: Flavor = Flavor.VANILLA, size: Size = Size.M, size_long: Size = Size.M, topping: Flavor | None = None, difficulty: str = 'normal', region: str | None = None, flavor_disabled: Flavor = Flavor.CHOCOLATE, topping_disabled: Flavor | None = None, difficulty_disabled: str = 'hard', region_disabled: str | None = 'eu', volume: float = 0.5, volume_disabled: float = 0.3, series_length: float = 7.0, series_length_disabled: float = 5.0, tint: tuple[float, float, float] = (0.5, 0.25, 1.0), tint_disabled: tuple[float, float, float] = (1.0, 0.6, 0.1), spacing_top_demo: bool = False, spacing_bottom_demo: bool = False, bands_demo: bool = False)[source]¶
Bases:
DocUIStateState for the widgets test page.
- checked_disabled: bool = True¶
Disabled checkboxes (selectable; not toggleable), one checked and one not.
- difficulty: str = 'normal'¶
Choices over an arbitrary string set (the page defines the options, not an enum); plain and optional.
- flavor_disabled: Flavor = 'c'¶
Disabled choice rows (selectable; menus won’t open), one of each form: enum, optional enum, str, optional str.
- presses: int = 0¶
Nothing shows or edits this directly; it simply rides along (and gets bumped by a button).
- spacing_top_demo: bool = False¶
Checkboxes on rows demonstrating control-row spacing and header / footer bands (they drive nothing).
- tint: tuple[float, float, float] = (0.5, 0.25, 1.0)¶
An rgb color, edited via the color-picker popup.