Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,43 @@
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""

# 1. Initialize fallback immediately to shield all downstream imports
import site
import sys

user_site = site.getusersitepackages()
if user_site not in sys.path:
sys.path.append(user_site)


try:
import torch
except ImportError:
# Create the local mock right here
class MetaMock(type):
def __getattr__(cls, name):
if name == "is_available":
return lambda: False
return cls

def __call__(cls, *args, **kwargs):
return cls

class LocalMockTorch(metaclass=MetaMock):
pass

# Inject it into Python's module registry BEFORE QGIS loads any sub-files
sys.modules["torch"] = LocalMockTorch
__author__ = "Fredrik Lindberg"
__date__ = "2020-04-02"
__copyright__ = "(C) 2020 by Fredrik Lindberg"
Expand All @@ -41,7 +61,7 @@ def classFactory(iface): # pylint: disable=invalid-name
:param iface: A QGIS interface instance.
:type iface: QgsInterface
"""
#
from .processing_umep import ProcessingUMEPPlugin

# Crucial: pass the iface variable QGIS gives you right into the plugin
return ProcessingUMEPPlugin()
340 changes: 0 additions & 340 deletions functions/SEBEfiles/Perez_v3_moved.py

This file was deleted.

Loading