-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path__init__.py
47 lines (39 loc) · 1.32 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import logging
import os
import sys
log = logging.getLogger('legger')
log.setLevel(logging.DEBUG)
sys.path.append(
os.path.join(os.path.dirname(os.path.realpath(__file__)), 'external')
)
tdi_external = os.path.join(os.path.dirname(os.path.realpath(__file__)),
os.path.pardir,
'ThreeDiToolbox',
'external')
try:
# temporary fix of libary geoalchemy2 in ThreeDiToolbox
geoalchemy_fix_file = os.path.join(tdi_external, 'geoalchemy2', '__init__.py')
f = open(geoalchemy_fix_file, 'r')
new_content = f.read().replace(
"""
bind.execute("VACUUM %s" % table.name)""",
"""
try:
bind.execute("VACUUM %s"%table.name)
except:
pass
""")
f.close()
f = open(geoalchemy_fix_file, 'w')
f.write(new_content)
f.close()
except:
log.warn('patch geoalchemy does not work')
sys.path.append(tdi_external)
# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
"""Load main tool class
:param iface: QgsInterface. A QGIS interface instance.
"""
from .qgistools_plugin import Legger
return Legger(iface)