1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| import sys
from PyQt4 import QtCore
from PyQt4 import QtGui
import psycopg2
import ui_load
import ui_srid
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Download(QtGui.QMainWindow):
def setupUi(self, Ui_Download, Main):
Ui_Download.setObjectName(_fromUtf8("Ui_Download"))
Ui_Download.resize(651, 251)
self.gridLayoutWidget = QtGui.QWidget(Ui_Download)
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 10, 631, 231))
self.gridLayoutWidget.setObjectName(_fromUtf8("gridLayoutWidget"))
self.gridLayout = QtGui.QGridLayout(self.gridLayoutWidget)
self.gridLayout.setMargin(0)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.label_titre = QtGui.QLabel(self.gridLayoutWidget)
font = QtGui.QFont()
font.setFamily(_fromUtf8("Calibri"))
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.label_titre.setFont(font)
self.label_titre.setObjectName(_fromUtf8("label_titre"))
self.gridLayout.addWidget(self.label_titre, 0, 0, 1, 1)
self.lineEdit_srid = QtGui.QLineEdit(self.gridLayoutWidget)
self.lineEdit_srid.setObjectName(_fromUtf8("lineEdit_srid"))
self.gridLayout.addWidget(self.lineEdit_srid, 4, 1, 1, 1)
self.pushButton_Browse = QtGui.QPushButton(self.gridLayoutWidget)
self.pushButton_Browse.setObjectName(_fromUtf8("pushButton_Browse"))
self.gridLayout.addWidget(self.pushButton_Browse, 2, 0, 1, 1)
self.pushButton_srid = QtGui.QPushButton(self.gridLayoutWidget)
self.pushButton_srid.setObjectName(_fromUtf8("pushButton_srid"))
self.gridLayout.addWidget(self.pushButton_srid, 4, 0, 1, 1)
self.pushButton_Import = QtGui.QPushButton(self.gridLayoutWidget)
self.pushButton_Import.setObjectName(_fromUtf8("pushButton_Import"))
self.gridLayout.addWidget(self.pushButton_Import, 6, 1, 1, 1)
self.lineEdit_pathfile = QtGui.QLineEdit(self.gridLayoutWidget)
self.lineEdit_pathfile.setObjectName(_fromUtf8("lineEdit_pathfile"))
self.gridLayout.addWidget(self.lineEdit_pathfile, 2, 1, 1, 1)
self.label_file = QtGui.QLabel(self.gridLayoutWidget)
self.label_file.setObjectName(_fromUtf8("label_file"))
self.gridLayout.addWidget(self.label_file, 1, 0, 1, 1)
self.label_srid = QtGui.QLabel(self.gridLayoutWidget)
self.label_srid.setObjectName(_fromUtf8("label_srid"))
self.gridLayout.addWidget(self.label_srid, 3, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 5, 1, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem1, 0, 1, 1, 1)
self.retranslateUi(Ui_Download)
#QtCore.QObject.connect(self.pushButton_Browse, QtCore.SIGNAL(_fromUtf8("clicked()")), Ui_Download.open)
QtCore.QObject.connect(self.pushButton_srid, QtCore.SIGNAL(_fromUtf8("clicked()")), Ui_Download.open)
QtCore.QObject.connect(self.pushButton_Import, QtCore.SIGNAL(_fromUtf8("clicked()")), Ui_Download.open)
QtCore.QMetaObject.connectSlotsByName(Ui_Download)
self.pushButton_Browse.clicked.connect(self.browseDialog)
self.pushButton_srid.clicked.connect(self.uiSrid)
def retranslateUi(self,Ui_Download):
Ui_Download.setWindowTitle(_translate("Ui_Download", "Ui_Download", None))
self.label_titre.setText(_translate("Ui_Download", "Data Download", None))
self.pushButton_Browse.setText(_translate("Ui_Download", "Browse", None))
self.pushButton_srid.setText(_translate("Ui_Download", "SRID", None))
self.pushButton_Import.setText(_translate("Ui_Download", "Import", None))
self.label_file.setText(_translate("Ui_Download", "Chose a file to import :", None))
self.label_srid.setText(_translate("Ui_Download", "Chose a srid :", None))
def browseDialog(self, Ui_Download):
pathfile = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '/home')
correctedpathfile= pathfile.replace('\\', '/')
self.lineEdit_pathfile.setText(str(correctedpathfile))
def uiImportation(self):
WindowDownload = QtGui.QDialog()
self.uimportation = ui_load.Ui_Dialog()
self.uimportation.setupUi(WindowDownload, self)
self.close()
reply = WindowDownload.exec_()
def uiSrid(self):
WindowDownload = QtGui.QDialog()
self.uisrid = ui_srid.Ui_Srid()
self.uisrid.setupUi(WindowDownload, self)
self.close()
reply = WindowDownload.exec_() |
Partager