planetfederal / qgis-geogiglight-plugin

GNU General Public License v2.0
19 stars 9 forks source link

python error when adding a new tiled layer #110

Closed gioman closed 6 years ago

gioman commented 7 years ago

strange thing:

new empty project, gg plugin installed, added a layer from "quick map services" plugin

AttributeError: 'TileLayer' object has no attribute 'split' 
Traceback (most recent call last):
  File "/home/giovanni/.qgis2/python/plugins/geogig/plugin.py", line 56, in trackLayer
    if isRepoLayer(layer):
  File "/home/giovanni/.qgis2/python/plugins/geogig/tools/layertracking.py", line 119, in isRepoLayer
    return getTrackingInfo(layer) is not None
  File "/home/giovanni/.qgis2/python/plugins/geogig/tools/layertracking.py", line 122, in getTrackingInfo
    source = formatSource(layer)
  File "/home/giovanni/.qgis2/python/plugins/geogig/tools/layers.py", line 116, in formatSource
    ext = source.split(".")[-1].lower()
AttributeError: 'TileLayer' object has no attribute 'split'
volaya commented 7 years ago

Please, stop trolling my plugins doing weird things like that :-P

It's an easy fix. There is a method that tries to track layers when they are loaded, and I didn't consider the case of it being a TileLayer

gioman commented 6 years ago

In the latest DEV version in the same scenario now the error is

AttributeError: 'TileLayer' object has no attribute 'replace' 
Traceback (most recent call last):
  File "C:/Users/gio/.qgis2/python/plugins\geogig\plugin.py", line 59, in trackLayer
    if isRepoLayer(layer):
  File "C:/Users/gio/.qgis2/python/plugins\geogig\tools\layertracking.py", line 121, in isRepoLayer
    return getTrackingInfo(layer) is not None
  File "C:/Users/gio/.qgis2/python/plugins\geogig\tools\layertracking.py", line 124, in getTrackingInfo
    source = formatSource(layer)
  File "C:/Users/gio/.qgis2/python/plugins\geogig\tools\layers.py", line 90, in formatSource
    source = os.path.normcase(source)
  File "C:\OSGEO4~1\apps\Python27\lib\ntpath.py", line 46, in normcase
    return s.replace("/", "\\").lower()
AttributeError: 'TileLayer' object has no attribute 'replace'