Skip to content

Commit

Permalink
Merge pull request #173 from specklesystems/2.17
Browse files Browse the repository at this point in the history
Installer from poetry; check for mismatching versions
  • Loading branch information
KatKatKateryna authored Oct 29, 2023
2 parents 1fcd28c + 4c2884e commit 8b7e87b
Show file tree
Hide file tree
Showing 13 changed files with 2,956 additions and 1,157 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ jobs:
- checkout
- attach_workspace:
at: ./
- run:
name: Export requirements.txt
command: |
poetry export --without-hashes --without-urls --output plugin_utils/requirements.txt
- run:
name: Install dependencies
command: |
Expand All @@ -73,6 +77,7 @@ jobs:
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]+//')
VERSION=$(echo "$SEMVER" | sed -e 's/[a-zA-Z]*\///')
python patch_version.py $VERSION
python plugin_utils/patch_requirements.py
- run:
name: ZIP plugin
command: pb_tool zip
Expand Down
36 changes: 25 additions & 11 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import os
import sys

path = os.path.dirname(os.path.abspath(__file__))
if(path not in sys.path):
if path not in sys.path:
sys.path.insert(0, path)

from plugin_utils.installer import ensure_dependencies, startDegugger
from speckle.utils.panel_logging import logger

from qgis.core import Qgis


# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
"""Load SpeckleQGIS class from file SpeckleQGIS.
Expand All @@ -21,35 +24,46 @@ def classFactory(iface): # pylint: disable=invalid-name
# Set qgisInterface to enable logToUser notifications
logger.qgisInterface = iface
iface.pluginToolBar().setVisible(True)

# Ensure dependencies are installed in the machine
#from speckle.utils import enable_remote_debugging
#enable_remote_debugging()
# from speckle.utils import enable_remote_debugging
# enable_remote_debugging()
ensure_dependencies("QGIS")
startDegugger()

try:
try:
import specklepy
import shapefile
#import triangle
from urllib3.contrib import appengine

except Exception as e:
logger.logToUserWithAction("Speckle dependencies were not installed.", action_text = "More info", url = "https://github.com/specklesystems/speckle-qgis/blob/main/plugin_utils/reporting_issues.md", level = 2)
except Exception as e:
logger.logToUserWithAction(
"Speckle dependencies were not resolved.",
action_text="More info",
url="https://github.com/specklesystems/speckle-qgis/blob/main/plugin_utils/reporting_issues.md",
level=2,
)
return EmptyClass(iface)

from speckle_qgis import SpeckleQGIS
from specklepy.logging import metrics

version = Qgis.QGIS_VERSION.encode('iso-8859-1', errors='ignore').decode('utf-8').split(".")[0]

version = (
Qgis.QGIS_VERSION.encode("iso-8859-1", errors="ignore")
.decode("utf-8")
.split(".")[0]
)
metrics.set_host_app("QGIS", f"QGIS{version}")
return SpeckleQGIS(iface)


class EmptyClass:
# https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/plugins/plugins.html#mainplugin-py
def __init__(self, iface):
pass

def initGui(self):
pass

def unload(self):
pass

Empty file added plugin_utils/__init__.py
Empty file.
Loading

0 comments on commit 8b7e87b

Please sign in to comment.