Translations:A2plus Workbench/144/it

def initUI(self): # the definition of the dialog components self.setMinimumSize(self.minimumSizeHint) # set the minimal dialog size to minimum self.setWindowTitle('Animation Dialog') # use a grid layout for the whole form self.mainLayout = QtGui.QGridLayout self.lineNo = 0 # first dialog grid line # add description label DescriptionLabel = QtGui.QLabel(self) DescriptionLabel.setText("Change slider to change rotation angle") self.mainLayout.addWidget(DescriptionLabel,self.lineNo,0,1,4) # next dialog grid line self.lineNo += 1 # add a label; there is no need for the "self." prefix because we don't want to change the label later LabelMin = QtGui.QLabel(self) LabelMin.setText("Min") LabelMin.setFixedHeight(32) self.mainLayout.addWidget(LabelMin,self.lineNo,0) # add a spin edit to define the slider minimum self.MinEdit = QtGui.QSpinBox(self) # get the angle unit as string self.MinEdit.setSuffix(" " + str(FreeCAD.Units.Quantity(1, FreeCAD.Units.Angle))[2:]) self.MinEdit.setMaximum(999) self.MinEdit.setMinimum(0) self.MinEdit.setSingleStep(10) self.MinEdit.setValue(0) self.MinEdit.setFixedHeight(32) self.MinEdit.setToolTip("Minimal angle for the slider") QtCore.QObject.connect(self.MinEdit, QtCore.SIGNAL("valueChanged(int)"), self.setMinEdit) self.mainLayout.addWidget(self.MinEdit,self.lineNo,1) # add the slider self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.slider.setRange(0, 360) self.slider.setValue(0) self.slider.setFixedHeight(32) self.slider.setToolTip("Move the slider to change the rotation angle") QtCore.QObject.connect(self.slider, QtCore.SIGNAL("sliderMoved(int)"), self.handleSliderValue) self.mainLayout.addWidget(self.slider,self.lineNo,2) # add a label LabelMax = QtGui.QLabel(self) LabelMax.setText("Max") LabelMax.setFixedHeight(32) self.mainLayout.addWidget(LabelMax,self.lineNo,3) # add a spin edit to define the slider maximum self.MaxEdit = QtGui.QSpinBox(self) # get the angle unit as string self.MaxEdit.setSuffix(" " + str(FreeCAD.Units.Quantity(1, FreeCAD.Units.Angle))[2:]) self.MaxEdit.setMaximum(999) self.MaxEdit.setMinimum(1) self.MaxEdit.setSingleStep(10) self.MaxEdit.setValue(360) self.MaxEdit.setFixedHeight(32) self.MaxEdit.setToolTip("Maximal angle for the slider") QtCore.QObject.connect(self.MaxEdit, QtCore.SIGNAL("valueChanged(int)"), self.setMaxEdit) self.mainLayout.addWidget(self.MaxEdit,self.lineNo,4) # next dialog grid line self.lineNo += 1 # add a spacer self.mainLayout.addItem(QtGui.QSpacerItem(10,10), 0, 0) # add a label LabelCurrent = QtGui.QLabel(self) LabelCurrent.setText("Current angle:") LabelCurrent.setFixedHeight(32) self.mainLayout.addWidget(LabelCurrent,self.lineNo,1) # output the current angle self.CurrentAngle = QtGui.QLineEdit(self) self.CurrentAngle.setText(str(0)) self.CurrentAngle.setFixedHeight(32) self.CurrentAngle.setToolTip("Current rotation angle") self.CurrentAngle.isReadOnly self.mainLayout.addWidget(self.CurrentAngle,self.lineNo,2) # add label for the unit LabelUnit = QtGui.QLabel(self) LabelUnit.setText("deg") LabelUnit.setFixedHeight(32) self.mainLayout.addWidget(LabelUnit,self.lineNo,3) # button to close the dialog self.Close = QtGui.QPushButton(self) self.Close.setText("Close") self.Close.setFixedHeight(32) self.Close.setToolTip("Closes the dialog") QtCore.QObject.connect(self.Close, QtCore.SIGNAL("clicked"), self.CloseClicked) self.mainLayout.addWidget(self.Close,self.lineNo,4) # place the defined grid layout to the dialog self.setLayout(self.mainLayout) self.update