Hooked up port editor in the document tree

This commit is contained in:
2026-07-26 17:20:37 +02:00
parent b417d85477
commit 8b45674cd2
9 changed files with 610 additions and 30 deletions

View File

@@ -0,0 +1,40 @@
from __future__ import annotations
from PySide6.QtWidgets import (
QDialog,
QDialogButtonBox,
QVBoxLayout,
QWidget,
)
from bedit_core.models import Port, PortID
from bedit_gui.views.port_editor_widget import PortEditorWidget
class InterfaceEditorDialog(QDialog):
"""Modal wrapper around the reusable port editor widget."""
def __init__(
self,
ports: dict[PortID, Port],
parent: QWidget | None = None,
) -> None:
super().__init__(parent)
self.setWindowTitle("Edit Interface")
self.resize(700, 500)
layout = QVBoxLayout(self)
self.editor = PortEditorWidget(self)
self.editor.set_ports(ports)
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 ports(self) -> dict[PortID, Port]:
return self.editor.ports()