From b77a0c0f868f09c07c81bf2ce776843964748eaf Mon Sep 17 00:00:00 2001 From: martinRenou Date: Wed, 11 Sep 2024 14:11:52 +0100 Subject: [PATCH] Set Qt offscreen in jupytergis-qgis (#131) * Set Qt offscreen in jupytergis-qgis This will ease user setting up jupytergis on a server * Add comment --- .github/workflows/build.yml | 8 -------- python/jupytergis_qgis/jupytergis_qgis/qgis_loader.py | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c2b744c..e65bfd0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,10 +89,6 @@ jobs: yarn=3 qgis - - name: Set QT env var - shell: bash -l {0} - run: echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV - - name: Checkout uses: actions/checkout@v3 @@ -166,10 +162,6 @@ jobs: with: name: extension-artifacts - - name: Set QT env var - shell: bash -l {0} - run: echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV - - name: Install the extension shell: bash -l {0} run: | diff --git a/python/jupytergis_qgis/jupytergis_qgis/qgis_loader.py b/python/jupytergis_qgis/jupytergis_qgis/qgis_loader.py index 58ef5134..6d98e9c9 100644 --- a/python/jupytergis_qgis/jupytergis_qgis/qgis_loader.py +++ b/python/jupytergis_qgis/jupytergis_qgis/qgis_loader.py @@ -24,6 +24,10 @@ QgsVectorTileLayer, ) +# Prevent any Qt application and event loop to spawn when +# using the QGIS Python app +os.environ["QT_QPA_PLATFORM"] = "offscreen" + QgsApplication.setPrefixPath(sys.prefix) qgs = QgsApplication([], False)