Esempio n. 1
0
 def edit():
     selector = QgsProjectionSelectionDialog()
     selector.setCrs(value);
     if selector.exec_():
         crs = selector.crs()
         if crs.upper().startswith("EPSG:"):
             self.lineEdit.setText(crs)
Esempio n. 2
0
 def selectcrs(self):
     # Select a new CRS
     s = QSettings()
     previousselectedcrs=s.value("quickcrs/crs", 0)
     #if previousselectedcrs=="" or previousselectedcrs==0 or previousselectedcrs is None:
         #self.nocrsselected()
     global selectedcrs
     try:
         projSelector = QgsGenericProjectionSelector()
         projSelector.exec_()
         projSelector.selectedCrsId()
         selectedcrs=projSelector.selectedCrsId()
     except:
         projSelector = QgsProjectionSelectionDialog()
         projSelector.exec_()
         selectedcrsdef = projSelector.crs()
         selectedcrs=selectedcrsdef.srsid()
     if (selectedcrs=="" or selectedcrs==0 or self.CrsId2AuthID(selectedcrs)=="" or selectedcrs is None):
         #selectedcrs=previousselectedcrs
         pass
     if (selectedcrs=="" or selectedcrs==0 or self.CrsId2AuthID(selectedcrs)=="" or selectedcrs is None) and (previousselectedcrs=="" or previousselectedcrs==0 or previousselectedcrs is None):
         #self.nocrsselected()
         pass
     else:
         #self.dlg.labelselectedcrs.setText(self.CrsId2AuthID(selectedcrs))
         src=self.CrsId2AuthID(selectedcrs).replace('\n','')
         if(not self.buscarEnArchivo(src, "src.txt")):
             this_folder = os.path.dirname(os.path.abspath(__file__))
             file = open(this_folder+"/src.txt", mode='a')
             file.write('\n'+src)
             file.close()
             self.file2Combo("src.txt", self.dlg.combo_src,'')
         self.dlg.combo_src.setCurrentText(src)
     self.dlg.show()