aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-06-15 14:21:05 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-06-15 14:21:05 +0200
commit98bdd3d498e9c7649c568fe098932861417e8b85 (patch)
tree2fc8c98d3e2069a529484b51a926678bdf726128
parent26bb9a0623a37a3bf235648cd48252b1b2d4d669 (diff)
downloadfreecad-boxer-98bdd3d498e9c7649c568fe098932861417e8b85.tar.gz
freecad-boxer-98bdd3d498e9c7649c568fe098932861417e8b85.tar.bz2
freecad-boxer-98bdd3d498e9c7649c568fe098932861417e8b85.tar.xz
freecad-boxer-98bdd3d498e9c7649c568fe098932861417e8b85.zip
o Improved widget layout in dock.
-rw-r--r--Boxer.py6
-rw-r--r--BoxerDockWidget.py111
-rw-r--r--BoxerDockWidget.ui120
-rw-r--r--BoxerGui.py6
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 @@
<x>0</x>
<y>0</y>
<width>499</width>
- <height>737</height>
+ <height>561</height>
</rect>
</property>
<property name="windowTitle">
@@ -203,79 +203,137 @@
<property name="enabled">
<bool>true</bool>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title">
<string>Side configuration</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="3" column="0">
+ <item row="3" column="1">
<widget class="QCheckBox" name="leftCheckBox">
<property name="text">
- <string>Left</string>
+ <string/>
</property>
</widget>
</item>
- <item row="6" column="0">
+ <item row="6" column="1">
<widget class="QCheckBox" name="bottomCheckBox">
<property name="text">
- <string>Bottom</string>
+ <string/>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="4" column="1">
<widget class="QCheckBox" name="rightCheckBox">
<property name="text">
- <string>Right</string>
+ <string/>
</property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="frontCheckBox">
+ <item row="6" column="2">
+ <widget class="QSpinBox" name="bottomThickness"/>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="leftThickness"/>
+ </item>
+ <item row="4" column="2">
+ <widget class="QSpinBox" name="rightThickness"/>
+ </item>
+ <item row="5" column="2">
+ <widget class="QSpinBox" name="topThickness"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="thicknessLabel">
<property name="text">
- <string>Front</string>
+ <string>Thickness</string>
</property>
- <property name="tristate">
- <bool>false</bool>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSpinBox" name="frontThickness"/>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="backThickness"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="frontCheckBox">
+ <property name="text">
+ <string/>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="2" column="1">
<widget class="QCheckBox" name="backCheckBox">
<property name="text">
- <string>Back</string>
+ <string/>
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="5" column="1">
<widget class="QCheckBox" name="topCheckBox">
<property name="text">
- <string>Top</string>
+ <string/>
</property>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QLabel" name="label_3">
+ <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>Thickness</string>
+ <string>Front</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="frontThickness"/>
+ <item row="2" column="0">
+ <widget class="QLabel" name="backLabel">
+ <property name="text">
+ <string>Back</string>
+ </property>
+ </widget>
</item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="backThickness"/>
+ <item row="3" column="0">
+ <widget class="QLabel" name="leftLabel">
+ <property name="text">
+ <string>Left</string>
+ </property>
+ </widget>
</item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="leftThickness"/>
+ <item row="4" column="0">
+ <widget class="QLabel" name="rightLabel">
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </widget>
</item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="rightThickness"/>
+ <item row="5" column="0">
+ <widget class="QLabel" name="topLabel">
+ <property name="text">
+ <string>Top</string>
+ </property>
+ </widget>
</item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="topThickness"/>
+ <item row="6" column="0">
+ <widget class="QLabel" name="bottomLabel">
+ <property name="text">
+ <string>Bottom</string>
+ </property>
+ </widget>
</item>
- <item row="6" column="1">
- <widget class="QSpinBox" name="bottomThickness"/>
+ <item row="0" column="1">
+ <widget class="QLabel" name="generateLabel">
+ <property name="text">
+ <string>Generate</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
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):