def _init_create_point_form(self, point_1=None, point_2=None): # Create the dialog and signals self.dlg_create_point = GwAuxPointUi() tools_gw.load_settings(self.dlg_create_point) validator = QDoubleValidator(-99999.99, 9999999.00, 3) validator.setNotation(QDoubleValidator().StandardNotation) self.dlg_create_point.dist_x.setValidator(validator) validator = QDoubleValidator(-99999.99, 9999999.00, 3) validator.setNotation(QDoubleValidator().StandardNotation) self.dlg_create_point.dist_y.setValidator(validator) self.dlg_create_point.dist_x.setFocus() self.dlg_create_point.btn_accept.clicked.connect( partial(self._get_values, point_1, point_2)) self.dlg_create_point.btn_cancel.clicked.connect(self.cancel) if tools_gw.get_config_parser('btn_auxpoint', "rb_left", "user", "session") in ("True", True): self.dlg_create_point.rb_left.setChecked(True) elif tools_gw.get_config_parser('btn_auxpoint', "rb_right", "user", "session") in ("True", True): self.dlg_create_point.rb_right.setChecked(True) tools_gw.open_dialog(self.dlg_create_point, dlg_name='auxpoint')
def init_create_point_form(self, point_1=None, point_2=None): # Create the dialog and signals self.dlg_create_point = AuxPoint() load_settings(self.dlg_create_point, self.controller) validator = QDoubleValidator(-99999.99, 99999.999, 3) validator.setNotation(QDoubleValidator().StandardNotation) self.dlg_create_point.dist_x.setValidator(validator) validator = QDoubleValidator(-99999.99, 99999.999, 3) validator.setNotation(QDoubleValidator().StandardNotation) self.dlg_create_point.dist_y.setValidator(validator) self.dlg_create_point.dist_x.setFocus() self.dlg_create_point.btn_accept.clicked.connect( partial(self.get_values, point_1, point_2)) self.dlg_create_point.btn_cancel.clicked.connect(self.cancel) rb_left = self.controller.plugin_settings_value( self.dlg_create_point.rb_left.objectName()) if rb_left == 'true': self.dlg_create_point.rb_left.setChecked(True) else: self.dlg_create_point.rb_right.setChecked(True) open_dialog(self.dlg_create_point, self.controller, dlg_name='auxpoint', maximize_button=False)
def double_validator(widget, min_=0, max_=999999, decimals=3, notation=QDoubleValidator().StandardNotation): validator = QDoubleValidator(min_, max_, decimals) validator.setNotation(notation) widget.setValidator(validator)
def init_create_circle_form(self, point): # Create the dialog and signals self.dlg_create_circle = AuxCircle() self.load_settings(self.dlg_create_circle) self.cancel_circle = False validator = QDoubleValidator(0.00, 999.00, 3) validator.setNotation(QDoubleValidator().StandardNotation) self.dlg_create_circle.radius.setValidator(validator) self.dlg_create_circle.btn_accept.clicked.connect(partial(self.get_radius, point)) self.dlg_create_circle.btn_cancel.clicked.connect(self.cancel) self.dlg_create_circle.radius.setFocus() self.open_dialog(self.dlg_create_circle, dlg_name='auxcircle')
def double_validator(widget, min_=-9999999, max_=9999999, decimals=2, notation=QDoubleValidator().StandardNotation): """ Create and apply a validator for doubles to ensure the number is within a maximum and minimum values :param widget: Widget to apply the validator :param min_: Minimum value (int) :param max_: Maximum value (int) :param decimals: Number of decimals (int) :param notation: """ validator = QDoubleValidator(min_, max_, decimals) validator.setNotation(notation) widget.setValidator(validator)