nexusLIMS.tui.apps.instruments.screens#

Screens for the instrument management TUI application.

Provides List, Add, Edit, and Delete screens for instrument CRUD operations.

Module Contents#

Classes#

WelcomeDialog

Welcome dialog shown when instruments table is empty.

InstrumentListScreen

Screen displaying all instruments in a table.

InstrumentAddScreen

Screen for adding a new instrument.

InstrumentEditScreen

Screen for editing an existing instrument.

API#

class nexusLIMS.tui.apps.instruments.screens.WelcomeDialog(name: str | None = None, id: str | None = None, classes: str | None = None)[source]#

Bases: textual.screen.ModalScreen

Welcome dialog shown when instruments table is empty.

CSS_PATH#

Type: typing.ClassVar

compose() textual.app.ComposeResult[source]#

Compose the welcome dialog.

on_button_pressed(event: textual.widgets.Button.Pressed) None[source]#

Handle button presses.

class nexusLIMS.tui.apps.instruments.screens.InstrumentListScreen(**kwargs)[source]#

Bases: nexusLIMS.tui.common.base_screens.BaseListScreen

Screen displaying all instruments in a table.

on_mount() None[source]#

Set up the screen and check if welcome dialog should be shown.

on_welcome_complete(should_add: bool) None[source]#

Handle welcome dialog completion.

get_columns() list[str][source]#

Get column headers.

get_data() list[dict][source]#

Get instrument data from database.

on_row_selected(_row_key, row_data: dict) None[source]#

Handle row selection - show edit screen.

on_edit_complete(result) None[source]#

Handle edit screen completion.

action_add() None[source]#

Show add instrument screen.

on_add_complete(result) None[source]#

Handle add screen completion.

action_delete() None[source]#

Delete selected instrument.

delete_instrument(instrument_pid: str) None[source]#

Delete an instrument from the database.

class nexusLIMS.tui.apps.instruments.screens.InstrumentAddScreen(**kwargs)[source]#

Bases: nexusLIMS.tui.common.base_screens.BaseFormScreen

Screen for adding a new instrument.

AUTO_FOCUS = <Multiline-String>#
CSS_PATH#

Type: typing.ClassVar

on_mount() None[source]#

Focus first input without scrolling.

get_form_fields() textual.app.ComposeResult[source]#

Generate form fields for instrument creation in two columns.

collect_form_data() dict[source]#

Collect data from form fields.

validate_form() dict[str, str][source]#

Validate form data.

on_save(data: dict) None[source]#

Save new instrument to database.

class nexusLIMS.tui.apps.instruments.screens.InstrumentEditScreen(instrument: Instrument, **kwargs)[source]#

Bases: nexusLIMS.tui.apps.instruments.screens.InstrumentAddScreen

Screen for editing an existing instrument.

on_mount() None[source]#

Populate form with existing instrument data.

validate_form() dict[str, str][source]#

Validate form data (excluding PID from uniqueness checks).

on_save(data: dict) None[source]#

Update existing instrument in database.