Ejemplo n.º 1
0
 def select_crs(self):
     """Shows a dialog to select a new CRS for the model"""
     crs_dialog = QgsProjectionSelectionDialog()
     crs_dialog.setShowNoProjection(True)
     if self.dlg.crsLineEdit.text() != "None":
         old_crs = QgsCoordinateReferenceSystem("EPSG:{}".format(
             self.dlg.crsLineEdit.text()))
         crs_dialog.setCrs(old_crs)
     crs_dialog.exec()
     if crs_dialog.crs().postgisSrid() == 0:
         self.dlg.crsLineEdit.setText("None")
     else:
         self.dlg.crsLineEdit.setText("{}".format(
             crs_dialog.crs().postgisSrid()))
Ejemplo n.º 2
0
    def testDialogNotSetOption(self):
        """ test allowing no projection option for QgsProjectionSelectionTreeWidget """
        w = QgsProjectionSelectionDialog()
        w.show()
        w.setShowNoProjection(True)
        self.assertTrue(w.showNoProjection())
        w.setShowNoProjection(False)
        self.assertFalse(w.showNoProjection())

        w.setShowNoProjection(True)
        w.setCrs(QgsCoordinateReferenceSystem())
        self.assertFalse(w.crs().isValid())
    def testDialogNotSetOption(self):
        """ test allowing no projection option for QgsProjectionSelectionTreeWidget """
        w = QgsProjectionSelectionDialog()
        w.show()
        w.setShowNoProjection(True)
        self.assertTrue(w.showNoProjection())
        w.setShowNoProjection(False)
        self.assertFalse(w.showNoProjection())

        w.setShowNoProjection(True)
        w.setCrs(QgsCoordinateReferenceSystem())
        self.assertFalse(w.crs().isValid())