From 03426f52762ac86a709673cae7f6d0ad6d254944 Mon Sep 17 00:00:00 2001 From: LtWorf Date: Sat, 8 Oct 2011 17:34:19 +0000 Subject: [PATCH] - Unified code for survey git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@316 014f5005-505e-4b48-8d0a-63407b615a7c --- relational_gui/compatibility.py | 35 +++ relational_gui/surveyForm.py | 20 +- relational_pyside/compatibility.py | 1 + relational_pyside/maingui.py | 209 ++++++++-------- relational_pyside/survey.py | 94 ++++--- relational_pyside/survey.ui | 389 +---------------------------- relational_pyside/surveyForm.py | 86 +------ 7 files changed, 209 insertions(+), 625 deletions(-) create mode 100644 relational_gui/compatibility.py create mode 120000 relational_pyside/compatibility.py mode change 100644 => 120000 relational_pyside/survey.ui mode change 100644 => 120000 relational_pyside/surveyForm.py diff --git a/relational_gui/compatibility.py b/relational_gui/compatibility.py new file mode 100644 index 0000000..e28ddcc --- /dev/null +++ b/relational_gui/compatibility.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Relational +# Copyright (C) 2011 Salvo "LtWorf" Tomaselli +# +# Relational 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# author Salvo "LtWorf" Tomaselli +# +# Module to unify the use of both pyqt and pyside + + +try: + from PyQt4 import QtCore, QtGui + pyqt=True +except: + from PySide import QtCore, QtGui + pyqt=False + + +def get_py_str(a): + '''Returns a python string out of a QString''' + if pyqt: + return str(a.toUtf8()) + return a #Already a python string in PySide \ No newline at end of file diff --git a/relational_gui/surveyForm.py b/relational_gui/surveyForm.py index 4ffd01e..7a522e3 100644 --- a/relational_gui/surveyForm.py +++ b/relational_gui/surveyForm.py @@ -16,8 +16,12 @@ # along with this program. If not, see . # # author Salvo "LtWorf" Tomaselli -from PyQt4 import QtCore, QtGui +try: + from PyQt4 import QtCore, QtGui +except: + from PySide import QtCore, QtGui +import compatibility from relational import maintenance import platform import locale @@ -56,13 +60,13 @@ class surveyForm (QtGui.QWidget): post={} post['software']="Relational algebra" post["version"]= version - post["system"]= str(self.ui.txtSystem.text().toUtf8()) - post["country"]= str(self.ui.txtCountry.text().toUtf8()) - post["school"]= str(self.ui.txtSchool.text().toUtf8()) - post["age"] = str(self.ui.txtAge.text().toUtf8()) - post["find"] = str(self.ui.txtFind.text().toUtf8()) - post["email"] =str(self.ui.txtEmail.text().toUtf8()) - post["comments"] = str(self.ui.txtComments.toPlainText().toUtf8()) + post["system"]= compatibility.get_py_str(self.ui.txtSystem.text()) + post["country"]= compatibility.get_py_str(self.ui.txtCountry.text()) + post["school"]= compatibility.get_py_str(self.ui.txtSchool.text()) + post["age"] = compatibility.get_py_str(self.ui.txtAge.text()) + post["find"] = compatibility.get_py_str(self.ui.txtFind.text()) + post["email"] = compatibility.get_py_str(self.ui.txtEmail.text()) + post["comments"] = compatibility.get_py_str(self.ui.txtComments.toPlainText()) #Clears the form self.ui.txtSystem.clear() diff --git a/relational_pyside/compatibility.py b/relational_pyside/compatibility.py new file mode 120000 index 0000000..7840e34 --- /dev/null +++ b/relational_pyside/compatibility.py @@ -0,0 +1 @@ +../relational_gui/compatibility.py \ No newline at end of file diff --git a/relational_pyside/maingui.py b/relational_pyside/maingui.py index 2b34c63..b1560a7 100644 --- a/relational_pyside/maingui.py +++ b/relational_pyside/maingui.py @@ -1,116 +1,113 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'maingui.ui' +# Form implementation generated from reading ui file 'relational_pyside/maingui.ui' # -# Created: Mon Mar 21 00:21:36 2011 -# by: PyQt4 UI code generator 4.8.3 +# Created: Sat Oct 8 19:27:40 2011 +# by: pyside-uic 0.2.13 running on PySide 1.0.7 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - class Ui_MainWindow(object): def setupUi(self, MainWindow): - MainWindow.setObjectName(_fromUtf8("MainWindow")) + MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 612) self.centralwidget = QtGui.QWidget(MainWindow) - self.centralwidget.setObjectName(_fromUtf8("centralwidget")) + self.centralwidget.setObjectName("centralwidget") self.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) + self.verticalLayout_7.setObjectName("verticalLayout_7") self.splitter_4 = QtGui.QSplitter(self.centralwidget) self.splitter_4.setOrientation(QtCore.Qt.Horizontal) - self.splitter_4.setObjectName(_fromUtf8("splitter_4")) + self.splitter_4.setObjectName("splitter_4") self.layoutWidget = QtGui.QWidget(self.splitter_4) - self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) + self.layoutWidget.setObjectName("layoutWidget") self.verticalLayout_11 = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) + self.verticalLayout_11.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_11.setObjectName("verticalLayout_11") self.groupBox_3 = QtGui.QGroupBox(self.layoutWidget) - self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) + self.groupBox_3.setObjectName("groupBox_3") self.verticalLayout_5 = QtGui.QVBoxLayout(self.groupBox_3) - self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) + self.verticalLayout_5.setObjectName("verticalLayout_5") self.cmdAbout = QtGui.QPushButton(self.groupBox_3) - self.cmdAbout.setObjectName(_fromUtf8("cmdAbout")) + self.cmdAbout.setObjectName("cmdAbout") self.verticalLayout_5.addWidget(self.cmdAbout) self.cmdSurvey = QtGui.QPushButton(self.groupBox_3) - self.cmdSurvey.setObjectName(_fromUtf8("cmdSurvey")) + self.cmdSurvey.setObjectName("cmdSurvey") self.verticalLayout_5.addWidget(self.cmdSurvey) self.verticalLayout_11.addWidget(self.groupBox_3) self.groupBox_4 = QtGui.QGroupBox(self.layoutWidget) - self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) + self.groupBox_4.setObjectName("groupBox_4") self.verticalLayout_10 = QtGui.QVBoxLayout(self.groupBox_4) - self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) + self.verticalLayout_10.setObjectName("verticalLayout_10") self.cmdProduct = QtGui.QPushButton(self.groupBox_4) - self.cmdProduct.setObjectName(_fromUtf8("cmdProduct")) + self.cmdProduct.setObjectName("cmdProduct") self.verticalLayout_10.addWidget(self.cmdProduct) self.cmdDifference = QtGui.QPushButton(self.groupBox_4) - self.cmdDifference.setObjectName(_fromUtf8("cmdDifference")) + self.cmdDifference.setObjectName("cmdDifference") self.verticalLayout_10.addWidget(self.cmdDifference) self.cmdUnion = QtGui.QPushButton(self.groupBox_4) - self.cmdUnion.setObjectName(_fromUtf8("cmdUnion")) + self.cmdUnion.setObjectName("cmdUnion") self.verticalLayout_10.addWidget(self.cmdUnion) self.cmdIntersection = QtGui.QPushButton(self.groupBox_4) - self.cmdIntersection.setObjectName(_fromUtf8("cmdIntersection")) + self.cmdIntersection.setObjectName("cmdIntersection") self.verticalLayout_10.addWidget(self.cmdIntersection) self.cmdDivision = QtGui.QPushButton(self.groupBox_4) - self.cmdDivision.setObjectName(_fromUtf8("cmdDivision")) + self.cmdDivision.setObjectName("cmdDivision") self.verticalLayout_10.addWidget(self.cmdDivision) self.cmdJoin = QtGui.QPushButton(self.groupBox_4) - self.cmdJoin.setObjectName(_fromUtf8("cmdJoin")) + self.cmdJoin.setObjectName("cmdJoin") self.verticalLayout_10.addWidget(self.cmdJoin) self.cmdOuterLeft = QtGui.QPushButton(self.groupBox_4) - self.cmdOuterLeft.setObjectName(_fromUtf8("cmdOuterLeft")) + self.cmdOuterLeft.setObjectName("cmdOuterLeft") self.verticalLayout_10.addWidget(self.cmdOuterLeft) self.cmdOuterRight = QtGui.QPushButton(self.groupBox_4) - self.cmdOuterRight.setObjectName(_fromUtf8("cmdOuterRight")) + self.cmdOuterRight.setObjectName("cmdOuterRight") self.verticalLayout_10.addWidget(self.cmdOuterRight) self.cmdOuter = QtGui.QPushButton(self.groupBox_4) - self.cmdOuter.setObjectName(_fromUtf8("cmdOuter")) + self.cmdOuter.setObjectName("cmdOuter") self.verticalLayout_10.addWidget(self.cmdOuter) self.cmdProjection = QtGui.QPushButton(self.groupBox_4) - self.cmdProjection.setObjectName(_fromUtf8("cmdProjection")) + self.cmdProjection.setObjectName("cmdProjection") self.verticalLayout_10.addWidget(self.cmdProjection) self.cmdSelection = QtGui.QPushButton(self.groupBox_4) - self.cmdSelection.setObjectName(_fromUtf8("cmdSelection")) + self.cmdSelection.setObjectName("cmdSelection") self.verticalLayout_10.addWidget(self.cmdSelection) self.cmdRename = QtGui.QPushButton(self.groupBox_4) - self.cmdRename.setObjectName(_fromUtf8("cmdRename")) + self.cmdRename.setObjectName("cmdRename") self.verticalLayout_10.addWidget(self.cmdRename) self.cmdArrow = QtGui.QPushButton(self.groupBox_4) - self.cmdArrow.setObjectName(_fromUtf8("cmdArrow")) + self.cmdArrow.setObjectName("cmdArrow") self.verticalLayout_10.addWidget(self.cmdArrow) spacerItem = QtGui.QSpacerItem(20, 25, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_10.addItem(spacerItem) self.verticalLayout_11.addWidget(self.groupBox_4) self.splitter_3 = QtGui.QSplitter(self.splitter_4) self.splitter_3.setOrientation(QtCore.Qt.Horizontal) - self.splitter_3.setObjectName(_fromUtf8("splitter_3")) + self.splitter_3.setObjectName("splitter_3") self.splitter_2 = QtGui.QSplitter(self.splitter_3) self.splitter_2.setOrientation(QtCore.Qt.Vertical) - self.splitter_2.setObjectName(_fromUtf8("splitter_2")) + self.splitter_2.setObjectName("splitter_2") self.table = QtGui.QTreeWidget(self.splitter_2) self.table.setMinimumSize(QtCore.QSize(450, 400)) self.table.setSizeIncrement(QtCore.QSize(0, 0)) self.table.setRootIsDecorated(False) - self.table.setObjectName(_fromUtf8("table")) - self.table.headerItem().setText(0, _fromUtf8("Empty relation")) + self.table.setObjectName("table") + self.table.headerItem().setText(0, "Empty relation") self.layoutWidget1 = QtGui.QWidget(self.splitter_2) - self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) + self.layoutWidget1.setObjectName("layoutWidget1") self.verticalLayout_6 = QtGui.QVBoxLayout(self.layoutWidget1) self.verticalLayout_6.setSizeConstraint(QtGui.QLayout.SetMinimumSize) - self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) + self.verticalLayout_6.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_6.setObjectName("verticalLayout_6") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) + self.horizontalLayout.setObjectName("horizontalLayout") self.cmdInsert = QtGui.QPushButton(self.layoutWidget1) - self.cmdInsert.setObjectName(_fromUtf8("cmdInsert")) + self.cmdInsert.setObjectName("cmdInsert") self.horizontalLayout.addWidget(self.cmdInsert) self.cmdDelete = QtGui.QPushButton(self.layoutWidget1) - self.cmdDelete.setObjectName(_fromUtf8("cmdDelete")) + self.cmdDelete.setObjectName("cmdDelete") self.horizontalLayout.addWidget(self.cmdDelete) self.verticalLayout_6.addLayout(self.horizontalLayout) self.lstHistory = QtGui.QListWidget(self.layoutWidget1) @@ -124,29 +121,29 @@ class Ui_MainWindow(object): font = QtGui.QFont() font.setStrikeOut(False) self.lstHistory.setFont(font) - self.lstHistory.setObjectName(_fromUtf8("lstHistory")) + self.lstHistory.setObjectName("lstHistory") self.verticalLayout_6.addWidget(self.lstHistory) self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) + self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.cmdOptimize = QtGui.QPushButton(self.layoutWidget1) - self.cmdOptimize.setObjectName(_fromUtf8("cmdOptimize")) + self.cmdOptimize.setObjectName("cmdOptimize") self.horizontalLayout_3.addWidget(self.cmdOptimize) self.cmdUndoOptimize = QtGui.QPushButton(self.layoutWidget1) - self.cmdUndoOptimize.setObjectName(_fromUtf8("cmdUndoOptimize")) + self.cmdUndoOptimize.setObjectName("cmdUndoOptimize") self.horizontalLayout_3.addWidget(self.cmdUndoOptimize) self.cmdClearHistory = QtGui.QPushButton(self.layoutWidget1) - self.cmdClearHistory.setObjectName(_fromUtf8("cmdClearHistory")) + self.cmdClearHistory.setObjectName("cmdClearHistory") self.horizontalLayout_3.addWidget(self.cmdClearHistory) self.verticalLayout_6.addLayout(self.horizontalLayout_3) self.splitter = QtGui.QSplitter(self.splitter_3) self.splitter.setOrientation(QtCore.Qt.Vertical) - self.splitter.setObjectName(_fromUtf8("splitter")) + self.splitter.setObjectName("splitter") self.groupBox = QtGui.QGroupBox(self.splitter) self.groupBox.setMinimumSize(QtCore.QSize(0, 0)) self.groupBox.setMaximumSize(QtCore.QSize(300, 16777215)) - self.groupBox.setObjectName(_fromUtf8("groupBox")) + self.groupBox.setObjectName("groupBox") self.verticalLayout = QtGui.QVBoxLayout(self.groupBox) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.verticalLayout.setObjectName("verticalLayout") self.lstRelations = QtGui.QListWidget(self.groupBox) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) @@ -154,23 +151,23 @@ class Ui_MainWindow(object): sizePolicy.setHeightForWidth(self.lstRelations.sizePolicy().hasHeightForWidth()) self.lstRelations.setSizePolicy(sizePolicy) self.lstRelations.setMaximumSize(QtCore.QSize(16777215, 16777215)) - self.lstRelations.setObjectName(_fromUtf8("lstRelations")) + self.lstRelations.setObjectName("lstRelations") self.verticalLayout.addWidget(self.lstRelations) self.cmdLoad = QtGui.QPushButton(self.groupBox) - self.cmdLoad.setObjectName(_fromUtf8("cmdLoad")) + self.cmdLoad.setObjectName("cmdLoad") self.verticalLayout.addWidget(self.cmdLoad) self.cmdSave = QtGui.QPushButton(self.groupBox) - self.cmdSave.setObjectName(_fromUtf8("cmdSave")) + self.cmdSave.setObjectName("cmdSave") self.verticalLayout.addWidget(self.cmdSave) self.cmdUnload = QtGui.QPushButton(self.groupBox) - self.cmdUnload.setObjectName(_fromUtf8("cmdUnload")) + self.cmdUnload.setObjectName("cmdUnload") self.verticalLayout.addWidget(self.cmdUnload) self.groupBox_2 = QtGui.QGroupBox(self.splitter) self.groupBox_2.setMinimumSize(QtCore.QSize(0, 0)) self.groupBox_2.setMaximumSize(QtCore.QSize(300, 16777215)) - self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) + self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_2) - self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) + self.verticalLayout_3.setObjectName("verticalLayout_3") self.lstAttributes = QtGui.QListWidget(self.groupBox_2) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) @@ -178,53 +175,53 @@ class Ui_MainWindow(object): sizePolicy.setHeightForWidth(self.lstAttributes.sizePolicy().hasHeightForWidth()) self.lstAttributes.setSizePolicy(sizePolicy) self.lstAttributes.setMaximumSize(QtCore.QSize(16777215, 16777215)) - self.lstAttributes.setObjectName(_fromUtf8("lstAttributes")) + self.lstAttributes.setObjectName("lstAttributes") self.verticalLayout_3.addWidget(self.lstAttributes) self.verticalLayout_7.addWidget(self.splitter_4) self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.txtResult = QtGui.QLineEdit(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.txtResult.sizePolicy().hasHeightForWidth()) self.txtResult.setSizePolicy(sizePolicy) - self.txtResult.setObjectName(_fromUtf8("txtResult")) + self.txtResult.setObjectName("txtResult") self.horizontalLayout_2.addWidget(self.txtResult) self.label = QtGui.QLabel(self.centralwidget) - self.label.setObjectName(_fromUtf8("label")) + self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) self.txtQuery = QtGui.QLineEdit(self.centralwidget) - self.txtQuery.setObjectName(_fromUtf8("txtQuery")) + self.txtQuery.setObjectName("txtQuery") self.horizontalLayout_2.addWidget(self.txtQuery) self.cmdClearQuery = QtGui.QPushButton(self.centralwidget) - self.cmdClearQuery.setObjectName(_fromUtf8("cmdClearQuery")) + self.cmdClearQuery.setObjectName("cmdClearQuery") self.horizontalLayout_2.addWidget(self.cmdClearQuery) self.cmdExecute = QtGui.QPushButton(self.centralwidget) - self.cmdExecute.setObjectName(_fromUtf8("cmdExecute")) + self.cmdExecute.setObjectName("cmdExecute") self.horizontalLayout_2.addWidget(self.cmdExecute) self.verticalLayout_7.addLayout(self.horizontalLayout_2) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21)) - self.menubar.setObjectName(_fromUtf8("menubar")) + self.menubar.setObjectName("menubar") self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName(_fromUtf8("menuFile")) + self.menuFile.setObjectName("menuFile") self.menuAbout = QtGui.QMenu(self.menubar) - self.menuAbout.setObjectName(_fromUtf8("menuAbout")) + self.menuAbout.setObjectName("menuAbout") self.action = QtGui.QAction(MainWindow) - self.action.setObjectName(_fromUtf8("action")) + self.action.setObjectName("action") MainWindow.setMenuBar(self.menubar) self.actionAbout = QtGui.QAction(MainWindow) self.actionAbout.setMenuRole(QtGui.QAction.AboutRole) - self.actionAbout.setObjectName(_fromUtf8("actionAbout")) + self.actionAbout.setObjectName("actionAbout") self.action_Load_relation = QtGui.QAction(MainWindow) - self.action_Load_relation.setObjectName(_fromUtf8("action_Load_relation")) + self.action_Load_relation.setObjectName("action_Load_relation") self.action_Save_relation = QtGui.QAction(MainWindow) - self.action_Save_relation.setObjectName(_fromUtf8("action_Save_relation")) + self.action_Save_relation.setObjectName("action_Save_relation") self.action_Quit = QtGui.QAction(MainWindow) self.action_Quit.setMenuRole(QtGui.QAction.QuitRole) - self.action_Quit.setObjectName(_fromUtf8("action_Quit")) + self.action_Quit.setObjectName("action_Quit") self.menuFile.addAction(self.action_Load_relation) self.menuFile.addAction(self.action_Save_relation) self.menuFile.addSeparator() @@ -235,41 +232,41 @@ class Ui_MainWindow(object): self.label.setBuddy(self.txtQuery) self.retranslateUi(MainWindow) - QtCore.QObject.connect(self.cmdClearQuery, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtQuery.clear) - QtCore.QObject.connect(self.cmdClearHistory, QtCore.SIGNAL(_fromUtf8("clicked()")), self.lstHistory.clear) - QtCore.QObject.connect(self.txtQuery, QtCore.SIGNAL(_fromUtf8("returnPressed()")), MainWindow.execute) - QtCore.QObject.connect(self.cmdExecute, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.execute) - QtCore.QObject.connect(self.cmdAbout, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.showAbout) - QtCore.QObject.connect(self.cmdSurvey, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.showSurvey) - QtCore.QObject.connect(self.cmdProduct, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addProduct) - QtCore.QObject.connect(self.cmdDifference, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addDifference) - QtCore.QObject.connect(self.cmdArrow, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addArrow) - QtCore.QObject.connect(self.cmdRename, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addRename) - QtCore.QObject.connect(self.cmdSelection, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addSelection) - QtCore.QObject.connect(self.cmdProjection, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addProjection) - QtCore.QObject.connect(self.cmdUnload, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.unloadRelation) - QtCore.QObject.connect(self.cmdSave, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.saveRelation) - QtCore.QObject.connect(self.cmdLoad, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.loadRelation) - QtCore.QObject.connect(self.cmdOptimize, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.optimize) - QtCore.QObject.connect(self.cmdUndoOptimize, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.undoOptimize) - QtCore.QObject.connect(self.txtResult, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtQuery.setFocus) - QtCore.QObject.connect(self.cmdDelete, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.deleteTuple) - QtCore.QObject.connect(self.cmdInsert, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.insertTuple) - QtCore.QObject.connect(self.cmdOuterRight, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addORight) - QtCore.QObject.connect(self.cmdOuter, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addOuter) - QtCore.QObject.connect(self.cmdOuterLeft, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addOLeft) - QtCore.QObject.connect(self.cmdJoin, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addJoin) - QtCore.QObject.connect(self.cmdDivision, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addDivision) - QtCore.QObject.connect(self.cmdIntersection, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addIntersection) - QtCore.QObject.connect(self.cmdUnion, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.addUnion) - QtCore.QObject.connect(self.lstRelations, QtCore.SIGNAL(_fromUtf8("itemDoubleClicked(QListWidgetItem*)")), MainWindow.printRelation) - QtCore.QObject.connect(self.lstRelations, QtCore.SIGNAL(_fromUtf8("itemClicked(QListWidgetItem*)")), MainWindow.showAttributes) - QtCore.QObject.connect(self.cmdClearQuery, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtQuery.setFocus) - QtCore.QObject.connect(self.lstHistory, QtCore.SIGNAL(_fromUtf8("itemDoubleClicked(QListWidgetItem*)")), MainWindow.resumeHistory) - QtCore.QObject.connect(self.actionAbout, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.showAbout) - QtCore.QObject.connect(self.action_Load_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.loadRelation) - QtCore.QObject.connect(self.action_Save_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.saveRelation) - QtCore.QObject.connect(self.action_Quit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.close) + QtCore.QObject.connect(self.cmdClearQuery, QtCore.SIGNAL("clicked()"), self.txtQuery.clear) + QtCore.QObject.connect(self.cmdClearHistory, QtCore.SIGNAL("clicked()"), self.lstHistory.clear) + QtCore.QObject.connect(self.txtQuery, QtCore.SIGNAL("returnPressed()"), MainWindow.execute) + QtCore.QObject.connect(self.cmdExecute, QtCore.SIGNAL("clicked()"), MainWindow.execute) + QtCore.QObject.connect(self.cmdAbout, QtCore.SIGNAL("clicked()"), MainWindow.showAbout) + QtCore.QObject.connect(self.cmdSurvey, QtCore.SIGNAL("clicked()"), MainWindow.showSurvey) + QtCore.QObject.connect(self.cmdProduct, QtCore.SIGNAL("clicked()"), MainWindow.addProduct) + QtCore.QObject.connect(self.cmdDifference, QtCore.SIGNAL("clicked()"), MainWindow.addDifference) + QtCore.QObject.connect(self.cmdArrow, QtCore.SIGNAL("clicked()"), MainWindow.addArrow) + QtCore.QObject.connect(self.cmdRename, QtCore.SIGNAL("clicked()"), MainWindow.addRename) + QtCore.QObject.connect(self.cmdSelection, QtCore.SIGNAL("clicked()"), MainWindow.addSelection) + QtCore.QObject.connect(self.cmdProjection, QtCore.SIGNAL("clicked()"), MainWindow.addProjection) + QtCore.QObject.connect(self.cmdUnload, QtCore.SIGNAL("clicked()"), MainWindow.unloadRelation) + QtCore.QObject.connect(self.cmdSave, QtCore.SIGNAL("clicked()"), MainWindow.saveRelation) + QtCore.QObject.connect(self.cmdLoad, QtCore.SIGNAL("clicked()"), MainWindow.loadRelation) + QtCore.QObject.connect(self.cmdOptimize, QtCore.SIGNAL("clicked()"), MainWindow.optimize) + QtCore.QObject.connect(self.cmdUndoOptimize, QtCore.SIGNAL("clicked()"), MainWindow.undoOptimize) + QtCore.QObject.connect(self.txtResult, QtCore.SIGNAL("returnPressed()"), self.txtQuery.setFocus) + QtCore.QObject.connect(self.cmdDelete, QtCore.SIGNAL("clicked()"), MainWindow.deleteTuple) + QtCore.QObject.connect(self.cmdInsert, QtCore.SIGNAL("clicked()"), MainWindow.insertTuple) + QtCore.QObject.connect(self.cmdOuterRight, QtCore.SIGNAL("clicked()"), MainWindow.addORight) + QtCore.QObject.connect(self.cmdOuter, QtCore.SIGNAL("clicked()"), MainWindow.addOuter) + QtCore.QObject.connect(self.cmdOuterLeft, QtCore.SIGNAL("clicked()"), MainWindow.addOLeft) + QtCore.QObject.connect(self.cmdJoin, QtCore.SIGNAL("clicked()"), MainWindow.addJoin) + QtCore.QObject.connect(self.cmdDivision, QtCore.SIGNAL("clicked()"), MainWindow.addDivision) + QtCore.QObject.connect(self.cmdIntersection, QtCore.SIGNAL("clicked()"), MainWindow.addIntersection) + QtCore.QObject.connect(self.cmdUnion, QtCore.SIGNAL("clicked()"), MainWindow.addUnion) + QtCore.QObject.connect(self.lstRelations, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), MainWindow.printRelation) + QtCore.QObject.connect(self.lstRelations, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), MainWindow.showAttributes) + QtCore.QObject.connect(self.cmdClearQuery, QtCore.SIGNAL("clicked()"), self.txtQuery.setFocus) + QtCore.QObject.connect(self.lstHistory, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"), MainWindow.resumeHistory) + QtCore.QObject.connect(self.actionAbout, QtCore.SIGNAL("triggered()"), MainWindow.showAbout) + QtCore.QObject.connect(self.action_Load_relation, QtCore.SIGNAL("triggered()"), MainWindow.loadRelation) + QtCore.QObject.connect(self.action_Save_relation, QtCore.SIGNAL("triggered()"), MainWindow.saveRelation) + QtCore.QObject.connect(self.action_Quit, QtCore.SIGNAL("triggered()"), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.cmdAbout, self.cmdSurvey) MainWindow.setTabOrder(self.cmdSurvey, self.cmdProduct) diff --git a/relational_pyside/survey.py b/relational_pyside/survey.py index 7b480cd..fa3b5c4 100644 --- a/relational_pyside/survey.py +++ b/relational_pyside/survey.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file 'survey.ui' +# Form implementation generated from reading ui file 'relational_pyside/survey.ui' # -# Created: Tue Nov 11 11:46:10 2008 -# by: PyQt4 UI code generator 4.4.2 +# Created: Sat Oct 8 19:27:40 2011 +# by: pyside-uic 0.2.13 running on PySide 1.0.7 # # WARNING! All changes made in this file will be lost! @@ -12,52 +12,64 @@ from PySide import QtCore, QtGui class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") - Form.resize(400,322) + Form.resize(422, 313) + Form.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.formLayout = QtGui.QGridLayout() self.formLayout.setObjectName("formLayout") self.txtSystem = QtGui.QLineEdit(Form) self.txtSystem.setObjectName("txtSystem") - self.formLayout.addWidget(self.txtSystem,0,1,1,1) + self.formLayout.addWidget(self.txtSystem, 0, 1, 1, 1) self.label = QtGui.QLabel(Form) + self.label.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label.setObjectName("label") - self.formLayout.addWidget(self.label,1,0,1,1) + self.formLayout.addWidget(self.label, 1, 0, 1, 1) self.txtCountry = QtGui.QLineEdit(Form) self.txtCountry.setObjectName("txtCountry") - self.formLayout.addWidget(self.txtCountry,1,1,1,1) + self.formLayout.addWidget(self.txtCountry, 1, 1, 1, 1) self.label_2 = QtGui.QLabel(Form) + self.label_2.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_2.setObjectName("label_2") - self.formLayout.addWidget(self.label_2,2,0,1,1) + self.formLayout.addWidget(self.label_2, 2, 0, 1, 1) self.txtSchool = QtGui.QLineEdit(Form) self.txtSchool.setObjectName("txtSchool") - self.formLayout.addWidget(self.txtSchool,2,1,1,1) + self.formLayout.addWidget(self.txtSchool, 2, 1, 1, 1) self.label_3 = QtGui.QLabel(Form) + self.label_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_3.setObjectName("label_3") - self.formLayout.addWidget(self.label_3,3,0,1,1) + self.formLayout.addWidget(self.label_3, 3, 0, 1, 1) self.txtAge = QtGui.QLineEdit(Form) self.txtAge.setObjectName("txtAge") - self.formLayout.addWidget(self.txtAge,3,1,1,1) + self.formLayout.addWidget(self.txtAge, 3, 1, 1, 1) self.label_4 = QtGui.QLabel(Form) + self.label_4.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_4.setObjectName("label_4") - self.formLayout.addWidget(self.label_4,4,0,1,1) + self.formLayout.addWidget(self.label_4, 4, 0, 1, 1) self.txtFind = QtGui.QLineEdit(Form) self.txtFind.setObjectName("txtFind") - self.formLayout.addWidget(self.txtFind,4,1,1,1) + self.formLayout.addWidget(self.txtFind, 4, 1, 1, 1) self.label_5 = QtGui.QLabel(Form) + self.label_5.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) self.label_5.setObjectName("label_5") - self.formLayout.addWidget(self.label_5,0,0,1,1) + self.formLayout.addWidget(self.label_5, 0, 0, 1, 1) self.label_6 = QtGui.QLabel(Form) self.label_6.setObjectName("label_6") - self.formLayout.addWidget(self.label_6,5,0,1,1) + self.formLayout.addWidget(self.label_6, 6, 0, 1, 1) self.txtComments = QtGui.QTextEdit(Form) self.txtComments.setTabChangesFocus(True) self.txtComments.setObjectName("txtComments") - self.formLayout.addWidget(self.txtComments,5,1,1,1) + self.formLayout.addWidget(self.txtComments, 6, 1, 1, 1) + self.label_7 = QtGui.QLabel(Form) + self.label_7.setObjectName("label_7") + self.formLayout.addWidget(self.label_7, 5, 0, 1, 1) + self.txtEmail = QtGui.QLineEdit(Form) + self.txtEmail.setObjectName("txtEmail") + self.formLayout.addWidget(self.txtEmail, 5, 1, 1, 1) self.verticalLayout.addLayout(self.formLayout) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") - spacerItem = QtGui.QSpacerItem(40,20,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Minimum) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.cmdCancel = QtGui.QPushButton(Form) self.cmdCancel.setObjectName("cmdCancel") @@ -66,6 +78,7 @@ class Ui_Form(object): self.cmdClear.setObjectName("cmdClear") self.horizontalLayout.addWidget(self.cmdClear) self.cmdSend = QtGui.QPushButton(Form) + self.cmdSend.setDefault(True) self.cmdSend.setObjectName("cmdSend") self.horizontalLayout.addWidget(self.cmdSend) self.verticalLayout.addLayout(self.horizontalLayout) @@ -75,30 +88,34 @@ class Ui_Form(object): self.label_4.setBuddy(self.txtFind) self.label_5.setBuddy(self.txtSystem) self.label_6.setBuddy(self.txtComments) + self.label_7.setBuddy(self.txtEmail) self.retranslateUi(Form) - QtCore.QObject.connect(self.cmdCancel,QtCore.SIGNAL("clicked()"),Form.close) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtComments.clear) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtFind.clear) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtAge.clear) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtSchool.clear) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtCountry.clear) - QtCore.QObject.connect(self.cmdClear,QtCore.SIGNAL("clicked()"),self.txtSystem.clear) - QtCore.QObject.connect(self.txtSystem,QtCore.SIGNAL("returnPressed()"),self.txtCountry.setFocus) - QtCore.QObject.connect(self.txtCountry,QtCore.SIGNAL("returnPressed()"),self.txtSchool.setFocus) - QtCore.QObject.connect(self.txtSchool,QtCore.SIGNAL("returnPressed()"),self.txtAge.setFocus) - QtCore.QObject.connect(self.txtAge,QtCore.SIGNAL("returnPressed()"),self.txtFind.setFocus) - QtCore.QObject.connect(self.txtFind,QtCore.SIGNAL("returnPressed()"),self.txtComments.setFocus) - QtCore.QObject.connect(self.cmdSend,QtCore.SIGNAL("clicked()"),Form.send) + QtCore.QObject.connect(self.cmdCancel, QtCore.SIGNAL("clicked()"), Form.close) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtComments.clear) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtFind.clear) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtAge.clear) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtSchool.clear) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtCountry.clear) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtSystem.clear) + QtCore.QObject.connect(self.txtSystem, QtCore.SIGNAL("returnPressed()"), self.txtCountry.setFocus) + QtCore.QObject.connect(self.txtCountry, QtCore.SIGNAL("returnPressed()"), self.txtSchool.setFocus) + QtCore.QObject.connect(self.txtSchool, QtCore.SIGNAL("returnPressed()"), self.txtAge.setFocus) + QtCore.QObject.connect(self.txtAge, QtCore.SIGNAL("returnPressed()"), self.txtFind.setFocus) + QtCore.QObject.connect(self.cmdSend, QtCore.SIGNAL("clicked()"), Form.send) + QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL("clicked()"), self.txtEmail.clear) + QtCore.QObject.connect(self.txtFind, QtCore.SIGNAL("returnPressed()"), self.txtEmail.setFocus) + QtCore.QObject.connect(self.txtEmail, QtCore.SIGNAL("returnPressed()"), self.txtComments.setFocus) QtCore.QMetaObject.connectSlotsByName(Form) - Form.setTabOrder(self.txtSystem,self.txtCountry) - Form.setTabOrder(self.txtCountry,self.txtSchool) - Form.setTabOrder(self.txtSchool,self.txtAge) - Form.setTabOrder(self.txtAge,self.txtFind) - Form.setTabOrder(self.txtFind,self.txtComments) - Form.setTabOrder(self.txtComments,self.cmdSend) - Form.setTabOrder(self.cmdSend,self.cmdClear) - Form.setTabOrder(self.cmdClear,self.cmdCancel) + Form.setTabOrder(self.txtSystem, self.txtCountry) + Form.setTabOrder(self.txtCountry, self.txtSchool) + Form.setTabOrder(self.txtSchool, self.txtAge) + Form.setTabOrder(self.txtAge, self.txtFind) + Form.setTabOrder(self.txtFind, self.txtEmail) + Form.setTabOrder(self.txtEmail, self.txtComments) + Form.setTabOrder(self.txtComments, self.cmdSend) + Form.setTabOrder(self.cmdSend, self.cmdClear) + Form.setTabOrder(self.cmdClear, self.cmdCancel) def retranslateUi(self, Form): Form.setWindowTitle(QtGui.QApplication.translate("Form", "Survey", None, QtGui.QApplication.UnicodeUTF8)) @@ -108,6 +125,7 @@ class Ui_Form(object): self.label_4.setText(QtGui.QApplication.translate("Form", "How did you find relational", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("Form", "System", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("Form", "Comments", None, QtGui.QApplication.UnicodeUTF8)) + self.label_7.setText(QtGui.QApplication.translate("Form", "Email (only if you want a reply)", None, QtGui.QApplication.UnicodeUTF8)) self.cmdCancel.setText(QtGui.QApplication.translate("Form", "Cancel", None, QtGui.QApplication.UnicodeUTF8)) self.cmdClear.setText(QtGui.QApplication.translate("Form", "Clear", None, QtGui.QApplication.UnicodeUTF8)) self.cmdSend.setText(QtGui.QApplication.translate("Form", "Send", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/relational_pyside/survey.ui b/relational_pyside/survey.ui deleted file mode 100644 index 5911f2e..0000000 --- a/relational_pyside/survey.ui +++ /dev/null @@ -1,388 +0,0 @@ - - Form - - - - 0 - 0 - 400 - 322 - - - - Survey - - - - - - - - - - - - - - - - - Country - - - txtCountry - - - - - - - - - - - - - School - - - txtSchool - - - - - - - - - - - - - Age - - - txtAge - - - - - - - - - - - - - How did you find relational - - - txtFind - - - - - - - - - - - - - System - - - txtSystem - - - - - - - Comments - - - txtComments - - - - - - - true - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Cancel - - - - - - - Clear - - - - - - - Send - - - true - - - - - - - - - txtSystem - txtCountry - txtSchool - txtAge - txtFind - txtComments - cmdSend - cmdClear - cmdCancel - - - - - cmdCancel - clicked() - Form - close() - - - 228 - 294 - - - 180 - 319 - - - - - cmdClear - clicked() - txtComments - clear() - - - 288 - 298 - - - 291 - 248 - - - - - cmdClear - clicked() - txtFind - clear() - - - 270 - 294 - - - 284 - 153 - - - - - cmdClear - clicked() - txtAge - clear() - - - 269 - 299 - - - 257 - 123 - - - - - cmdClear - clicked() - txtSchool - clear() - - - 310 - 299 - - - 317 - 87 - - - - - cmdClear - clicked() - txtCountry - clear() - - - 298 - 303 - - - 326 - 47 - - - - - cmdClear - clicked() - txtSystem - clear() - - - 287 - 303 - - - 302 - 18 - - - - - txtSystem - returnPressed() - txtCountry - setFocus() - - - 213 - 22 - - - 224 - 52 - - - - - txtCountry - returnPressed() - txtSchool - setFocus() - - - 268 - 54 - - - 276 - 89 - - - - - txtSchool - returnPressed() - txtAge - setFocus() - - - 355 - 85 - - - 358 - 118 - - - - - txtAge - returnPressed() - txtFind - setFocus() - - - 375 - 123 - - - 375 - 156 - - - - - txtFind - returnPressed() - txtComments - setFocus() - - - 332 - 154 - - - 335 - 200 - - - - - cmdSend - clicked() - Form - send() - - - 381 - 309 - - - 396 - 320 - - - - - - send() - - diff --git a/relational_pyside/survey.ui b/relational_pyside/survey.ui new file mode 120000 index 0000000..1e13504 --- /dev/null +++ b/relational_pyside/survey.ui @@ -0,0 +1 @@ +../relational_gui/survey.ui \ No newline at end of file diff --git a/relational_pyside/surveyForm.py b/relational_pyside/surveyForm.py deleted file mode 100644 index ff64863..0000000 --- a/relational_pyside/surveyForm.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- -# Relational -# Copyright (C) 2008 Salvo "LtWorf" Tomaselli -# -# Relational 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 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -# author Salvo "LtWorf" Tomaselli -from PySide import QtCore, QtGui - -import httplib -import urllib -import platform -import locale - -class surveyForm (QtGui.QWidget): - '''This class is the form used for the survey, needed to intercept the events. - It also sends the data with http POST to a page hosted on galileo''' - def setUi(self,ui): - self.ui=ui - def setDefaultValues(self): - '''Sets default values into the form GUI. It has to be - called after the form has been initialized''' - - #Dictionary with country codes - countries={'BD': 'BANGLADESH', 'BE': 'BELGIUM', 'BF': 'BURKINA FASO', 'BG': 'BULGARIA', 'BA': 'BOSNIA AND HERZEGOVINA', 'BB': 'BARBADOS', 'WF': 'WALLIS AND FUTUNA', 'BL': 'SAINT BARTH\xc3\x89LEMY', 'BM': 'BERMUDA', 'BN': 'BRUNEI DARUSSALAM', 'BO': 'BOLIVIA, PLURINATIONAL STATE OF', 'BH': 'BAHRAIN', 'BI': 'BURUNDI', 'BJ': 'BENIN', 'BT': 'BHUTAN', 'JM': 'JAMAICA', 'BV': 'BOUVET ISLAND', 'BW': 'BOTSWANA', 'WS': 'SAMOA', 'BR': 'BRAZIL', 'BS': 'BAHAMAS', 'JE': 'JERSEY', 'BY': 'BELARUS', 'BZ': 'BELIZE', 'RU': 'RUSSIAN FEDERATION', 'RW': 'RWANDA', 'RS': 'SERBIA', 'TL': 'TIMOR-LESTE', 'RE': 'R\xc3\x89UNION', 'TM': 'TURKMENISTAN', 'TJ': 'TAJIKISTAN', 'RO': 'ROMANIA', 'TK': 'TOKELAU', 'GW': 'GUINEA-BISSAU', 'GU': 'GUAM', 'GT': 'GUATEMALA', 'GS': 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'GR': 'GREECE', 'GQ': 'EQUATORIAL GUINEA', 'GP': 'GUADELOUPE', 'JP': 'JAPAN', 'GY': 'GUYANA', 'GG': 'GUERNSEY', 'GF': 'FRENCH GUIANA', 'GE': 'GEORGIA', 'GD': 'GRENADA', 'GB': 'UNITED KINGDOM', 'GA': 'GABON', 'GN': 'GUINEA', 'GM': 'GAMBIA', 'GL': 'GREENLAND', 'GI': 'GIBRALTAR', 'GH': 'GHANA', 'OM': 'OMAN', 'TN': 'TUNISIA', 'JO': 'JORDAN', 'HR': 'CROATIA', 'HT': 'HAITI', 'HU': 'HUNGARY', 'HK': 'HONG KONG', 'HN': 'HONDURAS', 'HM': 'HEARD ISLAND AND MCDONALD ISLANDS', 'VE': 'VENEZUELA, BOLIVARIAN REPUBLIC OF', 'PR': 'PUERTO RICO', 'PS': 'PALESTINIAN TERRITORY, OCCUPIED', 'PW': 'PALAU', 'PT': 'PORTUGAL', 'KN': 'SAINT KITTS AND NEVIS', 'PY': 'PARAGUAY', 'IQ': 'IRAQ', 'PA': 'PANAMA', 'PF': 'FRENCH POLYNESIA', 'PG': 'PAPUA NEW GUINEA', 'PE': 'PERU', 'PK': 'PAKISTAN', 'PH': 'PHILIPPINES', 'PN': 'PITCAIRN', 'PL': 'POLAND', 'PM': 'SAINT PIERRE AND MIQUELON', 'ZM': 'ZAMBIA', 'EH': 'WESTERN SAHARA', 'EE': 'ESTONIA', 'EG': 'EGYPT', 'ZA': 'SOUTH AFRICA', 'EC': 'ECUADOR', 'IT': 'ITALY', 'VN': 'VIET NAM', 'SB': 'SOLOMON ISLANDS', 'ET': 'ETHIOPIA', 'SO': 'SOMALIA', 'ZW': 'ZIMBABWE', 'SA': 'SAUDI ARABIA', 'ES': 'SPAIN', 'ER': 'ERITREA', 'ME': 'MONTENEGRO', 'MD': 'MOLDOVA, REPUBLIC OF', 'MG': 'MADAGASCAR', 'MF': 'SAINT MARTIN', 'MA': 'MOROCCO', 'MC': 'MONACO', 'UZ': 'UZBEKISTAN', 'MM': 'MYANMAR', 'ML': 'MALI', 'MO': 'MACAO', 'MN': 'MONGOLIA', 'MH': 'MARSHALL ISLANDS', 'MK': 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'MU': 'MAURITIUS', 'MT': 'MALTA', 'MW': 'MALAWI', 'MV': 'MALDIVES', 'MQ': 'MARTINIQUE', 'MP': 'NORTHERN MARIANA ISLANDS', 'MS': 'MONTSERRAT', 'MR': 'MAURITANIA', 'IM': 'ISLE OF MAN', 'UG': 'UGANDA', 'TZ': 'TANZANIA, UNITED REPUBLIC OF', 'MY': 'MALAYSIA', 'MX': 'MEXICO', 'IL': 'ISRAEL', 'FR': 'FRANCE', 'AW': 'ARUBA', 'SH': 'SAINT HELENA', 'SJ': 'SVALBARD AND JAN MAYEN', 'FI': 'FINLAND', 'FJ': 'FIJI', 'FK': 'FALKLAND ISLANDS (MALVINAS)', 'FM': 'MICRONESIA, FEDERATED STATES OF', 'FO': 'FAROE ISLANDS', 'NI': 'NICARAGUA', 'NL': 'NETHERLANDS', 'NO': 'NORWAY', 'NA': 'NAMIBIA', 'VU': 'VANUATU', 'NC': 'NEW CALEDONIA', 'NE': 'NIGER', 'NF': 'NORFOLK ISLAND', 'NG': 'NIGERIA', 'NZ': 'NEW ZEALAND', 'NP': 'NEPAL', 'NR': 'NAURU', 'NU': 'NIUE', 'CK': 'COOK ISLANDS', 'CI': "C\xc3\x94TE D'IVOIRE", 'CH': 'SWITZERLAND', 'CO': 'COLOMBIA', 'CN': 'CHINA', 'CM': 'CAMEROON', 'CL': 'CHILE', 'CC': 'COCOS (KEELING) ISLANDS', 'CA': 'CANADA', 'CG': 'CONGO', 'CF': 'CENTRAL AFRICAN REPUBLIC', 'CD': 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'CZ': 'CZECH REPUBLIC', 'CY': 'CYPRUS', 'CX': 'CHRISTMAS ISLAND', 'CR': 'COSTA RICA', 'CV': 'CAPE VERDE', 'CU': 'CUBA', 'SZ': 'SWAZILAND', 'SY': 'SYRIAN ARAB REPUBLIC', 'KG': 'KYRGYZSTAN', 'KE': 'KENYA', 'SR': 'SURINAME', 'KI': 'KIRIBATI', 'KH': 'CAMBODIA', 'SV': 'EL SALVADOR', 'KM': 'COMOROS', 'ST': 'SAO TOME AND PRINCIPE', 'SK': 'SLOVAKIA', 'KR': 'KOREA, REPUBLIC OF', 'SI': 'SLOVENIA', 'KP': "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", 'KW': 'KUWAIT', 'SN': 'SENEGAL', 'SM': 'SAN MARINO', 'SL': 'SIERRA LEONE', 'SC': 'SEYCHELLES', 'KZ': 'KAZAKHSTAN', 'KY': 'CAYMAN ISLANDS', 'SG': 'SINGAPORE', 'SE': 'SWEDEN', 'SD': 'SUDAN', 'DO': 'DOMINICAN REPUBLIC', 'DM': 'DOMINICA', 'DJ': 'DJIBOUTI', 'DK': 'DENMARK', 'VG': 'VIRGIN ISLANDS, BRITISH', 'DE': 'GERMANY', 'YE': 'YEMEN', 'DZ': 'ALGERIA', 'US': 'UNITED STATES', 'UY': 'URUGUAY', 'YT': 'MAYOTTE', 'UM': 'UNITED STATES MINOR OUTLYING ISLANDS', 'LB': 'LEBANON', 'LC': 'SAINT LUCIA', 'LA': "LAO PEOPLE'S DEMOCRATIC REPUBLIC", 'TV': 'TUVALU', 'TW': 'TAIWAN, PROVINCE OF CHINA', 'TT': 'TRINIDAD AND TOBAGO', 'TR': 'TURKEY', 'LK': 'SRI LANKA', 'LI': 'LIECHTENSTEIN', 'LV': 'LATVIA', 'TO': 'TONGA', 'LT': 'LITHUANIA', 'LU': 'LUXEMBOURG', 'LR': 'LIBERIA', 'LS': 'LESOTHO', 'TH': 'THAILAND', 'TF': 'FRENCH SOUTHERN TERRITORIES', 'TG': 'TOGO', 'TD': 'CHAD', 'TC': 'TURKS AND CAICOS ISLANDS', 'LY': 'LIBYAN ARAB JAMAHIRIYA', 'VA': 'HOLY SEE (VATICAN CITY STATE)', 'VC': 'SAINT VINCENT AND THE GRENADINES', 'AE': 'UNITED ARAB EMIRATES', 'AD': 'ANDORRA', 'AG': 'ANTIGUA AND BARBUDA', 'AF': 'AFGHANISTAN', 'AI': 'ANGUILLA', 'VI': 'VIRGIN ISLANDS, U.S.', 'IS': 'ICELAND', 'IR': 'IRAN, ISLAMIC REPUBLIC OF', 'AM': 'ARMENIA', 'AL': 'ALBANIA', 'AO': 'ANGOLA', 'AN': 'NETHERLANDS ANTILLES', 'AQ': 'ANTARCTICA', 'AS': 'AMERICAN SAMOA', 'AR': 'ARGENTINA', 'AU': 'AUSTRALIA', 'AT': 'AUSTRIA', 'IO': 'BRITISH INDIAN OCEAN TERRITORY', 'IN': 'INDIA', 'AX': '\xc3\x85LAND ISLANDS', 'AZ': 'AZERBAIJAN', 'IE': 'IRELAND', 'ID': 'INDONESIA', 'UA': 'UKRAINE', 'QA': 'QATAR', 'MZ': 'MOZAMBIQUE'} - - #Setting system string - try: - self.ui.txtSystem.setText(platform.platform()) - self.ui.txtSystem.setCursorPosition(0) - except: - pass - - #Getting country from locale code - try: - locale.setlocale(locale.LC_ALL,'') - country_code=locale.getlocale()[0].split('_')[1] - - self.ui.txtCountry.setText(countries[country_code]) - self.ui.txtCountry.setCursorPosition(0) - except: - pass - def send(self): - '''Sends the data inserted in the form''' - #Creates the string - post="Relational algebra\n" - post+="version: " + version + "\n" - post+="system:" + self.ui.txtSystem.text()+ "\n" - post+="country:" + self.ui.txtCountry.text()+ "\n" - post+="school:" + self.ui.txtSchool.text()+ "\n" - post+="age:" + self.ui.txtAge.text()+ "\n" - post+="find:" + self.ui.txtFind.text()+ "\n" - post+="comments:" + self.ui.txtComments.toPlainText() - - #Clears the form - self.ui.txtSystem.clear() - self.ui.txtCountry.clear() - self.ui.txtSchool.clear() - self.ui.txtAge.clear() - self.ui.txtFind.clear() - self.ui.txtComments.clear() - - #sends the string - params = urllib.urlencode({'survey':post}) - headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} - connection = httplib.HTTPConnection('galileo.dmi.unict.it') - connection.request("POST","/~ltworf/survey.php",params,headers) - response=connection.getresponse() - if response.status!=200: - QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"),QtGui.QApplication.translate("Form", "Unable to send the data!") ) - else: - QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Thanks"),QtGui.QApplication.translate("Form", "Thanks for sending!") ) - - self.hide() diff --git a/relational_pyside/surveyForm.py b/relational_pyside/surveyForm.py new file mode 120000 index 0000000..40164de --- /dev/null +++ b/relational_pyside/surveyForm.py @@ -0,0 +1 @@ +../relational_gui/surveyForm.py \ No newline at end of file