Skip to content
Permalink
Browse files

missing changes of QgsMapLayer::Type => QgsMapLayerType

  • Loading branch information
3nids committed Mar 26, 2019
1 parent 6068288 commit 8d51a693a19ff4ece06a7a6b4e950479f8c4454b
@@ -172,7 +172,7 @@ def exportActionSlot(self):
return

inLayer = table.toMapLayer()
if inLayer.type() != QgsMapLayer.VectorLayer:
if inLayer.type() != QgsMapLayerType.VectorLayer:
self.infoBar.pushMessage(
self.tr("Select a vector or a tabular layer you want export."),
Qgis.Warning, self.iface.messageTimeout())
@@ -56,7 +56,7 @@ def initGui(self):
self.iface.mainWindow())
self.layerAction.setObjectName("dbManagerUpdateSqlLayer")
self.layerAction.triggered.connect(self.onUpdateSqlLayer)
self.iface.addCustomActionForLayerType(self.layerAction, "", QgsMapLayer.VectorLayer, False)
self.iface.addCustomActionForLayerType(self.layerAction, "", QgsMapLayerType.VectorLayer, False)
for l in list(QgsProject.instance().mapLayers().values()):
self.onLayerWasAdded(l)
QgsProject.instance().layerWasAdded.connect(self.onLayerWasAdded)
@@ -290,7 +290,7 @@ def toSqlLayer(self, sql, geomCol, uniqueCol, layerName="QueryLayer", layerType=
if avoidSelectById:
uri.disableSelectAtId(True)
provider = self.dbplugin().providerName()
if layerType == QgsMapLayer.RasterLayer:
if layerType == QgsMapLayerType.RasterLayer:
return QgsRasterLayer(uri.uri(False), layerName, provider)
return QgsVectorLayer(uri.uri(False), layerName, provider)

@@ -194,7 +194,7 @@ def getVectorTables(self, schema=None):
VLayerRegistry.instance().reset()
lst = []
for _, l in QgsProject.instance().mapLayers().items():
if l.type() == QgsMapLayer.VectorLayer:
if l.type() == QgsMapLayerType.VectorLayer:

lname = l.name()
# if there is already a layer with this name, use the layer id
@@ -132,7 +132,7 @@ def populateLayers(self):
for nodeLayer in QgsProject.instance().layerTreeRoot().findLayers():
layer = nodeLayer.layer()
# TODO: add import raster support!
if layer.type() == QgsMapLayer.VectorLayer:
if layer.type() == QgsMapLayerType.VectorLayer:
self.cboInputLayer.addItem(layer.name(), layer.id())

def deleteInputLayer(self):
@@ -177,7 +177,7 @@ def reloadInputLayer(self):

layerName = QFileInfo(filename).completeBaseName()
layer = QgsVectorLayer(filename, layerName, "ogr")
if not layer.isValid() or layer.type() != QgsMapLayer.VectorLayer:
if not layer.isValid() or layer.type() != QgsMapLayerType.VectorLayer:
layer.deleteLater()
return False

@@ -303,7 +303,7 @@ def _getSqlLayer(self, _filter):

from qgis.core import QgsMapLayer

layerType = QgsMapLayer.VectorLayer if self.vectorRadio.isChecked() else QgsMapLayer.RasterLayer
layerType = QgsMapLayerType.VectorLayer if self.vectorRadio.isChecked() else QgsMapLayerType.RasterLayer

# get a new layer name
names = []
@@ -403,7 +403,7 @@ def _getSqlLayer(self, _filter):

from qgis.core import QgsMapLayer

layerType = QgsMapLayer.VectorLayer if self.vectorRadio.isChecked() else QgsMapLayer.RasterLayer
layerType = QgsMapLayerType.VectorLayer if self.vectorRadio.isChecked() else QgsMapLayerType.RasterLayer

# get a new layer name
names = []
@@ -289,7 +289,7 @@ def sync_in_place_button_state(self, layer=None):

old_enabled_state = self.editInPlaceAction.isEnabled()

new_enabled_state = layer is not None and layer.type() == QgsMapLayer.VectorLayer
new_enabled_state = layer is not None and layer.type() == QgsMapLayerType.VectorLayer
self.editInPlaceAction.setEnabled(new_enabled_state)

if new_enabled_state != old_enabled_state:
@@ -479,10 +479,10 @@ def processInputs(self, parameters, context, feedback):
for idx, layer in enumerate(layers):
layerName = '{}_{}'.format(paramName, idx)
# Add a raster layer
if layer.type() == QgsMapLayer.RasterLayer:
if layer.type() == QgsMapLayerType.RasterLayer:
self.loadRasterLayer(layerName, layer)
# Add a vector layer
elif layer.type() == QgsMapLayer.VectorLayer:
elif layer.type() == QgsMapLayerType.VectorLayer:
self.loadVectorLayer(layerName, layer, external=None, feedback=feedback)

self.postInputs()
@@ -88,7 +88,7 @@ def __init__(self, alg):

self.cmbInputLayer.setFilters(QgsMapLayerProxyModel.VectorLayer)
try:
if iface.activeLayer().type() == QgsMapLayer.VectorLayer:
if iface.activeLayer().type() == QgsMapLayerType.VectorLayer:
self.cmbInputLayer.setLayer(iface.activeLayer())
except:
pass
@@ -141,7 +141,7 @@ def fetchResults(self, string, context, feedback):
# collect results in main thread, since this method is inexpensive and
# accessing the processing registry/current layer is not thread safe

if iface.activeLayer() is None or iface.activeLayer().type() != QgsMapLayer.VectorLayer:
if iface.activeLayer() is None or iface.activeLayer().type() != QgsMapLayerType.VectorLayer:
return

for a in QgsApplication.processingRegistry().algorithms():
@@ -110,7 +110,7 @@ def handleAlgorithmResults(alg, context, feedback=None, showResults=True, parame
if outputName:
style = RenderingStyles.getStyle(alg.id(), outputName)
if style is None:
if layer.type() == QgsMapLayer.RasterLayer:
if layer.type() == QgsMapLayerType.RasterLayer:
style = ProcessingConfig.getSetting(ProcessingConfig.RASTER_STYLE)
else:
if layer.geometryType() == QgsWkbTypes.PointGeometry:
@@ -138,7 +138,7 @@ def set_in_place_edit_mode(self, enabled):
self.in_place_mode = enabled

def layer_changed(self, layer):
if layer is None or layer.type() != QgsMapLayer.VectorLayer:
if layer is None or layer.type() != QgsMapLayerType.VectorLayer:
return
self.algorithmTree.setInPlaceLayer(layer)

@@ -1133,7 +1133,7 @@ def createWidget(self):
filters = QgsMapLayerProxyModel.VectorLayer

try:
if iface.activeLayer().type() == QgsMapLayer.VectorLayer:
if iface.activeLayer().type() == QgsMapLayerType.VectorLayer:
self.combo.setLayer(iface.activeLayer())
self.use_selection_checkbox.setEnabled(iface.activeLayer().selectedFeatureCount() > 0)

@@ -1184,7 +1184,7 @@ def createWidget(self):
return widget

def layerChanged(self, layer):
if layer is None or layer.type() != QgsMapLayer.VectorLayer or layer.selectedFeatureCount() == 0:
if layer is None or layer.type() != QgsMapLayerType.VectorLayer or layer.selectedFeatureCount() == 0:
self.use_selection_checkbox.setChecked(False)
self.use_selection_checkbox.setEnabled(False)
else:
@@ -1470,7 +1470,7 @@ def createWidget(self):

self.combo.setExcludedProviders(['grass'])
try:
if iface.activeLayer().type() == QgsMapLayer.VectorLayer:
if iface.activeLayer().type() == QgsMapLayerType.VectorLayer:
self.combo.setLayer(iface.activeLayer())
except:
pass

0 comments on commit 8d51a69

Please sign in to comment.
You can’t perform that action at this time.