composeui.core.client

Where the app runs for its user, and who the user is (ClientCapabilities, User).

The same app may run on the user’s own computer (Qt, Textual, a local web server) or on another one that the user reaches through a browser or a terminal. MainView.open_folder, open_file, open_url and display_path adapt to it. An app reads MainView.client only to hide or change a control, such as an “Open folder” button that can’t work. Behind a login proxy, on the web, MainView.user says who the user is.

class composeui.core.client.ClientCapabilities[source]

Bases: object

What the app can do for its user, from where it runs for them.

Each backend sets it: Qt runs on the user’s computer (local), and so does Textual, unless it runs over SSH or textual-serve, where the app can’t reach the user’s desktop. The web serves users on other computers (served), unless WebSettings(client=ClientCapabilities.local()) says that the server runs on the user’s own computer, outside a container: nothing in a request can tell.

shares_files: bool

Whether a path in the app is the same path for the user: on their computer, or in the shell that runs a terminal app.

can_open_on_desktop: bool

Whether MainView.open_folder and open_file open on the user’s desktop: in its file manager or the file’s app.

multi_user: bool

Whether several people may use this process at once, as on a web server. It says how the app is deployed, not who the user is.

classmethod local()[source]

Get the capabilities of an app on its user’s own computer: Qt’s.

Return type:

ClientCapabilities

classmethod served()[source]

Get the capabilities of an app that a server runs for users on other computers.

Return type:

ClientCapabilities

__init__(*, shares_files, can_open_on_desktop, multi_user)

Method generated by attrs for class ClientCapabilities.

Parameters:
  • shares_files (bool)

  • can_open_on_desktop (bool)

  • multi_user (bool)

Return type:

None

class composeui.core.client.User[source]

Bases: object

The user whom a login proxy let in, on the web (MainView.user).

The proxy names them in the headers of each request (WebSettings.user_header, user_name_header, user_email_header). Only id tells users apart: the name and the email are for the app to show, and None when the proxy gives none. Never grant access by them: a user can often change both at the identity provider, and it may not have checked the email.

id: str

The user’s id, as the proxy names it, such as a login name or an email address. Each id has sessions of its own.

name: str | None

The user’s name for display, such as "Ada Lovelace", or None.

email: str | None

The user’s email address, as the proxy gives it, or None.

__init__(*, id, name=None, email=None)

Method generated by attrs for class User.

Parameters:
  • id (str)

  • name (str | None)

  • email (str | None)

Return type:

None