def test_set_setting_with_int(self): set_setting(GROUP, PREFIX, "something", 10) settings = QSettings() settings.beginGroup(GROUP) returned = settings.value(PREFIX + "something", type=int) settings.endGroup() self.assertEqual(returned, 10)
def test_set_setting_with_bool_true(self): set_setting(GROUP, PREFIX, "something", True) settings = QSettings() settings.beginGroup("CustomInterfaces") returned = settings.value("EngineeringDiffraction2/" + "something", type=bool) settings.endGroup() self.assertEqual(returned, True)
def test_set_setting_with_string(self): set_setting(GROUP, PREFIX, "something", "value") settings = QSettings() settings.beginGroup(GROUP) returned = settings.value(PREFIX + "something") settings.endGroup() self.assertEqual(returned, "value")
def on_focus_clicked(self): if not self._validate(): return regions_dict = self.current_calibration.create_focus_roi_dictionary() focus_paths = self.view.get_focus_filenames() van_path = self.view.get_vanadium_filename() if self._number_of_files_warning(focus_paths): self.start_focus_worker(focus_paths, van_path, self.view.get_plot_output(), self.rb_num, regions_dict) van_run = self.view.get_vanadium_run() set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, "last_vanadium_run", van_run)
def generate_prm_output_file(difa_list, difc_list, tzero_list, bank_name, kwargs_to_pass): file_path = calibration_dir + EnggUtils.generate_output_file_name( ceria_path, instrument, bank=bank_name) EnggUtils.write_ENGINX_GSAS_iparam_file(file_path, difa_list, difc_list, tzero_list, bk2bk_params, **kwargs_to_pass) set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, "last_calibration_path", file_path)
def on_calibrate_clicked(self): plot_output = self.view.get_plot_output() if self.view.get_new_checked() and self._validate(): sample_file = self.view.get_sample_filename() if self.view.get_crop_checked(): self.start_cropped_calibration_worker(sample_file, plot_output, self.rb_num) else: self.start_calibration_worker(sample_file,plot_output, self.rb_num) elif self.view.get_load_checked(): if not self.validate_path(): logger.notice("Invalid calibration path") return filename = self.view.get_path_filename() try: instrument, sample_file, grp_ws_name, roi_text, banks = \ self.model.load_existing_calibration_files(filename) except: return self.pending_calibration.set_calibration(sample_file, instrument) self.pending_calibration.set_roi_info_load(banks, grp_ws_name, roi_text) self.set_current_calibration() set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, "last_calibration_path", filename)
def set_setting(name, value): set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, name, value)
def _notify_updated_calibration(self): self.calibration_notifier.notify_subscribers(self.current_calibration) set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, "last_calibration_path", self.current_calibration.get_prm_filepath())