def __init__(self, label, parent): super(AxisChangerView, self).__init__(parent) layout = QtWidgets.QHBoxLayout() self._label = QtWidgets.QLabel(label) self._min_label = QtWidgets.QLabel(label + " min") self.lower_bound = QtWidgets.QLineEdit() self.lower_bound.setMaxLength(MAXIMUM_BOUND_PRECISION) self.lower_bound_validator = LineEditDoubleValidator( self.lower_bound, 0.0) self.lower_bound.setValidator(self.lower_bound_validator) self.lower_bound.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.lower_bound.returnPressed.connect(self._bound_changed) self._max_label = QtWidgets.QLabel(label + " max") self.upper_bound = QtWidgets.QLineEdit() self.upper_bound.setMaxLength(MAXIMUM_BOUND_PRECISION) self.upper_bound_validator = LineEditDoubleValidator( self.upper_bound, 15.0) self.upper_bound.setValidator(self.upper_bound_validator) self.upper_bound.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) self.upper_bound.returnPressed.connect(self._bound_changed) layout.addWidget(self._min_label) layout.addWidget(self.lower_bound) layout.addWidget(self._max_label) layout.addWidget(self.upper_bound) self.setLayout(layout)
def __init__(self, parent=None): super(ImagesTabWidgetView, self).__init__(parent=parent) self.ui = load_ui(__file__, 'images_tab.ui', baseinstance=self) self._populate_colormap_combo_box() self._populate_interpolation_combo_box() self._populate_scale_combo_box() self.max_min_value_warning.setVisible(False) self.min_value_validator = LineEditDoubleValidator( self.min_value_line_edit, 0.0) self.max_value_validator = LineEditDoubleValidator( self.max_value_line_edit, 1.0) self.min_value_line_edit.setValidator(self.min_value_validator) self.max_value_line_edit.setValidator(self.max_value_validator)
def addDoubleToTable(table, value, row, col=1, minimum=0.0): number_widget = QtWidgets.QLineEdit(str(value)) validator = LineEditDoubleValidator(number_widget, float(value)) validator.setBottom(minimum) validator.setTop(sys.float_info.max) validator.setDecimals(3) number_widget.setValidator(validator) table.setCellWidget(row, col, number_widget) return number_widget, validator
def __init__(self, parent: QWidget = None): """Initializes the TFAsymmetryFittingOptionsView.""" super(TFAsymmetryFittingOptionsView, self).__init__(parent) self.setupUi(self) self.normalisation_validator = LineEditDoubleValidator( self.normalisation_line_edit, 0.0) self.normalisation_line_edit.setValidator(self.normalisation_validator)
def createEditor(self, parent, option, index): line_edit = QLineEdit(parent) validator = LineEditDoubleValidator(line_edit, float(0.0)) validator.setBottom(-sys.float_info.max) validator.setTop(sys.float_info.max) line_edit.setValidator(validator) return line_edit
def __init__(self, parent=None): super(AxesTabWidgetView, self).__init__(parent=parent) self.ui = load_ui(__file__, 'axes_tab_widget.ui', baseinstance=self) self.color_selector_widget = ColorSelector(parent=self) self.color_selector_layout.replaceWidget(self.color_selector_dummy_widget, self.color_selector_widget) self.setAttribute(Qt.WA_DeleteOnClose, True) # QTabBar cannot be created in QTDesigner # QTabWidget not suitable because we reuse controls for each axis self.axis_tab_bar = QTabBar(parent=self) self.x_tab = self.axis_tab_bar.addTab("x") self.y_tab = self.axis_tab_bar.addTab("y") self.z_tab = self.axis_tab_bar.addTab("z") self.axis_tab_bar_layout.replaceWidget(self.dummy_axis_tab_bar, self.axis_tab_bar) self.lower_limit_validator = LineEditDoubleValidator(self.lower_limit_line_edit, 0.0) self.upper_limit_validator = LineEditDoubleValidator(self.upper_limit_line_edit, 1.0) self.lower_limit_line_edit.setValidator(self.lower_limit_validator) self.upper_limit_line_edit.setValidator(self.upper_limit_validator)
def _create_validator(self): validator = LineEditDoubleValidator(self.line_edit, self.initial_value) self.line_edit.setValidator(validator) return validator