repype.textual.editor
- class repype.textual.editor.EditorScreen(mode: Literal['new', 'edit'], task: Task | None = None, parent_task: Task | None = None)
Bases:
ModalScreen[bool]A screen for editing or creating a task.
- Parameters:
mode – The mode of the screen.
task – The task to edit, if mode is ‘edit’.
parent_task – The parent task of the new task, if mode is ‘new’.
- Raises:
AssertionError – If the combination of arguments is invalid.
- BINDINGS: ClassVar[list[BindingType]] = [Binding(key='ctrl+s', action='save', description='Save', show=True, key_display=None, priority=True), Binding(key='ctrl+c', action='cancel', description='Cancel', show=True, key_display=None, priority=True)]
Key bindings of the screen.
- action_cancel() None
Close the task editor without saving.
A confirmation dialog based on
confirm()is shown before closing the editor.Dismisses the screen with a value of False if the editor is closed.
- action_save() None
Create a new task if the screen is in ‘new’ mode, or update an existing task if the screen is in ‘edit’ mode.
Validates the input before saving the task. Shows an error if the task name is empty or the YAML code is invalid. Dismisses the screen with a value of True if the task is saved successfully.
- async confirm(*args, **kwargs) bool
Shortcut for
repype.textual.confirm.confirm.
- async static edit(app: App, task: Task) bool
Display an editor screen to update the task specification.
- Parameters:
app – The application instance.
task – The task to be updated.
- Returns:
True if the task was saved, and False otherwise.
- async static new(app: App, parent_task: Task) bool
Display an editor screen to create a new sub-task.
- Parameters:
app – The application instance.
parent_task – The parent task of the sub-task.
- Returns:
True if the task was created, and False otherwise.
- property task_name: str
The task name.
- Raises:
AssertionError – If the screen is not in ‘new’ mode.
- property task_name_input: Input
The input widget for the task name.
- Raises:
AssertionError – If the screen is not in ‘new’ mode.
- property task_spec_editor: TextArea
The text area widget for the task specification.