trading_agent.terminal.widgets.picture_view
¶
A picture in the chat: one a tool showed the model, one the desk sent, or one the user attached.
The picture is downloaded from the gateway and drawn with textual-image, which uses the terminal's own graphics (the Kitty protocol or Sixel) when it has them, and coloured half-blocks otherwise. Enter, or a click, opens the full picture with the desktop's default program.
Typical usage example:
view = PictureView('general', picture_path='charts/nifty.png') view = PictureView('general', attachment=attachment)
PictureView
¶
Bases: Vertical
A picture with its name.
Creates the view; the picture loads once it is on screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk the picture belongs to. |
required |
picture_path
|
str | None
|
A picture inside the desk's folder, from a tool result. |
None
|
attachment
|
dict[str, Any] | None
|
An attachment, from a message. |
None
|
Source code in src/trading_agent/terminal/widgets/picture_view.py
compose
¶
Builds the view.
Yields:
| Type | Description |
|---|---|
Widget
|
The caption; the picture is added once loaded. |
on_mount
¶
on_click
¶
Opens the picture on a click.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Click
|
The click. |
required |
action_open_picture
¶
Opens the full picture with the desktop's default program.