Hooked up port editor in the document tree
This commit is contained in:
40
src/bedit_gui/views/dialogs/interface_editor_dialog.py
Normal file
40
src/bedit_gui/views/dialogs/interface_editor_dialog.py
Normal 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()
|
||||
Reference in New Issue
Block a user