def createEditor(self, parent, option, index):
editor = QSpinBox(parent)
editor.setMinimum(0)
editor.setMaximum(100)
return editor
python类QSpinBox()的实例源码
def setupUi(self, SettingsDialog):
SettingsDialog.setObjectName("SettingsDialog")
SettingsDialog.resize(459, 141)
self.gridLayout_2 = QtWidgets.QGridLayout(SettingsDialog)
self.gridLayout_2.setObjectName("gridLayout_2")
self.comboBox = QtWidgets.QComboBox(SettingsDialog)
self.comboBox.setObjectName("comboBox")
self.gridLayout_2.addWidget(self.comboBox, 0, 1, 1, 1)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setContentsMargins(0, -1, -1, -1)
self.gridLayout.setObjectName("gridLayout")
self.label = QtWidgets.QLabel(SettingsDialog)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(SettingsDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout_2.addWidget(self.buttonBox, 2, 0, 1, 2)
self.label_2 = QtWidgets.QLabel(SettingsDialog)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1)
self.spinBox = QtWidgets.QSpinBox(SettingsDialog)
self.spinBox.setObjectName("spinBox")
self.gridLayout_2.addWidget(self.spinBox, 1, 1, 1, 1)
self.retranslateUi(SettingsDialog)
self.buttonBox.accepted.connect(SettingsDialog.accept)
self.buttonBox.rejected.connect(SettingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
def createEditor(self, parent, option, index):
editor = QSpinBox(parent)
editor.setMinimum(0)
editor.setMaximum(100)
return editor
def __init__(self):
super().__init__()
self.setFrameShape(QtWidgets.QFrame.Box)
self.setFrameShadow(QtWidgets.QFrame.Sunken)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self)
self.horizontalLayout_3.setContentsMargins(3, 0, 3, 0)
self.horizontalLayout_3.setSpacing(0)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.upbeatSpinBox = QtWidgets.QSpinBox(self)
self.upbeatSpinBox.setPrefix("")
self.upbeatSpinBox.setMinimum(0)
self.upbeatSpinBox.setMaximum(999999999)
self.upbeatSpinBox.setObjectName("upbeatSpinBox")
self.horizontalLayout_3.addWidget(self.upbeatSpinBox)
self.callTickWidget = QtWidgets.QPushButton(self)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.callTickWidget.sizePolicy().hasHeightForWidth())
self.callTickWidget.setSizePolicy(sizePolicy)
self.callTickWidget.setMaximumSize(QtCore.QSize(25, 16777215))
self.callTickWidget.setFlat(False)
self.callTickWidget.setObjectName("callTickWidget")
self.callTickWidget.setText("?? ")
self.horizontalLayout_3.addWidget(self.callTickWidget)
self.callTickWidget.clicked.connect(self.callClickWidgetForUpbeat)
self.setFocusPolicy(0) #no focus
self.callTickWidget.setFocusPolicy(0) #no focus
self.valueChanged = self.upbeatSpinBox.valueChanged
def __init__(self, mainWindow, staticExportTempoItem = None):
super().__init__(mainWindow, "choose units per minute, reference note, graph type")
self.mainWindow = mainWindow
self.staticExportTempoItem = staticExportTempoItem
tickindex, unitsPerMinute, referenceTicks, graphType = self.getCurrentValues() #takes self.staticExportTempoItem into account
self.unitbox = QtWidgets.QSpinBox()
self.unitbox.setMinimum(1)
self.unitbox.setMaximum(999)
self.unitbox.setValue(unitsPerMinute)
self.layout.addWidget(self.unitbox)
self.referenceList = QtWidgets.QComboBox()
self.referenceList.addItems(constantsAndConfigs.prettyExtendedRhythmsStrings)
self.referenceList.setCurrentIndex(constantsAndConfigs.prettyExtendedRhythmsValues.index(referenceTicks))
self.layout.addWidget(self.referenceList)
self.interpolationList = QtWidgets.QComboBox()
l = api.getListOfGraphInterpolationTypesAsStrings()
self.interpolationList.addItems(l)
self.interpolationList.setCurrentIndex(l.index(graphType))
self.layout.addWidget(self.interpolationList)
self.__call__()
def makeValueWidget(self, value):
types = {
str : QtWidgets.QLineEdit,
int : QtWidgets.QSpinBox,
float : QtWidgets.QDoubleSpinBox,
}
typ = type(value)
widget = types[typ]()
if typ == str:
widget.setText(value)
elif typ == int or typ == float:
widget.setValue(value)
return widget
def __init__(self, mainWindow):
super().__init__(mainWindow, "Channel Change 0-15. [enter] to use value")
self.spinbox = QtWidgets.QSpinBox()
self.spinbox.setValue(type(self).lastCustomValue)
self.spinbox.setMinimum(0)
self.spinbox.setMaximum(15)
self.spinbox.setSingleStep(1)
self.layout.addRow("Channel", self.spinbox)
self.name = QtWidgets.QLineEdit()
self.layout.addRow("Text", self.name)
def createEditor(self, parent, styleOption, index):
if index.column() == 0:
editor = QLineEdit(parent)
editor.setReadOnly(True)
return editor
editor = QSpinBox(parent)
return editor
def setEditorData(self, editor, index):
if isinstance(editor, QLineEdit):
editor.setText(index.model().data(index, Qt.DisplayRole))
elif isinstance(editor, QSpinBox):
value = int(index.model().data(index, Qt.EditRole))
editor.setValue(value)
def setModelData(self, editor, model, index):
if isinstance(editor, QLineEdit):
model.setData(index, editor.text())
elif isinstance(editor, QSpinBox):
model.setData(index, editor.value())
def __init__(self, parent):
super().__init__('Font', parent)
self.font_name_edit = QtWidgets.QComboBox(
self,
editable=False,
sizePolicy=QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Expanding,
QtWidgets.QSizePolicy.Preferred),
insertPolicy=QtWidgets.QComboBox.NoInsert)
self.font_size_edit = QtWidgets.QSpinBox(self, minimum=0)
self.bold_checkbox = QtWidgets.QCheckBox('Bold', self)
self.italic_checkbox = QtWidgets.QCheckBox('Italic', self)
self.underline_checkbox = QtWidgets.QCheckBox('Underline', self)
self.strike_out_checkbox = QtWidgets.QCheckBox('Strike-out', self)
all_fonts = QtGui.QFontDatabase().families()
self.font_name_edit.addItems(all_fonts)
layout = QtWidgets.QGridLayout(self)
layout.setColumnStretch(0, 1)
layout.setColumnStretch(1, 2)
layout.addWidget(QtWidgets.QLabel('Name:', self), 0, 0)
layout.addWidget(self.font_name_edit, 0, 1)
layout.addWidget(QtWidgets.QLabel('Size:', self), 1, 0)
layout.addWidget(self.font_size_edit, 1, 1)
layout.addWidget(QtWidgets.QLabel('Style:', self), 2, 0)
layout.addWidget(self.bold_checkbox, 2, 1)
layout.addWidget(self.italic_checkbox, 3, 1)
layout.addWidget(self.underline_checkbox, 4, 1)
layout.addWidget(self.strike_out_checkbox, 5, 1)
def __init__(self, parent=None):
super().__init__(parent)
self.start_time_edit = bubblesub.ui.util.TimeEdit(self)
self.end_time_edit = bubblesub.ui.util.TimeEdit(self)
self.duration_edit = bubblesub.ui.util.TimeEdit(self)
self.margins_widget = QtWidgets.QWidget(self)
self.margin_l_edit = QtWidgets.QSpinBox(
self.margins_widget, minimum=0, maximum=999)
self.margin_v_edit = QtWidgets.QSpinBox(
self.margins_widget, minimum=0, maximum=999)
self.margin_r_edit = QtWidgets.QSpinBox(
self.margins_widget, minimum=0, maximum=999)
layout = QtWidgets.QHBoxLayout(self.margins_widget, spacing=0)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.margin_l_edit)
layout.addWidget(self.margin_v_edit)
layout.addWidget(self.margin_r_edit)
self.layer_edit = QtWidgets.QSpinBox(self, minimum=0)
layout = QtWidgets.QHBoxLayout(self)
layout.setSpacing(12)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(QtWidgets.QLabel('Start time:', self))
layout.addWidget(self.start_time_edit)
layout.addWidget(QtWidgets.QLabel('End time:', self))
layout.addWidget(self.end_time_edit)
layout.addWidget(QtWidgets.QLabel('Duration:', self))
layout.addWidget(self.duration_edit)
layout.addStretch()
layout.addWidget(QtWidgets.QLabel('Margins:', self))
layout.addWidget(self.margins_widget)
layout.addWidget(QtWidgets.QLabel('Layer:', self))
layout.addWidget(self.layer_edit)
def setUp(self, ui):
super().setUp(ui)
self.spinbox = QSpinBox(self)
self.spinbox.setSingleStep(self.parameter.step)
if self.parameter.range is not None:
min_, max_ = self.parameter.range
self.spinbox.setMinimum(min_)
self.spinbox.setMaximum(max_)
self.spinbox.setValue(self.value)
self.spinbox.valueChanged.connect(self.on_spinbox_valueChanged)
self.layout.addWidget(self.spinbox)
def setupUi(self, Form):
Form.setObjectName("Form")
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupbox = QtWidgets.QGroupBox(Form)
self.groupbox.setObjectName("groupbox")
self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox)
self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_2.setObjectName("formLayout_2")
self.orderLabel = QtWidgets.QLabel(self.groupbox)
self.orderLabel.setObjectName("orderLabel")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.orderLabel)
self.orderSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.orderSpinBox.setObjectName("orderSpinBox")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.orderSpinBox)
self.numOfStandardDeviationsLabel = QtWidgets.QLabel(self.groupbox)
self.numOfStandardDeviationsLabel.setObjectName("numOfStandardDeviationsLabel")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.numOfStandardDeviationsLabel)
self.numOfStandardDeviationsSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.numOfStandardDeviationsSpinBox.setObjectName("numOfStandardDeviationsSpinBox")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.numOfStandardDeviationsSpinBox)
self.maxNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox)
self.maxNumOfIterationsLabel.setObjectName("maxNumOfIterationsLabel")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.maxNumOfIterationsLabel)
self.maxNumOfIterationsSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.maxNumOfIterationsSpinBox.setObjectName("maxNumOfIterationsSpinBox")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.maxNumOfIterationsSpinBox)
self.verticalLayout.addWidget(self.groupbox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form):
Form.setObjectName("Form")
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupbox = QtWidgets.QGroupBox(Form)
self.groupbox.setObjectName("groupbox")
self.formLayout = QtWidgets.QFormLayout(self.groupbox)
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName("formLayout")
self.asymmetryLabel = QtWidgets.QLabel(self.groupbox)
self.asymmetryLabel.setObjectName("asymmetryLabel")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.asymmetryLabel)
self.asymmetryDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox)
self.asymmetryDoubleSpinBox.setObjectName("asymmetryDoubleSpinBox")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.asymmetryDoubleSpinBox)
self.smoothnessLabel = QtWidgets.QLabel(self.groupbox)
self.smoothnessLabel.setObjectName("smoothnessLabel")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.smoothnessLabel)
self.smoothnessDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox)
self.smoothnessDoubleSpinBox.setObjectName("smoothnessDoubleSpinBox")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.smoothnessDoubleSpinBox)
self.maxNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox)
self.maxNumOfIterationsLabel.setObjectName("maxNumOfIterationsLabel")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.maxNumOfIterationsLabel)
self.maxNumOfIterationsSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.maxNumOfIterationsSpinBox.setObjectName("maxNumOfIterationsSpinBox")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.maxNumOfIterationsSpinBox)
self.convergenceThresholdLabel = QtWidgets.QLabel(self.groupbox)
self.convergenceThresholdLabel.setObjectName("convergenceThresholdLabel")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.convergenceThresholdLabel)
self.convergenceThresholdDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox)
self.convergenceThresholdDoubleSpinBox.setObjectName("convergenceThresholdDoubleSpinBox")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.convergenceThresholdDoubleSpinBox)
self.verticalLayout.addWidget(self.groupbox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
outliers_IsolationForest.py 文件源码
项目:PySAT_Point_Spectra_GUI
作者: USGS-Astrogeology
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def setupUi(self, Form):
Form.setObjectName("Form")
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupBox = QtWidgets.QGroupBox(Form)
self.groupBox.setObjectName("groupBox")
self.formLayout = QtWidgets.QFormLayout(self.groupBox)
self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout.setObjectName("formLayout")
self.n_est_label = QtWidgets.QLabel(self.groupBox)
self.n_est_label.setObjectName("n_est_label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.n_est_label)
self.n_est_spin = QtWidgets.QSpinBox(self.groupBox)
self.n_est_spin.setObjectName("n_est_spin")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.n_est_spin)
self.prop_outliers_label = QtWidgets.QLabel(self.groupBox)
self.prop_outliers_label.setToolTip("")
self.prop_outliers_label.setObjectName("prop_outliers_label")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.prop_outliers_label)
self.prop_outliers_spin = QtWidgets.QDoubleSpinBox(self.groupBox)
self.prop_outliers_spin.setDecimals(4)
self.prop_outliers_spin.setMaximum(0.5)
self.prop_outliers_spin.setObjectName("prop_outliers_spin")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.prop_outliers_spin)
self.verticalLayout.addWidget(self.groupBox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form):
Form.setObjectName("Form")
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupbox = QtWidgets.QGroupBox(Form)
self.groupbox.setObjectName("groupbox")
self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox)
self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_2.setObjectName("formLayout_2")
self.polynomialOrderLabel = QtWidgets.QLabel(self.groupbox)
self.polynomialOrderLabel.setObjectName("polynomialOrderLabel")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.polynomialOrderLabel)
self.polynomialOrderSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.polynomialOrderSpinBox.setObjectName("polynomialOrderSpinBox")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.polynomialOrderSpinBox)
self.maximumNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox)
self.maximumNumOfIterationsLabel.setObjectName("maximumNumOfIterationsLabel")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.maximumNumOfIterationsLabel)
self.maximumNumOfIterationsDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox)
self.maximumNumOfIterationsDoubleSpinBox.setObjectName("maximumNumOfIterationsDoubleSpinBox")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.maximumNumOfIterationsDoubleSpinBox)
self.toleranceLabel = QtWidgets.QLabel(self.groupbox)
self.toleranceLabel.setObjectName("toleranceLabel")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.toleranceLabel)
self.toleranceDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox)
self.toleranceDoubleSpinBox.setObjectName("toleranceDoubleSpinBox")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.toleranceDoubleSpinBox)
self.verticalLayout.addWidget(self.groupbox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form):
Form.setObjectName("Form")
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setObjectName("verticalLayout")
self.groupbox = QtWidgets.QGroupBox(Form)
self.groupbox.setObjectName("groupbox")
self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox)
self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_2.setObjectName("formLayout_2")
self.topWidthLabel = QtWidgets.QLabel(self.groupbox)
self.topWidthLabel.setObjectName("topWidthLabel")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.topWidthLabel)
self.topWidthSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.topWidthSpinBox.setObjectName("topWidthSpinBox")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.topWidthSpinBox)
self.bottomWidthLabel = QtWidgets.QLabel(self.groupbox)
self.bottomWidthLabel.setObjectName("bottomWidthLabel")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.bottomWidthLabel)
self.bottomWidthSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.bottomWidthSpinBox.setObjectName("bottomWidthSpinBox")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.bottomWidthSpinBox)
self.exponentLabel = QtWidgets.QLabel(self.groupbox)
self.exponentLabel.setObjectName("exponentLabel")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.exponentLabel)
self.exponentSpinBox = QtWidgets.QSpinBox(self.groupbox)
self.exponentSpinBox.setObjectName("exponentSpinBox")
self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.exponentSpinBox)
self.tangentLabel = QtWidgets.QLabel(self.groupbox)
self.tangentLabel.setObjectName("tangentLabel")
self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.tangentLabel)
self.tangentCheckBox = QtWidgets.QCheckBox(self.groupbox)
self.tangentCheckBox.setObjectName("tangentCheckBox")
self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.tangentCheckBox)
self.verticalLayout.addWidget(self.groupbox)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex):
editor = QSpinBox(parent)
editor.setMinimum(self.minimum)
editor.setMaximum(self.maximum)
editor.valueChanged.connect(self.valueChanged)
return editor
def createEditor(self, parent, option, index):
editor = QSpinBox(parent)
editor.setMinimum(0)
editor.setMaximum(100)
return editor