def check_document_repository_before_saving_settings(self): # Check if source service is checked (active). If so, check if either status or endpoint changed. If so, # check if self._valid_document_repository is False. If so, we need to test the service and only allow to save # if such test is successful. res, msg = True, '' if self.connection_box.isChecked( ): # The user wants to have the source service enabled initial_config = QSettings().value( 'Asistente-LADM-COL/sources/use_service', DEFAULT_USE_SOURCE_SERVICE_SETTING, bool) initial_endpoint = QSettings().value( 'Asistente-LADM-COL/sources/service_endpoint', DEFAULT_ENDPOINT_SOURCE_SERVICE) # Config changed or Endpoint changed? if initial_config != self.connection_box.isChecked( ) or initial_endpoint.strip() != self.txt_service_endpoint.text( ).strip(): if not self._valid_document_repository: # A test service has not been run, so we need to do it now self.logger.debug( __name__, "The user wants to enable the source service but the 'test service' has not been run on the current URL. Testing it..." ) res_test, msg_test = self.test_service() if not res_test: res = False msg = QCoreApplication.translate( "SettingsDialog", "The source service is not valid, so it cannot be activated! Adjust such configuration before saving settings." ) return res, msg
def html_url(self): url = WebLayer3857.html_url(self) apiKey = QSettings().value("Plugin-OpenLayers/googleMapsApiKey") if apiKey is not None and bool(apiKey.strip()): url += "?key=%s" % apiKey return url