From 98bdd3d498e9c7649c568fe098932861417e8b85 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 15 Jun 2016 14:21:05 +0200 Subject: o Improved widget layout in dock. --- Boxer.py | 6 --- BoxerDockWidget.py | 111 ++++++++++++++++++++++++++++++++----------------- BoxerDockWidget.ui | 120 +++++++++++++++++++++++++++++++++++++++-------------- BoxerGui.py | 6 +-- 4 files changed, 165 insertions(+), 78 deletions(-) diff --git a/Boxer.py b/Boxer.py index 7e1c13a..737a760 100644 --- a/Boxer.py +++ b/Boxer.py @@ -163,12 +163,6 @@ class BoxCfg(object): self.generateExtrudes = True self.generateViews = True - for s in self.sides: - s.enabled = False - self.sides[SideType.left].enabled = True - self.sides[SideType.left].thickness = 20 - self.sides[SideType.back].enabled = True - @property def thickness(self): raise Exception('thickness is de-implemented') diff --git a/BoxerDockWidget.py b/BoxerDockWidget.py index 59f0055..8dba93d 100644 --- a/BoxerDockWidget.py +++ b/BoxerDockWidget.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'BoxerDockWidget.ui' # -# Created: Tue Jun 14 19:26:17 2016 +# Created: Wed Jun 15 14:12:20 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, 737) + BoxerDockWidget.resize(499, 561) self.dockWidgetContents = QtGui.QWidget() sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -120,49 +120,85 @@ class Ui_BoxerDockWidget(object): 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) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) + self.groupBox.setSizePolicy(sizePolicy) self.groupBox.setObjectName("groupBox") self.gridLayout = QtGui.QGridLayout(self.groupBox) self.gridLayout.setObjectName("gridLayout") self.leftCheckBox = QtGui.QCheckBox(self.groupBox) + self.leftCheckBox.setText("") self.leftCheckBox.setObjectName("leftCheckBox") - self.gridLayout.addWidget(self.leftCheckBox, 3, 0, 1, 1) + self.gridLayout.addWidget(self.leftCheckBox, 3, 1, 1, 1) self.bottomCheckBox = QtGui.QCheckBox(self.groupBox) + self.bottomCheckBox.setText("") self.bottomCheckBox.setObjectName("bottomCheckBox") - self.gridLayout.addWidget(self.bottomCheckBox, 6, 0, 1, 1) + self.gridLayout.addWidget(self.bottomCheckBox, 6, 1, 1, 1) self.rightCheckBox = QtGui.QCheckBox(self.groupBox) + self.rightCheckBox.setText("") self.rightCheckBox.setObjectName("rightCheckBox") - self.gridLayout.addWidget(self.rightCheckBox, 4, 0, 1, 1) - self.frontCheckBox = QtGui.QCheckBox(self.groupBox) - self.frontCheckBox.setTristate(False) - self.frontCheckBox.setObjectName("frontCheckBox") - self.gridLayout.addWidget(self.frontCheckBox, 1, 0, 1, 1) - self.backCheckBox = QtGui.QCheckBox(self.groupBox) - self.backCheckBox.setObjectName("backCheckBox") - self.gridLayout.addWidget(self.backCheckBox, 2, 0, 1, 1) - self.topCheckBox = QtGui.QCheckBox(self.groupBox) - self.topCheckBox.setObjectName("topCheckBox") - self.gridLayout.addWidget(self.topCheckBox, 5, 0, 1, 1) - self.label_3 = QtGui.QLabel(self.groupBox) - self.label_3.setObjectName("label_3") - self.gridLayout.addWidget(self.label_3, 0, 1, 1, 1) - self.frontThickness = QtGui.QSpinBox(self.groupBox) - self.frontThickness.setObjectName("frontThickness") - self.gridLayout.addWidget(self.frontThickness, 1, 1, 1, 1) - self.backThickness = QtGui.QSpinBox(self.groupBox) - self.backThickness.setObjectName("backThickness") - self.gridLayout.addWidget(self.backThickness, 2, 1, 1, 1) + self.gridLayout.addWidget(self.rightCheckBox, 4, 1, 1, 1) + self.bottomThickness = QtGui.QSpinBox(self.groupBox) + self.bottomThickness.setObjectName("bottomThickness") + self.gridLayout.addWidget(self.bottomThickness, 6, 2, 1, 1) self.leftThickness = QtGui.QSpinBox(self.groupBox) self.leftThickness.setObjectName("leftThickness") - self.gridLayout.addWidget(self.leftThickness, 3, 1, 1, 1) + self.gridLayout.addWidget(self.leftThickness, 3, 2, 1, 1) self.rightThickness = QtGui.QSpinBox(self.groupBox) self.rightThickness.setObjectName("rightThickness") - self.gridLayout.addWidget(self.rightThickness, 4, 1, 1, 1) + self.gridLayout.addWidget(self.rightThickness, 4, 2, 1, 1) self.topThickness = QtGui.QSpinBox(self.groupBox) self.topThickness.setObjectName("topThickness") - self.gridLayout.addWidget(self.topThickness, 5, 1, 1, 1) - self.bottomThickness = QtGui.QSpinBox(self.groupBox) - self.bottomThickness.setObjectName("bottomThickness") - self.gridLayout.addWidget(self.bottomThickness, 6, 1, 1, 1) + self.gridLayout.addWidget(self.topThickness, 5, 2, 1, 1) + self.thicknessLabel = QtGui.QLabel(self.groupBox) + self.thicknessLabel.setObjectName("thicknessLabel") + self.gridLayout.addWidget(self.thicknessLabel, 0, 2, 1, 1) + self.frontThickness = QtGui.QSpinBox(self.groupBox) + self.frontThickness.setObjectName("frontThickness") + self.gridLayout.addWidget(self.frontThickness, 1, 2, 1, 1) + self.backThickness = QtGui.QSpinBox(self.groupBox) + self.backThickness.setObjectName("backThickness") + self.gridLayout.addWidget(self.backThickness, 2, 2, 1, 1) + self.frontCheckBox = QtGui.QCheckBox(self.groupBox) + self.frontCheckBox.setText("") + self.frontCheckBox.setObjectName("frontCheckBox") + self.gridLayout.addWidget(self.frontCheckBox, 1, 1, 1, 1) + self.backCheckBox = QtGui.QCheckBox(self.groupBox) + self.backCheckBox.setText("") + self.backCheckBox.setObjectName("backCheckBox") + self.gridLayout.addWidget(self.backCheckBox, 2, 1, 1, 1) + self.topCheckBox = QtGui.QCheckBox(self.groupBox) + 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) + self.leftLabel = QtGui.QLabel(self.groupBox) + self.leftLabel.setObjectName("leftLabel") + self.gridLayout.addWidget(self.leftLabel, 3, 0, 1, 1) + self.rightLabel = QtGui.QLabel(self.groupBox) + self.rightLabel.setObjectName("rightLabel") + self.gridLayout.addWidget(self.rightLabel, 4, 0, 1, 1) + 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.verticalLayout.addWidget(self.groupBox) self.generateButton = QtGui.QPushButton(self.dockWidgetContents) self.generateButton.setEnabled(False) @@ -222,13 +258,14 @@ class Ui_BoxerDockWidget(object): 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.leftCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Left", None, QtGui.QApplication.UnicodeUTF8)) - self.bottomCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Bottom", None, QtGui.QApplication.UnicodeUTF8)) - self.rightCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Right", None, QtGui.QApplication.UnicodeUTF8)) - self.frontCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Front", None, QtGui.QApplication.UnicodeUTF8)) - self.backCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Back", None, QtGui.QApplication.UnicodeUTF8)) - self.topCheckBox.setText(QtGui.QApplication.translate("BoxerDockWidget", "Top", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate("BoxerDockWidget", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) + self.thicknessLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Thickness", None, QtGui.QApplication.UnicodeUTF8)) + self.frontLabel.setText(QtGui.QApplication.translate("BoxerDockWidget", "Front", 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.generateButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "Generate", None, QtGui.QApplication.UnicodeUTF8)) self.fitViewButton.setText(QtGui.QApplication.translate("BoxerDockWidget", "Fit all", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/BoxerDockWidget.ui b/BoxerDockWidget.ui index 2b631f7..8eb5ad0 100644 --- a/BoxerDockWidget.ui +++ b/BoxerDockWidget.ui @@ -8,7 +8,7 @@ 0 0 499 - 737 + 561 @@ -203,79 +203,137 @@ true + + + 0 + 0 + + Side configuration - + - Left + - + - Bottom + - + - Right + - - + + + + + + + + + + + + + + - Front + Thickness - - false + + + + + + + + + + + + - + - Back + - + - Top + - - + + + + + 0 + 0 + + - Thickness + Front - - + + + + Back + + - - + + + + Left + + - - + + + + Right + + - - + + + + Top + + - - + + + + Bottom + + - - + + + + Generate + + diff --git a/BoxerGui.py b/BoxerGui.py index 5e0ce43..5b04a1d 100644 --- a/BoxerGui.py +++ b/BoxerGui.py @@ -10,12 +10,10 @@ class BoxerDocumentObserver: pass def slotDeletedDocument(self, doc): - print('slotDeletedDocument') - gui.dockWidget.ui.generateButton.setEnabled(False) + gui.dockWidget.ui.generateButton.setEnabled(FreeCAD.ActiveDocument is not None) def slotActivateDocument(self, doc): - print('slotActivateDocument') - gui.dockWidget.ui.generateButton.setEnabled(True) + gui.dockWidget.ui.generateButton.setEnabled(FreeCAD.ActiveDocument is not None) class BoxerGui(object): -- cgit v1.2.3