(self, parent=None, *, file_path=None)
| 27 | |
| 28 | class DialogSaveCalibration(QDialog): |
| 29 | def __init__(self, parent=None, *, file_path=None): |
| 30 | super().__init__(parent) |
| 31 | |
| 32 | self.__file_path = "" |
| 33 | self.__distance_to_sample = 0.0 |
| 34 | self.__overwrite_existing = False |
| 35 | self.__preview = ("", {}) # str - information, dict - warnings |
| 36 | |
| 37 | self.setWindowTitle("Save Quantitative Calibration") |
| 38 | self.setMinimumHeight(600) |
| 39 | self.setMinimumWidth(600) |
| 40 | self.resize(600, 600) |
| 41 | |
| 42 | self.text_edit = QTextEdit() |
| 43 | set_tooltip( |
| 44 | self.text_edit, |
| 45 | "Preview the <b>quantitative calibration data</b> to be saved. The displayed " |
| 46 | "warnings will not be saved, but need to be addressed in order to keep " |
| 47 | "data integrity. The parameter <b>distance-to-sample</b> is optional, " |
| 48 | "but desirable. If <b>distance-to-sample</b> is zero then no scaling will be " |
| 49 | "applied to data to compensate for changing distance.", |
| 50 | ) |
| 51 | self.text_edit.setReadOnly(True) |
| 52 | |
| 53 | self.le_file_path = LineEditReadOnly() |
| 54 | set_tooltip( |
| 55 | self.le_file_path, |
| 56 | "Full path to the file used to <b>save the calibration data</b>. The path " |
| 57 | "can be changed in file selection dialog box.", |
| 58 | ) |
| 59 | self.pb_file_path = PushButtonMinimumWidth("..") |
| 60 | set_tooltip(self.pb_file_path, "Change <b>file path</b> for saving the calibration data.") |
| 61 | self.pb_file_path.clicked.connect(self.pb_file_path_clicked) |
| 62 | self.pb_file_path.setDefault(False) |
| 63 | self.pb_file_path.setAutoDefault(False) |
| 64 | |
| 65 | self.le_distance_to_sample = LineEditExtended() |
| 66 | self.le_distance_to_sample.textChanged.connect(self.le_distance_to_sample_text_changed) |
| 67 | self.le_distance_to_sample.editingFinished.connect(self.le_distance_to_sample_editing_finished) |
| 68 | self._le_distance_to_sample_validator = DoubleValidatorStrict() |
| 69 | self._le_distance_to_sample_validator.setBottom(0.0) |
| 70 | set_tooltip( |
| 71 | self.le_distance_to_sample, |
| 72 | "<b>Distance</b> between the detector and the sample during calibration. If the value " |
| 73 | "is 0, then no scaling is applied to data to correct the data if distance-to-sample " |
| 74 | "is changed between calibration and measurement.", |
| 75 | ) |
| 76 | |
| 77 | self.cb_overwrite = QCheckBox("Overwrite Existing") |
| 78 | self.cb_overwrite.stateChanged.connect(self.cb_overwrite_state_changed) |
| 79 | set_tooltip( |
| 80 | self.cb_overwrite, |
| 81 | "Overwrite the <b>existing</b> file. This is a safety feature implemented to protect " |
| 82 | "valuable results from accidental deletion.", |
| 83 | ) |
| 84 | |
| 85 | vbox = QVBoxLayout() |
| 86 |
nothing calls this directly
no test coverage detected