2012-10-05 23:28:47 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
CrsSelectionPanel.py
|
|
|
|
---------------------
|
|
|
|
Date : August 2012
|
|
|
|
Copyright : (C) 2012 by Victor Olaya
|
|
|
|
Email : volayaf at gmail dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = 'Victor Olaya'
|
|
|
|
__date__ = 'August 2012'
|
|
|
|
__copyright__ = '(C) 2012, Victor Olaya'
|
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2012-09-15 18:25:25 +03:00
|
|
|
from PyQt4 import QtGui, QtCore
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.gui.CrsSelectionDialog import CrsSelectionDialog
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
class CrsSelectionPanel(QtGui.QWidget):
|
|
|
|
|
|
|
|
def __init__(self, default):
|
2013-02-28 22:08:32 +01:00
|
|
|
super(CrsSelectionPanel, self).__init__(None)
|
2013-01-04 23:02:44 +01:00
|
|
|
self.authid = default
|
2012-09-15 18:25:25 +03:00
|
|
|
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()
|
2013-02-28 22:08:32 +01:00
|
|
|
|
2013-02-23 16:18:22 +01:00
|
|
|
def setAuthid(self, authid):
|
|
|
|
self.authid = authid
|
|
|
|
self.setText()
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def showSelectionDialog(self):
|
|
|
|
dialog = CrsSelectionDialog()
|
|
|
|
dialog.exec_()
|
2013-01-04 23:02:44 +01:00
|
|
|
if dialog.authid:
|
|
|
|
self.authid = str(dialog.authid)
|
2012-09-15 18:25:25 +03:00
|
|
|
self.setText()
|
|
|
|
|
|
|
|
def setText(self):
|
2013-02-23 16:18:22 +01:00
|
|
|
if self.authid is not None:
|
|
|
|
self.text.setText(str(self.authid))
|
2012-09-15 18:25:25 +03:00
|
|
|
|
|
|
|
def getValue(self):
|
2013-01-04 23:02:44 +01:00
|
|
|
return self.authid
|