Repository navigation
API turboframe.ui.app
rafageist edited this page Dec 4, 2026
·
5 revisions
Source: turboframe/ui/app.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.
The base of a TurboFrame application: what every desktop does before its own features.
DesktopApp is a textual-vision Application that:
- fixes Alt+letter and Alt+digit in the terminal (
turboframe.ui.compat); - draws the thumbs of Textual's scroll bars in whole cells, CP437 as the rest of
the screen (
compat.install_cell_scrollbars;CELL_SCROLLBARS = Falseleaves Textual's eighths); - starts in the palette and colour depth its store keeps (
colors_store:palette,colors; Options > Colors writes them, seeturboframe.ui.colors.ColorsMixin), or in those given to it; - registers every TurboFrame theme, with the
$tf-*roles, and paints the desktop, the menus' active item and the hotkeys from them; on a theme change what the code paints is painted again; - draws Turbo Vision's shadows (
ShadowScreen); - puts
DropMenuBarandHintStatusLinein place of textual-vision's bars; - numbers its windows 1 to 9: Alt+1..9 brings one up,
cycle_windowsis F6 and Shift+F6; - shows a spinner while a block runs (
with app.busy("Indexing"):); - runs a dialog modally (
await app.run_dialog(dialog), from a worker); - lets processes start once mounted and, when it closes, starts no more,
waits for those being started and kills what is left (
turboframe.process).
An application subclasses it, mixes in its own features, and adds its menus, status line, bindings and windows as with Application.
class DesktopApp(ColorsMixin, Application)
DesktopApp(*, palette: str | None = None, colors: str | None = None, **kwargs)A Turbo Vision desktop: themes, shadows, the bars, numbered windows, busy, dialogs, its processes.
palette and colors (a colour depth: auto, truecolor, 256, 16) override what the store keeps.
-
watch_theme(name: str) -> None: The CSS follows by itself; what the code paints (shadows, lists, diffs) is painted again. -
on_mouse_down(event: events.MouseDown) -> None: textual-vision'sApplication.on_mouse_downcloses an open menu on a click outside it. It gets the click as it bubbles back up from the widget it went to, a moment later; a click on the desktop just before another on the menu bar came back after the second had opened the menu, and closed it at once (#73). A click older than the menu's opening is not a click on the open menu: it does not close it. -
init_desktop() -> DeskTop: TurboFrame's desktop: Window > Tile (desktop.tile()) leaves the explorer uncovered. -
async on_unmount() -> None: Nothing new starts while the app closes, what is being started finishes starting (the loop cannot close while asyncio starts a process: CPython gh-103847), and nothing it started outlives it. -
hint(text: str) -> None:textin the status line (once it is there). -
busy(label: str): A spinner andlabelin the status line while the block runs. -
async run_dialog(dialog) -> Command: Rundialogmodally and return the command it ended with. Call from a worker. dialog_open() -> bool-
windows() -> list[Window]: The desktop's windows, bottom to top. active_window() -> Window | None-
free_number() -> int: The lowest window number (1 to 9) no window has; 0 when all are taken. -
raise_window(window: Window) -> None: Bringwindowto the top; an application extends it (its status line, its frames). -
action_window(number: int) -> None: Alt+number: the window with that number comes up. -
cycle_windows(*, forward: bool) -> None: F6 brings the bottom window up; Shift+F6 sends the top one down.
TurboFrame · part of Divengine · GPL-3.0-or-later · report an issue
Tutorial
Examples
The desktop
- The Desktop
- Application Mixins
- Windows and Lists
- Dialogs
- Histories
- Progress
- Themes and Colors
- Glyphs
- Settings and Recent Files
- Command Palette
Editing
Tasks
Languages
Running
Reference
Links