from __future__ import annotations from PySide6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QWidget from bedit_core.models import ParameterID, Parameter from bedit_gui.views.param_editor_widget import ParamEditorWidget class ParamEditorDialog(QDialog): """Modal wrapper around the reusable param editor widget.""" def __init__( self, params: dict[ParameterID, Parameter], parent: QWidget | None = None, ) -> None: super().__init__(parent) self.setWindowTitle("Edit Parameters") self.resize(550, 280) layout = QVBoxLayout(self) self.editor = ParamEditorWidget(self) self.editor.set_params(params) layout.addWidget(self.editor) buttons = QDialogButtonBox( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel, self, ) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) def params(self) -> dict[ParameterID, Parameter]: return self.editor.params()