Translations:A2plus Workbench/144/zh-hans

def initUI(self): # 对话框组件的定义 self.setMinimumSize(self.minimumSizeHint) # 将最小对话框大小设置为最小 self.setWindowTitle('Animation Dialog') # 对整个表单使用网格布局 self.mainLayout = QtGui.QGridLayout self.lineNo = 0 # first dialog grid line # 添加描述标签 DescriptionLabel = QtGui.QLabel(self) DescriptionLabel.setText("Change slider to change rotation angle") self.mainLayout.addWidget(DescriptionLabel,self.lineNo,0,1,4) # 下一个对话框网格线 self.lineNo += 1 # 添加标签；不需要“自我”前缀，因为我们不想以后更改标签 LabelMin = QtGui.QLabel(self) LabelMin.setText("Min") LabelMin.setFixedHeight(32) self.mainLayout.addWidget(LabelMin,self.lineNo,0) # 添加旋转编辑以定义滑块最小值 self.MinEdit = QtGui.QSpinBox(self) # 获取角度单位为字符串 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) # 添加滑块 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) # 添加标签 LabelMax = QtGui.QLabel(self) LabelMax.setText("Max") LabelMax.setFixedHeight(32) self.mainLayout.addWidget(LabelMax,self.lineNo,3) # 添加旋转编辑以定义滑块最大值 self.MaxEdit = QtGui.QSpinBox(self) # 获取角度单位为字符串 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) # 下一个对话框网格线 self.lineNo += 1 # 添加一个间隔 self.mainLayout.addItem(QtGui.QSpacerItem(10,10), 0, 0) # 添加标签 LabelCurrent = QtGui.QLabel(self) LabelCurrent.setText("Current angle:") LabelCurrent.setFixedHeight(32) self.mainLayout.addWidget(LabelCurrent,self.lineNo,1) # 输出当前角度 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) # 添加单位标签 LabelUnit = QtGui.QLabel(self) LabelUnit.setText("deg") LabelUnit.setFixedHeight(32) self.mainLayout.addWidget(LabelUnit,self.lineNo,3) # 关闭对话框按钮 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) # 将定义的网格布局放置到对话框中g self.setLayout(self.mainLayout) self.update