trading_agent.terminal.screens.files_screen
¶
The Files page: the user's editable files, with an editor, and the changes desks propose to them.
It copies the web page's FilesPage.tsx. A file opens in an editor; Ctrl+S saves it and Ctrl+U puts back the text as it was last saved. Leaving a file with unsaved changes asks first. Proposals show their diff and are accepted with a or rejected with x.
Typical usage example:
app.push_screen(FilesScreen('general'))
FilesScreen
¶
Bases: PageScreen
The Files page.
Creates the page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk the chat shows. |
required |
Source code in src/trading_agent/terminal/screens/files_screen.py
compose_page
¶
Builds the file and proposal lists and the editor and diff panes.
Yields:
| Type | Description |
|---|---|
Widget
|
The page's parts. |
Source code in src/trading_agent/terminal/screens/files_screen.py
on_mount
¶
Hides the editor and the diff until something is chosen.
refresh_page
async
¶
Reads the files and the proposals.
Source code in src/trading_agent/terminal/screens/files_screen.py
on_option_list_option_selected
¶
Opens the chosen file or proposal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
OptionSelected
|
The choice. |
required |
Source code in src/trading_agent/terminal/screens/files_screen.py
action_save
¶
action_revert
¶
Puts back the text as it was last saved.
action_accept
¶
Accepts the shown proposal, changing its file.
action_reject
¶
action_toggle_decided
¶
Shows or hides proposals that were already accepted or rejected.
action_back
¶
Goes back to the chat, asking first when the open file has unsaved changes.
DiscardDialog
¶
Bases: ModalScreen[bool]
Asks whether to discard unsaved changes to a file.
Creates the dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str
|
The file with unsaved changes. |
required |
Source code in src/trading_agent/terminal/screens/files_screen.py
compose
¶
Builds the dialog.
Yields:
| Type | Description |
|---|---|
Widget
|
The question and the keys. |