def test_update_and_set_facility(self): self.assertFalse("TEST" in config.getFacilityNames()) ConfigService.updateFacilities( os.path.join(ConfigService.getInstrumentDirectory(), "IDFs_for_UNIT_TESTING/UnitTestFacilities.xml") ) ConfigService.setFacility("TEST") self.assertEquals(config.getFacility().name(), "TEST") self.assertRaises(RuntimeError, config.getFacility, "SNS")
def test_update_and_set_facility(self): self.assertFalse("TEST" in config.getFacilityNames()) ConfigService.updateFacilities( os.path.join(ConfigService.getInstrumentDirectory(), "IDFs_for_UNIT_TESTING/UnitTestFacilities.xml")) ConfigService.setFacility("TEST") self.assertEquals(config.getFacility().name(), "TEST") self.assertRaises(RuntimeError, config.getFacility, "SNS")
def action_facility_changed(self, new_facility): """ When the facility is changed, refreshes all available instruments that can be selected in the dropdown. :param new_facility: The name of the new facility that was selected """ ConfigService.setFacility(new_facility) # refresh the instrument selection to contain instruments about the selected facility only self.view.instrument.clear() self.view.instrument.addItems( [instr.name() for instr in ConfigService.getFacility(new_facility).instruments()])
def action_facility_changed(self, new_facility): """ When the facility is changed, refreshes all available instruments that can be selected in the dropdown. :param new_facility: The name of the new facility that was selected """ current_value = ConfigService.getFacility().name() if new_facility != current_value: ConfigService.setFacility(new_facility) # refresh the instrument selection to contain instruments about the selected facility only self.view.instrument.facility = new_facility if new_facility != current_value: self.view.instrument.setCurrentIndex(0)
def action_facility_changed(self, new_facility): """ When the facility is changed, refreshes all available instruments that can be selected in the dropdown. :param new_facility: The name of the new facility that was selected """ current_value = ConfigService.getFacility().name() if new_facility != current_value: ConfigService.setFacility(new_facility) # refresh the instrument selection to contain instruments about the selected facility only self.view.cbInstrument.clear() self.view.cbInstrument.addItems( [instr.name() for instr in ConfigService.getFacility(new_facility).instruments()])
def store_facility(self, new_facility): current_value = ConfigService.getFacility().name() if new_facility != current_value: ConfigService.setFacility(new_facility) return True return False
def store_facility(self, new_facility): current_facility = self._get_current_facility() if new_facility != current_facility: ConfigService.setFacility(new_facility) return True return False