本文整理匯總了Python中qgis.PyQt.QtCore.pyqtSlot方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.pyqtSlot方法的具體用法?Python QtCore.pyqtSlot怎麽用?Python QtCore.pyqtSlot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qgis.PyQt.QtCore
的用法示例。
在下文中一共展示了QtCore.pyqtSlot方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import pyqtSlot [as 別名]
def __init__(self, parent=None):
"""Constructor."""
super(self.__class__, self).__init__(parent)
# Set up the user interface from Designer.
# After setupUI you can access any designer object by doing
# self.<objectname>, and you can use autoconnect slots - see
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
# #widgets-and-dialogs-with-auto-connect
self.setupUi(self)
self.serverAbstractDb = None
self.dbDict = dict()
self.permissionManager = None
self.permissionTreeWidget.setContextMenuPolicy(Qt.CustomContextMenu)
self.permissionTreeWidget.customContextMenuRequested.connect(self.createMenuAssigned)
# @pyqtSlot(bool, name='on_manageProfilesPushButton_clicked')
示例2: stretch_raster
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import pyqtSlot [as 別名]
def stretch_raster(self):
try:
formerLayer = self.iface.activeLayer()
layer = self.rasterComboBox.currentLayer()
# keep track of current tool status
assignValueStatus = self.valueSetterButton.isChecked()
self.iface.setActiveLayer(layer)
self.iface.mainWindow().findChild( QAction, 'mActionLocalCumulativeCutStretch' ).trigger()
self.iface.setActiveLayer(formerLayer)
# make sure it still be on, if necessary
if assignValueStatus:
self.valueSetterButton.setChecked(assignValueStatus)
except AttributeError:
pass
# @pyqtSlot(bool, name = 'on_valueSetterButton_toggled')
示例3: disconnectLayerSignals
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import pyqtSlot [as 別名]
def disconnectLayerSignals(self):
"""
Disconnecting the signals from the previous layer
"""
if self.prevLayer:
try:
self.prevLayer.featureAdded.disconnect(self.setAttributesFromButton)
self.prevLayer.editCommandEnded.disconnect(self.updateAttributesAfterAdding)
setup = self.prevLayer.editFormConfig()
setup.setSuppress(QgsEditFormConfig.SuppressDefault)
self.prevLayer.setEditFormConfig(setup)
except:
pass
# @pyqtSlot(bool)
# @pyqtSlot(QgsMapLayer)
示例4: getLayerFromButton
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import pyqtSlot [as 別名]
def getLayerFromButton(self, buttonText):
"""
Gets the correct layer to be used in the tool
"""
#edgvClass found in the dictionary (this is made using the sqlite seed)
# if more than 1 button exists, it randomly generates this & middle string, why? no idea
button = buttonText.split(' [')[0].replace('&', '')
(category, edgvClass) = self.findReclassificationClass(button)
driverName = self.widget.abstractDb.getType()
if driverName == "QSQLITE":
#reclassification layer name
reclassificationClass = '_'.join(edgvClass.split('_')[1::])
if driverName == "QPSQL":
#reclassification layer name
reclassificationClass = '_'.join(edgvClass.split('.')[1::])
#getting the QgsVectorLayer to perform the reclassification
reclassificationLayer = self.loadLayer(reclassificationClass)
if reclassificationLayer:
# self.iface.setActiveLayer(reclassificationLayer)
#entering in editing mode
if not reclassificationLayer.isEditable():
reclassificationLayer.startEditing()
lyrAttributes = [i.name() for i in reclassificationLayer.fields()]
for attr in list(self.reclassificationDict[category][edgvClass][button].keys()):
if attr == 'buttonProp':
continue
candidateDict = self.reclassificationDict[category][edgvClass][button][attr]
if isinstance(candidateDict, dict):
if candidateDict['isEditable'] == '0' and attr in lyrAttributes:
attrIdx = lyrAttributes.index(attr)
reclassificationLayer.editFormConfig().setReadOnly(attrIdx, True)
return (reclassificationLayer, category, edgvClass)
# @pyqtSlot(QgsFeatureId)
# @pyqtSlot(int)
示例5: acquire
# 需要導入模塊: from qgis.PyQt import QtCore [as 別名]
# 或者: from qgis.PyQt.QtCore import pyqtSlot [as 別名]
def acquire(self, pressed):
"""
Performs the actual reclassification, moving the geometry to the correct layer along with the specified attributes.
The difference here is the use of real time editing to make the reclassification
"""
if pressed:
if not self.checkConditions():
return
#getting the object that sent the signal
sender = self.sender()
#if the sender is the iface object, this means that the user made the click and changed the current layer
#when this happens we should untoggle all buttons
if isinstance(sender, QgisInterface):
#checking if another button is checked
for button in self.buttons:
button.setChecked(False)
#return and do nothing else
return
#button that sent the signal
self.buttonName = sender.text().split(' [')[0].replace('&', '')
#checking if another button is checked
for button in self.buttons:
if button.text().split(' [')[0] != self.buttonName and button.isChecked():
button.setChecked(False)
#disconnecting the previous layer
self.disconnectLayerSignals()
(reclassificationLayer, self.category, self.edgvClass) = self.getLayerFromButton(self.buttonName)
if reclassificationLayer is not None:
#suppressing the form dialog
setup = reclassificationLayer.editFormConfig()
setup.setSuppress(QgsEditFormConfig.SuppressOn)
reclassificationLayer.setEditFormConfig(setup)
#connecting addedFeature signal
reclassificationLayer.featureAdded.connect(self.setAttributesFromButton)
reclassificationLayer.editCommandEnded.connect(self.updateAttributesAfterAdding)
#triggering the add feature tool
if reclassificationLayer != self.iface.activeLayer():
self.iface.blockSignals(True)
self.iface.setActiveLayer(reclassificationLayer)
self.iface.blockSignals(False)
self.iface.actionAddFeature().trigger()
#setting the previous layer
self.prevLayer = reclassificationLayer
else:
#disconnecting the previous layer
self.disconnectLayerSignals()
# @pyqtSlot()