Python qgis.PyQt.QtCore.pyqtSlot() Examples
The following are 5
code examples of qgis.PyQt.QtCore.pyqtSlot().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
qgis.PyQt.QtCore
, or try the search function
.
Example #1
Source File: permissionWidget.py From DsgTools with GNU General Public License v2.0 | 6 votes |
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')
Example #2
Source File: dsgRasterInfoTool.py From DsgTools with GNU General Public License v2.0 | 6 votes |
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')
Example #3
Source File: field_toolbox.py From DsgTools with GNU General Public License v2.0 | 6 votes |
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)
Example #4
Source File: field_toolbox.py From DsgTools with GNU General Public License v2.0 | 5 votes |
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)
Example #5
Source File: field_toolbox.py From DsgTools with GNU General Public License v2.0 | 4 votes |
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()