more ui files instead of python generated ui

This commit is contained in:
2026-07-20 12:27:29 +02:00
parent 48a2b4c8d0
commit 8fa450d734
23 changed files with 916 additions and 847 deletions

3
BEdit/.gitignore vendored
View File

@@ -8,4 +8,5 @@ dist/
.idea/
.vscode/*
!.vscode/tasks.json
.ruff_cache
.ruff_cache
ui/*_ui.py

View File

@@ -2,11 +2,11 @@
"version": "2.0.0",
"tasks": [
{
"label": "Qt: Open Main Window in Designer",
"label": "Qt: Open Designer",
"type": "shell",
"command": "pyside6-designer",
"args": [
"${workspaceFolder}/ui/main_window.ui"
"${workspaceFolder}/ui/*.ui"
],
"options": {
"cwd": "${workspaceFolder}",
@@ -21,26 +21,6 @@
"panel": "dedicated"
}
},
{
"label": "Qt: Open Settings Dialog in Designer",
"type": "shell",
"command": "pyside6-designer",
"args": [
"${workspaceFolder}/ui/settings_dialog.ui"
],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"QT_QPA_PLATFORMTHEME": "qt6ct",
"QT_QPA_PLATFORM": "xcb"
}
},
"problemMatcher": [],
"presentation": {
"reveal": "always",
"panel": "dedicated"
}
},
{
"label": "Qt: Compile Resources to Python",
"type": "shell",
@@ -112,6 +92,30 @@
"problemMatcher": [],
"presentation": {"reveal": "silent", "panel": "shared"}
},
{
"label": "Qt: Compile Port Options UI to Python",
"type": "shell",
"command": "pyside6-uic",
"args": ["--from-imports", "${workspaceFolder}/ui/port_options_dialog.ui", "-o", "${workspaceFolder}/src/bedit/gui/generated/ui_port_options_dialog.py"],
"options": {"cwd": "${workspaceFolder}"},
"problemMatcher": []
},
{
"label": "Qt: Compile Shape Options UI to Python",
"type": "shell",
"command": "pyside6-uic",
"args": ["--from-imports", "${workspaceFolder}/ui/shape_options_dialog.ui", "-o", "${workspaceFolder}/src/bedit/gui/generated/ui_shape_options_dialog.py"],
"options": {"cwd": "${workspaceFolder}"},
"problemMatcher": []
},
{
"label": "Qt: Compile Icon Editor UI to Python",
"type": "shell",
"command": "pyside6-uic",
"args": ["--from-imports", "${workspaceFolder}/ui/icon_editor_dialog.ui", "-o", "${workspaceFolder}/src/bedit/gui/generated/ui_icon_editor_dialog.py"],
"options": {"cwd": "${workspaceFolder}"},
"problemMatcher": []
},
{
"label": "Qt: Build Designer Files",
"dependsOrder": "sequence",
@@ -119,7 +123,10 @@
"Qt: Compile Resources to Python",
"Qt: Compile UI to Python",
"Qt: Compile Settings UI to Python",
"Qt: Compile Component Options UI to Python"
"Qt: Compile Component Options UI to Python",
"Qt: Compile Port Options UI to Python",
"Qt: Compile Shape Options UI to Python",
"Qt: Compile Icon Editor UI to Python"
],
"problemMatcher": [],
"group": {

View File

@@ -98,13 +98,23 @@ pyside6-uic --from-imports ui/settings_dialog.ui \
pyside6-uic --from-imports ui/component_options_dialog.ui \
-o src/bedit/gui/generated/ui_component_options_dialog.py
pyside6-uic --from-imports ui/port_options_dialog.ui \
-o src/bedit/gui/generated/ui_port_options_dialog.py
pyside6-uic --from-imports ui/shape_options_dialog.ui \
-o src/bedit/gui/generated/ui_shape_options_dialog.py
pyside6-uic --from-imports ui/icon_editor_dialog.ui \
-o src/bedit/gui/generated/ui_icon_editor_dialog.py
```
When adding a promoted/custom widget in Designer, its header must use the real
Python module path, for example `bedit.gui.graphics.workspace`.
Some dialogs are currently assembled programmatically. Keep that code inside
`gui/dialogs`; do not put widget creation in `core`.
Substantial windows and dialogs must have a Designer `.ui` source. Python classes
bind behavior and data but must not reconstruct or replace those layouts at
runtime. A tiny generic prompt with one field and OK/Cancel may remain code-only.
## Editing conventions

View File

@@ -75,6 +75,11 @@ Do not hand-edit files in `gui/generated`; change the `.ui` source and regenerat
it. Add behavior and signal connections in `gui/main_window.py`. Widget names from
Designer are available there through `self.ui`, such as `self.ui.graphView`.
Substantial views are all represented in Designer: the main window, settings,
component options, port options, shape options, and icon editor. Python binds
data and behavior to those forms; it does not rebuild their layouts at runtime.
Only tiny generic prompts may be code-only.
In VS Code, the same commands are available through **Terminal → Run Task**:
- **Qt: Open Main Window in Designer** opens the form for visual editing.

View File

@@ -1,4 +1,4 @@
from PySide6.QtWidgets import QDialog, QMessageBox, QPushButton
from PySide6.QtWidgets import QDialog, QMessageBox
from bedit.core.model import Component
from bedit.gui.graphics.icon_editor import IconEditorDialog
@@ -15,16 +15,7 @@ class ComponentOptionsDialog(QDialog):
self.edited_inputs = component.inputs
self.edited_outputs = component.outputs
self.ui.nameEdit.setText(component.name)
for widget in (
self.ui.shapeLabel, self.ui.shapeCombo, self.ui.iconTextLabel,
self.ui.iconTextEdit, self.ui.fillLabel, self.ui.fillEdit,
self.ui.borderLabel, self.ui.borderEdit,
):
widget.hide()
self.icon_editor_button = QPushButton("Edit Icon…", self)
self.icon_editor_button.setToolTip("Open the vector icon and port-position editor")
self.icon_editor_button.clicked.connect(self.edit_icon)
self.ui.optionsForm.insertRow(1, "Icon:", self.icon_editor_button)
self.ui.editIconButton.clicked.connect(self.edit_icon)
self.ui.showSubtreeCheckBox.setChecked(component.show_subtree_in_library)
def edit_icon(self) -> None:

View File

@@ -2,25 +2,11 @@ from copy import deepcopy
from uuid import uuid4
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QComboBox,
QDialog,
QDialogButtonBox,
QFormLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QListWidget,
QListWidgetItem,
QMessageBox,
QPushButton,
QSplitter,
QVBoxLayout,
QWidget,
)
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem, QMessageBox
from bedit.core.model import Component, Port
from bedit.core.port_types import PortTypeRegistry
from bedit.gui.generated.ui_port_options_dialog import Ui_PortOptionsDialog
PORT_ROLE = Qt.ItemDataRole.UserRole
@@ -31,60 +17,34 @@ class PortOptionsDialog(QDialog):
def __init__(self, component: Component, parent=None, *, read_only: bool = False) -> None:
super().__init__(parent)
self.ui = Ui_PortOptionsDialog()
self.ui.setupUi(self)
self.setWindowTitle(f"Port Options — {component.name}")
self.resize(620, 380)
self.ports: list[tuple[Port, str]] = [
*((deepcopy(port), "input") for port in component.inputs),
*((deepcopy(port), "output") for port in component.outputs),
]
self._loading = False
layout = QVBoxLayout(self)
splitter = QSplitter()
left = QWidget()
left_layout = QVBoxLayout(left)
self.list = QListWidget()
self.list.currentRowChanged.connect(self._load_current)
left_layout.addWidget(self.list)
port_buttons = QHBoxLayout()
self.add_button = QPushButton("Add Port")
self.remove_button = QPushButton("Remove Port")
self.add_button.clicked.connect(self.add_port)
self.remove_button.clicked.connect(self.remove_port)
port_buttons.addWidget(self.add_button)
port_buttons.addWidget(self.remove_button)
left_layout.addLayout(port_buttons)
right = QWidget()
form = QFormLayout(right)
self.name_edit = QLineEdit()
self.type_combo = QComboBox()
self.ui.typeCombo.clear()
for port_type in PortTypeRegistry.all():
self.type_combo.addItem(port_type.display_name, port_type.id)
self.orientation_combo = QComboBox()
self.orientation_combo.addItem("Input", "input")
self.orientation_combo.addItem("Output", "output")
form.addRow("Name:", self.name_edit)
form.addRow("Type:", self.type_combo)
form.addRow("Orientation:", self.orientation_combo)
form.addRow("", QLabel("New ports start at (0, 0) in the icon editor."))
self.name_edit.textEdited.connect(self._store_current)
self.type_combo.currentIndexChanged.connect(self._store_current)
self.orientation_combo.currentIndexChanged.connect(self._store_current)
splitter.addWidget(left)
splitter.addWidget(right)
splitter.setSizes([250, 370])
layout.addWidget(splitter)
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
layout.addWidget(buttons)
self.ui.typeCombo.addItem(port_type.display_name, port_type.id)
self.ui.orientationCombo.setItemData(0, "input")
self.ui.orientationCombo.setItemData(1, "output")
self.ui.portList.currentRowChanged.connect(self._load_current)
self.ui.addPortButton.clicked.connect(self.add_port)
self.ui.removePortButton.clicked.connect(self.remove_port)
self.ui.nameEdit.textEdited.connect(self._store_current)
self.ui.typeCombo.currentIndexChanged.connect(self._store_current)
self.ui.orientationCombo.currentIndexChanged.connect(self._store_current)
self.ui.portSplitter.setSizes([250, 370])
if read_only:
self.add_button.setEnabled(False)
self.remove_button.setEnabled(False)
self.name_edit.setReadOnly(True)
self.type_combo.setEnabled(False)
self.orientation_combo.setEnabled(False)
buttons.button(QDialogButtonBox.StandardButton.Ok).setText("Close")
buttons.button(QDialogButtonBox.StandardButton.Cancel).hide()
self.ui.addPortButton.setEnabled(False)
self.ui.removePortButton.setEnabled(False)
self.ui.nameEdit.setReadOnly(True)
self.ui.typeCombo.setEnabled(False)
self.ui.orientationCombo.setEnabled(False)
self.ui.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText("Close")
self.ui.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).hide()
self._rebuild_list(0 if self.ports else -1)
@property
@@ -96,12 +56,12 @@ class PortOptionsDialog(QDialog):
return [port for port, orientation in self.ports if orientation == "output"]
def _rebuild_list(self, row: int = -1) -> None:
self.list.clear()
self.ui.portList.clear()
for port, orientation in self.ports:
item = QListWidgetItem(f"{port.name} [{orientation}, {port.type}]")
item.setData(PORT_ROLE, port.id)
self.list.addItem(item)
self.list.setCurrentRow(min(row, len(self.ports) - 1))
self.ui.portList.addItem(item)
self.ui.portList.setCurrentRow(min(row, len(self.ports) - 1))
self._update_enabled()
def _load_current(self, row: int) -> None:
@@ -109,30 +69,30 @@ class PortOptionsDialog(QDialog):
enabled = 0 <= row < len(self.ports)
if enabled:
port, orientation = self.ports[row]
self.name_edit.setText(port.name)
self.type_combo.setCurrentIndex(self.type_combo.findData(port.type))
self.orientation_combo.setCurrentIndex(self.orientation_combo.findData(orientation))
self.ui.nameEdit.setText(port.name)
self.ui.typeCombo.setCurrentIndex(self.ui.typeCombo.findData(port.type))
self.ui.orientationCombo.setCurrentIndex(self.ui.orientationCombo.findData(orientation))
else:
self.name_edit.clear()
self.ui.nameEdit.clear()
self._loading = False
self._update_enabled()
def _update_enabled(self) -> None:
enabled = self.list.currentRow() >= 0
self.remove_button.setEnabled(enabled)
self.name_edit.setEnabled(enabled)
self.type_combo.setEnabled(enabled)
self.orientation_combo.setEnabled(enabled)
enabled = self.ui.portList.currentRow() >= 0
self.ui.removePortButton.setEnabled(enabled)
self.ui.nameEdit.setEnabled(enabled)
self.ui.typeCombo.setEnabled(enabled)
self.ui.orientationCombo.setEnabled(enabled)
def _store_current(self) -> None:
row = self.list.currentRow()
row = self.ui.portList.currentRow()
if self._loading or not (0 <= row < len(self.ports)):
return
port, _orientation = self.ports[row]
port.name = self.name_edit.text()
port.type = self.type_combo.currentData()
self.ports[row] = (port, self.orientation_combo.currentData())
self.list.item(row).setText(
port.name = self.ui.nameEdit.text()
port.type = self.ui.typeCombo.currentData()
self.ports[row] = (port, self.ui.orientationCombo.currentData())
self.ui.portList.item(row).setText(
f"{port.name} [{self.ports[row][1]}, {port.type}]"
)
@@ -145,11 +105,11 @@ class PortOptionsDialog(QDialog):
)
self.ports.append((port, "input"))
self._rebuild_list(len(self.ports) - 1)
self.name_edit.selectAll()
self.name_edit.setFocus()
self.ui.nameEdit.selectAll()
self.ui.nameEdit.setFocus()
def remove_port(self) -> None:
row = self.list.currentRow()
row = self.ui.portList.currentRow()
if row >= 0:
self.ports.pop(row)
self._rebuild_list(min(row, len(self.ports) - 1))

View File

@@ -1,7 +1,7 @@
from pathlib import Path
from PySide6.QtCore import QSettings, Signal
from PySide6.QtWidgets import QDialog, QFileDialog, QFormLayout, QGroupBox, QSpinBox
from PySide6.QtWidgets import QDialog, QFileDialog
from bedit.core.libraries import default_library_paths
from bedit.gui.preferences import application_settings
@@ -17,22 +17,9 @@ class SettingsDialog(QDialog):
super().__init__(parent)
self.ui = Ui_SettingsDialog()
self.ui.setupUi(self)
self.grid_group = QGroupBox("Editor grids", self.ui.generalTab)
grid_form = QFormLayout(self.grid_group)
self.graph_grid_spin = QSpinBox()
self.graph_grid_spin.setRange(8, 512)
self.graph_grid_spin.setSuffix(" units")
self.graph_snap_spin = QSpinBox()
self.graph_snap_spin.setRange(1, 128)
self.graph_snap_spin.setSuffix(" units")
self.graph_grid_spin.valueChanged.connect(self.graph_snap_spin.setMaximum)
self.icon_grid_spin = QSpinBox()
self.icon_grid_spin.setRange(1, 64)
self.icon_grid_spin.setSuffix(" units")
grid_form.addRow("Workspace grid size:", self.graph_grid_spin)
grid_form.addRow("Workspace snapping size:", self.graph_snap_spin)
grid_form.addRow("Icon grid size:", self.icon_grid_spin)
self.ui.generalLayout.insertWidget(1, self.grid_group)
self.ui.graphGridSpinBox.valueChanged.connect(
self.ui.graphSnapSpinBox.setMaximum
)
self.settings = application_settings()
self.ui.addLibraryFileButton.clicked.connect(self._add_library_file)
self.ui.addLibraryFolderButton.clicked.connect(self._add_library_folder)
@@ -53,9 +40,9 @@ class SettingsDialog(QDialog):
self.ui.autosaveIntervalSpinBox.setValue(int(interval))
self.ui.libraryPathsList.clear()
self.ui.libraryPathsList.addItems(self.library_paths(self.settings))
self.graph_grid_spin.setValue(self.graph_grid_size(self.settings))
self.graph_snap_spin.setValue(self.graph_snap_size(self.settings))
self.icon_grid_spin.setValue(self.icon_grid_size(self.settings))
self.ui.graphGridSpinBox.setValue(self.graph_grid_size(self.settings))
self.ui.graphSnapSpinBox.setValue(self.graph_snap_size(self.settings))
self.ui.iconGridSpinBox.setValue(self.icon_grid_size(self.settings))
self._update_remove_button()
@staticmethod
@@ -130,9 +117,9 @@ class SettingsDialog(QDialog):
for row in range(self.ui.libraryPathsList.count())
]
self.settings.setValue("libraries/paths", paths)
self.settings.setValue("grid/graphSize", self.graph_grid_spin.value())
self.settings.setValue("grid/graphSnapSize", self.graph_snap_spin.value())
self.settings.setValue("grid/iconSize", self.icon_grid_spin.value())
self.settings.setValue("grid/graphSize", self.ui.graphGridSpinBox.value())
self.settings.setValue("grid/graphSnapSize", self.ui.graphSnapSpinBox.value())
self.settings.setValue("grid/iconSize", self.ui.iconGridSpinBox.value())
self.settings.sync()
self.settingsChanged.emit()
super().accept()

View File

@@ -15,9 +15,9 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QComboBox,
QDialog, QDialogButtonBox, QFormLayout, QLabel,
QLineEdit, QSizePolicy, QSpacerItem, QVBoxLayout,
from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QDialog,
QDialogButtonBox, QFormLayout, QLabel, QLineEdit,
QPushButton, QSizePolicy, QSpacerItem, QVBoxLayout,
QWidget)
class Ui_ComponentOptionsDialog(object):
@@ -39,53 +39,21 @@ class Ui_ComponentOptionsDialog(object):
self.optionsForm.setWidget(0, QFormLayout.ItemRole.FieldRole, self.nameEdit)
self.shapeLabel = QLabel(ComponentOptionsDialog)
self.shapeLabel.setObjectName(u"shapeLabel")
self.iconLabel = QLabel(ComponentOptionsDialog)
self.iconLabel.setObjectName(u"iconLabel")
self.optionsForm.setWidget(1, QFormLayout.ItemRole.LabelRole, self.shapeLabel)
self.optionsForm.setWidget(1, QFormLayout.ItemRole.LabelRole, self.iconLabel)
self.shapeCombo = QComboBox(ComponentOptionsDialog)
self.shapeCombo.addItem("")
self.shapeCombo.addItem("")
self.shapeCombo.setObjectName(u"shapeCombo")
self.editIconButton = QPushButton(ComponentOptionsDialog)
self.editIconButton.setObjectName(u"editIconButton")
self.optionsForm.setWidget(1, QFormLayout.ItemRole.FieldRole, self.shapeCombo)
self.iconTextLabel = QLabel(ComponentOptionsDialog)
self.iconTextLabel.setObjectName(u"iconTextLabel")
self.optionsForm.setWidget(2, QFormLayout.ItemRole.LabelRole, self.iconTextLabel)
self.iconTextEdit = QLineEdit(ComponentOptionsDialog)
self.iconTextEdit.setObjectName(u"iconTextEdit")
self.optionsForm.setWidget(2, QFormLayout.ItemRole.FieldRole, self.iconTextEdit)
self.fillLabel = QLabel(ComponentOptionsDialog)
self.fillLabel.setObjectName(u"fillLabel")
self.optionsForm.setWidget(3, QFormLayout.ItemRole.LabelRole, self.fillLabel)
self.fillEdit = QLineEdit(ComponentOptionsDialog)
self.fillEdit.setObjectName(u"fillEdit")
self.optionsForm.setWidget(3, QFormLayout.ItemRole.FieldRole, self.fillEdit)
self.borderLabel = QLabel(ComponentOptionsDialog)
self.borderLabel.setObjectName(u"borderLabel")
self.optionsForm.setWidget(4, QFormLayout.ItemRole.LabelRole, self.borderLabel)
self.borderEdit = QLineEdit(ComponentOptionsDialog)
self.borderEdit.setObjectName(u"borderEdit")
self.optionsForm.setWidget(4, QFormLayout.ItemRole.FieldRole, self.borderEdit)
self.optionsForm.setWidget(1, QFormLayout.ItemRole.FieldRole, self.editIconButton)
self.showSubtreeCheckBox = QCheckBox(ComponentOptionsDialog)
self.showSubtreeCheckBox.setObjectName(u"showSubtreeCheckBox")
self.showSubtreeCheckBox.setChecked(True)
self.optionsForm.setWidget(5, QFormLayout.ItemRole.SpanningRole, self.showSubtreeCheckBox)
self.optionsForm.setWidget(2, QFormLayout.ItemRole.SpanningRole, self.showSubtreeCheckBox)
self.dialogLayout.addLayout(self.optionsForm)
@@ -111,15 +79,11 @@ class Ui_ComponentOptionsDialog(object):
def retranslateUi(self, ComponentOptionsDialog):
ComponentOptionsDialog.setWindowTitle(QCoreApplication.translate("ComponentOptionsDialog", u"Component Options", None))
self.nameLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Name:", None))
self.shapeLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Icon shape:", None))
self.shapeCombo.setItemText(0, QCoreApplication.translate("ComponentOptionsDialog", u"rectangle", None))
self.shapeCombo.setItemText(1, QCoreApplication.translate("ComponentOptionsDialog", u"ellipse", None))
self.iconTextLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Icon text:", None))
self.fillLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Fill color:", None))
self.fillEdit.setPlaceholderText(QCoreApplication.translate("ComponentOptionsDialog", u"#dbeafe", None))
self.borderLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Border color:", None))
self.borderEdit.setPlaceholderText(QCoreApplication.translate("ComponentOptionsDialog", u"#303030", None))
self.iconLabel.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Icon:", None))
self.editIconButton.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Edit Icon\u2026", None))
#if QT_CONFIG(tooltip)
self.editIconButton.setToolTip(QCoreApplication.translate("ComponentOptionsDialog", u"Open the vector icon and port-position editor", None))
#endif // QT_CONFIG(tooltip)
self.showSubtreeCheckBox.setText(QCoreApplication.translate("ComponentOptionsDialog", u"Show contained components in the Libraries tree", None))
# retranslateUi

View File

@@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'icon_editor_dialog.ui'
##
## Created by: Qt User Interface Compiler version 6.11.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
QGraphicsView, QHBoxLayout, QLabel, QPushButton,
QSizePolicy, QSpacerItem, QToolButton, QVBoxLayout,
QWidget)
from bedit.gui.graphics.icon_canvas import IconCanvasView
class Ui_IconEditorDialog(object):
def setupUi(self, IconEditorDialog):
if not IconEditorDialog.objectName():
IconEditorDialog.setObjectName(u"IconEditorDialog")
IconEditorDialog.resize(850, 600)
self.dialogLayout = QVBoxLayout(IconEditorDialog)
self.dialogLayout.setObjectName(u"dialogLayout")
self.shapeToolbarLayout = QHBoxLayout()
self.shapeToolbarLayout.setObjectName(u"shapeToolbarLayout")
self.addShapeLabel = QLabel(IconEditorDialog)
self.addShapeLabel.setObjectName(u"addShapeLabel")
self.shapeToolbarLayout.addWidget(self.addShapeLabel)
self.addRectangleButton = QToolButton(IconEditorDialog)
self.addRectangleButton.setObjectName(u"addRectangleButton")
self.shapeToolbarLayout.addWidget(self.addRectangleButton)
self.addCircleButton = QToolButton(IconEditorDialog)
self.addCircleButton.setObjectName(u"addCircleButton")
self.shapeToolbarLayout.addWidget(self.addCircleButton)
self.addEllipseButton = QToolButton(IconEditorDialog)
self.addEllipseButton.setObjectName(u"addEllipseButton")
self.shapeToolbarLayout.addWidget(self.addEllipseButton)
self.addLineButton = QToolButton(IconEditorDialog)
self.addLineButton.setObjectName(u"addLineButton")
self.shapeToolbarLayout.addWidget(self.addLineButton)
self.addTriangleButton = QToolButton(IconEditorDialog)
self.addTriangleButton.setObjectName(u"addTriangleButton")
self.shapeToolbarLayout.addWidget(self.addTriangleButton)
self.addTextButton = QToolButton(IconEditorDialog)
self.addTextButton.setObjectName(u"addTextButton")
self.shapeToolbarLayout.addWidget(self.addTextButton)
self.toolbarSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.shapeToolbarLayout.addItem(self.toolbarSpacer)
self.deleteSelectedButton = QPushButton(IconEditorDialog)
self.deleteSelectedButton.setObjectName(u"deleteSelectedButton")
self.shapeToolbarLayout.addWidget(self.deleteSelectedButton)
self.dialogLayout.addLayout(self.shapeToolbarLayout)
self.iconView = IconCanvasView(IconEditorDialog)
self.iconView.setObjectName(u"iconView")
self.iconView.setDragMode(QGraphicsView.DragMode.RubberBandDrag)
self.dialogLayout.addWidget(self.iconView)
self.portHintLabel = QLabel(IconEditorDialog)
self.portHintLabel.setObjectName(u"portHintLabel")
self.portHintLabel.setWordWrap(True)
self.dialogLayout.addWidget(self.portHintLabel)
self.buttonBox = QDialogButtonBox(IconEditorDialog)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Ok)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(IconEditorDialog)
self.buttonBox.accepted.connect(IconEditorDialog.accept)
self.buttonBox.rejected.connect(IconEditorDialog.reject)
QMetaObject.connectSlotsByName(IconEditorDialog)
# setupUi
def retranslateUi(self, IconEditorDialog):
IconEditorDialog.setWindowTitle(QCoreApplication.translate("IconEditorDialog", u"Icon Editor", None))
self.addShapeLabel.setText(QCoreApplication.translate("IconEditorDialog", u"Add:", None))
self.addRectangleButton.setText(QCoreApplication.translate("IconEditorDialog", u"Rectangle", None))
self.addCircleButton.setText(QCoreApplication.translate("IconEditorDialog", u"Circle", None))
self.addEllipseButton.setText(QCoreApplication.translate("IconEditorDialog", u"Ellipse", None))
self.addLineButton.setText(QCoreApplication.translate("IconEditorDialog", u"Line", None))
self.addTriangleButton.setText(QCoreApplication.translate("IconEditorDialog", u"Triangle", None))
self.addTextButton.setText(QCoreApplication.translate("IconEditorDialog", u"Text", None))
self.deleteSelectedButton.setText(QCoreApplication.translate("IconEditorDialog", u"Delete selected", None))
self.portHintLabel.setText(QCoreApplication.translate("IconEditorDialog", u"Green points are inputs; red points are outputs. Drag them to place connection anchors.", None))
# retranslateUi

View File

@@ -40,6 +40,12 @@ class Ui_MainWindow(object):
icon1 = QIcon()
icon1.addFile(u":/icons/icons/transform-rotate.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionRotateClockwise.setIcon(icon1)
self.actionZoomIn = QAction(MainWindow)
self.actionZoomIn.setObjectName(u"actionZoomIn")
self.actionZoomOut = QAction(MainWindow)
self.actionZoomOut.setObjectName(u"actionZoomOut")
self.actionCenterView = QAction(MainWindow)
self.actionCenterView.setObjectName(u"actionCenterView")
self.actionOpen = QAction(MainWindow)
self.actionOpen.setObjectName(u"actionOpen")
icon2 = QIcon()
@@ -123,6 +129,8 @@ class Ui_MainWindow(object):
self.librariesLayout.setContentsMargins(0, 0, 0, 0)
self.treeView = QTreeView(self.dockWidgetContents)
self.treeView.setObjectName(u"treeView")
self.treeView.setIconSize(QSize(28, 28))
self.treeView.setStyleSheet(u"QTreeView::item { height: 32px; }")
self.treeView.setAlternatingRowColors(True)
self.treeView.setUniformRowHeights(True)
@@ -141,6 +149,7 @@ class Ui_MainWindow(object):
self.documentPanelLayout.setContentsMargins(0, 0, 0, 0)
self.documentTreeView = QTreeView(self.documentDockContents)
self.documentTreeView.setObjectName(u"documentTreeView")
self.documentTreeView.setIconSize(QSize(16, 16))
self.documentTreeView.setAlternatingRowColors(True)
self.documentTreeView.setUniformRowHeights(True)
@@ -201,20 +210,6 @@ class Ui_MainWindow(object):
self.workspaceHeaderLayout.addWidget(self.pointerToolButton)
self.inputToolButton = QToolButton(self.workspaceHeader)
self.inputToolButton.setObjectName(u"inputToolButton")
self.inputToolButton.setCheckable(True)
self.inputToolButton.setAutoExclusive(True)
self.workspaceHeaderLayout.addWidget(self.inputToolButton)
self.outputToolButton = QToolButton(self.workspaceHeader)
self.outputToolButton.setObjectName(u"outputToolButton")
self.outputToolButton.setCheckable(True)
self.outputToolButton.setAutoExclusive(True)
self.workspaceHeaderLayout.addWidget(self.outputToolButton)
self.workspaceEditorLayout.addWidget(self.workspaceHeader)
@@ -245,10 +240,12 @@ class Ui_MainWindow(object):
self.workspaceStack.addWidget(self.jsonPage)
self.emptyPage = QWidget()
self.emptyPage.setObjectName(u"emptyPage")
self.emptyPage.setStyleSheet(u"background-color: #9a9a9a;")
self.emptyPageLayout = QVBoxLayout(self.emptyPage)
self.emptyPageLayout.setObjectName(u"emptyPageLayout")
self.emptyWorkspaceLabel = QLabel(self.emptyPage)
self.emptyWorkspaceLabel.setObjectName(u"emptyWorkspaceLabel")
self.emptyWorkspaceLabel.setStyleSheet(u"background: transparent; color: #202020;")
self.emptyWorkspaceLabel.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.emptyPageLayout.addWidget(self.emptyWorkspaceLabel)
@@ -295,6 +292,9 @@ class Ui_MainWindow(object):
self.transformToolbar = QToolBar(MainWindow)
self.transformToolbar.setObjectName(u"transformToolbar")
MainWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.transformToolbar)
self.cameraToolbar = QToolBar(MainWindow)
self.cameraToolbar.setObjectName(u"cameraToolbar")
MainWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.cameraToolbar)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuEdit.menuAction())
@@ -332,6 +332,9 @@ class Ui_MainWindow(object):
self.editToolbar.addAction(self.actionCut)
self.editToolbar.addAction(self.actionPaste)
self.transformToolbar.addAction(self.actionRotateClockwise)
self.cameraToolbar.addAction(self.actionZoomIn)
self.cameraToolbar.addAction(self.actionZoomOut)
self.cameraToolbar.addAction(self.actionCenterView)
self.retranslateUi(MainWindow)
@@ -356,6 +359,18 @@ class Ui_MainWindow(object):
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.actionRotateClockwise.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+R", None))
#endif // QT_CONFIG(shortcut)
self.actionZoomIn.setText(QCoreApplication.translate("MainWindow", u"Zoom In", None))
#if QT_CONFIG(shortcut)
self.actionZoomIn.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl++", None))
#endif // QT_CONFIG(shortcut)
self.actionZoomOut.setText(QCoreApplication.translate("MainWindow", u"Zoom Out", None))
#if QT_CONFIG(shortcut)
self.actionZoomOut.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+-", None))
#endif // QT_CONFIG(shortcut)
self.actionCenterView.setText(QCoreApplication.translate("MainWindow", u"Center", None))
#if QT_CONFIG(shortcut)
self.actionCenterView.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+0", None))
#endif // QT_CONFIG(shortcut)
self.actionOpen.setText(QCoreApplication.translate("MainWindow", u"&Open\u2026", None))
#if QT_CONFIG(statustip)
@@ -427,14 +442,6 @@ class Ui_MainWindow(object):
self.workspaceModeLabel.setText(QCoreApplication.translate("MainWindow", u"Graph", None))
self.applyJsonButton.setText(QCoreApplication.translate("MainWindow", u"Apply JSON", None))
self.pointerToolButton.setText(QCoreApplication.translate("MainWindow", u"Pointer", None))
self.inputToolButton.setText(QCoreApplication.translate("MainWindow", u"Input", None))
#if QT_CONFIG(tooltip)
self.inputToolButton.setToolTip(QCoreApplication.translate("MainWindow", u"Add an interface input", None))
#endif // QT_CONFIG(tooltip)
self.outputToolButton.setText(QCoreApplication.translate("MainWindow", u"Output", None))
#if QT_CONFIG(tooltip)
self.outputToolButton.setToolTip(QCoreApplication.translate("MainWindow", u"Add an interface output", None))
#endif // QT_CONFIG(tooltip)
self.jsonEditor.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Component JSON", None))
self.emptyWorkspaceLabel.setText(QCoreApplication.translate("MainWindow", u"No document open", None))
self.menuFile.setTitle(QCoreApplication.translate("MainWindow", u"&File", None))
@@ -446,5 +453,6 @@ class Ui_MainWindow(object):
self.fileToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"File", None))
self.editToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"Edit", None))
self.transformToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"Transform", None))
self.cameraToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"Camera", None))
# retranslateUi

View File

@@ -0,0 +1,135 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'port_options_dialog.ui'
##
## Created by: Qt User Interface Compiler version 6.11.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QComboBox, QDialog,
QDialogButtonBox, QFormLayout, QHBoxLayout, QLabel,
QLineEdit, QListWidget, QListWidgetItem, QPushButton,
QSizePolicy, QSplitter, QVBoxLayout, QWidget)
class Ui_PortOptionsDialog(object):
def setupUi(self, PortOptionsDialog):
if not PortOptionsDialog.objectName():
PortOptionsDialog.setObjectName(u"PortOptionsDialog")
PortOptionsDialog.resize(620, 380)
self.dialogLayout = QVBoxLayout(PortOptionsDialog)
self.dialogLayout.setObjectName(u"dialogLayout")
self.portSplitter = QSplitter(PortOptionsDialog)
self.portSplitter.setObjectName(u"portSplitter")
self.portSplitter.setOrientation(Qt.Orientation.Horizontal)
self.portListPanel = QWidget(self.portSplitter)
self.portListPanel.setObjectName(u"portListPanel")
self.portListLayout = QVBoxLayout(self.portListPanel)
self.portListLayout.setObjectName(u"portListLayout")
self.portListLayout.setContentsMargins(0, 0, 0, 0)
self.portList = QListWidget(self.portListPanel)
self.portList.setObjectName(u"portList")
self.portListLayout.addWidget(self.portList)
self.portButtonsLayout = QHBoxLayout()
self.portButtonsLayout.setObjectName(u"portButtonsLayout")
self.addPortButton = QPushButton(self.portListPanel)
self.addPortButton.setObjectName(u"addPortButton")
self.portButtonsLayout.addWidget(self.addPortButton)
self.removePortButton = QPushButton(self.portListPanel)
self.removePortButton.setObjectName(u"removePortButton")
self.portButtonsLayout.addWidget(self.removePortButton)
self.portListLayout.addLayout(self.portButtonsLayout)
self.portSplitter.addWidget(self.portListPanel)
self.portDetailsPanel = QWidget(self.portSplitter)
self.portDetailsPanel.setObjectName(u"portDetailsPanel")
self.portDetailsForm = QFormLayout(self.portDetailsPanel)
self.portDetailsForm.setObjectName(u"portDetailsForm")
self.portDetailsForm.setContentsMargins(0, 0, 0, 0)
self.nameLabel = QLabel(self.portDetailsPanel)
self.nameLabel.setObjectName(u"nameLabel")
self.portDetailsForm.setWidget(0, QFormLayout.ItemRole.LabelRole, self.nameLabel)
self.nameEdit = QLineEdit(self.portDetailsPanel)
self.nameEdit.setObjectName(u"nameEdit")
self.portDetailsForm.setWidget(0, QFormLayout.ItemRole.FieldRole, self.nameEdit)
self.typeLabel = QLabel(self.portDetailsPanel)
self.typeLabel.setObjectName(u"typeLabel")
self.portDetailsForm.setWidget(1, QFormLayout.ItemRole.LabelRole, self.typeLabel)
self.typeCombo = QComboBox(self.portDetailsPanel)
self.typeCombo.addItem("")
self.typeCombo.setObjectName(u"typeCombo")
self.portDetailsForm.setWidget(1, QFormLayout.ItemRole.FieldRole, self.typeCombo)
self.orientationLabel = QLabel(self.portDetailsPanel)
self.orientationLabel.setObjectName(u"orientationLabel")
self.portDetailsForm.setWidget(2, QFormLayout.ItemRole.LabelRole, self.orientationLabel)
self.orientationCombo = QComboBox(self.portDetailsPanel)
self.orientationCombo.addItem("")
self.orientationCombo.addItem("")
self.orientationCombo.setObjectName(u"orientationCombo")
self.portDetailsForm.setWidget(2, QFormLayout.ItemRole.FieldRole, self.orientationCombo)
self.positionHintLabel = QLabel(self.portDetailsPanel)
self.positionHintLabel.setObjectName(u"positionHintLabel")
self.positionHintLabel.setWordWrap(True)
self.portDetailsForm.setWidget(3, QFormLayout.ItemRole.SpanningRole, self.positionHintLabel)
self.portSplitter.addWidget(self.portDetailsPanel)
self.dialogLayout.addWidget(self.portSplitter)
self.buttonBox = QDialogButtonBox(PortOptionsDialog)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Ok)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(PortOptionsDialog)
self.buttonBox.accepted.connect(PortOptionsDialog.accept)
self.buttonBox.rejected.connect(PortOptionsDialog.reject)
QMetaObject.connectSlotsByName(PortOptionsDialog)
# setupUi
def retranslateUi(self, PortOptionsDialog):
PortOptionsDialog.setWindowTitle(QCoreApplication.translate("PortOptionsDialog", u"Port Options", None))
self.addPortButton.setText(QCoreApplication.translate("PortOptionsDialog", u"Add Port", None))
self.removePortButton.setText(QCoreApplication.translate("PortOptionsDialog", u"Remove Port", None))
self.nameLabel.setText(QCoreApplication.translate("PortOptionsDialog", u"Name:", None))
self.typeLabel.setText(QCoreApplication.translate("PortOptionsDialog", u"Type:", None))
self.typeCombo.setItemText(0, QCoreApplication.translate("PortOptionsDialog", u"Signal", None))
self.orientationLabel.setText(QCoreApplication.translate("PortOptionsDialog", u"Orientation:", None))
self.orientationCombo.setItemText(0, QCoreApplication.translate("PortOptionsDialog", u"Input", None))
self.orientationCombo.setItemText(1, QCoreApplication.translate("PortOptionsDialog", u"Output", None))
self.positionHintLabel.setText(QCoreApplication.translate("PortOptionsDialog", u"New ports start at (0, 0) in the icon editor.", None))
# retranslateUi

View File

@@ -25,7 +25,7 @@ class Ui_SettingsDialog(object):
def setupUi(self, SettingsDialog):
if not SettingsDialog.objectName():
SettingsDialog.setObjectName(u"SettingsDialog")
SettingsDialog.resize(480, 300)
SettingsDialog.resize(480, 420)
SettingsDialog.setModal(True)
self.dialogLayout = QVBoxLayout(SettingsDialog)
self.dialogLayout.setObjectName(u"dialogLayout")
@@ -52,6 +52,52 @@ class Ui_SettingsDialog(object):
self.generalLayout.addWidget(self.autosaveGroupBox)
self.editorGridsGroupBox = QGroupBox(self.generalTab)
self.editorGridsGroupBox.setObjectName(u"editorGridsGroupBox")
self.editorGridsLayout = QFormLayout(self.editorGridsGroupBox)
self.editorGridsLayout.setObjectName(u"editorGridsLayout")
self.graphGridLabel = QLabel(self.editorGridsGroupBox)
self.graphGridLabel.setObjectName(u"graphGridLabel")
self.editorGridsLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.graphGridLabel)
self.graphGridSpinBox = QSpinBox(self.editorGridsGroupBox)
self.graphGridSpinBox.setObjectName(u"graphGridSpinBox")
self.graphGridSpinBox.setMinimum(8)
self.graphGridSpinBox.setMaximum(512)
self.graphGridSpinBox.setValue(64)
self.editorGridsLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.graphGridSpinBox)
self.graphSnapLabel = QLabel(self.editorGridsGroupBox)
self.graphSnapLabel.setObjectName(u"graphSnapLabel")
self.editorGridsLayout.setWidget(1, QFormLayout.ItemRole.LabelRole, self.graphSnapLabel)
self.graphSnapSpinBox = QSpinBox(self.editorGridsGroupBox)
self.graphSnapSpinBox.setObjectName(u"graphSnapSpinBox")
self.graphSnapSpinBox.setMinimum(1)
self.graphSnapSpinBox.setMaximum(128)
self.graphSnapSpinBox.setValue(8)
self.editorGridsLayout.setWidget(1, QFormLayout.ItemRole.FieldRole, self.graphSnapSpinBox)
self.iconGridLabel = QLabel(self.editorGridsGroupBox)
self.iconGridLabel.setObjectName(u"iconGridLabel")
self.editorGridsLayout.setWidget(2, QFormLayout.ItemRole.LabelRole, self.iconGridLabel)
self.iconGridSpinBox = QSpinBox(self.editorGridsGroupBox)
self.iconGridSpinBox.setObjectName(u"iconGridSpinBox")
self.iconGridSpinBox.setMinimum(1)
self.iconGridSpinBox.setMaximum(64)
self.iconGridSpinBox.setValue(8)
self.editorGridsLayout.setWidget(2, QFormLayout.ItemRole.FieldRole, self.iconGridSpinBox)
self.generalLayout.addWidget(self.editorGridsGroupBox)
self.generalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.generalLayout.addItem(self.generalSpacer)
@@ -122,6 +168,13 @@ class Ui_SettingsDialog(object):
SettingsDialog.setWindowTitle(QCoreApplication.translate("SettingsDialog", u"Settings", None))
self.autosaveGroupBox.setTitle(QCoreApplication.translate("SettingsDialog", u"Automatic saving", None))
self.autosaveIntervalSpinBox.setSuffix(QCoreApplication.translate("SettingsDialog", u" minutes", None))
self.editorGridsGroupBox.setTitle(QCoreApplication.translate("SettingsDialog", u"Editor grids", None))
self.graphGridLabel.setText(QCoreApplication.translate("SettingsDialog", u"Workspace grid size:", None))
self.graphGridSpinBox.setSuffix(QCoreApplication.translate("SettingsDialog", u" units", None))
self.graphSnapLabel.setText(QCoreApplication.translate("SettingsDialog", u"Workspace snapping size:", None))
self.graphSnapSpinBox.setSuffix(QCoreApplication.translate("SettingsDialog", u" units", None))
self.iconGridLabel.setText(QCoreApplication.translate("SettingsDialog", u"Icon grid size:", None))
self.iconGridSpinBox.setSuffix(QCoreApplication.translate("SettingsDialog", u" units", None))
self.settingsTabs.setTabText(self.settingsTabs.indexOf(self.generalTab), QCoreApplication.translate("SettingsDialog", u"General", None))
self.libraryPathsLabel.setText(QCoreApplication.translate("SettingsDialog", u"Load library JSON files from these files or folders at startup:", None))
self.addLibraryFileButton.setText(QCoreApplication.translate("SettingsDialog", u"Add File\u2026", None))

View File

@@ -0,0 +1,194 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'shape_options_dialog.ui'
##
## Created by: Qt User Interface Compiler version 6.11.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QComboBox, QDialog,
QDialogButtonBox, QDoubleSpinBox, QFormLayout, QLabel,
QLineEdit, QPushButton, QSizePolicy, QSpacerItem,
QVBoxLayout, QWidget)
class Ui_ShapeOptionsDialog(object):
def setupUi(self, ShapeOptionsDialog):
if not ShapeOptionsDialog.objectName():
ShapeOptionsDialog.setObjectName(u"ShapeOptionsDialog")
ShapeOptionsDialog.resize(420, 440)
self.dialogLayout = QVBoxLayout(ShapeOptionsDialog)
self.dialogLayout.setObjectName(u"dialogLayout")
self.optionsForm = QFormLayout()
self.optionsForm.setObjectName(u"optionsForm")
self.widthLabel = QLabel(ShapeOptionsDialog)
self.widthLabel.setObjectName(u"widthLabel")
self.optionsForm.setWidget(0, QFormLayout.ItemRole.LabelRole, self.widthLabel)
self.widthSpin = QDoubleSpinBox(ShapeOptionsDialog)
self.widthSpin.setObjectName(u"widthSpin")
self.widthSpin.setMinimum(1.000000000000000)
self.widthSpin.setMaximum(500.000000000000000)
self.optionsForm.setWidget(0, QFormLayout.ItemRole.FieldRole, self.widthSpin)
self.heightLabel = QLabel(ShapeOptionsDialog)
self.heightLabel.setObjectName(u"heightLabel")
self.optionsForm.setWidget(1, QFormLayout.ItemRole.LabelRole, self.heightLabel)
self.heightSpin = QDoubleSpinBox(ShapeOptionsDialog)
self.heightSpin.setObjectName(u"heightSpin")
self.heightSpin.setMinimum(1.000000000000000)
self.heightSpin.setMaximum(500.000000000000000)
self.optionsForm.setWidget(1, QFormLayout.ItemRole.FieldRole, self.heightSpin)
self.lineStyleLabel = QLabel(ShapeOptionsDialog)
self.lineStyleLabel.setObjectName(u"lineStyleLabel")
self.optionsForm.setWidget(2, QFormLayout.ItemRole.LabelRole, self.lineStyleLabel)
self.lineStyleCombo = QComboBox(ShapeOptionsDialog)
self.lineStyleCombo.addItem("")
self.lineStyleCombo.addItem("")
self.lineStyleCombo.addItem("")
self.lineStyleCombo.addItem("")
self.lineStyleCombo.addItem("")
self.lineStyleCombo.setObjectName(u"lineStyleCombo")
self.optionsForm.setWidget(2, QFormLayout.ItemRole.FieldRole, self.lineStyleCombo)
self.lineWidthLabel = QLabel(ShapeOptionsDialog)
self.lineWidthLabel.setObjectName(u"lineWidthLabel")
self.optionsForm.setWidget(3, QFormLayout.ItemRole.LabelRole, self.lineWidthLabel)
self.lineWidthSpin = QDoubleSpinBox(ShapeOptionsDialog)
self.lineWidthSpin.setObjectName(u"lineWidthSpin")
self.lineWidthSpin.setMinimum(0.100000000000000)
self.lineWidthSpin.setMaximum(20.000000000000000)
self.lineWidthSpin.setSingleStep(0.500000000000000)
self.optionsForm.setWidget(3, QFormLayout.ItemRole.FieldRole, self.lineWidthSpin)
self.strokeColorLabel = QLabel(ShapeOptionsDialog)
self.strokeColorLabel.setObjectName(u"strokeColorLabel")
self.optionsForm.setWidget(4, QFormLayout.ItemRole.LabelRole, self.strokeColorLabel)
self.strokeColorButton = QPushButton(ShapeOptionsDialog)
self.strokeColorButton.setObjectName(u"strokeColorButton")
self.optionsForm.setWidget(4, QFormLayout.ItemRole.FieldRole, self.strokeColorButton)
self.fillTypeLabel = QLabel(ShapeOptionsDialog)
self.fillTypeLabel.setObjectName(u"fillTypeLabel")
self.optionsForm.setWidget(5, QFormLayout.ItemRole.LabelRole, self.fillTypeLabel)
self.fillTypeCombo = QComboBox(ShapeOptionsDialog)
self.fillTypeCombo.addItem("")
self.fillTypeCombo.addItem("")
self.fillTypeCombo.setObjectName(u"fillTypeCombo")
self.optionsForm.setWidget(5, QFormLayout.ItemRole.FieldRole, self.fillTypeCombo)
self.fillColorLabel = QLabel(ShapeOptionsDialog)
self.fillColorLabel.setObjectName(u"fillColorLabel")
self.optionsForm.setWidget(6, QFormLayout.ItemRole.LabelRole, self.fillColorLabel)
self.fillColorButton = QPushButton(ShapeOptionsDialog)
self.fillColorButton.setObjectName(u"fillColorButton")
self.optionsForm.setWidget(6, QFormLayout.ItemRole.FieldRole, self.fillColorButton)
self.cornerRadiusLabel = QLabel(ShapeOptionsDialog)
self.cornerRadiusLabel.setObjectName(u"cornerRadiusLabel")
self.optionsForm.setWidget(7, QFormLayout.ItemRole.LabelRole, self.cornerRadiusLabel)
self.cornerRadiusSpin = QDoubleSpinBox(ShapeOptionsDialog)
self.cornerRadiusSpin.setObjectName(u"cornerRadiusSpin")
self.cornerRadiusSpin.setMaximum(50.000000000000000)
self.optionsForm.setWidget(7, QFormLayout.ItemRole.FieldRole, self.cornerRadiusSpin)
self.textLabel = QLabel(ShapeOptionsDialog)
self.textLabel.setObjectName(u"textLabel")
self.optionsForm.setWidget(8, QFormLayout.ItemRole.LabelRole, self.textLabel)
self.textEdit = QLineEdit(ShapeOptionsDialog)
self.textEdit.setObjectName(u"textEdit")
self.optionsForm.setWidget(8, QFormLayout.ItemRole.FieldRole, self.textEdit)
self.fontSizeLabel = QLabel(ShapeOptionsDialog)
self.fontSizeLabel.setObjectName(u"fontSizeLabel")
self.optionsForm.setWidget(9, QFormLayout.ItemRole.LabelRole, self.fontSizeLabel)
self.fontSizeSpin = QDoubleSpinBox(ShapeOptionsDialog)
self.fontSizeSpin.setObjectName(u"fontSizeSpin")
self.fontSizeSpin.setMinimum(4.000000000000000)
self.fontSizeSpin.setMaximum(96.000000000000000)
self.optionsForm.setWidget(9, QFormLayout.ItemRole.FieldRole, self.fontSizeSpin)
self.dialogLayout.addLayout(self.optionsForm)
self.verticalSpacer = QSpacerItem(20, 20, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.dialogLayout.addItem(self.verticalSpacer)
self.buttonBox = QDialogButtonBox(ShapeOptionsDialog)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Cancel|QDialogButtonBox.StandardButton.Ok)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(ShapeOptionsDialog)
self.buttonBox.accepted.connect(ShapeOptionsDialog.accept)
self.buttonBox.rejected.connect(ShapeOptionsDialog.reject)
QMetaObject.connectSlotsByName(ShapeOptionsDialog)
# setupUi
def retranslateUi(self, ShapeOptionsDialog):
ShapeOptionsDialog.setWindowTitle(QCoreApplication.translate("ShapeOptionsDialog", u"Shape Options", None))
self.widthLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Width:", None))
self.heightLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Height:", None))
self.lineStyleLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Line style:", None))
self.lineStyleCombo.setItemText(0, QCoreApplication.translate("ShapeOptionsDialog", u"solid", None))
self.lineStyleCombo.setItemText(1, QCoreApplication.translate("ShapeOptionsDialog", u"dash", None))
self.lineStyleCombo.setItemText(2, QCoreApplication.translate("ShapeOptionsDialog", u"dot", None))
self.lineStyleCombo.setItemText(3, QCoreApplication.translate("ShapeOptionsDialog", u"dash-dot", None))
self.lineStyleCombo.setItemText(4, QCoreApplication.translate("ShapeOptionsDialog", u"none", None))
self.lineWidthLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Line width:", None))
self.strokeColorLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Line colour:", None))
self.strokeColorButton.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Choose\u2026", None))
self.fillTypeLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Fill type:", None))
self.fillTypeCombo.setItemText(0, QCoreApplication.translate("ShapeOptionsDialog", u"solid", None))
self.fillTypeCombo.setItemText(1, QCoreApplication.translate("ShapeOptionsDialog", u"none", None))
self.fillColorLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Fill colour:", None))
self.fillColorButton.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Choose\u2026", None))
self.cornerRadiusLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Corner radius:", None))
self.textLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Text:", None))
self.fontSizeLabel.setText(QCoreApplication.translate("ShapeOptionsDialog", u"Font size:", None))
# retranslateUi

View File

@@ -0,0 +1,24 @@
from PySide6.QtCore import QPointF, QRectF
from PySide6.QtGui import QColor, QPainter, QPen
from PySide6.QtWidgets import QGraphicsView
from bedit.gui.preferences import application_settings
def icon_grid_size() -> int:
return application_settings().value("grid/iconSize", 8, type=int)
class IconCanvasView(QGraphicsView):
"""Designer-promotable view that paints the icon editor grid."""
def drawBackground(self, painter: QPainter, rect: QRectF) -> None: # noqa: N802
painter.fillRect(rect, QColor("#ffffff"))
grid = icon_grid_size()
painter.setPen(QPen(QColor("#dbeafe"), 0))
left = int(rect.left()) - int(rect.left()) % grid
top = int(rect.top()) - int(rect.top()) % grid
for x in range(left, int(rect.right()) + grid, grid):
painter.drawLine(QPointF(x, rect.top()), QPointF(x, rect.bottom()))
for y in range(top, int(rect.bottom()) + grid, grid):
painter.drawLine(QPointF(rect.left(), y), QPointF(rect.right(), y))

View File

@@ -4,36 +4,26 @@ from PySide6.QtCore import QPointF, QRectF, Qt
from PySide6.QtGui import QColor, QPainter, QPen, QPolygonF
from PySide6.QtWidgets import (
QColorDialog,
QComboBox,
QDialog,
QDialogButtonBox,
QDoubleSpinBox,
QFormLayout,
QGraphicsEllipseItem,
QGraphicsItem,
QGraphicsObject,
QGraphicsScene,
QGraphicsSceneContextMenuEvent,
QGraphicsSceneMouseEvent,
QGraphicsView,
QHBoxLayout,
QInputDialog,
QLabel,
QLineEdit,
QMenu,
QPushButton,
QToolButton,
QVBoxLayout,
QWidget,
)
from bedit.core.model import Component, Icon, Port
from bedit.gui.generated.ui_icon_editor_dialog import Ui_IconEditorDialog
from bedit.gui.generated.ui_shape_options_dialog import Ui_ShapeOptionsDialog
from bedit.gui.graphics.icon_canvas import icon_grid_size
from bedit.gui.graphics.icon_renderer import _pen
from bedit.gui.preferences import application_settings
def _icon_grid_size() -> int:
return application_settings().value("grid/iconSize", 8, type=int)
return icon_grid_size()
def _snap(value: float) -> float:
@@ -41,19 +31,6 @@ def _snap(value: float) -> float:
return round(value / grid) * grid
class IconEditorView(QGraphicsView):
def drawBackground(self, painter: QPainter, rect: QRectF) -> None: # noqa: N802
painter.fillRect(rect, QColor("#ffffff"))
grid = _icon_grid_size()
painter.setPen(QPen(QColor("#dbeafe"), 0))
left = int(rect.left()) - int(rect.left()) % grid
top = int(rect.top()) - int(rect.top()) % grid
for x in range(left, int(rect.right()) + grid, grid):
painter.drawLine(x, rect.top(), x, rect.bottom())
for y in range(top, int(rect.bottom()) + grid, grid):
painter.drawLine(rect.left(), y, rect.right(), y)
class ResizeHandle(QGraphicsEllipseItem):
def __init__(self, owner: "ShapeItem") -> None:
super().__init__(-4, -4, 8, 8, owner)
@@ -86,95 +63,79 @@ class ResizeHandle(QGraphicsEllipseItem):
return super().itemChange(change, value)
class ColorButton(QPushButton):
def __init__(self, color: str, allow_none: bool = False, parent=None) -> None:
super().__init__(parent)
self.color = color
self.allow_none = allow_none
self.clicked.connect(self.choose)
self._refresh()
def _refresh(self) -> None:
self.setText("No fill" if self.color == "none" else self.color)
swatch = "transparent" if self.color == "none" else self.color
self.setStyleSheet(f"QPushButton {{ background: {swatch}; }}")
def choose(self) -> None:
initial = QColor("#ffffff" if self.color == "none" else self.color)
color = QColorDialog.getColor(initial, self, "Choose colour", QColorDialog.ColorDialogOption.ShowAlphaChannel)
if color.isValid():
self.color = color.name(QColor.NameFormat.HexArgb) if color.alpha() < 255 else color.name()
self._refresh()
class ShapeOptionsDialog(QDialog):
def __init__(self, element: dict, parent=None) -> None:
super().__init__(parent)
self.ui = Ui_ShapeOptionsDialog()
self.ui.setupUi(self)
self.element = deepcopy(element)
self.setWindowTitle("Shape Options")
layout = QVBoxLayout(self)
form = QFormLayout()
self.line_style = QComboBox()
self.line_style.addItems(["solid", "dash", "dot", "dash-dot", "none"])
self.line_style.setCurrentText(self.element.get("lineStyle", "solid"))
self.line_width = QDoubleSpinBox()
self.line_width.setRange(0.1, 20.0)
self.line_width.setValue(float(self.element.get("lineWidth", 1.5)))
self.stroke = ColorButton(self.element.get("stroke", "#303030"))
self.fill_type = QComboBox()
self.fill_type.addItems(["solid", "none"])
self.stroke_color = self.element.get("stroke", "#303030")
fill = self.element.get("fill", "#ffffff")
self.fill_type.setCurrentText("none" if fill in {"none", "transparent", ""} else "solid")
self.fill = ColorButton("#ffffff" if fill in {"none", "transparent", ""} else fill)
self.width = QDoubleSpinBox()
self.width.setRange(1, 500)
self.width.setValue(float(self.element.get("width", 20)))
self.height = QDoubleSpinBox()
self.height.setRange(1, 500)
self.height.setValue(float(self.element.get("height", 20)))
form.addRow("Width:", self.width)
form.addRow("Height:", self.height)
form.addRow("Line style:", self.line_style)
form.addRow("Line width:", self.line_width)
form.addRow("Line colour:", self.stroke)
if self.element.get("type") != "line":
form.addRow("Fill type:", self.fill_type)
form.addRow("Fill colour:", self.fill)
self.radius = None
if self.element.get("type") == "rectangle":
self.radius = QDoubleSpinBox()
self.radius.setRange(0, 50)
self.radius.setValue(float(self.element.get("cornerRadius", 0)))
form.addRow("Corner radius:", self.radius)
self.text_edit = None
self.font_size = None
if self.element.get("type") == "text":
self.text_edit = QLineEdit(str(self.element.get("text", "Text")))
self.font_size = QDoubleSpinBox()
self.font_size.setRange(4, 96)
self.font_size.setValue(float(self.element.get("fontSize", 12)))
form.addRow("Text:", self.text_edit)
form.addRow("Font size:", self.font_size)
layout.addLayout(form)
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
layout.addWidget(buttons)
self.fill_color = "#ffffff" if fill in {"none", "transparent", ""} else fill
self.ui.widthSpin.setValue(float(self.element.get("width", 20)))
self.ui.heightSpin.setValue(float(self.element.get("height", 20)))
self.ui.lineStyleCombo.setCurrentText(self.element.get("lineStyle", "solid"))
self.ui.lineWidthSpin.setValue(float(self.element.get("lineWidth", 1.5)))
self.ui.fillTypeCombo.setCurrentText(
"none" if fill in {"none", "transparent", ""} else "solid"
)
self.ui.cornerRadiusSpin.setValue(float(self.element.get("cornerRadius", 0)))
self.ui.textEdit.setText(str(self.element.get("text", "Text")))
self.ui.fontSizeSpin.setValue(float(self.element.get("fontSize", 12)))
self._show_row(self.ui.fillTypeLabel, self.ui.fillTypeCombo, self.element.get("type") != "line")
self._show_row(self.ui.fillColorLabel, self.ui.fillColorButton, self.element.get("type") != "line")
self._show_row(self.ui.cornerRadiusLabel, self.ui.cornerRadiusSpin, self.element.get("type") == "rectangle")
is_text = self.element.get("type") == "text"
self._show_row(self.ui.textLabel, self.ui.textEdit, is_text)
self._show_row(self.ui.fontSizeLabel, self.ui.fontSizeSpin, is_text)
self.ui.strokeColorButton.clicked.connect(self._choose_stroke)
self.ui.fillColorButton.clicked.connect(self._choose_fill)
self._refresh_color_buttons()
@staticmethod
def _show_row(label, field, visible: bool) -> None:
label.setVisible(visible)
field.setVisible(visible)
def _choose_color(self, current: str) -> str:
color = QColorDialog.getColor(
QColor(current), self, "Choose colour",
QColorDialog.ColorDialogOption.ShowAlphaChannel,
)
if not color.isValid():
return current
return color.name(QColor.NameFormat.HexArgb) if color.alpha() < 255 else color.name()
def _choose_stroke(self) -> None:
self.stroke_color = self._choose_color(self.stroke_color)
self._refresh_color_buttons()
def _choose_fill(self) -> None:
self.fill_color = self._choose_color(self.fill_color)
self._refresh_color_buttons()
def _refresh_color_buttons(self) -> None:
for button, color in (
(self.ui.strokeColorButton, self.stroke_color),
(self.ui.fillColorButton, self.fill_color),
):
button.setText(color)
button.setStyleSheet(f"QPushButton {{ background: {color}; }}")
def accept(self) -> None:
self.element["lineStyle"] = self.line_style.currentText()
self.element["lineWidth"] = self.line_width.value()
self.element["stroke"] = self.stroke.color
self.element["width"] = self.width.value()
self.element["height"] = self.height.value()
self.element["lineStyle"] = self.ui.lineStyleCombo.currentText()
self.element["lineWidth"] = self.ui.lineWidthSpin.value()
self.element["stroke"] = self.stroke_color
self.element["width"] = self.ui.widthSpin.value()
self.element["height"] = self.ui.heightSpin.value()
if self.element.get("type") != "line":
self.element["fill"] = self.fill.color if self.fill_type.currentText() == "solid" else "none"
if self.radius is not None:
self.element["cornerRadius"] = self.radius.value()
if self.text_edit is not None:
self.element["text"] = self.text_edit.text()
self.element["fontSize"] = self.font_size.value()
self.element["color"] = self.stroke.color
self.element["fill"] = self.fill_color if self.ui.fillTypeCombo.currentText() == "solid" else "none"
if self.element.get("type") == "rectangle":
self.element["cornerRadius"] = self.ui.cornerRadiusSpin.value()
if self.element.get("type") == "text":
self.element["text"] = self.ui.textEdit.text()
self.element["fontSize"] = self.ui.fontSizeSpin.value()
self.element["color"] = self.stroke_color
super().accept()
@@ -308,39 +269,33 @@ class PortHandle(QGraphicsEllipseItem):
class IconEditorDialog(QDialog):
def __init__(self, component: Component, parent=None) -> None:
super().__init__(parent)
self.ui = Ui_IconEditorDialog()
self.ui.setupUi(self)
self.setWindowTitle(f"Icon Editor — {component.name}")
self.resize(850, 600)
self.icon = Icon.from_dict(component.icon.to_dict())
self.inputs = deepcopy(component.inputs)
self.outputs = deepcopy(component.outputs)
layout = QVBoxLayout(self)
toolbar = QHBoxLayout()
toolbar.addWidget(QLabel("Add:"))
for kind in ("rectangle", "circle", "ellipse", "line", "triangle", "text"):
button = QToolButton()
button.setText(kind.title())
button.clicked.connect(lambda _checked=False, value=kind: self.add_shape(value))
toolbar.addWidget(button)
toolbar.addStretch()
delete = QPushButton("Delete selected")
delete.clicked.connect(self.delete_selected)
toolbar.addWidget(delete)
layout.addLayout(toolbar)
for button, kind in (
(self.ui.addRectangleButton, "rectangle"),
(self.ui.addCircleButton, "circle"),
(self.ui.addEllipseButton, "ellipse"),
(self.ui.addLineButton, "line"),
(self.ui.addTriangleButton, "triangle"),
(self.ui.addTextButton, "text"),
):
button.clicked.connect(
lambda _checked=False, value=kind: self.add_shape(value)
)
self.ui.deleteSelectedButton.clicked.connect(self.delete_selected)
self.scene = QGraphicsScene(0, 0, self.icon.width, self.icon.height, self)
self.view = IconEditorView(self.scene)
self.ui.iconView.setScene(self.scene)
self.view = self.ui.iconView
self.view.setRenderHint(QPainter.RenderHint.Antialiasing)
self.view.setDragMode(QGraphicsView.DragMode.RubberBandDrag)
self.scene.addRect(self.scene.sceneRect(), QPen(QColor("#64748b"), 0)).setZValue(-100)
layout.addWidget(self.view, 1)
layout.addWidget(QLabel("Green points are inputs; red points are outputs. Drag them to place connection anchors."))
for element in self.icon.elements:
self.scene.addItem(ShapeItem(element))
self._add_ports(self.inputs, "input", 0.0)
self._add_ports(self.outputs, "output", self.icon.width)
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
layout.addWidget(buttons)
self.view.fitInView(self.scene.sceneRect().adjusted(-10, -10, 10, 10), Qt.AspectRatioMode.KeepAspectRatio)
def _add_ports(self, ports: list[Port], direction: str, default_x: float) -> None:

View File

@@ -2,9 +2,9 @@ import json
from copy import deepcopy
from pathlib import Path
from PySide6.QtCore import QSize, Qt, Slot
from PySide6.QtGui import QAction, QCloseEvent
from PySide6.QtWidgets import QFileDialog, QMainWindow, QMenu, QMessageBox, QToolBar
from PySide6.QtCore import Qt, Slot
from PySide6.QtGui import QCloseEvent
from PySide6.QtWidgets import QFileDialog, QMainWindow, QMenu, QMessageBox
from bedit.core.model import Component, Port
from bedit.core.serializer import JsonDocumentSerializer
@@ -32,11 +32,6 @@ class MainWindow(QMainWindow):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.emptyPage.setStyleSheet("background-color: #9a9a9a;")
self.ui.emptyWorkspaceLabel.setStyleSheet(
"background: transparent; color: #202020;"
)
self._create_camera_toolbar()
self.settings = application_settings()
self.libraries = LibraryRepository(self)
@@ -68,8 +63,6 @@ class MainWindow(QMainWindow):
def _configure_models(self) -> None:
self.ui.treeView.setModel(self.library_tree_model)
self.ui.treeView.setIconSize(QSize(28, 28))
self.ui.treeView.setStyleSheet("QTreeView::item { height: 32px; }")
self.ui.treeView.setHeaderHidden(True)
self.ui.treeView.setDragEnabled(True)
self.ui.treeView.setDragDropMode(self.ui.treeView.DragDropMode.DragOnly)
@@ -79,7 +72,6 @@ class MainWindow(QMainWindow):
)
self.library_tree_model.rebuilt.connect(self.ui.treeView.expandAll)
self.ui.documentTreeView.setModel(self.document_tree_model)
self.ui.documentTreeView.setIconSize(QSize(16, 16))
self.ui.documentTreeView.setHeaderHidden(True)
self.ui.documentTreeView.setDragEnabled(True)
self.ui.documentTreeView.setDragDropMode(
@@ -103,25 +95,9 @@ class MainWindow(QMainWindow):
)
self.ui.navigateUpButton.clicked.connect(self.navigate_up)
self.ui.pointerToolButton.clicked.connect(lambda: self.set_graph_tool("pointer"))
self.ui.inputToolButton.hide()
self.ui.outputToolButton.hide()
self.ui.applyJsonButton.clicked.connect(self.apply_json)
self.document_controller.activeGraphChanged.connect(self._active_graph_changed)
def _create_camera_toolbar(self) -> None:
self.cameraToolbar = QToolBar("Camera", self)
self.cameraToolbar.setObjectName("cameraToolbar")
self.actionZoomIn = QAction("Zoom In", self)
self.actionZoomIn.setShortcut("Ctrl++")
self.actionZoomOut = QAction("Zoom Out", self)
self.actionZoomOut.setShortcut("Ctrl+-")
self.actionCenterView = QAction("Center", self)
self.actionCenterView.setShortcut("Ctrl+0")
self.cameraToolbar.addActions(
(self.actionZoomIn, self.actionZoomOut, self.actionCenterView)
)
self.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.cameraToolbar)
def _connect_actions(self) -> None:
self.ui.actionNew.triggered.connect(self.new_document)
self.ui.actionOpen.triggered.connect(self.open_document)
@@ -142,9 +118,9 @@ class MainWindow(QMainWindow):
self.ui.actionPaste.triggered.connect(self.ui.graphView.paste_selection)
self.ui.actionSelectAll.triggered.connect(self.ui.graphView.select_all)
self.ui.actionRotateClockwise.triggered.connect(self.ui.graphView.rotate_selected)
self.actionZoomIn.triggered.connect(self.ui.graphView.zoom_in)
self.actionZoomOut.triggered.connect(self.ui.graphView.zoom_out)
self.actionCenterView.triggered.connect(self.ui.graphView.center_workspace)
self.ui.actionZoomIn.triggered.connect(self.ui.graphView.zoom_in)
self.ui.actionZoomOut.triggered.connect(self.ui.graphView.zoom_out)
self.ui.actionCenterView.triggered.connect(self.ui.graphView.center_workspace)
self.document_controller.undo_stack.canUndoChanged.connect(self.ui.actionUndo.setEnabled)
self.document_controller.undo_stack.canRedoChanged.connect(self.ui.actionRedo.setEnabled)
self.document_controller.modifiedChanged.connect(lambda _modified: self._update_title())
@@ -162,7 +138,7 @@ class MainWindow(QMainWindow):
self.ui.fileToolbar,
self.ui.editToolbar,
self.ui.transformToolbar,
self.cameraToolbar,
self.ui.cameraToolbar,
):
self.ui.menuToolbars.addAction(toolbar.toggleViewAction())
@@ -197,12 +173,7 @@ class MainWindow(QMainWindow):
self.ui.workspaceModeLabel.setText("")
self.ui.workspaceStack.setCurrentWidget(self.ui.emptyPage)
self.ui.applyJsonButton.setVisible(False)
for button in (
self.ui.pointerToolButton,
self.ui.inputToolButton,
self.ui.outputToolButton,
):
button.setVisible(False)
self.ui.pointerToolButton.setVisible(False)
self._update_edit_actions()
return
self.ui.graphBreadcrumbLabel.setText(" ".join(self.document_controller.breadcrumb()))
@@ -214,8 +185,6 @@ class MainWindow(QMainWindow):
self.ui.workspaceStack.setCurrentWidget(self.ui.graphPage if is_graph else self.ui.jsonPage)
self.ui.applyJsonButton.setVisible(not is_graph)
self.ui.pointerToolButton.setVisible(is_graph)
self.ui.inputToolButton.hide()
self.ui.outputToolButton.hide()
if is_graph:
self.set_graph_tool("pointer")
else:

View File

@@ -9,15 +9,9 @@
<layout class="QFormLayout" name="optionsForm">
<item row="0" column="0"><widget class="QLabel" name="nameLabel"><property name="text"><string>Name:</string></property></widget></item>
<item row="0" column="1"><widget class="QLineEdit" name="nameEdit"/></item>
<item row="1" column="0"><widget class="QLabel" name="shapeLabel"><property name="text"><string>Icon shape:</string></property></widget></item>
<item row="1" column="1"><widget class="QComboBox" name="shapeCombo"><item><property name="text"><string>rectangle</string></property></item><item><property name="text"><string>ellipse</string></property></item></widget></item>
<item row="2" column="0"><widget class="QLabel" name="iconTextLabel"><property name="text"><string>Icon text:</string></property></widget></item>
<item row="2" column="1"><widget class="QLineEdit" name="iconTextEdit"/></item>
<item row="3" column="0"><widget class="QLabel" name="fillLabel"><property name="text"><string>Fill color:</string></property></widget></item>
<item row="3" column="1"><widget class="QLineEdit" name="fillEdit"><property name="placeholderText"><string>#dbeafe</string></property></widget></item>
<item row="4" column="0"><widget class="QLabel" name="borderLabel"><property name="text"><string>Border color:</string></property></widget></item>
<item row="4" column="1"><widget class="QLineEdit" name="borderEdit"><property name="placeholderText"><string>#303030</string></property></widget></item>
<item row="5" column="0" colspan="2"><widget class="QCheckBox" name="showSubtreeCheckBox"><property name="text"><string>Show contained components in the Libraries tree</string></property><property name="checked"><bool>true</bool></property></widget></item>
<item row="1" column="0"><widget class="QLabel" name="iconLabel"><property name="text"><string>Icon:</string></property></widget></item>
<item row="1" column="1"><widget class="QPushButton" name="editIconButton"><property name="text"><string>Edit Icon…</string></property><property name="toolTip"><string>Open the vector icon and port-position editor</string></property></widget></item>
<item row="2" column="0" colspan="2"><widget class="QCheckBox" name="showSubtreeCheckBox"><property name="text"><string>Show contained components in the Libraries tree</string></property><property name="checked"><bool>true</bool></property></widget></item>
</layout>
</item>
<item><spacer name="optionsSpacer"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>40</height></size></property></spacer></item>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>IconEditorDialog</class>
<widget class="QDialog" name="IconEditorDialog">
<property name="geometry"><rect><x>0</x><y>0</y><width>850</width><height>600</height></rect></property>
<property name="windowTitle"><string>Icon Editor</string></property>
<layout class="QVBoxLayout" name="dialogLayout">
<item>
<layout class="QHBoxLayout" name="shapeToolbarLayout">
<item><widget class="QLabel" name="addShapeLabel"><property name="text"><string>Add:</string></property></widget></item>
<item><widget class="QToolButton" name="addRectangleButton"><property name="text"><string>Rectangle</string></property></widget></item>
<item><widget class="QToolButton" name="addCircleButton"><property name="text"><string>Circle</string></property></widget></item>
<item><widget class="QToolButton" name="addEllipseButton"><property name="text"><string>Ellipse</string></property></widget></item>
<item><widget class="QToolButton" name="addLineButton"><property name="text"><string>Line</string></property></widget></item>
<item><widget class="QToolButton" name="addTriangleButton"><property name="text"><string>Triangle</string></property></widget></item>
<item><widget class="QToolButton" name="addTextButton"><property name="text"><string>Text</string></property></widget></item>
<item><spacer name="toolbarSpacer"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item>
<item><widget class="QPushButton" name="deleteSelectedButton"><property name="text"><string>Delete selected</string></property></widget></item>
</layout>
</item>
<item><widget class="IconCanvasView" name="iconView"><property name="dragMode"><enum>QGraphicsView::DragMode::RubberBandDrag</enum></property></widget></item>
<item><widget class="QLabel" name="portHintLabel"><property name="text"><string>Green points are inputs; red points are outputs. Drag them to place connection anchors.</string></property><property name="wordWrap"><bool>true</bool></property></widget></item>
<item><widget class="QDialogButtonBox" name="buttonBox"><property name="standardButtons"><set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set></property></widget></item>
</layout>
</widget>
<customwidgets><customwidget><class>IconCanvasView</class><extends>QGraphicsView</extends><header>bedit.gui.graphics.icon_canvas</header></customwidget></customwidgets>
<resources/>
<connections>
<connection><sender>buttonBox</sender><signal>accepted()</signal><receiver>IconEditorDialog</receiver><slot>accept()</slot><hints/></connection>
<connection><sender>buttonBox</sender><signal>rejected()</signal><receiver>IconEditorDialog</receiver><slot>reject()</slot><hints/></connection>
</connections>
</ui>

View File

@@ -83,6 +83,8 @@
</property>
<item>
<widget class="QTreeView" name="treeView">
<property name="iconSize"><size><width>28</width><height>28</height></size></property>
<property name="styleSheet"><string notr="true">QTreeView::item { height: 32px; }</string></property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
@@ -109,6 +111,7 @@
<property name="bottomMargin"><number>0</number></property>
<item>
<widget class="QTreeView" name="documentTreeView">
<property name="iconSize"><size><width>16</width><height>16</height></size></property>
<property name="alternatingRowColors"><bool>true</bool></property>
<property name="uniformRowHeights"><bool>true</bool></property>
</widget>
@@ -146,8 +149,6 @@
<item><spacer name="workspaceHeaderSpacer"><property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property><property name="sizeHint" stdset="0"><size><width>40</width><height>20</height></size></property></spacer></item>
<item><widget class="QPushButton" name="applyJsonButton"><property name="text"><string>Apply JSON</string></property><property name="visible"><bool>false</bool></property></widget></item>
<item><widget class="QToolButton" name="pointerToolButton"><property name="text"><string>Pointer</string></property><property name="checkable"><bool>true</bool></property><property name="checked"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
<item><widget class="QToolButton" name="inputToolButton"><property name="text"><string>Input</string></property><property name="toolTip"><string>Add an interface input</string></property><property name="checkable"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
<item><widget class="QToolButton" name="outputToolButton"><property name="text"><string>Output</string></property><property name="toolTip"><string>Add an interface output</string></property><property name="checkable"><bool>true</bool></property><property name="autoExclusive"><bool>true</bool></property></widget></item>
</layout>
</widget>
</item>
@@ -167,9 +168,11 @@
</layout>
</widget>
<widget class="QWidget" name="emptyPage">
<property name="styleSheet"><string notr="true">background-color: #9a9a9a;</string></property>
<layout class="QVBoxLayout" name="emptyPageLayout">
<item>
<widget class="QLabel" name="emptyWorkspaceLabel">
<property name="styleSheet"><string notr="true">background: transparent; color: #202020;</string></property>
<property name="text"><string>No document open</string></property>
<property name="alignment"><set>Qt::AlignmentFlag::AlignCenter</set></property>
</widget>
@@ -311,6 +314,14 @@
<attribute name="toolBarBreak"><bool>false</bool></attribute>
<addaction name="actionRotateClockwise"/>
</widget>
<widget class="QToolBar" name="cameraToolbar">
<property name="windowTitle"><string>Camera</string></property>
<attribute name="toolBarArea"><enum>TopToolBarArea</enum></attribute>
<attribute name="toolBarBreak"><bool>false</bool></attribute>
<addaction name="actionZoomIn"/>
<addaction name="actionZoomOut"/>
<addaction name="actionCenterView"/>
</widget>
<action name="actionNew">
<property name="icon">
<iconset resource="../resources/resources.qrc">
@@ -335,6 +346,9 @@
<property name="toolTip"><string>Rotate selected blocks clockwise by 90 degrees</string></property>
<property name="shortcut"><string>Ctrl+R</string></property>
</action>
<action name="actionZoomIn"><property name="text"><string>Zoom In</string></property><property name="shortcut"><string>Ctrl++</string></property></action>
<action name="actionZoomOut"><property name="text"><string>Zoom Out</string></property><property name="shortcut"><string>Ctrl+-</string></property></action>
<action name="actionCenterView"><property name="text"><string>Center</string></property><property name="shortcut"><string>Ctrl+0</string></property></action>
<action name="actionOpen">
<property name="icon">
<iconset resource="../resources/resources.qrc">

View File

@@ -1,450 +0,0 @@
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'main_window.ui'
##
## Created by: Qt User Interface Compiler version 6.11.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient,
QCursor, QFont, QFontDatabase, QGradient,
QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QApplication, QDockWidget, QFrame, QHBoxLayout,
QHeaderView, QLabel, QMainWindow, QMenu,
QMenuBar, QPlainTextEdit, QPushButton, QSizePolicy,
QSpacerItem, QSplitter, QStackedWidget, QToolBar,
QToolButton, QTreeView, QVBoxLayout, QWidget)
from bedit.gui.graphics.workspace import GraphWorkspaceView
import resources_rc
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
if not MainWindow.objectName():
MainWindow.setObjectName(u"MainWindow")
MainWindow.resize(1000, 700)
self.actionNew = QAction(MainWindow)
self.actionNew.setObjectName(u"actionNew")
icon = QIcon()
icon.addFile(u":/icons/icons/document-new.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionNew.setIcon(icon)
self.actionRotateClockwise = QAction(MainWindow)
self.actionRotateClockwise.setObjectName(u"actionRotateClockwise")
icon1 = QIcon()
icon1.addFile(u":/icons/icons/transform-rotate.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionRotateClockwise.setIcon(icon1)
self.actionOpen = QAction(MainWindow)
self.actionOpen.setObjectName(u"actionOpen")
icon2 = QIcon()
icon2.addFile(u":/icons/icons/document-open.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionOpen.setIcon(icon2)
self.actionSave = QAction(MainWindow)
self.actionSave.setObjectName(u"actionSave")
icon3 = QIcon()
icon3.addFile(u":/icons/icons/document-save.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionSave.setIcon(icon3)
self.actionSaveAs = QAction(MainWindow)
self.actionSaveAs.setObjectName(u"actionSaveAs")
icon4 = QIcon()
icon4.addFile(u":/icons/icons/document-save-as.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionSaveAs.setIcon(icon4)
self.actionExit = QAction(MainWindow)
self.actionExit.setObjectName(u"actionExit")
self.actionClose = QAction(MainWindow)
self.actionClose.setObjectName(u"actionClose")
self.actionUndo = QAction(MainWindow)
self.actionUndo.setObjectName(u"actionUndo")
icon5 = QIcon()
icon5.addFile(u":/icons/icons/edit-undo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionUndo.setIcon(icon5)
self.actionRedo = QAction(MainWindow)
self.actionRedo.setObjectName(u"actionRedo")
icon6 = QIcon()
icon6.addFile(u":/icons/icons/edit-redo.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionRedo.setIcon(icon6)
self.actionCut = QAction(MainWindow)
self.actionCut.setObjectName(u"actionCut")
icon7 = QIcon()
icon7.addFile(u":/icons/icons/edit-cut.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionCut.setIcon(icon7)
self.actionCopy = QAction(MainWindow)
self.actionCopy.setObjectName(u"actionCopy")
icon8 = QIcon()
icon8.addFile(u":/icons/icons/edit-copy.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionCopy.setIcon(icon8)
self.actionPaste = QAction(MainWindow)
self.actionPaste.setObjectName(u"actionPaste")
icon9 = QIcon()
icon9.addFile(u":/icons/icons/edit-paste.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off)
self.actionPaste.setIcon(icon9)
self.actionSelectAll = QAction(MainWindow)
self.actionSelectAll.setObjectName(u"actionSelectAll")
self.actionDelete = QAction(MainWindow)
self.actionDelete.setObjectName(u"actionDelete")
self.actionAbout = QAction(MainWindow)
self.actionAbout.setObjectName(u"actionAbout")
self.actionSettings = QAction(MainWindow)
self.actionSettings.setObjectName(u"actionSettings")
self.actionAboutQt = QAction(MainWindow)
self.actionAboutQt.setObjectName(u"actionAboutQt")
self.centralwidget = QWidget(MainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.workspaceLayout = QHBoxLayout(self.centralwidget)
self.workspaceLayout.setSpacing(0)
self.workspaceLayout.setObjectName(u"workspaceLayout")
self.workspaceLayout.setContentsMargins(0, 0, 0, 0)
self.workspaceSplitter = QSplitter(self.centralwidget)
self.workspaceSplitter.setObjectName(u"workspaceSplitter")
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.workspaceSplitter.sizePolicy().hasHeightForWidth())
self.workspaceSplitter.setSizePolicy(sizePolicy)
self.workspaceSplitter.setOrientation(Qt.Orientation.Horizontal)
self.workspaceSplitter.setChildrenCollapsible(False)
self.leftDockHost = QMainWindow(self.workspaceSplitter)
self.leftDockHost.setObjectName(u"leftDockHost")
self.leftDockHost.setMinimumSize(QSize(220, 0))
self.panel_libraries = QDockWidget(self.leftDockHost)
self.panel_libraries.setObjectName(u"panel_libraries")
self.panel_libraries.setMinimumSize(QSize(220, 91))
self.dockWidgetContents = QWidget()
self.dockWidgetContents.setObjectName(u"dockWidgetContents")
self.librariesLayout = QVBoxLayout(self.dockWidgetContents)
self.librariesLayout.setSpacing(0)
self.librariesLayout.setObjectName(u"librariesLayout")
self.librariesLayout.setContentsMargins(0, 0, 0, 0)
self.treeView = QTreeView(self.dockWidgetContents)
self.treeView.setObjectName(u"treeView")
self.treeView.setAlternatingRowColors(True)
self.treeView.setUniformRowHeights(True)
self.librariesLayout.addWidget(self.treeView)
self.panel_libraries.setWidget(self.dockWidgetContents)
self.leftDockHost.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, self.panel_libraries)
self.panel_document = QDockWidget(self.leftDockHost)
self.panel_document.setObjectName(u"panel_document")
self.panel_document.setMinimumSize(QSize(220, 91))
self.documentDockContents = QWidget()
self.documentDockContents.setObjectName(u"documentDockContents")
self.documentPanelLayout = QVBoxLayout(self.documentDockContents)
self.documentPanelLayout.setSpacing(0)
self.documentPanelLayout.setObjectName(u"documentPanelLayout")
self.documentPanelLayout.setContentsMargins(0, 0, 0, 0)
self.documentTreeView = QTreeView(self.documentDockContents)
self.documentTreeView.setObjectName(u"documentTreeView")
self.documentTreeView.setAlternatingRowColors(True)
self.documentTreeView.setUniformRowHeights(True)
self.documentPanelLayout.addWidget(self.documentTreeView)
self.panel_document.setWidget(self.documentDockContents)
self.leftDockHost.addDockWidget(Qt.DockWidgetArea.LeftDockWidgetArea, self.panel_document)
self.workspaceSplitter.addWidget(self.leftDockHost)
self.workspace = QWidget(self.workspaceSplitter)
self.workspace.setObjectName(u"workspace")
sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy1.setHorizontalStretch(1)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.workspace.sizePolicy().hasHeightForWidth())
self.workspace.setSizePolicy(sizePolicy1)
self.workspaceEditorLayout = QVBoxLayout(self.workspace)
self.workspaceEditorLayout.setSpacing(0)
self.workspaceEditorLayout.setObjectName(u"workspaceEditorLayout")
self.workspaceEditorLayout.setContentsMargins(0, 0, 0, 0)
self.workspaceHeader = QFrame(self.workspace)
self.workspaceHeader.setObjectName(u"workspaceHeader")
self.workspaceHeader.setMinimumSize(QSize(0, 34))
self.workspaceHeader.setMaximumSize(QSize(16777215, 34))
self.workspaceHeader.setFrameShape(QFrame.Shape.StyledPanel)
self.workspaceHeaderLayout = QHBoxLayout(self.workspaceHeader)
self.workspaceHeaderLayout.setObjectName(u"workspaceHeaderLayout")
self.workspaceHeaderLayout.setContentsMargins(6, 2, 6, 2)
self.navigateUpButton = QToolButton(self.workspaceHeader)
self.navigateUpButton.setObjectName(u"navigateUpButton")
self.workspaceHeaderLayout.addWidget(self.navigateUpButton)
self.graphBreadcrumbLabel = QLabel(self.workspaceHeader)
self.graphBreadcrumbLabel.setObjectName(u"graphBreadcrumbLabel")
self.workspaceHeaderLayout.addWidget(self.graphBreadcrumbLabel)
self.workspaceModeLabel = QLabel(self.workspaceHeader)
self.workspaceModeLabel.setObjectName(u"workspaceModeLabel")
self.workspaceHeaderLayout.addWidget(self.workspaceModeLabel)
self.workspaceHeaderSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
self.workspaceHeaderLayout.addItem(self.workspaceHeaderSpacer)
self.applyJsonButton = QPushButton(self.workspaceHeader)
self.applyJsonButton.setObjectName(u"applyJsonButton")
self.applyJsonButton.setVisible(False)
self.workspaceHeaderLayout.addWidget(self.applyJsonButton)
self.pointerToolButton = QToolButton(self.workspaceHeader)
self.pointerToolButton.setObjectName(u"pointerToolButton")
self.pointerToolButton.setCheckable(True)
self.pointerToolButton.setChecked(True)
self.pointerToolButton.setAutoExclusive(True)
self.workspaceHeaderLayout.addWidget(self.pointerToolButton)
self.inputToolButton = QToolButton(self.workspaceHeader)
self.inputToolButton.setObjectName(u"inputToolButton")
self.inputToolButton.setCheckable(True)
self.inputToolButton.setAutoExclusive(True)
self.workspaceHeaderLayout.addWidget(self.inputToolButton)
self.outputToolButton = QToolButton(self.workspaceHeader)
self.outputToolButton.setObjectName(u"outputToolButton")
self.outputToolButton.setCheckable(True)
self.outputToolButton.setAutoExclusive(True)
self.workspaceHeaderLayout.addWidget(self.outputToolButton)
self.workspaceEditorLayout.addWidget(self.workspaceHeader)
self.workspaceStack = QStackedWidget(self.workspace)
self.workspaceStack.setObjectName(u"workspaceStack")
self.graphPage = QWidget()
self.graphPage.setObjectName(u"graphPage")
self.graphPageLayout = QVBoxLayout(self.graphPage)
self.graphPageLayout.setObjectName(u"graphPageLayout")
self.graphPageLayout.setContentsMargins(0, 0, 0, 0)
self.graphView = GraphWorkspaceView(self.graphPage)
self.graphView.setObjectName(u"graphView")
self.graphPageLayout.addWidget(self.graphView)
self.workspaceStack.addWidget(self.graphPage)
self.jsonPage = QWidget()
self.jsonPage.setObjectName(u"jsonPage")
self.jsonPageLayout = QVBoxLayout(self.jsonPage)
self.jsonPageLayout.setObjectName(u"jsonPageLayout")
self.jsonPageLayout.setContentsMargins(0, 0, 0, 0)
self.jsonEditor = QPlainTextEdit(self.jsonPage)
self.jsonEditor.setObjectName(u"jsonEditor")
self.jsonEditor.setLineWrapMode(QPlainTextEdit.LineWrapMode.NoWrap)
self.jsonPageLayout.addWidget(self.jsonEditor)
self.workspaceStack.addWidget(self.jsonPage)
self.emptyPage = QWidget()
self.emptyPage.setObjectName(u"emptyPage")
self.emptyPageLayout = QVBoxLayout(self.emptyPage)
self.emptyPageLayout.setObjectName(u"emptyPageLayout")
self.emptyWorkspaceLabel = QLabel(self.emptyPage)
self.emptyWorkspaceLabel.setObjectName(u"emptyWorkspaceLabel")
self.emptyWorkspaceLabel.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.emptyPageLayout.addWidget(self.emptyWorkspaceLabel)
self.workspaceStack.addWidget(self.emptyPage)
self.workspaceEditorLayout.addWidget(self.workspaceStack)
self.workspaceSplitter.addWidget(self.workspace)
self.workspaceLayout.addWidget(self.workspaceSplitter)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QMenuBar(MainWindow)
self.menubar.setObjectName(u"menubar")
self.menubar.setGeometry(QRect(0, 0, 1000, 24))
self.menuFile = QMenu(self.menubar)
self.menuFile.setObjectName(u"menuFile")
self.menuEdit = QMenu(self.menubar)
self.menuEdit.setObjectName(u"menuEdit")
self.menuView = QMenu(self.menubar)
self.menuView.setObjectName(u"menuView")
self.menuPanels = QMenu(self.menuView)
self.menuPanels.setObjectName(u"menuPanels")
self.menuToolbars = QMenu(self.menuView)
self.menuToolbars.setObjectName(u"menuToolbars")
self.menuHelp = QMenu(self.menubar)
self.menuHelp.setObjectName(u"menuHelp")
MainWindow.setMenuBar(self.menubar)
self.fileToolbar = QToolBar(MainWindow)
self.fileToolbar.setObjectName(u"fileToolbar")
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
sizePolicy2.setHorizontalStretch(0)
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.fileToolbar.sizePolicy().hasHeightForWidth())
self.fileToolbar.setSizePolicy(sizePolicy2)
self.fileToolbar.setMinimumSize(QSize(0, 40))
self.fileToolbar.setMaximumSize(QSize(16777215, 40))
self.fileToolbar.setIconSize(QSize(24, 24))
MainWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.fileToolbar)
self.editToolbar = QToolBar(MainWindow)
self.editToolbar.setObjectName(u"editToolbar")
MainWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.editToolbar)
self.transformToolbar = QToolBar(MainWindow)
self.transformToolbar.setObjectName(u"transformToolbar")
MainWindow.addToolBar(Qt.ToolBarArea.TopToolBarArea, self.transformToolbar)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuEdit.menuAction())
self.menubar.addAction(self.menuView.menuAction())
self.menubar.addAction(self.menuHelp.menuAction())
self.menuFile.addAction(self.actionNew)
self.menuFile.addAction(self.actionOpen)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionSave)
self.menuFile.addAction(self.actionSaveAs)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionClose)
self.menuFile.addAction(self.actionExit)
self.menuEdit.addAction(self.actionUndo)
self.menuEdit.addAction(self.actionRedo)
self.menuEdit.addSeparator()
self.menuEdit.addAction(self.actionCopy)
self.menuEdit.addAction(self.actionCut)
self.menuEdit.addAction(self.actionPaste)
self.menuEdit.addAction(self.actionDelete)
self.menuEdit.addAction(self.actionSelectAll)
self.menuEdit.addSeparator()
self.menuEdit.addAction(self.actionSettings)
self.menuView.addAction(self.menuPanels.menuAction())
self.menuView.addAction(self.menuToolbars.menuAction())
self.menuHelp.addAction(self.actionAbout)
self.menuHelp.addAction(self.actionAboutQt)
self.fileToolbar.addAction(self.actionNew)
self.fileToolbar.addAction(self.actionOpen)
self.fileToolbar.addAction(self.actionSave)
self.fileToolbar.addAction(self.actionSaveAs)
self.editToolbar.addAction(self.actionUndo)
self.editToolbar.addAction(self.actionRedo)
self.editToolbar.addAction(self.actionCopy)
self.editToolbar.addAction(self.actionCut)
self.editToolbar.addAction(self.actionPaste)
self.transformToolbar.addAction(self.actionRotateClockwise)
self.retranslateUi(MainWindow)
self.workspaceStack.setCurrentIndex(0)
QMetaObject.connectSlotsByName(MainWindow)
# setupUi
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"BEdit", None))
self.actionNew.setText(QCoreApplication.translate("MainWindow", u"&New", None))
#if QT_CONFIG(statustip)
self.actionNew.setStatusTip(QCoreApplication.translate("MainWindow", u"Create a new document", None))
#endif // QT_CONFIG(statustip)
#if QT_CONFIG(shortcut)
self.actionNew.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+N", None))
#endif // QT_CONFIG(shortcut)
self.actionRotateClockwise.setText(QCoreApplication.translate("MainWindow", u"Rotate Clockwise", None))
#if QT_CONFIG(tooltip)
self.actionRotateClockwise.setToolTip(QCoreApplication.translate("MainWindow", u"Rotate selected blocks clockwise by 90 degrees", None))
#endif // QT_CONFIG(tooltip)
#if QT_CONFIG(shortcut)
self.actionRotateClockwise.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+R", None))
#endif // QT_CONFIG(shortcut)
self.actionOpen.setText(QCoreApplication.translate("MainWindow", u"&Open\u2026", None))
#if QT_CONFIG(statustip)
self.actionOpen.setStatusTip(QCoreApplication.translate("MainWindow", u"Open a document", None))
#endif // QT_CONFIG(statustip)
#if QT_CONFIG(shortcut)
self.actionOpen.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+O", None))
#endif // QT_CONFIG(shortcut)
self.actionSave.setText(QCoreApplication.translate("MainWindow", u"&Save", None))
#if QT_CONFIG(statustip)
self.actionSave.setStatusTip(QCoreApplication.translate("MainWindow", u"Save the current document", None))
#endif // QT_CONFIG(statustip)
#if QT_CONFIG(shortcut)
self.actionSave.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+S", None))
#endif // QT_CONFIG(shortcut)
self.actionSaveAs.setText(QCoreApplication.translate("MainWindow", u"Save &As\u2026", None))
#if QT_CONFIG(shortcut)
self.actionSaveAs.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Shift+S", None))
#endif // QT_CONFIG(shortcut)
self.actionExit.setText(QCoreApplication.translate("MainWindow", u"E&xit", None))
#if QT_CONFIG(shortcut)
self.actionExit.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Q", None))
#endif // QT_CONFIG(shortcut)
self.actionClose.setText(QCoreApplication.translate("MainWindow", u"&Close Document", None))
#if QT_CONFIG(shortcut)
self.actionClose.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+W", None))
#endif // QT_CONFIG(shortcut)
self.actionUndo.setText(QCoreApplication.translate("MainWindow", u"&Undo", None))
#if QT_CONFIG(shortcut)
self.actionUndo.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Z", None))
#endif // QT_CONFIG(shortcut)
self.actionRedo.setText(QCoreApplication.translate("MainWindow", u"&Redo", None))
#if QT_CONFIG(shortcut)
self.actionRedo.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Y", None))
#endif // QT_CONFIG(shortcut)
self.actionCut.setText(QCoreApplication.translate("MainWindow", u"Cu&t", None))
#if QT_CONFIG(shortcut)
self.actionCut.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+X", None))
#endif // QT_CONFIG(shortcut)
self.actionCopy.setText(QCoreApplication.translate("MainWindow", u"&Copy", None))
#if QT_CONFIG(shortcut)
self.actionCopy.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+C", None))
#endif // QT_CONFIG(shortcut)
self.actionPaste.setText(QCoreApplication.translate("MainWindow", u"&Paste", None))
#if QT_CONFIG(shortcut)
self.actionPaste.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+V", None))
#endif // QT_CONFIG(shortcut)
self.actionSelectAll.setText(QCoreApplication.translate("MainWindow", u"Select &All", None))
#if QT_CONFIG(shortcut)
self.actionSelectAll.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+A", None))
#endif // QT_CONFIG(shortcut)
self.actionDelete.setText(QCoreApplication.translate("MainWindow", u"&Delete", None))
#if QT_CONFIG(shortcut)
self.actionDelete.setShortcut(QCoreApplication.translate("MainWindow", u"Del", None))
#endif // QT_CONFIG(shortcut)
self.actionAbout.setText(QCoreApplication.translate("MainWindow", u"&About BEdit", None))
self.actionSettings.setText(QCoreApplication.translate("MainWindow", u"&Settings\u2026", None))
#if QT_CONFIG(statustip)
self.actionSettings.setStatusTip(QCoreApplication.translate("MainWindow", u"Configure BEdit", None))
#endif // QT_CONFIG(statustip)
self.actionAboutQt.setText(QCoreApplication.translate("MainWindow", u"About &Qt", None))
self.panel_libraries.setWindowTitle(QCoreApplication.translate("MainWindow", u"Libraries", None))
self.panel_document.setWindowTitle(QCoreApplication.translate("MainWindow", u"Document", None))
self.navigateUpButton.setText(QCoreApplication.translate("MainWindow", u"Up", None))
#if QT_CONFIG(tooltip)
self.navigateUpButton.setToolTip(QCoreApplication.translate("MainWindow", u"Open the containing graph", None))
#endif // QT_CONFIG(tooltip)
self.graphBreadcrumbLabel.setText(QCoreApplication.translate("MainWindow", u"Untitled", None))
self.workspaceModeLabel.setText(QCoreApplication.translate("MainWindow", u"Graph", None))
self.applyJsonButton.setText(QCoreApplication.translate("MainWindow", u"Apply JSON", None))
self.pointerToolButton.setText(QCoreApplication.translate("MainWindow", u"Pointer", None))
self.inputToolButton.setText(QCoreApplication.translate("MainWindow", u"Input", None))
#if QT_CONFIG(tooltip)
self.inputToolButton.setToolTip(QCoreApplication.translate("MainWindow", u"Add an interface input", None))
#endif // QT_CONFIG(tooltip)
self.outputToolButton.setText(QCoreApplication.translate("MainWindow", u"Output", None))
#if QT_CONFIG(tooltip)
self.outputToolButton.setToolTip(QCoreApplication.translate("MainWindow", u"Add an interface output", None))
#endif // QT_CONFIG(tooltip)
self.jsonEditor.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Component JSON", None))
self.emptyWorkspaceLabel.setText(QCoreApplication.translate("MainWindow", u"No document open", None))
self.menuFile.setTitle(QCoreApplication.translate("MainWindow", u"&File", None))
self.menuEdit.setTitle(QCoreApplication.translate("MainWindow", u"&Edit", None))
self.menuView.setTitle(QCoreApplication.translate("MainWindow", u"&View", None))
self.menuPanels.setTitle(QCoreApplication.translate("MainWindow", u"&Panels", None))
self.menuToolbars.setTitle(QCoreApplication.translate("MainWindow", u"&Toolbars", None))
self.menuHelp.setTitle(QCoreApplication.translate("MainWindow", u"&Help", None))
self.fileToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"File", None))
self.editToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"Edit", None))
self.transformToolbar.setWindowTitle(QCoreApplication.translate("MainWindow", u"Transform", None))
# retranslateUi

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PortOptionsDialog</class>
<widget class="QDialog" name="PortOptionsDialog">
<property name="geometry"><rect><x>0</x><y>0</y><width>620</width><height>380</height></rect></property>
<property name="windowTitle"><string>Port Options</string></property>
<layout class="QVBoxLayout" name="dialogLayout">
<item>
<widget class="QSplitter" name="portSplitter">
<property name="orientation"><enum>Qt::Orientation::Horizontal</enum></property>
<widget class="QWidget" name="portListPanel">
<layout class="QVBoxLayout" name="portListLayout">
<item><widget class="QListWidget" name="portList"/></item>
<item>
<layout class="QHBoxLayout" name="portButtonsLayout">
<item><widget class="QPushButton" name="addPortButton"><property name="text"><string>Add Port</string></property></widget></item>
<item><widget class="QPushButton" name="removePortButton"><property name="text"><string>Remove Port</string></property></widget></item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="portDetailsPanel">
<layout class="QFormLayout" name="portDetailsForm">
<item row="0" column="0"><widget class="QLabel" name="nameLabel"><property name="text"><string>Name:</string></property></widget></item>
<item row="0" column="1"><widget class="QLineEdit" name="nameEdit"/></item>
<item row="1" column="0"><widget class="QLabel" name="typeLabel"><property name="text"><string>Type:</string></property></widget></item>
<item row="1" column="1"><widget class="QComboBox" name="typeCombo"><item><property name="text"><string>Signal</string></property></item></widget></item>
<item row="2" column="0"><widget class="QLabel" name="orientationLabel"><property name="text"><string>Orientation:</string></property></widget></item>
<item row="2" column="1"><widget class="QComboBox" name="orientationCombo"><item><property name="text"><string>Input</string></property></item><item><property name="text"><string>Output</string></property></item></widget></item>
<item row="3" column="0" colspan="2"><widget class="QLabel" name="positionHintLabel"><property name="text"><string>New ports start at (0, 0) in the icon editor.</string></property><property name="wordWrap"><bool>true</bool></property></widget></item>
</layout>
</widget>
</widget>
</item>
<item><widget class="QDialogButtonBox" name="buttonBox"><property name="standardButtons"><set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set></property></widget></item>
</layout>
</widget>
<resources/>
<connections>
<connection><sender>buttonBox</sender><signal>accepted()</signal><receiver>PortOptionsDialog</receiver><slot>accept()</slot><hints/></connection>
<connection><sender>buttonBox</sender><signal>rejected()</signal><receiver>PortOptionsDialog</receiver><slot>reject()</slot><hints/></connection>
</connections>
</ui>

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>480</width>
<height>300</height>
<height>420</height>
</rect>
</property>
<property name="windowTitle">
@@ -56,6 +56,19 @@
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="editorGridsGroupBox">
<property name="title"><string>Editor grids</string></property>
<layout class="QFormLayout" name="editorGridsLayout">
<item row="0" column="0"><widget class="QLabel" name="graphGridLabel"><property name="text"><string>Workspace grid size:</string></property></widget></item>
<item row="0" column="1"><widget class="QSpinBox" name="graphGridSpinBox"><property name="suffix"><string> units</string></property><property name="minimum"><number>8</number></property><property name="maximum"><number>512</number></property><property name="value"><number>64</number></property></widget></item>
<item row="1" column="0"><widget class="QLabel" name="graphSnapLabel"><property name="text"><string>Workspace snapping size:</string></property></widget></item>
<item row="1" column="1"><widget class="QSpinBox" name="graphSnapSpinBox"><property name="suffix"><string> units</string></property><property name="minimum"><number>1</number></property><property name="maximum"><number>128</number></property><property name="value"><number>8</number></property></widget></item>
<item row="2" column="0"><widget class="QLabel" name="iconGridLabel"><property name="text"><string>Icon grid size:</string></property></widget></item>
<item row="2" column="1"><widget class="QSpinBox" name="iconGridSpinBox"><property name="suffix"><string> units</string></property><property name="minimum"><number>1</number></property><property name="maximum"><number>64</number></property><property name="value"><number>8</number></property></widget></item>
</layout>
</widget>
</item>
<item>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ShapeOptionsDialog</class>
<widget class="QDialog" name="ShapeOptionsDialog">
<property name="geometry"><rect><x>0</x><y>0</y><width>420</width><height>440</height></rect></property>
<property name="windowTitle"><string>Shape Options</string></property>
<layout class="QVBoxLayout" name="dialogLayout">
<item>
<layout class="QFormLayout" name="optionsForm">
<item row="0" column="0"><widget class="QLabel" name="widthLabel"><property name="text"><string>Width:</string></property></widget></item>
<item row="0" column="1"><widget class="QDoubleSpinBox" name="widthSpin"><property name="minimum"><double>1.000000000000000</double></property><property name="maximum"><double>500.000000000000000</double></property></widget></item>
<item row="1" column="0"><widget class="QLabel" name="heightLabel"><property name="text"><string>Height:</string></property></widget></item>
<item row="1" column="1"><widget class="QDoubleSpinBox" name="heightSpin"><property name="minimum"><double>1.000000000000000</double></property><property name="maximum"><double>500.000000000000000</double></property></widget></item>
<item row="2" column="0"><widget class="QLabel" name="lineStyleLabel"><property name="text"><string>Line style:</string></property></widget></item>
<item row="2" column="1"><widget class="QComboBox" name="lineStyleCombo"><item><property name="text"><string>solid</string></property></item><item><property name="text"><string>dash</string></property></item><item><property name="text"><string>dot</string></property></item><item><property name="text"><string>dash-dot</string></property></item><item><property name="text"><string>none</string></property></item></widget></item>
<item row="3" column="0"><widget class="QLabel" name="lineWidthLabel"><property name="text"><string>Line width:</string></property></widget></item>
<item row="3" column="1"><widget class="QDoubleSpinBox" name="lineWidthSpin"><property name="minimum"><double>0.100000000000000</double></property><property name="maximum"><double>20.000000000000000</double></property><property name="singleStep"><double>0.500000000000000</double></property></widget></item>
<item row="4" column="0"><widget class="QLabel" name="strokeColorLabel"><property name="text"><string>Line colour:</string></property></widget></item>
<item row="4" column="1"><widget class="QPushButton" name="strokeColorButton"><property name="text"><string>Choose…</string></property></widget></item>
<item row="5" column="0"><widget class="QLabel" name="fillTypeLabel"><property name="text"><string>Fill type:</string></property></widget></item>
<item row="5" column="1"><widget class="QComboBox" name="fillTypeCombo"><item><property name="text"><string>solid</string></property></item><item><property name="text"><string>none</string></property></item></widget></item>
<item row="6" column="0"><widget class="QLabel" name="fillColorLabel"><property name="text"><string>Fill colour:</string></property></widget></item>
<item row="6" column="1"><widget class="QPushButton" name="fillColorButton"><property name="text"><string>Choose…</string></property></widget></item>
<item row="7" column="0"><widget class="QLabel" name="cornerRadiusLabel"><property name="text"><string>Corner radius:</string></property></widget></item>
<item row="7" column="1"><widget class="QDoubleSpinBox" name="cornerRadiusSpin"><property name="maximum"><double>50.000000000000000</double></property></widget></item>
<item row="8" column="0"><widget class="QLabel" name="textLabel"><property name="text"><string>Text:</string></property></widget></item>
<item row="8" column="1"><widget class="QLineEdit" name="textEdit"/></item>
<item row="9" column="0"><widget class="QLabel" name="fontSizeLabel"><property name="text"><string>Font size:</string></property></widget></item>
<item row="9" column="1"><widget class="QDoubleSpinBox" name="fontSizeSpin"><property name="minimum"><double>4.000000000000000</double></property><property name="maximum"><double>96.000000000000000</double></property></widget></item>
</layout>
</item>
<item><spacer name="verticalSpacer"><property name="orientation"><enum>Qt::Orientation::Vertical</enum></property><property name="sizeHint" stdset="0"><size><width>20</width><height>20</height></size></property></spacer></item>
<item><widget class="QDialogButtonBox" name="buttonBox"><property name="standardButtons"><set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set></property></widget></item>
</layout>
</widget>
<resources/>
<connections>
<connection><sender>buttonBox</sender><signal>accepted()</signal><receiver>ShapeOptionsDialog</receiver><slot>accept()</slot><hints/></connection>
<connection><sender>buttonBox</sender><signal>rejected()</signal><receiver>ShapeOptionsDialog</receiver><slot>reject()</slot><hints/></connection>
</connections>
</ui>