From 3d89d6e6ccdcd05f31717a694f7a3e4121b1ee07 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 24 Oct 2023 18:01:49 +1000 Subject: [PATCH] Fix issue with line item --- gns3/dialogs/style_editor_dialog.py | 15 +++++++-- gns3/ui/style_editor_dialog.ui | 20 +++++------ gns3/ui/style_editor_dialog_ui.py | 52 ++++++++++++----------------- 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/gns3/dialogs/style_editor_dialog.py b/gns3/dialogs/style_editor_dialog.py index f24093cb4..43496691e 100644 --- a/gns3/dialogs/style_editor_dialog.py +++ b/gns3/dialogs/style_editor_dialog.py @@ -78,11 +78,20 @@ def __init__(self, parent, items): if not corner_radius: corner_radius = first_item.verticalCornerRadius() self.uiCornerRadiusSpinBox.setValue(corner_radius) + else: + self.uiCornerRadiusLabel.hide() + self.uiCornerRadiusSpinBox.hide() self.uiRotationSpinBox.setValue(int(first_item.rotation())) self.uiBorderWidthSpinBox.setValue(pen.width()) - rect=first_item.rect() - self.uiWidthSpinBox.setValue(int(rect.width())) - self.uiHeightSpinBox.setValue(int(rect.height())) + if isinstance(first_item, ShapeItem): + rect = first_item.rect() + self.uiWidthSpinBox.setValue(int(rect.width())) + self.uiHeightSpinBox.setValue(int(rect.height())) + else: + self.uiWidthSpinBox.hide() + self.uiWidthLabel.hide() + self.uiHeightSpinBox.hide() + self.uiHeightLabel.hide() index = self.uiBorderStyleComboBox.findData(pen.style()) if index != -1: self.uiBorderStyleComboBox.setCurrentIndex(index) diff --git a/gns3/ui/style_editor_dialog.ui b/gns3/ui/style_editor_dialog.ui index d25d9dd1c..c704002a7 100755 --- a/gns3/ui/style_editor_dialog.ui +++ b/gns3/ui/style_editor_dialog.ui @@ -6,8 +6,8 @@ 0 0 - 270 - 294 + 288 + 358 @@ -84,14 +84,14 @@ - + Rotation: - + @@ -114,14 +114,14 @@ editing (notes only) with ALT and '+' (or P) / ALT and '-' (or M) - + Corner radius: - + ° @@ -131,14 +131,14 @@ editing (notes only) with ALT and '+' (or P) / ALT and '-' (or M) - + Width: - + px @@ -151,14 +151,14 @@ editing (notes only) with ALT and '+' (or P) / ALT and '-' (or M) - + Height: - + px diff --git a/gns3/ui/style_editor_dialog_ui.py b/gns3/ui/style_editor_dialog_ui.py index e40475b9e..75966bae3 100644 --- a/gns3/ui/style_editor_dialog_ui.py +++ b/gns3/ui/style_editor_dialog_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/ui/style_editor_dialog.ui' # -# Created by: PyQt5 UI code generator 5.15.9 +# Created by: PyQt5 UI code generator 5.15.6 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -14,7 +14,7 @@ class Ui_StyleEditorDialog(object): def setupUi(self, StyleEditorDialog): StyleEditorDialog.setObjectName("StyleEditorDialog") - StyleEditorDialog.resize(270, 294) + StyleEditorDialog.resize(288, 358) StyleEditorDialog.setModal(True) self.verticalLayout = QtWidgets.QVBoxLayout(StyleEditorDialog) self.verticalLayout.setObjectName("verticalLayout") @@ -53,7 +53,7 @@ def setupUi(self, StyleEditorDialog): self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.uiBorderStyleComboBox) self.uiRotationLabel = QtWidgets.QLabel(self.uiStyleSettingsGroupBox) self.uiRotationLabel.setObjectName("uiRotationLabel") - self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.uiRotationLabel) + self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.uiRotationLabel) self.uiRotationSpinBox = QtWidgets.QSpinBox(self.uiStyleSettingsGroupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -63,40 +63,30 @@ def setupUi(self, StyleEditorDialog): self.uiRotationSpinBox.setMinimum(-360) self.uiRotationSpinBox.setMaximum(360) self.uiRotationSpinBox.setObjectName("uiRotationSpinBox") - self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.uiRotationSpinBox) + self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.uiRotationSpinBox) + self.uiCornerRadiusLabel = QtWidgets.QLabel(self.uiStyleSettingsGroupBox) + self.uiCornerRadiusLabel.setObjectName("uiCornerRadiusLabel") + self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.uiCornerRadiusLabel) + self.uiCornerRadiusSpinBox = QtWidgets.QSpinBox(self.uiStyleSettingsGroupBox) + self.uiCornerRadiusSpinBox.setMaximum(100) + self.uiCornerRadiusSpinBox.setObjectName("uiCornerRadiusSpinBox") + self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.uiCornerRadiusSpinBox) self.uiWidthLabel = QtWidgets.QLabel(self.uiStyleSettingsGroupBox) self.uiWidthLabel.setObjectName("uiWidthLabel") - self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.uiWidthLabel) + self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.uiWidthLabel) self.uiWidthSpinBox = QtWidgets.QSpinBox(self.uiStyleSettingsGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiWidthSpinBox.sizePolicy().hasHeightForWidth()) - self.uiWidthSpinBox.setSizePolicy(sizePolicy) - self.uiWidthSpinBox.setMinimum(1) + self.uiWidthSpinBox.setMinimum(10) self.uiWidthSpinBox.setMaximum(1000) self.uiWidthSpinBox.setObjectName("uiWidthSpinBox") - self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.uiWidthSpinBox) + self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.uiWidthSpinBox) self.uiHeightLabel = QtWidgets.QLabel(self.uiStyleSettingsGroupBox) self.uiHeightLabel.setObjectName("uiHeightLabel") - self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.uiHeightLabel) + self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.uiHeightLabel) self.uiHeightSpinBox = QtWidgets.QSpinBox(self.uiStyleSettingsGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.uiHeightSpinBox.sizePolicy().hasHeightForWidth()) - self.uiHeightSpinBox.setSizePolicy(sizePolicy) - self.uiHeightSpinBox.setMinimum(1) + self.uiHeightSpinBox.setMinimum(10) self.uiHeightSpinBox.setMaximum(1000) self.uiHeightSpinBox.setObjectName("uiHeightSpinBox") - self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.uiHeightSpinBox) - self.uiCornerRadiusLabel = QtWidgets.QLabel(self.uiStyleSettingsGroupBox) - self.uiCornerRadiusLabel.setObjectName("uiCornerRadiusLabel") - self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.uiCornerRadiusLabel) - self.uiCornerRadiusSpinBox = QtWidgets.QSpinBox(self.uiStyleSettingsGroupBox) - self.uiCornerRadiusSpinBox.setMaximum(100) - self.uiCornerRadiusSpinBox.setObjectName("uiCornerRadiusSpinBox") - self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.uiCornerRadiusSpinBox) + self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.uiHeightSpinBox) self.verticalLayout.addWidget(self.uiStyleSettingsGroupBox) self.uiButtonBox = QtWidgets.QDialogButtonBox(StyleEditorDialog) self.uiButtonBox.setOrientation(QtCore.Qt.Horizontal) @@ -124,10 +114,10 @@ def retranslateUi(self, StyleEditorDialog): self.uiRotationSpinBox.setToolTip(_translate("StyleEditorDialog", "Rotation can be ajusted on the scene for a selected item while\n" "editing (notes only) with ALT and \'+\' (or P) / ALT and \'-\' (or M)")) self.uiRotationSpinBox.setSuffix(_translate("StyleEditorDialog", "°")) - self.uiWidthLabel.setText(_translate("StyleEditorDialog", "Width:")) - self.uiWidthSpinBox.setSuffix(_translate("StyleEditorDialog", "px")) - self.uiHeightLabel.setText(_translate("StyleEditorDialog", "Height:")) - self.uiHeightSpinBox.setSuffix(_translate("StyleEditorDialog", "px")) self.uiCornerRadiusLabel.setText(_translate("StyleEditorDialog", "Corner radius:")) self.uiCornerRadiusSpinBox.setSuffix(_translate("StyleEditorDialog", "°")) + self.uiWidthLabel.setText(_translate("StyleEditorDialog", "Width:")) + self.uiWidthSpinBox.setSuffix(_translate("StyleEditorDialog", " px")) + self.uiHeightLabel.setText(_translate("StyleEditorDialog", "Height:")) + self.uiHeightSpinBox.setSuffix(_translate("StyleEditorDialog", " px")) from . import resources_rc