Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing QgsMessageLog.LEVEL by Qgis.Level #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Visor_UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ def showNewImage(self, image):
self.postInformationMessageToUser("Layer '"+image[1]+"' ["+image[2]+"]retrieved")
layer = image[0]
if layer and layer.isValid():
QgsMapLayerRegistry.instance().addMapLayer(layer)
QgsProject.instance().addMapLayer(layer)
iface.zoomToActiveLayer()
iface.legendInterface().refreshLayerSymbology(layer)
iface.layerTreeView().refreshLayerSymbology(layer.id())
else:
self.postInformationMessageToUser("There was a problem loading the layer.")

Expand Down
2 changes: 1 addition & 1 deletion libvisor/ThreddsMapperGeneric.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def fetchAvailableDatasets(self, depth = -1):
page = urllib.request.urlopen(self.threddsMainCatalog+r'/'+self.threddsCatalogFileName,
timeout=self.NetworkRequestTimeout)
except (HTTPException, URLError, ValueError) as e:
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )
raise e

string = page.read()
Expand Down
20 changes: 10 additions & 10 deletions libvisor/VisorController.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _loadServerDatasets(self, threddsServerInfoObj, depth=0):
self.serverDataService.hide()
except (HTTPException, URLError, ValueError, timeout):
self.errorMessage.emit("Error fetching datasets: Server unreachable")
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )

def asyncQueryDataset(self, depth=0):
"""Will request an asynchronous update of the underlying
Expand All @@ -107,14 +107,14 @@ def asyncQueryDataset(self, depth=0):
threading.Thread(target = self._fetchDatasetList, args=(depth,)).start()
except (HTTPException, URLError, ValueError, timeout):
self.errorMessage.emit("Error fetching datasets: Server unreachable or corrupt data found.")
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )

def _fetchDatasetList(self, depth):
try:
self.InfoService.fetchAvailableDatasets(depth)
except (HTTPException, URLError, ValueError, timeout) as e:
self.errorMessage.emit("Error fetching datasets: URL not found")
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )

@pyqtSlot(list, str)
def _onNewDataSetListRetrieved(self, dataSetList, serverName):
Expand Down Expand Up @@ -157,7 +157,7 @@ def mapDataSet(self, dataSetObject, depth=-1):
self.threddsDataSetUpdated.emit(dataSetObject)
except (HTTPException, URLError, ValueError, timeout):
self.errorMessage.emit("Error fetching datasets: Server unreachable")
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )

def getMapObject(self, mapName, parentSetName, projectDataSet):
"""Will take the requested map name (mapName), the map parent sub set
Expand Down Expand Up @@ -212,7 +212,7 @@ def getMapObject(self, mapName, parentSetName, projectDataSet):
#print("emitting from controller... "+str(mapInfoList.values()[0]))
self.mapInfoRetrieved.emit(list(mapInfoList.values())[0])
except IndexError:
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )
return None


Expand Down Expand Up @@ -244,7 +244,7 @@ def getWMSMapInfo(self, mapObject):
def notAuthorized(self):
notAuth = NotAuthorized.NotAuthorized()
if notAuth.exec_() == QtWidgets.QDialog.Accepted:
QgsMessageLog.logMessage(traceback.format_exc(), "Protected dataset, not authorized", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "Protected dataset, not authorized", Qgis.Critical )
self.standardMessage.emit("Protected dataset, not authorized")


Expand All @@ -263,8 +263,8 @@ def _retrieveWMSMapImage(self, threddsMapObject, layerName, styleName, timeReque
lectorWMS = WMS.WMSparser(threddsMapObject.getWMS())
lectorWMS.createMapLayer(layerName,styleName,boundingBox, timeRequested)
resultImage = (lectorWMS.getLastCreatedMapLayer(),layerName,"WMS")
QgsMessageLog.logMessage("WMS Layer Name: " + layerName, "THREDDS Explorer", QgsMessageLog.INFO )
QgsMessageLog.logMessage("WMS timeRequested: " + timeRequested, "THREDDS Explorer", QgsMessageLog.INFO )
QgsMessageLog.logMessage("WMS Layer Name: " + layerName, "THREDDS Explorer", Qgis.Info )
QgsMessageLog.logMessage("WMS timeRequested: " + timeRequested, "THREDDS Explorer", Qgis.Info )
self.mapImageRetrieved.emit(resultImage)

def asyncFetchWMSImageFile(self, threddsMapObject, layerName, styleName, timeRangeRequested, boundingBox):
Expand Down Expand Up @@ -365,7 +365,7 @@ def _retrieveWCSMapImage(self, threddsMapObject, coverageName, timeRequested, bb
msg = "WCS capabilities URL: {img}\n".format(img=imageurl)
msg += "WCS timeRequested: {tr}\n".format(tr=timeRequested)
msg += "WCS coverage: {cn}".format(cn=coverageName)
QgsMessageLog.logMessage(msg, "THREDDS Explorer", QgsMessageLog.INFO)
QgsMessageLog.logMessage(msg, "THREDDS Explorer", Qgis.Info)

resultImage = (lectorWCS.generateLayer(coverageName, timeRequested, boundingBox=bbox), coverageName, "WCS")
self.mapImageRetrieved.emit(resultImage)
Expand Down Expand Up @@ -401,7 +401,7 @@ def BatchWorkerThreadDone(self, layerDictionary, workerObject):
try:
self.batchDownloadFinished.emit(list(layerDictionary.values()), workerObject.getJobName())
except KeyError:
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )
# Might happen if a thread is cancelled in the last frame download,
# as it'll already have been queued for removal from the threadsInUse dict
pass
2 changes: 1 addition & 1 deletion libvisor/animation/AnimationController2.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def onNextFrameRequested(self):
self.pause()
self.errorSignal.emit("A layer for this animation was not found.\nWas it removed?"\
" Please, click\nagain on prepare animation to fix this issue.")
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", Qgis.Critical )
self.framesShown.append(layer)
except KeyError:
#QgsMessageLog.logMessage(traceback.format_exc(), "THREDDS Explorer", QgsMessageLog.CRITICAL )
Expand Down