def changeLayerForFeature(self, currLayer, currFeature):

        status = False

        sameGeomTypeLayerList = self.getSameGeomTypeLayerList(
            currLayer, currFeature)

        TOMsMessageLog.logMessage(
            "In setNewLayerForFeature: sameGeomTypeLayerList: {}".format(
                sameGeomTypeLayerList),
            level=Qgis.Info)

        surveyDialog = QInputDialog()
        surveyDialog.setLabelText("Please confirm new layer for this feature ")
        surveyDialog.setComboBoxItems(sameGeomTypeLayerList)
        surveyDialog.setTextValue(currLayer.name())

        if surveyDialog.exec_() == QDialog.Accepted:
            newLayerName = surveyDialog.textValue()
            TOMsMessageLog.logMessage(
                "In setNewLayerForFeature: {}".format(newLayerName),
                level=Qgis.Info)

            if currLayer.name() != newLayerName:
                newLayer = QgsProject.instance().mapLayersByName(
                    newLayerName)[0]
                reply = QMessageBox.information(
                    None, "Information", "Setting {} to layer {}".format(
                        currFeature.attribute("GeometryID"), newLayer.name()),
                    QMessageBox.Ok)

                status = self.moveFeatureToNewLayer(currLayer, currFeature,
                                                    newLayer)

        return status
Esempio n. 2
0
 def updDescrSelectedDimStyle(self):
     if self.selectedDimStyle is None:
         return
     Title = QadMsg.translate(
         "DimStyle_Dialog", "QAD - Editing dimension style description: "
     ) + self.selectedDimStyle.name
     inputDlg = QInputDialog(self)
     inputDlg.setWindowTitle(Title)
     inputDlg.setInputMode(QInputDialog.TextInput)
     inputDlg.setLabelText(
         QadMsg.translate("DimStyle_Dialog", "New description:"))
     inputDlg.setTextValue(self.selectedDimStyle.description)
     inputDlg.resize(600, 100)
     if inputDlg.exec_():
         self.selectedDimStyle.description = inputDlg.textValue()
         self.selectedDimStyle.save()
         self.init()