def testTreeWidgetGettersSetters(self): """ basic tests for QgsProjectionSelectionTreeWidget """ w = QgsProjectionSelectionTreeWidget() w.show() self.assertFalse(w.hasValidSelection()) w.setCrs(QgsCoordinateReferenceSystem('EPSG:3111')) self.assertEqual(w.crs().authid(), 'EPSG:3111') self.assertTrue(w.hasValidSelection())
def testTreeWidgetNotSetOption(self): """ test allowing no projection option for QgsProjectionSelectionTreeWidget """ w = QgsProjectionSelectionTreeWidget() w.show() w.setShowNoProjection(True) self.assertTrue(w.showNoProjection()) w.setShowNoProjection(False) self.assertFalse(w.showNoProjection()) w.setShowNoProjection(True) # no projection should be a valid selection w.setCrs(QgsCoordinateReferenceSystem()) self.assertTrue(w.hasValidSelection()) self.assertFalse(w.crs().isValid())
def geomapfishCrsButtonClicked(self): dlg = QgsProjectionSelectionTreeWidget(self) dlg.setMessage('Select GeoMapFish CRS') dlg.setSelectedAuthId(self.geomapfishCrs.text()) if dlg.exec_(): self.geomapfishCrs.setText(dlg.selectedAuthId())