Skip to content

visualdynamics.gui.disclaimer

disclaimer

The alpha notice, acknowledged before the window takes input.

The launcher shows this dialog the first time each version is launched, after the window is built and before the event loop handles anything else. The version acknowledged is kept in the preference store (gui.preferences.settings), so a later launch of the same version opens straight to the window, and the next version asks again. Quit is enabled from the start; Continue is enabled only once the checkbox is ticked, and nothing in the window can be reached until Continue is pressed.

It is not part of MainWindow, so the API and the tests' window fixture never show it. The launcher's --no-disclaimer flag skips it, for a script that opens the window and has already read the notice.

Classes:

Name Description
Disclaimer

The notice as a modal dialog. exec() returns Accepted only

Functions:

Name Description
needed

Whether this version's notice is still to be acknowledged: True

remember

Record that this version's notice was acknowledged.

acknowledged

Show the notice. Returns True when the user ticked the checkbox

Classes

Disclaimer

Disclaimer(parent: QWidget | None = None)

Bases: QDialog

The notice as a modal dialog. exec() returns Accepted only after the checkbox is ticked and Continue is pressed; closing the dialog any other way counts as Quit.

Source code in src/visualdynamics/gui/disclaimer.py
def __init__(self, parent: QWidget | None = None) -> None:
    super().__init__(parent)
    self.setWindowTitle(TITLE)
    self.setModal(True)
    layout = QVBoxLayout(self)
    self.notice: QLabel = QLabel(TEXT)
    self.notice.setWordWrap(True)
    self.notice.setOpenExternalLinks(True)
    self.notice.setTextInteractionFlags(
        Qt.TextInteractionFlag.TextBrowserInteraction)
    self.notice.setMaximumWidth(520)
    layout.addWidget(self.notice)
    self.acknowledged: QCheckBox = QCheckBox(ACKNOWLEDGMENT)
    layout.addWidget(self.acknowledged)
    self.buttons: QDialogButtonBox = QDialogButtonBox()
    self.continue_button: QPushButton = self.buttons.addButton(
        'Continue', QDialogButtonBox.ButtonRole.AcceptRole)
    self.quit_button: QPushButton = self.buttons.addButton(
        'Quit', QDialogButtonBox.ButtonRole.RejectRole)
    self.continue_button.setEnabled(False)
    self.continue_button.setDefault(True)
    self.acknowledged.toggled.connect(self.continue_button.setEnabled)
    self.buttons.accepted.connect(self.accept)
    self.buttons.rejected.connect(self.reject)
    layout.addWidget(self.buttons)

Functions:

needed

needed() -> bool

Whether this version's notice is still to be acknowledged: True on the first launch of a version, False once it was.

Source code in src/visualdynamics/gui/disclaimer.py
def needed() -> bool:
    """Whether this version's notice is still to be acknowledged: True
    on the first launch of a version, False once it was."""
    return str(settings().value(KEY, '')) != __version__

remember

remember() -> None

Record that this version's notice was acknowledged.

Source code in src/visualdynamics/gui/disclaimer.py
def remember() -> None:
    """Record that this version's notice was acknowledged."""
    store = settings()
    store.setValue(KEY, __version__)
    store.sync()

acknowledged

acknowledged(parent: QWidget | None = None) -> bool

Show the notice. Returns True when the user ticked the checkbox and pressed Continue, and False otherwise.

Source code in src/visualdynamics/gui/disclaimer.py
def acknowledged(parent: QWidget | None = None) -> bool:
    """Show the notice. Returns True when the user ticked the checkbox
    and pressed Continue, and False otherwise."""
    return Disclaimer(parent).exec() == QDialog.DialogCode.Accepted