Skip to content
Permalink
Browse files

[processing] update projection selector widget

  • Loading branch information
alexbruy committed Nov 17, 2014
1 parent 6ff4877 commit 24a3e227a5f449d964facc05022923b6800cc1a4
@@ -120,7 +120,7 @@ def headerDoubleClicked(self, col):
elif isinstance(widget, CrsSelectionPanel):
widgetValue = widget.getValue()
for row in range(1, self.table.rowCount()):
self.table.cellWidget(row, col).setAuthid(widgetValue)
self.table.cellWidget(row, col).setAuthId(widgetValue)
elif isinstance(widget, FileSelectionPanel):
widgetValue = widget.getValue()
for row in range(1, self.table.rowCount()):

This file was deleted.

@@ -25,44 +25,38 @@

__revision__ = '$Format:%H$'

from PyQt4 import QtGui, QtCore
from processing.gui.CrsSelectionDialog import CrsSelectionDialog
from qgis.core import QgsCoordinateReferenceSystem
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class CrsSelectionPanel(QtGui.QWidget):
from qgis.gui import *
from qgis.core import *

from processing.ui.ui_widgetCRSSelector import Ui_widgetCRSSelector

class CrsSelectionPanel(QWidget, Ui_widgetCRSSelector):

def __init__(self, default):
super(CrsSelectionPanel, self).__init__(None)
self.authid = QgsCoordinateReferenceSystem(default).authid()
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.text = QtGui.QLineEdit()
self.text.setEnabled(False)
self.text.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.text)
self.pushButton = QtGui.QPushButton()
self.pushButton.setText('...')
self.pushButton.clicked.connect(self.showSelectionDialog)
self.horizontalLayout.addWidget(self.pushButton)
self.setLayout(self.horizontalLayout)
self.setText()
QWidget.__init__(self)
self.setupUi(self)

self.btnBrowse.clicked.connect(self.browseCRS)
self.authId = QgsCoordinateReferenceSystem(default).authid()
self.updateText()

def setAuthid(self, authid):
self.authid = authid
self.setText()
def setAuthId(self, authid):
self.authId = authid
self.updateText()

def showSelectionDialog(self):
dialog = CrsSelectionDialog()
dialog.exec_()
if dialog.authid:
self.authid = str(dialog.authid)
self.setText()
def browseCRS(self):
selector = QgsGenericProjectionSelector()
selector.setSelectedAuthId(self.authId)
if selector.exec_():
self.authId = selector.selectedAuthId()
self.updateText()

def setText(self):
if self.authid is not None:
self.text.setText(str(self.authid))
def updateText(self):
if self.authId is not None:
self.leCRS.setText(self.authId)

def getValue(self):
return self.authid
return self.authId
@@ -422,7 +422,7 @@ def setPreviousValues(self):
else:
self.setComboBoxValue(widget, value, param)
elif isinstance(param, ParameterCrs):
widget.setAuthid(value)
widget.setAuthId(value)
elif isinstance(param, ParameterFixedTable):
pass #TODO!
elif isinstance(param, ParameterMultipleInput):
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>widgetCRSSelector</class>
<widget class="QWidget" name="widgetCRSSelector">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>23</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="leCRS">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnBrowse">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit 24a3e22

Please sign in to comment.
You can’t perform that action at this time.