diff options
-rw-r--r-- | BoxerDockWidget.py | 169 | ||||
-rw-r--r-- | BoxerDockWidget.ui | 306 | ||||
-rw-r--r-- | 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 @@ <rect> <x>0</x> <y>0</y> - <width>499</width> - <height>561</height> + <width>357</width> + <height>473</height> </rect> </property> <property name="windowTitle"> @@ -27,52 +27,6 @@ </property> <item> <layout class="QGridLayout" name="dimLayout"> - <item row="3" column="0"> - <widget class="QLabel" name="notchSizeLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Notch size</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="widthLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Width</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="heightLabel"> - <property name="text"> - <string>Height</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="innerLabel"> - <property name="text"> - <string>Inner</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> <item row="1" column="0"> <widget class="QLabel" name="outerLabel"> <property name="text"> @@ -83,29 +37,13 @@ </property> </widget> </item> - <item row="2" column="2"> - <widget class="QLineEdit" name="innerHeight"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLineEdit" name="innerDepth"> - <property name="enabled"> - <bool>false</bool> + <item row="1" column="1"> + <widget class="QSpinBox" name="outerWidth"> + <property name="minimum"> + <number>1</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="maximum"> + <number>99999</number> </property> </widget> </item> @@ -116,26 +54,6 @@ </property> </widget> </item> - <item row="3" column="2"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Thickness</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="outerWidth"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>99999</number> - </property> - </widget> - </item> <item row="1" column="2"> <widget class="QSpinBox" name="outerHeight"> <property name="minimum"> @@ -156,7 +74,7 @@ </property> </widget> </item> - <item row="3" column="1"> + <item row="2" column="1"> <widget class="QSpinBox" name="notchSize"> <property name="minimum"> <number>1</number> @@ -166,39 +84,45 @@ </property> </widget> </item> - <item row="3" column="3"> - <widget class="QSpinBox" name="thickness"> - <property name="minimum"> - <number>1</number> + <item row="2" column="0"> + <widget class="QLabel" name="notchSizeLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="maximum"> - <number>99999</number> + <property name="text"> + <string>Notch size</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="innerWidth"> - <property name="enabled"> - <bool>false</bool> - </property> + <item row="0" column="1"> + <widget class="QLabel" name="widthLabel"> <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <property name="text"> + <string>Width</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="heightLabel"> + <property name="text"> + <string>Height</string> + </property> </widget> </item> </layout> </item> <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> <widget class="QGroupBox" name="groupBox"> <property name="enabled"> <bool>true</bool> @@ -237,6 +161,13 @@ <item row="6" column="2"> <widget class="QSpinBox" name="bottomThickness"/> </item> + <item row="6" column="0"> + <widget class="QLabel" name="bottomLabel"> + <property name="text"> + <string>Bottom</string> + </property> + </widget> + </item> <item row="3" column="2"> <widget class="QSpinBox" name="leftThickness"/> </item> @@ -246,6 +177,26 @@ <item row="5" column="2"> <widget class="QSpinBox" name="topThickness"/> </item> + <item row="1" column="0"> + <widget class="QLabel" name="frontLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Front</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="generateLabel"> + <property name="text"> + <string>Generate</string> + </property> + </widget> + </item> <item row="0" column="2"> <widget class="QLabel" name="thicknessLabel"> <property name="text"> @@ -280,19 +231,6 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="frontLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - </item> <item row="2" column="0"> <widget class="QLabel" name="backLabel"> <property name="text"> @@ -321,17 +259,10 @@ </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="bottomLabel"> - <property name="text"> - <string>Bottom</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="generateLabel"> + <item row="1" column="3"> + <widget class="QPushButton" name="copyToOthersButton"> <property name="text"> - <string>Generate</string> + <string>Copy to all sides</string> </property> </widget> </item> @@ -339,40 +270,37 @@ </widget> </item> <item> - <widget class="QPushButton" name="generateButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>484</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Generate</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="fitViewButton"> - <property name="text"> - <string>Fit all</string> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="generateButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>484</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Generate</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="viewBoxButton"> + <property name="text"> + <string>View box</string> + </property> + </widget> + </item> + </layout> </item> <item> <spacer name="verticalSpacer"> @@ -394,11 +322,7 @@ <tabstop>outerWidth</tabstop> <tabstop>outerHeight</tabstop> <tabstop>outerDepth</tabstop> - <tabstop>innerWidth</tabstop> - <tabstop>innerHeight</tabstop> - <tabstop>innerDepth</tabstop> <tabstop>notchSize</tabstop> - <tabstop>thickness</tabstop> <tabstop>frontCheckBox</tabstop> <tabstop>frontThickness</tabstop> <tabstop>backCheckBox</tabstop> @@ -412,7 +336,8 @@ <tabstop>bottomCheckBox</tabstop> <tabstop>bottomThickness</tabstop> <tabstop>generateButton</tabstop> - <tabstop>fitViewButton</tabstop> + <tabstop>viewBoxButton</tabstop> + <tabstop>copyToOthersButton</tabstop> </tabstops> <resources/> <connections> @@ -423,34 +348,51 @@ <slot>generateClicked()</slot> <hints> <hint type="sourcelabel"> - <x>233</x> - <y>502</y> + <x>234</x> + <y>494</y> </hint> <hint type="destinationlabel"> <x>151</x> - <y>520</y> + <y>510</y> + </hint> + </hints> + </connection> + <connection> + <sender>viewBoxButton</sender> + <signal>clicked()</signal> + <receiver>BoxerDockWidget</receiver> + <slot>viewBoxClicked()</slot> + <hints> + <hint type="sourcelabel"> + <x>488</x> + <y>494</y> + </hint> + <hint type="destinationlabel"> + <x>367</x> + <y>421</y> </hint> </hints> </connection> <connection> - <sender>fitViewButton</sender> + <sender>copyToOthersButton</sender> <signal>clicked()</signal> <receiver>BoxerDockWidget</receiver> - <slot>fitAllClicked()</slot> + <slot>copyToOthersClicked()</slot> <hints> <hint type="sourcelabel"> - <x>269</x> - <y>544</y> + <x>307</x> + <y>247</y> </hint> <hint type="destinationlabel"> - <x>219</x> - <y>568</y> + <x>397</x> + <y>275</y> </hint> </hints> </connection> </connections> <slots> <slot>generateClicked()</slot> - <slot>fitAllClicked()</slot> + <slot>viewBoxClicked()</slot> + <slot>copyToOthersClicked()</slot> </slots> </ui> 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() |