Skip to content

Commit

Permalink
Arch: Converted wall tool to units system
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Mar 31, 2014
1 parent e47b859 commit 10a4fc0
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/Mod/Arch/ArchWall.py
Expand Up @@ -156,6 +156,8 @@ def Activated(self):
self.Height = p.GetFloat("WallHeight",3000)
self.JOIN_WALLS_SKETCHES = p.GetBool("joinWallSketches",False)
self.AUTOJOIN = p.GetBool("autoJoinWalls",True)
self.DECIMALS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2)
self.FORMAT = "%." + str(self.DECIMALS) + "f mm"
sel = FreeCADGui.Selection.getSelectionEx()
done = False
self.existing = []
Expand Down Expand Up @@ -260,40 +262,37 @@ def update(self,point,info):
dv = dv.negative()
self.tracker.update([b.add(dv),point.add(dv)])
if self.Length:
self.Length.setValue(bv.Length)
self.Length.setText(self.FORMAT % bv.Length)

def taskbox(self):
"sets up a taskbox widget"
d = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2)
w = QtGui.QWidget()
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Wall options").decode("utf8"))
lay0 = QtGui.QVBoxLayout(w)

lay5 = QtGui.QHBoxLayout()
lay0.addLayout(lay5)
label5 = QtGui.QLabel(translate("Arch","Length").decode("utf8"))
lay5.addWidget(label5)
self.Length = QtGui.QDoubleSpinBox()
self.Length.setDecimals(d)
self.Length.setValue(0.00)
self.Length = ui.createWidget("Gui::InputField")
self.Length.setText("0.00 mm")
lay5.addWidget(self.Length)

lay1 = QtGui.QHBoxLayout()
lay0.addLayout(lay1)
label1 = QtGui.QLabel(translate("Arch","Width").decode("utf8"))
lay1.addWidget(label1)
value1 = QtGui.QDoubleSpinBox()
value1.setDecimals(d)
value1.setValue(self.Width)
value1 = ui.createWidget("Gui::InputField")
value1.setText(self.FORMAT % self.Width)
lay1.addWidget(value1)

lay2 = QtGui.QHBoxLayout()
lay0.addLayout(lay2)
label2 = QtGui.QLabel(translate("Arch","Height").decode("utf8"))
lay2.addWidget(label2)
value2 = QtGui.QDoubleSpinBox()
value2.setDecimals(d)
value2.setValue(self.Height)
value2 = ui.createWidget("Gui::InputField")
value2.setText(self.FORMAT % self.Height)
lay2.addWidget(value2)

lay3 = QtGui.QHBoxLayout()
Expand All @@ -306,12 +305,19 @@ def taskbox(self):
value3.setCurrentIndex(items.index(self.Align))
lay3.addWidget(value3)

value4 = QtGui.QCheckBox(translate("Arch","Con&tinue").decode("utf8"))
lay4 = QtGui.QHBoxLayout()
lay0.addLayout(lay4)
label4 = QtGui.QLabel(translate("Arch","Con&tinue").decode("utf8"))
lay4.addWidget(label4)
value4 = QtGui.QCheckBox()
value4.setObjectName("ContinueCmd")
lay0.addWidget(value4)
value4.setLayoutDirection(QtCore.Qt.RightToLeft)
label4.setBuddy(value4)
lay4.addWidget(value4)
if hasattr(FreeCADGui,"draftToolBar"):
value4.setChecked(FreeCADGui.draftToolBar.continueMode)
self.continueCmd = FreeCADGui.draftToolBar.continueMode

QtCore.QObject.connect(value1,QtCore.SIGNAL("valueChanged(double)"),self.setWidth)
QtCore.QObject.connect(value2,QtCore.SIGNAL("valueChanged(double)"),self.setHeight)
QtCore.QObject.connect(value3,QtCore.SIGNAL("currentIndexChanged(int)"),self.setAlign)
Expand Down

0 comments on commit 10a4fc0

Please sign in to comment.