Work Item Attachments
IssueAttachmentsWidget
- class IssueAttachmentsWidget
Bases:
textual.containers.VerticalScrollA container for displaying the files attached to a work item.
This widget is responsible for the following:
opening the modal screen that allows users to attach files.
processing the result from the modal screen and attaching a file to the work item via the API.
deleting attachments from the work item via the API when the message
jiratui.widgets.attachments.attachments.AttachmentsDataTable.Deletedis posted.updating the list of attachments when an attachment is deleted.
The config variable
config.fetch_attachments_on_deletecontrols whether the widget retrieves the attachments from the work item after an attachment is deleted.See Also:
Initialization
Construct a scrollable container.
- Parameters:
children – Child widgets.
name – The name of the widget.
id – The ID of the widget in the DOM.
classes – The CSS classes for the widget.
disabled – Whether the widget is disabled or not.
can_focus – Can this container be focused?
can_focus_children – Can this container’s children be focused?
can_maximized – Allow this container to maximize? None to use default logic.,
- on_attachments_data_table_deleted(message: jiratui.widgets.attachments.attachments.AttachmentsDataTable) None
Schedules a task to delete an attachment.
FileAttachmentWidget
- class FileAttachmentWidget
A factory to build Widgets to view different types of files attached to a work item.
- static build_widget(file_type: str, content: bytes) textual.widget.Widget | None
Builds a
textual.widget.Widgetfor visualizing a specific type of file/content.- Parameters:
file_type – the file’s MIME type.
content – the bytes representation of the file’s content to display.
- Returns:
A textual.widget.Widget to display the contents or None if the file’s content is not supported.
AttachmentsDataTable
- class AttachmentsDataTable(work_item_key: str)
Bases:
textual.widgets.DataTableA data table to list the files attached to a work item.
Initialization
Initializes a widget to display tabular data.
- Parameters:
show_header – Whether the table header should be visible or not.
show_row_labels – Whether the row labels should be shown or not.
fixed_rows – The number of rows, counting from the top, that should be fixed and still visible when the user scrolls down.
fixed_columns – The number of columns, counting from the left, that should be fixed and still visible when the user scrolls right.
zebra_stripes – Enables or disables a zebra effect applied to the background color of the rows of the table, where alternate colors are styled differently to improve the readability of the table.
header_height – The height, in number of cells, of the data table header.
show_cursor – Whether the cursor should be visible when navigating the data table or not.
cursor_foreground_priority – If the data associated with a cell is an arbitrary renderable with a set foreground color, this determines whether that color is prioritized over the cursor component class or not.
cursor_background_priority – If the data associated with a cell is an arbitrary renderable with a set background color, this determines whether that color is prioritized over the cursor component class or not.
cursor_type – The type of cursor to be used when navigating the data table with the keyboard.
cell_padding – The number of cells added on each side of each column. Setting this value to zero will likely make your table very hard to read.
name – The name of the widget.
id – The ID of the widget in the DOM.
classes – The CSS classes for the widget.
disabled – Whether the widget is disabled or not.
- class Deleted(work_item_key: str, attachment_id: str)
Bases:
textual.message.MessagePosted when the user deletes an attachment.
It holds the key of the work item whose attachment we deleted and the ID of the deleted attachment.
Initialization
- highlighted(event: textual.widgets.DataTable.RowHighlighted) None
Handles the event when a user highlights a row.
We want to store the id of the attachment, the file name of the attachment and the file type. This data will be used for displaying images and opening links in the browser.
- Parameters:
event – the event triggered when the user highlights a row.
- Returns:
None
- selected(event: textual.widgets.DataTable.RowSelected) None
Handles the event when a user selects a row.
We want to store the id of the attachment, the file name of the attachment and the file type. This data will be used for displaying images and opening links in the browser.
- Parameters:
event – the event triggered when the user selects a row.
- Returns:
None
- async action_open_attachment() None
Opens the currently selected attached file in the default browser.