organoid_tracker.gui.dialog module

class organoid_tracker.gui.dialog.DefaultOption(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

CANCEL = 'CANCEL'
OK = 'OK'
class organoid_tracker.gui.dialog.PopupWindow(q_window: QMainWindow, figure: Figure, parent_window: Union[GuiExperiment, Window], title_text: QLabel, status_text: QLabel)

Bases: Window

class organoid_tracker.gui.dialog.PromptAnswer(answer: int)

Bases: object

is_cancel()
is_no()
is_yes()
organoid_tracker.gui.dialog.open_file(filepath: str)

Opens a file using the default application.

organoid_tracker.gui.dialog.popup_error(title: str, message: str)
organoid_tracker.gui.dialog.popup_exception(exception: BaseException)
organoid_tracker.gui.dialog.popup_figure(parent_window: Union[GuiExperiment, Window], draw_function: Callable[[Figure], None], *, size_cm: Tuple[float, float] = (14, 12.7), export_function: Optional[Callable[[], Dict[str, Any]]] = None)

Pops up a figure. The figure is drawn inside draw_function. Size (x, y) is specified using size_cm. export_function is used to save a JSON structure when the user presses Ctrl+E.

For backwards compatibility, parent_window can still be a GuiExperiment. However, then plugins cannot access anything in the popup window.

organoid_tracker.gui.dialog.popup_manual()

Shows the manual of the program.

organoid_tracker.gui.dialog.popup_message(title: str, message: str)
organoid_tracker.gui.dialog.popup_message_cancellable(title: str, message: str) bool

Shows a dialog with Ok and Cancel buttons, but with an “i” sign instead of a “?”.

organoid_tracker.gui.dialog.popup_rich_text(text: RichTextPopup)

Pops up a rich text window, so that you can easily show dialogs with text, links and images.

organoid_tracker.gui.dialog.popup_visualizer(parent_window: Window, visualizer_callable: Callable[[Window], Any], *, size_cm: Tuple[float, float] = (14, 12.7))

Pops up a window, which is then returned. You can then for example attach a Visualizer to this window to show something. The size is the size of the figure, not the window. The window will be slightly larger than the figure.

organoid_tracker.gui.dialog.prompt_color(title: str, default_color: ~organoid_tracker.core.Color = <organoid_tracker.core.Color object>) Optional[Color]

Prompts the user to choose a color.

organoid_tracker.gui.dialog.prompt_confirmation(title: str, question: str)

Shows a OK/Cancel dialog box. Returns True if the user pressed OK, returns False if the user pressed Cancel or simply closed the dialog box.

organoid_tracker.gui.dialog.prompt_directory(title: str) Optional[str]

Shows a prompt that asks the user to select a directory. Returns None if the user pressed Cancel.

organoid_tracker.gui.dialog.prompt_float(title: str, question: str, minimum: float = - 10000000000.0, maximum: float = 10000000000.0, default: float = 0, decimals: int = 1) Optional[float]

Asks the user to enter a float. Returns None if the user pressed Cancel or closed the dialog box. The default value is automatically clamped to the minimum and maximum.

organoid_tracker.gui.dialog.prompt_int(title: str, question: str, *, minimum: int = - 2147483647, maximum: int = 2147483647, default=0) Optional[int]

Asks the user to enter an integer. Returns None if the user pressed Cancel or closed the dialog box. If the minimum is equal to the maximum, that number is returned. The default value is automatically clamped to the minimum and maximum.

organoid_tracker.gui.dialog.prompt_load_file(title: str, file_types: List[Tuple[str, str]]) Optional[str]

Shows a prompt that asks the user to open a file. Example:

prompt_load_file(“Choose an image”, [(“PNG file”, “.png”), (“JPEG file”, “.jpg”)])

Returns None if the user pressed Cancel. This function automatically adds an “All supported files” option.

organoid_tracker.gui.dialog.prompt_load_multiple_files(title: str, file_types: List[Tuple[str, str]]) List[str]

Shows a prompt that asks the user to open multiple files. Example:

prompt_load_files(“Choose images”, [(“PNG file”, “.png”), (“JPEG file”, “.jpg”)])

Returns an empty list if the user pressed Cancel. This function automatically adds an “All supported files” option.

organoid_tracker.gui.dialog.prompt_options(title: str, question: str, *, option_1: str, option_2: Optional[str] = None, option_3: Optional[str] = None, option_default: DefaultOption = DefaultOption.CANCEL) Optional[int]

Shows two or three options to choose from, and additionally a cancel button. Returns None if the default button (either Cancel or Ok) was pressed, returns a number (1, 2 or 3, depending on the picked option) otherwise.

organoid_tracker.gui.dialog.prompt_save_file(title: str, file_types: List[Tuple[str, str]], suggested_name: Optional[Name] = None) Optional[str]

Shows a prompt that asks the user to save a file. Example:

prompt_save_file(“Save as…”, [(“PNG file”, “.png”), (“JPEG file”, “.jpg”)])

If the user does not write a file extension, then the file extension will be added automatically.

organoid_tracker.gui.dialog.prompt_str(title: str, question: str, default: str = '') Optional[str]

Asks the user to enter a line of text. Returns None if the user pressed Cancel or closed the dialog box.

organoid_tracker.gui.dialog.prompt_yes_no(title: str, message: str) bool

Asks a Yes/No question. Returns True if the user pressed Yes and False otherwise.

organoid_tracker.gui.dialog.prompt_yes_no_cancel(title: str, message: str) PromptAnswer

Asks a yes/no/cancel question.