class GdalToolsSRSDialog(QDialog): def __init__(self, title, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(title) layout = QVBoxLayout() self.selector = QgsProjectionSelector(self) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close) layout.addWidget(self.selector) layout.addWidget(buttonBox) self.setLayout(layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject) def authid(self): return str(self.selector.selectedAuthId()) def proj4string(self): return self.selector.selectedProj4String() def getProjection(self): if self.authid().upper().startswith("EPSG:"): return self.authid() if self.selector.selectedProj4String(): return self.proj4string() return ''
class SRSChooserDialog(QtGui.QDialog): """Inspired by: `<http://code.google.com/p/qspatialite/source/browse/trunk/dialogSRS.py?spec=svn45&r=45>`_ """ def __init__(self, title): QtGui.QDialog.__init__(self) self.setWindowTitle(title) layout = QtGui.QVBoxLayout() self.selector = QgsProjectionSelector(self) buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Close) layout.addWidget(self.selector) layout.addWidget(buttonBox) self.setLayout(layout) self.connect(buttonBox, QtCore.SIGNAL("accepted()"), self.accept) self.connect(buttonBox, QtCore.SIGNAL("rejected()"), self.reject) def epsg(self): return str(self.selector.selectedEpsg()) def proj4string(self): return self.selector.selectedProj4String() def getProjection(self): if self.selector.selectedEpsg() != 0: return self.epsg() if not self.selector.selectedProj4String().isEmpty(): return self.proj4string() return QtCore.QString()
class SelectCrsDlg(QDialog): def __init__(self, title, parent=None): QDialog.__init__(self) self.setWindowTitle( title ) layout = QVBoxLayout() self.selector = QgsProjectionSelector(self) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close) layout.addWidget(self.selector) layout.addWidget(buttonBox) self.setLayout(layout) self.connect(buttonBox, SIGNAL("accepted()"), self.accept) self.connect(buttonBox, SIGNAL("rejected()"), self.reject) def epsg(self): return "EPSG:" + str(self.selector.selectedEpsg()) def proj4string(self): return self.selector.selectedProj4String() def getProjection(self): if self.selector.selectedEpsg() != 0: return self.epsg() if not self.selector.selectedProj4String().isEmpty(): return self.proj4string() return QString()
def __init__(self, title, parent=None): QDialog.__init__(self, parent) self.setWindowTitle(title) layout = QVBoxLayout() self.selector = QgsProjectionSelector(self) buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close) layout.addWidget(self.selector) layout.addWidget(buttonBox) self.setLayout(layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self, title): QtGui.QDialog.__init__(self) self.setWindowTitle(title) layout = QtGui.QVBoxLayout() self.selector = QgsProjectionSelector(self) buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Close) layout.addWidget(self.selector) layout.addWidget(buttonBox) self.setLayout(layout) self.connect(buttonBox, QtCore.SIGNAL("accepted()"), self.accept) self.connect(buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
# coding: utf-8 from PyQt4.QtGui import QDialog, QVBoxLayout from qgis.gui import QgsProjectionSelector new_dialog = QDialog() new_dialog.resize(800, 800) layout = QVBoxLayout() projection_selector = QgsProjectionSelector(new_dialog) # Widget based layout.addWidget(projection_selector) new_dialog.setLayout(layout) new_dialog.show()