From 78462e7b628c23a84c9a978effcf88f71cb03517 Mon Sep 17 00:00:00 2001 From: signedav Date: Mon, 13 Feb 2023 16:46:15 +0100 Subject: [PATCH] Workaround to add the usabilityhub repository when a metaconfig file is passed to ili2db what usually is done when using usabilityhub. This does resolve https://github.com/opengisch/QgisModelBaker/issues/784 as workaround and can be reverted when we have a decition there. --- modelbaker/iliwrapper/ili2dbconfig.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modelbaker/iliwrapper/ili2dbconfig.py b/modelbaker/iliwrapper/ili2dbconfig.py index 6839ead..52ab2af 100644 --- a/modelbaker/iliwrapper/ili2dbconfig.py +++ b/modelbaker/iliwrapper/ili2dbconfig.py @@ -59,7 +59,7 @@ def restore(self, settings): self.debugging_enabled = settings.value("DebuggingEnabled", False, bool) self.logfile_path = settings.value("LogfilePath", "", str) - def to_ili2db_args(self, with_modeldir=True): + def to_ili2db_args(self, with_modeldir=True, with_usabilityhub_repo=False): """ Create an ili2db command line argument string from this configuration """ @@ -73,6 +73,11 @@ def to_ili2db_args(self, with_modeldir=True): ] str_model_directories = ";".join(str_model_directories) args += ["--modeldir", str_model_directories] + if with_usabilityhub_repo: + if not self.custom_model_directories_enabled: + # Workaround for https://github.com/opengisch/QgisModelBaker/issues/784. + # Can be removed when ili2db has access to the UsabILIty Hub repository. + args += ["--modeldir", "https://models.opengis.ch/"] if self.debugging_enabled and self.logfile_path: args += ["--trace"] args += ["--log", self.logfile_path] @@ -146,7 +151,9 @@ def to_ili2db_args(self): # Valid ili file, don't pass --modeldir (it can cause ili2db errors) with_modeldir = not self.ilifile - args = self.base_configuration.to_ili2db_args(with_modeldir=with_modeldir) + args = self.base_configuration.to_ili2db_args( + with_modeldir=with_modeldir, with_usabilityhub_repo=bool(self.metaconfig_id) + ) proxy = QgsNetworkAccessManager.instance().fallbackProxy() if proxy.type() == QNetworkProxy.HttpProxy: