From 1a0b12f128911c25d5b95193cb3aff024ae6af59 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 15 Jun 2016 14:52:30 +0200 Subject: o Cleaning up UI, adding button to apply thickness to all sides. --- BoxerDockWidget.py | 169 +++++++++++------------------ BoxerDockWidget.ui | 306 ++++++++++++++++++++++------------------------------- BoxerGui.py | 42 +++++--- 3 files changed, 213 insertions(+), 304 deletions(-) diff --git a/BoxerDockWidget.py b/BoxerDockWidget.py index 8dba93d..63431e5 100644 --- a/BoxerDockWidget.py +++ b/BoxerDockWidget.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'BoxerDockWidget.ui' # -# Created: Wed Jun 15 14:12:20 2016 +# Created: Wed Jun 15 14:50:55 2016 # by: pyside-uic 0.2.15 running on PySide 1.2.2 # # WARNING! All changes made in this file will be lost! @@ -12,7 +12,7 @@ from PySide import QtCore, QtGui class Ui_BoxerDockWidget(object): def setupUi(self, BoxerDockWidget): BoxerDockWidget.setObjectName("BoxerDockWidget") - BoxerDockWidget.resize(499, 561) + BoxerDockWidget.resize(357, 473) self.dockWidgetContents = QtGui.QWidget() sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -25,64 +25,18 @@ class Ui_BoxerDockWidget(object): self.verticalLayout.setObjectName("verticalLayout") self.dimLayout = QtGui.QGridLayout() self.dimLayout.setObjectName("dimLayout") - self.notchSizeLabel = QtGui.QLabel(self.dockWidgetContents) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.notchSizeLabel.sizePolicy().hasHeightForWidth()) - self.notchSizeLabel.setSizePolicy(sizePolicy) - self.notchSizeLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.notchSizeLabel.setObjectName("notchSizeLabel") - self.dimLayout.addWidget(self.notchSizeLabel, 3, 0, 1, 1) - self.widthLabel = QtGui.QLabel(self.dockWidgetContents) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.widthLabel.sizePolicy().hasHeightForWidth()) - self.widthLabel.setSizePolicy(sizePolicy) - self.widthLabel.setObjectName("widthLabel") - self.dimLayout.addWidget(self.widthLabel, 0, 1, 1, 1) - self.heightLabel = QtGui.QLabel(self.dockWidgetContents) - self.heightLabel.setObjectName("heightLabel") - self.dimLayout.addWidget(self.heightLabel, 0, 2, 1, 1) - self.innerLabel = QtGui.QLabel(self.dockWidgetContents) - self.innerLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.innerLabel.setObjectName("innerLabel") - self.dimLayout.addWidget(self.innerLabel, 2, 0, 1, 1) self.outerLabel = QtGui.QLabel(self.dockWidgetContents) self.outerLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.outerLabel.setObjectName("outerLabel") self.dimLayout.addWidget(self.outerLabel, 1, 0, 1, 1) - self.innerHeight = QtGui.QLineEdit(self.dockWidgetContents) - self.innerHeight.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.innerHeight.sizePolicy().hasHeightForWidth()) - self.innerHeight.setSizePolicy(sizePolicy) - self.innerHeight.setObjectName("innerHeight") - self.dimLayout.addWidget(self.innerHeight, 2, 2, 1, 1) - self.innerDepth = QtGui.QLineEdit(self.dockWidgetContents) - self.innerDepth.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.innerDepth.sizePolicy().hasHeightForWidth()) - self.innerDepth.setSizePolicy(sizePolicy) - self.innerDepth.setObjectName("innerDepth") - self.dimLayout.addWidget(self.innerDepth, 2, 3, 1, 1) - self.depthLabel = QtGui.QLabel(self.dockWidgetContents) - self.depthLabel.setObjectName("depthLabel") - self.dimLayout.addWidget(self.depthLabel, 0, 3, 1, 1) - self.label = QtGui.QLabel(self.dockWidgetContents) - self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label.setObjectName("label") - self.dimLayout.addWidget(self.label, 3, 2, 1, 1) self.outerWidth = QtGui.QSpinBox(self.dockWidgetContents) self.outerWidth.setMinimum(1) self.outerWidth.setMaximum(99999) self.outerWidth.setObjectName("outerWidth") self.dimLayout.addWidget(self.outerWidth, 1, 1, 1, 1) + self.depthLabel = QtGui.QLabel(self.dockWidgetContents) + self.depthLabel.setObjectName("depthLabel") + self.dimLayout.addWidget(self.depthLabel, 0, 3, 1, 1) self.outerHeight = QtGui.QSpinBox(self.dockWidgetContents) self.outerHeight.setMinimum(1) self.outerHeight.setMaximum(99999) @@ -97,27 +51,28 @@ class Ui_BoxerDockWidget(object): self.notchSize.setMinimum(1) self.notchSize.setMaximum(99999) self.notchSize.setObjectName("notchSize") - self.dimLayout.addWidget(self.notchSize, 3, 1, 1, 1) - self.thickness = QtGui.QSpinBox(self.dockWidgetContents) - self.thickness.setMinimum(1) - self.thickness.setMaximum(99999) - self.thickness.setObjectName("thickness") - self.dimLayout.addWidget(self.thickness, 3, 3, 1, 1) - self.innerWidth = QtGui.QLineEdit(self.dockWidgetContents) - self.innerWidth.setEnabled(False) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + self.dimLayout.addWidget(self.notchSize, 2, 1, 1, 1) + self.notchSizeLabel = QtGui.QLabel(self.dockWidgetContents) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.innerWidth.sizePolicy().hasHeightForWidth()) - self.innerWidth.setSizePolicy(sizePolicy) - self.innerWidth.setObjectName("innerWidth") - self.dimLayout.addWidget(self.innerWidth, 2, 1, 1, 1) + sizePolicy.setHeightForWidth(self.notchSizeLabel.sizePolicy().hasHeightForWidth()) + self.notchSizeLabel.setSizePolicy(sizePolicy) + self.notchSizeLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.notchSizeLabel.setObjectName("notchSizeLabel") + self.dimLayout.addWidget(self.notchSizeLabel, 2, 0, 1, 1) + self.widthLabel = QtGui.QLabel(self.dockWidgetContents) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.widthLabel.sizePolicy().hasHeightForWidth()) + self.widthLabel.setSizePolicy(sizePolicy) + self.widthLabel.setObjectName("widthLabel") + self.dimLayout.addWidget(self.widthLabel, 0, 1, 1, 1) + self.heightLabel = QtGui.QLabel(self.dockWidgetContents) + self.heightLabel.setObjectName("heightLabel") + self.dimLayout.addWidget(self.heightLabel, 0, 2, 1, 1) self.verticalLayout.addLayout(self.dimLayout) - self.line_2 = QtGui.QFrame(self.dockWidgetContents) - self.line_2.setFrameShape(QtGui.QFrame.HLine) - self.line_2.setFrameShadow(QtGui.QFrame.Sunken) - self.line_2.setObjectName("line_2") - self.verticalLayout.addWidget(self.line_2) self.groupBox = QtGui.QGroupBox(self.dockWidgetContents) self.groupBox.setEnabled(True) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) @@ -143,6 +98,9 @@ class Ui_BoxerDockWidget(object): self.bottomThickness = QtGui.QSpinBox(self.groupBox) self.bottomThickness.setObjectName("bottomThickness") self.gridLayout.addWidget(self.bottomThickness, 6, 2, 1, 1) + self.bottomLabel = QtGui.QLabel(self.groupBox) + self.bottomLabel.setObjectName("bottomLabel") + self.gridLayout.addWidget(self.bottomLabel, 6, 0, 1, 1) self.leftThickness = QtGui.QSpinBox(self.groupBox) self.leftThickness.setObjectName("leftThickness") self.gridLayout.addWidget(self.leftThickness, 3, 2, 1, 1) @@ -152,6 +110,17 @@ class Ui_BoxerDockWidget(object): self.topThickness = QtGui.QSpinBox(self.groupBox) self.topThickness.setObjectName("topThickness") self.gridLayout.addWidget(self.topThickness, 5, 2, 1, 1) + self.frontLabel = QtGui.QLabel(self.groupBox) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.frontLabel.sizePolicy().hasHeightForWidth()) + self.frontLabel.setSizePolicy(sizePolicy) + self.frontLabel.setObjectName("frontLabel") + self.gridLayout.addWidget(self.frontLabel, 1, 0, 1, 1) + self.generateLabel = QtGui.QLabel(self.groupBox) + self.generateLabel.setObjectName("generateLabel") + self.gridLayout.addWidget(self.generateLabel, 0, 1, 1, 1) self.thicknessLabel = QtGui.QLabel(self.groupBox) self.thicknessLabel.setObjectName("thicknessLabel") self.gridLayout.addWidget(self.thicknessLabel, 0, 2, 1, 1) @@ -173,14 +142,6 @@ class Ui_BoxerDockWidget(object): self.topCheckBox.setText("") self.topCheckBox.setObjectName("topCheckBox") self.gridLayout.addWidget(self.topCheckBox, 5, 1, 1, 1) - self.frontLabel = QtGui.QLabel(self.groupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.frontLabel.sizePolicy().hasHeightForWidth()) - self.frontLabel.setSizePolicy(sizePolicy) - self.frontLabel.setObjectName("frontLabel") - self.gridLayout.addWidget(self.frontLabel, 1, 0, 1, 1) self.backLabel = QtGui.QLabel(self.groupBox) self.backLabel.setObjectName("backLabel") self.gridLayout.addWidget(self.backLabel, 2, 0, 1, 1) @@ -193,13 +154,12 @@ class Ui_BoxerDockWidget(object): self.topLabel = QtGui.QLabel(self.groupBox) self.topLabel.setObjectName("topLabel") self.gridLayout.addWidget(self.topLabel, 5, 0, 1, 1) - self.bottomLabel = QtGui.QLabel(self.groupBox) - self.bottomLabel.setObjectName("bottomLabel") - self.gridLayout.addWidget(self.bottomLabel, 6, 0, 1, 1) - self.generateLabel = QtGui.QLabel(self.groupBox) - self.generateLabel.setObjectName("generateLabel") - self.gridLayout.addWidget(self.generateLabel, 0, 1, 1, 1) + self.copyToOthersButton = QtGui.QPushButton(self.groupBox) + self.copyToOthersButton.setObjectName("copyToOthersButton") + self.gridLayout.addWidget(self.copyToOthersButton, 1, 3, 1, 1) self.verticalLayout.addWidget(self.groupBox) + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") self.generateButton = QtGui.QPushButton(self.dockWidgetContents) self.generateButton.setEnabled(False) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Maximum) @@ -209,31 +169,24 @@ class Ui_BoxerDockWidget(object): self.generateButton.setSizePolicy(sizePolicy) self.generateButton.setMaximumSize(QtCore.QSize(484, 16777215)) self.generateButton.setObjectName("generateButton") - self.verticalLayout.addWidget(self.generateButton) - self.line = QtGui.QFrame(self.dockWidgetContents) - self.line.setFrameShape(QtGui.QFrame.HLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) - self.line.setObjectName("line") - self.verticalLayout.addWidget(self.line) - self.fitViewButton = QtGui.QPushButton(self.dockWidgetContents) - self.fitViewButton.setObjectName("fitViewButton") - self.verticalLayout.addWidget(self.fitViewButton) + self.horizontalLayout.addWidget(self.generateButton) + self.viewBoxButton = QtGui.QPushButton(self.dockWidgetContents) + self.viewBoxButton.setObjectName("viewBoxButton") + self.horizontalLayout.addWidget(self.viewBoxButton) + self.verticalLayout.addLayout(self.horizontalLayout) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) BoxerDockWidget.setWidget(self.dockWidgetContents) self.retranslateUi(BoxerDockWidget) QtCore.QObject.connect(self.generateButton, QtCore.SIGNAL("clicked()"), BoxerDockWidget.generateClicked) - QtCore.QObject.connect(self.fitViewButton, QtCore.SIGNAL("clicked()"), BoxerDockWidget.fitAllClicked) + QtCore.QObject.connect(self.viewBoxButton, QtCore.SIGNAL("clicked()"), BoxerDockWidget.viewBoxClicked) + QtCore.QObject.connect(self.copyToOthersButton, QtCore.SIGNAL("clicked()"), BoxerDockWidget.copyToOthersClicked) QtCore.QMetaObject.connectSlotsByName(BoxerDockWidget) BoxerDockWidget.setTabOrder(self.outerWidth, self.outerHeight) BoxerDockWidget.setTabOrder(self.outerHeight, self.outerDepth) - BoxerDockWidget.setTabOrder(self.outerDepth, self.innerWidth) - BoxerDockWidget.setTabOrder(self.innerWidth, self.innerHeight) - BoxerDockWidget.setTabOrder(self.innerHeight, self.innerDepth) - BoxerDockWidget.setTabOrder(self.innerDepth, self.notchSize) - BoxerDockWidget.setTabOrder(self.notchSize, self.thickness) - BoxerDockWidget.setTabOrder(self.thickness, self.frontCheckBox) + BoxerDockWidget.setTabOrder(self.outerDepth, self.notchSize) + BoxerDockWidget.setTabOrder(self.notchSize, self.frontCheckBox) BoxerDockWidget.setTabOrder(self.frontCheckBox, self.frontThickness) BoxerDockWidget.setTabOrder(self.frontThickness, self.backCheckBox) BoxerDockWidget.setTabOrder(self.backCheckBox, self.backThickness) @@ -246,26 +199,26 @@ class Ui_BoxerDockWidget(object): BoxerDockWidget.setTabOrder(self.topThickness, self.bottomCheckBox) BoxerDockWidget.setTabOrder(self.bottomCheckBox, self.bottomThickness) BoxerDockWidget.setTabOrder(self.bottomThickness, self.generateButton) - BoxerDockWidget.setTabOrder(self.generateButton, self.fitViewButton) + BoxerDockWidget.setTabOrder(self.generateButton, self.viewBoxButton) + BoxerDockWidget.setTabOrder(self.viewBoxButton, self.copyToOthersButton) def retranslateUi(self, BoxerDockWidget): BoxerDockWidget.setWindowTitle(QtGui.QApplication.translate("BoxerDockWidget", "Boxer", None, QtGui.QApplication.UnicodeUTF8)) + self.outerLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Outer", None, QtGui.QApplication.UnicodeUTF8)) + self.depthLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Depth", None, QtGui.QApplication.UnicodeUTF8)) self.notchSizeLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Notch size", None, QtGui.QApplication.UnicodeUTF8)) self.widthLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Width", None, QtGui.QApplication.UnicodeUTF8)) self.heightLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Height", None, QtGui.QApplication.UnicodeUTF8)) - self.innerLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Inner", None, QtGui.QApplication.UnicodeUTF8)) - self.outerLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Outer", None, QtGui.QApplication.UnicodeUTF8)) - self.depthLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Depth", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("BoxerDockWidget", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setTitle(QtGui.QApplication.translate("BoxerDockWidget", "Side configuration", None, QtGui.QApplication.UnicodeUTF8)) - self.thicknessLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) + self.bottomLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) self.frontLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Front", None, QtGui.QApplication.UnicodeUTF8)) + self.generateLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Generate", None, QtGui.QApplication.UnicodeUTF8)) + self.thicknessLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) self.backLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Back", None, QtGui.QApplication.UnicodeUTF8)) self.leftLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Left", None, QtGui.QApplication.UnicodeUTF8)) self.rightLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Right", None, QtGui.QApplication.UnicodeUTF8)) self.topLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Top", None, QtGui.QApplication.UnicodeUTF8)) - self.bottomLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) - self.generateLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Generate", None, QtGui.QApplication.UnicodeUTF8)) + self.copyToOthersButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "Copy to all sides", None, QtGui.QApplication.UnicodeUTF8)) self.generateButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "Generate", None, QtGui.QApplication.UnicodeUTF8)) - self.fitViewButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "Fit all", None, QtGui.QApplication.UnicodeUTF8)) + self.viewBoxButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "View box", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/BoxerDockWidget.ui b/BoxerDockWidget.ui index 8eb5ad0..1e34f44 100644 --- a/BoxerDockWidget.ui +++ b/BoxerDockWidget.ui @@ -7,8 +7,8 @@ 0 0 - 499 - 561 + 357 + 473 @@ -27,52 +27,6 @@ - - - - - 0 - 0 - - - - Notch size - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Width - - - - - - - Height - - - - - - - Inner - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - @@ -83,29 +37,13 @@ - - - - false - - - - 0 - 0 - - - - - - - - false + + + + 1 - - - 0 - 0 - + + 99999 @@ -116,26 +54,6 @@ - - - - Thickness - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 1 - - - 99999 - - - @@ -156,7 +74,7 @@ - + 1 @@ -166,38 +84,44 @@ - - - - 1 + + + + + 0 + 0 + - - 99999 + + Notch size + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - false - + + - + 0 0 + + Width + + + + + + + Height + - - - - Qt::Horizontal - - - @@ -237,6 +161,13 @@ + + + + Bottom + + + @@ -246,6 +177,26 @@ + + + + + 0 + 0 + + + + Front + + + + + + + Generate + + + @@ -280,19 +231,6 @@ - - - - - 0 - 0 - - - - Front - - - @@ -321,17 +259,10 @@ - - - - Bottom - - - - - + + - Generate + Copy to all sides @@ -339,40 +270,37 @@ - - - false - - - - 0 - 0 - - - - - 484 - 16777215 - - - - Generate - - - - - - - Qt::Horizontal - - - - - - - Fit all - - + + + + + false + + + + 0 + 0 + + + + + 484 + 16777215 + + + + Generate + + + + + + + View box + + + + @@ -394,11 +322,7 @@ outerWidth outerHeight outerDepth - innerWidth - innerHeight - innerDepth notchSize - thickness frontCheckBox frontThickness backCheckBox @@ -412,7 +336,8 @@ bottomCheckBox bottomThickness generateButton - fitViewButton + viewBoxButton + copyToOthersButton @@ -423,34 +348,51 @@ generateClicked() - 233 - 502 + 234 + 494 151 - 520 + 510 + + + + + viewBoxButton + clicked() + BoxerDockWidget + viewBoxClicked() + + + 488 + 494 + + + 367 + 421 - fitViewButton + copyToOthersButton clicked() BoxerDockWidget - fitAllClicked() + copyToOthersClicked() - 269 - 544 + 307 + 247 - 219 - 568 + 397 + 275 generateClicked() - fitAllClicked() + viewBoxClicked() + copyToOthersClicked() diff --git a/BoxerGui.py b/BoxerGui.py index 5b04a1d..2ab5161 100644 --- a/BoxerGui.py +++ b/BoxerGui.py @@ -28,22 +28,31 @@ class BoxerGui(object): self.dockWidget = dockWidget = QtGui.QDockWidget() dockWidget.ui = BoxerDockWidget.Ui_BoxerDockWidget() dockWidget.generateClicked = self.generateButtonClicked - dockWidget.fitAllClicked = self.fitAllButtonClicked + dockWidget.viewBoxClicked = self.viewBoxButtonClicked + dockWidget.copyToOthersClicked = self.copyToOthersClicked dockWidget.ui.setupUi(dockWidget) dockWidget.ui.generateButton.setEnabled(doc is not None) - dockWidget.ui.outerWidth.setValue(self.cfg.outerWidth) - dockWidget.ui.outerHeight.setValue(self.cfg.outerHeight) - dockWidget.ui.outerDepth.setValue(self.cfg.outerDepth) - dockWidget.ui.notchSize.setValue(self.cfg.notchUnitWidth) + + self.copyFromCfg() + + self.documentObserver = BoxerDocumentObserver() + FreeCAD.addDocumentObserver(self.documentObserver) + + def copyFromCfg(self): + ui = self.dockWidget.ui + ui.outerWidth.setValue(self.cfg.outerWidth) + ui.outerHeight.setValue(self.cfg.outerHeight) + ui.outerDepth.setValue(self.cfg.outerDepth) + ui.notchSize.setValue(self.cfg.notchUnitWidth) self.sideCheckBoxes = [ # yapf: disable - (SideType.front, dockWidget.ui.frontCheckBox, dockWidget.ui.frontThickness), - (SideType.back, dockWidget.ui.backCheckBox, dockWidget.ui.backThickness), - (SideType.left, dockWidget.ui.leftCheckBox, dockWidget.ui.leftThickness), - (SideType.right, dockWidget.ui.rightCheckBox, dockWidget.ui.rightThickness), - (SideType.top, dockWidget.ui.topCheckBox, dockWidget.ui.topThickness), - (SideType.bottom, dockWidget.ui.bottomCheckBox, dockWidget.ui.bottomThickness) + (SideType.front, ui.frontCheckBox, ui.frontThickness), + (SideType.back, ui.backCheckBox, ui.backThickness), + (SideType.left, ui.leftCheckBox, ui.leftThickness), + (SideType.right, ui.rightCheckBox, ui.rightThickness), + (SideType.top, ui.topCheckBox, ui.topThickness), + (SideType.bottom, ui.bottomCheckBox, ui.bottomThickness) # yapf: enable ] @@ -52,8 +61,6 @@ class BoxerGui(object): checkBox.setChecked(side.enabled) thickness.setValue(side.thickness) - self.documentObserver = BoxerDocumentObserver() - FreeCAD.addDocumentObserver(self.documentObserver) def generateButtonClicked(self): ui = self.dockWidget.ui @@ -89,9 +96,16 @@ class BoxerGui(object): doc = FreeCAD.ActiveDocument Boxer.removeEverything(doc) - def fitAllButtonClicked(self): + def viewBoxButtonClicked(self): Gui.SendMsgToActiveView("ViewFit") + def copyToOthersClicked(self): + front = self.cfg.sideForType(SideType.front) + front.thickness = self.dockWidget.ui.frontThickness.value() + for st in [st for st in SideType if st != SideType.front]: + s = self.cfg.sideForType(st) + s.thickness = front.thickness + self.copyFromCfg() gui = BoxerGui() gui.setupGui() -- cgit v1.2.3