Skip to content

visualdynamics.gui.ask

ask

File dialogs for the one-call workflows.

The scripted entry points take paths. When a path is left out, they ask for it here with a file dialog instead of refusing, so visualdynamics.random_vibration_report() with no arguments works.

This module is in gui/ because it needs Qt. The workflows import it inside the function that asks, so project.py stays free of Qt and a script that passes every path never loads Qt at all.

Functions:

Name Description
for_runs

The controller runs the user picks in a file dialog, or an empty

for_geometry

The geometry file the user picks in a file dialog, or None when

Functions:

for_runs

for_runs(title: str = 'Select the runs to report on') -> list[str]

The controller runs the user picks in a file dialog, or an empty list when the dialog is canceled.

The dialog allows several files at once, because a test campaign is a folder of runs and each run gets its own report.

Source code in src/visualdynamics/gui/ask.py
def for_runs(title: str = 'Select the runs to report on') -> list[str]:
    """The controller runs the user picks in a file dialog, or an empty
    list when the dialog is canceled.

    The dialog allows several files at once, because a test campaign is
    a folder of runs and each run gets its own report.
    """
    from PySide6.QtWidgets import QFileDialog

    _application()
    paths, _ = QFileDialog.getOpenFileNames(None, title, '', RUN_FILTER)
    return [str(p) for p in paths]

for_geometry

for_geometry(title: str = 'Select a geometry (Cancel for none)') -> str | None

The geometry file the user picks in a file dialog, or None when the dialog is canceled.

Canceling is allowed: a report is still written without a geometry, and the sections that need one are left out.

Source code in src/visualdynamics/gui/ask.py
def for_geometry(title: str = 'Select a geometry (Cancel for none)'
                 ) -> str | None:
    """The geometry file the user picks in a file dialog, or None when
    the dialog is canceled.

    Canceling is allowed: a report is still written without a geometry,
    and the sections that need one are left out.
    """
    from PySide6.QtWidgets import QFileDialog

    _application()
    path, _ = QFileDialog.getOpenFileName(None, title, '', GEOMETRY_FILTER)
    return str(path) or None