trading_agent.terminal.screens.page_screen
¶
The shared frame of the terminal program's pages, such as Trading or Schedule: a title line, Escape to go back to the chat, and timed refreshes.
Each page is its own subclass, in its own file, with its own content. This base holds only what every page does the same way.
Typical usage example:
class SkillsScreen(PageScreen): TITLE_TEXT = 'Skills' ...
PageScreen
¶
Bases: Screen[None]
A page of the terminal program.
Creates the page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk the chat shows, which a desk's page starts on. |
required |
Source code in src/trading_agent/terminal/screens/page_screen.py
compose
¶
Builds the frame around the page's own content.
Yields:
| Type | Description |
|---|---|
Widget
|
The title line, the content and the key footer. |
Source code in src/trading_agent/terminal/screens/page_screen.py
compose_page
¶
Builds the page's own content; each page overrides it.
Yields:
| Type | Description |
|---|---|
Widget
|
Nothing in the base. |
on_mount
¶
Shows the title, focuses the first table or list, reads the page's data, and starts the timer.
Source code in src/trading_agent/terminal/screens/page_screen.py
refresh_page
¶
take_event
¶
Takes a live event; pages that follow events override it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
dict[str, Any]
|
The event. |
required |
action_back
¶
action_refresh_page
¶
action_next_desk
¶
Shows the next desk, on pages that show one desk.
Source code in src/trading_agent/terminal/screens/page_screen.py
show_title
¶
Redraws the title line.
Source code in src/trading_agent/terminal/screens/page_screen.py
problem
¶
Shows a problem reading or changing the page's data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The problem. |
required |
table
¶
One of the page's tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_id
|
str
|
The table's id, without the "#". |
required |
Returns:
| Type | Description |
|---|---|
DataTable
|
The table. |
Source code in src/trading_agent/terminal/screens/page_screen.py
selected_key
¶
The key of a table's highlighted row.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_id
|
str
|
The table's id. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The row's key, or None when the table is empty. |