Skip to content

Commit efa9448

Browse files
committed
Fix to allow qgis_process to function correctly
1 parent bd952b8 commit efa9448

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PLUGINNAME = datetimetools
22
PLUGINS = "$(HOME)"/AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins/$(PLUGINNAME)
3-
PY_FILES = datetimetools.py __init__.py conversionDialog.py copyTimezoneTool.py captureCoordinate.py jdcal.py util.py wintz.py settings.py provider.py addtimezone.py copyModeSettings.py addastronomical.py
3+
PY_FILES = __init__.py addastronomical.py addtimezone.py captureCoordinate.py conversionDialog.py copyModeSettings.py copyTimezoneTool.py datetimetoolsprocessing.py datetimetools.py jdcal.py provider.py settings.py util.py wintz.py
44
EXTRAS = metadata.txt icon.png
55

66
deploy:

__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
def classFactory(iface):
2-
from .datetimetools import DateTimeTools
3-
return DateTimeTools(iface)
2+
if iface:
3+
from .datetimetools import DateTimeTools
4+
return DateTimeTools(iface)
5+
else:
6+
# This is used when the plugin is loaded from the command line command qgis_process
7+
from .datetimetoolsprocessing import DateTimeTools
8+
return DateTimeTools()

datetimetoolsprocessing.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
from qgis.core import QgsApplication
3+
4+
try:
5+
from timezonefinder import TimezoneFinder
6+
from astral.sun import sun
7+
import reverse_geocoder
8+
from .provider import DateTimeToolsProvider
9+
libraries_found = True
10+
except Exception:
11+
libraries_found = False
12+
13+
class DateTimeTools(object):
14+
def __init__(self):
15+
self.provider = None
16+
17+
def initProcessing(self):
18+
if libraries_found:
19+
self.provider = DateTimeToolsProvider()
20+
QgsApplication.processingRegistry().addProvider(self.provider)
21+
22+
def initGui(self):
23+
self.initProcessing()
24+
25+
def unload(self):
26+
if libraries_found:
27+
QgsApplication.processingRegistry().removeProvider(self.provider)
28+

metadata.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name=Date/Time Tools
33
qgisMinimumVersion=3.14
44
description=Tools to display and convert date, time, time zone, UNIX time (Epoch), Julian date, ISO8601, date differences, times and positions of the sun. (Note Python library dependencies.)
5-
version=3.0.9
5+
version=3.0.10
66
author=C Hamilton
77
88
about=
@@ -17,7 +17,9 @@ category=Plugins
1717
icon=icon.png
1818
experimental=False
1919
deprecated=False
20+
hasProcessingProvider=yes
2021
changelog=
22+
3.0.10 - Fix to allow qgis_process to function correctly.
2123
3.0.9 - Changed Python dependencies missing message.
2224
3.0.8 - No longer distributing the Python dependencies as a part of the plugin.
2325
3.0.7 - Add as dock widget

0 commit comments

Comments
 (0)