From cf377eca46291ad8edd39c16b6cfe4f4ceab71f8 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 19 Feb 2015 14:00:47 +0100 Subject: [PATCH] Initial Qt5/Python3 switch This converts the GUI code to use Qt5 and Python3 The GUI is still somewhat buggy, and it can't open files yet, but seems to be mostly working, extensive testing will be needed before this can be released. --- README.md | 2 +- relational/maintenance.py | 15 +- relational_gui.py | 12 +- relational_gui/about.py | 110 ++++--- relational_gui/compatibility.py | 13 +- relational_gui/creator.py | 48 ++- relational_gui/guihandler.py | 105 ++++--- relational_gui/maingui.py | 523 ++++++++++++++++---------------- relational_gui/rel_edit.py | 95 +++--- relational_gui/survey.py | 157 +++++----- relational_gui/surveyForm.py | 20 +- 11 files changed, 526 insertions(+), 574 deletions(-) diff --git a/README.md b/README.md index dddfb4b..97e0772 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ To launch the application, run ``` If it needs some dependencies: -Qt4, Python 2.7, either PyQT4 or Pyside. +Qt5, Python 3.4 or greater, PyQt5 It can run on osx but this is not supported. diff --git a/relational/maintenance.py b/relational/maintenance.py index 591a05e..b4a2fb4 100644 --- a/relational/maintenance.py +++ b/relational/maintenance.py @@ -19,9 +19,10 @@ # # Stuff non-related to relational algebra, but used for maintenance. -import httplib -import urllib -import relation +import http.client +import urllib.parse + +from relational import relation def send_survey(data): @@ -33,10 +34,10 @@ def send_survey(data): post += '%s: %s\n' % (i, data[i]) # sends the string - params = urllib.urlencode({'survey': post}) + params = urllib.parse.urlencode({'survey': post}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} - connection = httplib.HTTPConnection('feedback-ltworf.appspot.com') + connection = http.client.HTTPConnection('feedback-ltworf.appspot.com') connection.request("POST", "/feedback/relational", params, headers) return connection.getresponse() @@ -46,7 +47,7 @@ def check_latest_version(): '''Returns the latest version available. Heavely dependent on server and server configurations not granted to work forever.''' - connection = httplib.HTTPConnection('feedback-ltworf.appspot.com') + connection = http.client.HTTPConnection('feedback-ltworf.appspot.com') connection.request("GET", "/version/relational") r = connection.getresponse() @@ -54,7 +55,7 @@ def check_latest_version(): s = r.read() if len(s) == 0: return None - return s.strip() + return str(s.strip()) class interface (object): diff --git a/relational_gui.py b/relational_gui.py index 0d8e8fb..d257045 100755 --- a/relational_gui.py +++ b/relational_gui.py @@ -84,18 +84,20 @@ if __name__ == "__main__": if x11: import sip # needed on windows - from PyQt4 import QtGui + from PyQt5 import QtGui, QtWidgets + #FIXME remove this + from relational_gui import maingui, guihandler, about, surveyForm try: from relational_gui import maingui, guihandler, about, surveyForm except: - print >> sys.stderr, "Module relational_gui is missing.\nPlease install relational package." + print ("Module relational_gui is missing.\nPlease install relational package.",file=sys.stderr) sys.exit(3) about.version = version surveyForm.version = version guihandler.version = version - app = QtGui.QApplication(sys.argv) + app = QtWidgets.QApplication(sys.argv) app.setOrganizationName('None') app.setApplicationName('relational') @@ -110,7 +112,7 @@ if __name__ == "__main__": for i in range(len(files)): if not os.path.isfile(files[i]): - print >> sys.stderr, "%s is not a file" % files[i] + print ("%s is not a file" % files[i],file=sys.stderr) printhelp(12) f = files[i].split('/') defname = f[len(f) - 1].lower() @@ -126,7 +128,7 @@ if __name__ == "__main__": try: import relational_readline.linegui except: - print >> sys.stderr, "Module relational_readline is missing.\nPlease install relational-cli package." + print ("Module relational_readline is missing.\nPlease install relational-cli package.",file=sys.stderr) sys.exit(3) relational_readline.linegui.version = version relational_readline.linegui.main(files) diff --git a/relational_gui/about.py b/relational_gui/about.py index f27f76d..f54f906 100644 --- a/relational_gui/about.py +++ b/relational_gui/about.py @@ -18,10 +18,10 @@ # author Salvo "LtWorf" Tomaselli import os -from PyQt4 import QtCore, QtGui +from PyQt5 import QtCore, QtGui, QtWidgets try: # If QtWebKit is available, uses it - from PyQt4 import QtWebKit + from PyQt5 import QtWebKit webk = True except: webk = False @@ -34,58 +34,58 @@ class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(510, 453) - self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog) + self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout_2.setObjectName("verticalLayout_2") - self.tabWidget = QtGui.QTabWidget(Dialog) + self.tabWidget = QtWidgets.QTabWidget(Dialog) self.tabWidget.setObjectName("tabWidget") - self.tab = QtGui.QWidget() + self.tab = QtWidgets.QWidget() self.tab.setGeometry(QtCore.QRect(0, 0, 494, 377)) self.tab.setObjectName("tab") - self.verticalLayout_3 = QtGui.QVBoxLayout(self.tab) + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.tab) self.verticalLayout_3.setObjectName("verticalLayout_3") - self.groupBox = QtGui.QGroupBox(self.tab) + self.groupBox = QtWidgets.QGroupBox(self.tab) self.groupBox.setObjectName("groupBox") - self.verticalLayout_5 = QtGui.QVBoxLayout(self.groupBox) + self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox) self.verticalLayout_5.setObjectName("verticalLayout_5") - self.label = QtGui.QLabel(self.groupBox) + self.label = QtWidgets.QLabel(self.groupBox) font = QtGui.QFont() font.setPointSize(15) self.label.setFont(font) self.label.setObjectName("label") self.verticalLayout_5.addWidget(self.label) - self.label_3 = QtGui.QLabel(self.groupBox) + self.label_3 = QtWidgets.QLabel(self.groupBox) self.label_3.setObjectName("label_3") self.verticalLayout_5.addWidget(self.label_3) self.verticalLayout_3.addWidget(self.groupBox) - self.groupBox_3 = QtGui.QGroupBox(self.tab) + self.groupBox_3 = QtWidgets.QGroupBox(self.tab) self.groupBox_3.setObjectName("groupBox_3") - self.verticalLayout_4 = QtGui.QVBoxLayout(self.groupBox_3) + self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_3) self.verticalLayout_4.setObjectName("verticalLayout_4") - self.label_2 = QtGui.QLabel(self.groupBox_3) + self.label_2 = QtWidgets.QLabel(self.groupBox_3) self.label_2.setObjectName("label_2") self.verticalLayout_4.addWidget(self.label_2) self.verticalLayout_3.addWidget(self.groupBox_3) - self.groupBox_2 = QtGui.QGroupBox(self.tab) + self.groupBox_2 = QtWidgets.QGroupBox(self.tab) self.groupBox_2.setObjectName("groupBox_2") - self.verticalLayout_6 = QtGui.QVBoxLayout(self.groupBox_2) + self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.groupBox_2) self.verticalLayout_6.setObjectName("verticalLayout_6") - self.label_4 = QtGui.QLabel(self.groupBox_2) + self.label_4 = QtWidgets.QLabel(self.groupBox_2) self.label_4.setObjectName("label_4") self.verticalLayout_6.addWidget(self.label_4) self.verticalLayout_3.addWidget(self.groupBox_2) self.tabWidget.addTab(self.tab, "") - self.License = QtGui.QWidget() + self.License = QtWidgets.QWidget() self.License.setGeometry(QtCore.QRect(0, 0, 494, 377)) self.License.setObjectName("License") - self.verticalLayout = QtGui.QVBoxLayout(self.License) + self.verticalLayout = QtWidgets.QVBoxLayout(self.License) self.verticalLayout.setObjectName("verticalLayout") - self.textEdit = QtGui.QTextEdit(self.License) + self.textEdit = QtWidgets.QTextEdit(self.License) self.textEdit.setObjectName("textEdit") self.verticalLayout.addWidget(self.textEdit) self.tabWidget.addTab(self.License, "") - self.tab_2 = QtGui.QWidget() + self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") - self.verticalLayout_7 = QtGui.QVBoxLayout(self.tab_2) + self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.tab_2) self.verticalLayout_7.setObjectName("verticalLayout_7") if (webk): self.webView = QtWebKit.QWebView(self.tab_2) @@ -94,10 +94,10 @@ class Ui_Dialog(object): self.webView.setObjectName("webView") self.verticalLayout_7.addWidget(self.webView) else: - self.webLink = QtGui.QLabel(self.groupBox) + self.webLink = QtWidgets.QLabel(self.groupBox) self.webLink.setFont(font) self.webLink.setObjectName("lblLink") - self.webLink.setText(QtGui.QApplication.translate( + self.webLink.setText(QtWidgets.QApplication.translate( "Dialog", "Relational's website", None,)) self.webLink.setOpenExternalLinks(True) self.webLink.setTextFormat(QtCore.Qt.AutoText) @@ -113,48 +113,46 @@ class Ui_Dialog(object): self.tabWidget.addTab(self.tab_2, "") self.verticalLayout_2.addWidget(self.tabWidget) - self.buttonBox = QtGui.QDialogButtonBox(Dialog) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_2.addWidget(self.buttonBox) self.retranslateUi(Dialog) self.tabWidget.setCurrentIndex(0) - QtCore.QObject.connect( - self.buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept) - QtCore.QObject.connect( - self.buttonBox, QtCore.SIGNAL("rejected()"), Dialog.reject) - QtCore.QMetaObject.connectSlotsByName(Dialog) + + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) def retranslateUi(self, Dialog): - Dialog.setWindowTitle(QtGui.QApplication.translate( - "Dialog", "Documentation", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox.setTitle(QtGui.QApplication.translate( - "Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate( - "Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setText(QtGui.QApplication.translate( - "Dialog", "Version " + version, None, QtGui.QApplication.UnicodeUTF8)) + Dialog.setWindowTitle(QtWidgets.QApplication.translate( + "Dialog", "Documentation", None)) + self.groupBox.setTitle(QtWidgets.QApplication.translate( + "Dialog", "Relational", None)) + self.label.setText(QtWidgets.QApplication.translate( + "Dialog", "Relational", None)) + self.label_3.setText(QtWidgets.QApplication.translate( + "Dialog", "Version " + version, None)) self.label_3.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) - self.groupBox_3.setTitle(QtGui.QApplication.translate( - "Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setText(QtGui.QApplication.translate( - "Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>
Emilio Di Prima <emiliodiprima[at]msn[dot]com> (For the windows setup)", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_3.setTitle(QtWidgets.QApplication.translate( + "Dialog", "Author", None)) + self.label_2.setText(QtWidgets.QApplication.translate( + "Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>
Emilio Di Prima <emiliodiprima[at]msn[dot]com> (For the windows setup)", None)) self.label_2.setOpenExternalLinks(True) self.label_2.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) - self.groupBox_2.setTitle(QtGui.QApplication.translate( - "Dialog", "Links", None, QtGui.QApplication.UnicodeUTF8)) - self.label_4.setText(QtGui.QApplication.translate( - "Dialog", "http://ltworf.github.io/relational/", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox_2.setTitle(QtWidgets.QApplication.translate( + "Dialog", "Links", None)) + self.label_4.setText(QtWidgets.QApplication.translate( + "Dialog", "http://ltworf.github.io/relational/", None)) self.label_4.setOpenExternalLinks(True) self.label_4.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate( - "Dialog", "About", None, QtGui.QApplication.UnicodeUTF8)) - self.textEdit.setHtml(QtGui.QApplication.translate("Dialog", "\n" + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtWidgets.QApplication.translate( + "Dialog", "About", None)) + self.textEdit.setHtml(QtWidgets.QApplication.translate("Dialog", "\n" "GNU General Public License - GNU Project - Free Software Foundation (FSF)\n" @@ -295,17 +293,17 @@ class Ui_Dialog(object): "
    under certain conditions; type `show c\' for details. 
\n" "

The hypothetical commands `show w\' and `show c\' should show the appropriate parts of the General Public License. Of course, your program\'s commands might be different; for a GUI interface, you would use an “about box”.

\n" "

You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>.

\n" - "

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.License), QtGui.QApplication.translate( - "Dialog", "License", None, QtGui.QApplication.UnicodeUTF8)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate( - "Dialog", "Docs", None, QtGui.QApplication.UnicodeUTF8)) + "

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.

", None)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.License), QtWidgets.QApplication.translate( + "Dialog", "License", None)) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtWidgets.QApplication.translate( + "Dialog", "Docs", None)) if __name__ == "__main__": import sys - app = QtGui.QApplication(sys.argv) - Dialog = QtGui.QDialog() + app = QtWidgets.QApplication(sys.argv) + Dialog = QtWidgets.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) Dialog.show() diff --git a/relational_gui/compatibility.py b/relational_gui/compatibility.py index cad6efa..cf39ccb 100644 --- a/relational_gui/compatibility.py +++ b/relational_gui/compatibility.py @@ -19,22 +19,21 @@ # # Module to unify the use of both pyqt and pyside -from PyQt4 import QtCore, QtGui +from PyQt5 import QtCore, QtWidgets def get_py_str(a): '''Returns a python string out of a QString''' - return unicode(a.toUtf8(), 'utf-8') + return a def set_utf8_text(component, text): - component.setText(QtCore.QString.fromUtf8(text)) + component.setText(text) def get_filename(filename): + print (filename) return str(filename.toUtf8()) def add_list_item(l, item): - history_item = QtCore.QString() - history_item.append(item) - hitem = QtGui.QListWidgetItem(None, 0) - hitem.setText(history_item) + hitem = QtWidgets.QListWidgetItem(None, 0) + hitem.setText(item) l.addItem(hitem) l.setCurrentItem(hitem) diff --git a/relational_gui/creator.py b/relational_gui/creator.py index 401e872..621e4f9 100644 --- a/relational_gui/creator.py +++ b/relational_gui/creator.py @@ -17,20 +17,16 @@ # # author Salvo "LtWorf" Tomaselli -try: - from PyQt4 import QtCore, QtGui -except: - from PySide import QtCore, QtGui +from PyQt5 import QtCore, QtGui, QtWidgets -import compatibility +from relational_gui import compatibility +from relational_gui import rel_edit from relational import relation -import rel_edit - -class creatorForm(QtGui.QDialog): +class creatorForm(QtWidgets.QDialog): def __init__(self, rel=None): - QtGui.QDialog.__init__(self) + QtWidgets.QDialog.__init__(self) self.setSizeGripEnabled(True) self.result_relation = None @@ -50,7 +46,7 @@ class creatorForm(QtGui.QDialog): self.table.insertRow(0) for i in rel.header.attributes: - item = QtGui.QTableWidgetItem() + item = QtWidgets.QTableWidgetItem() item.setText(i) self.table.insertColumn(self.table.columnCount()) self.table.setItem(0, self.table.columnCount() - 1, item) @@ -58,7 +54,7 @@ class creatorForm(QtGui.QDialog): for i in rel.content: self.table.insertRow(self.table.rowCount()) for j in range(len(i)): - item = QtGui.QTableWidgetItem() + item = QtWidgets.QTableWidgetItem() item.setText(i[j]) self.table.setItem(self.table.rowCount() - 1, j, item) @@ -70,10 +66,10 @@ class creatorForm(QtGui.QDialog): self.table.insertRow(0) self.table.insertRow(0) - i00 = QtGui.QTableWidgetItem() - i01 = QtGui.QTableWidgetItem() - i10 = QtGui.QTableWidgetItem() - i11 = QtGui.QTableWidgetItem() + i00 = QtWidgets.QTableWidgetItem() + i01 = QtWidgets.QTableWidgetItem() + i10 = QtWidgets.QTableWidgetItem() + i11 = QtWidgets.QTableWidgetItem() i00.setText('Field name 1') i01.setText('Field name 2') i10.setText('Value 1') @@ -92,9 +88,9 @@ class creatorForm(QtGui.QDialog): compatibility.get_py_str(self.table.item(0, i).text())) try: header = relation.header(hlist) - except Exception, e: - QtGui.QMessageBox.information(None, QtGui.QApplication.translate("Form", "Error"), "%s\n%s" % ( - QtGui.QApplication.translate("Form", "Header error!"), e.__str__())) + except Exception as e: + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), "%s\n%s" % ( + QtWidgets.QApplication.translate("Form", "Header error!"), e.__str__())) return None r = relation.relation() r.header = header @@ -106,8 +102,8 @@ class creatorForm(QtGui.QDialog): hlist.append( compatibility.get_py_str(self.table.item(i, j).text())) except: - QtGui.QMessageBox.information(None, QtGui.QApplication.translate( - "Form", "Error"), QtGui.QApplication.translate("Form", "Unset value in %d,%d!" % (i + 1, j + 1))) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate( + "Form", "Error"), QtWidgets.QApplication.translate("Form", "Unset value in %d,%d!" % (i + 1, j + 1))) return None r.content.add(tuple(hlist)) return r @@ -118,31 +114,25 @@ class creatorForm(QtGui.QDialog): # Doesn't close the window in case of errors if self.result_relation != None: - QtGui.QDialog.accept(self) - pass + QtWidgets.QDialog.accept(self) def reject(self): self.result_relation = None - QtGui.QDialog.reject(self) - pass + QtWidgets.QDialog.reject(self) def addColumn(self): self.table.insertColumn(self.table.columnCount()) - pass def addRow(self): self.table.insertRow(1) - pass def deleteColumn(self): if self.table.columnCount() > 1: self.table.removeColumn(self.table.currentColumn()) - pass def deleteRow(self): if self.table.rowCount() > 2: self.table.removeRow(self.table.currentRow()) - pass def edit_relation(rel=None): @@ -165,4 +155,4 @@ if __name__ == '__main__': app = QtGui.QApplication(sys.argv) r = relation.relation( "/home/salvo/dev/relational/trunk/samples/people.csv") - print edit_relation(r) + print (edit_relation(r)) diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index 8c61195..7a93a23 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -19,21 +19,21 @@ import sys import os -from PyQt4 import QtCore, QtGui +from PyQt5 import QtCore, QtWidgets, QtWidgets from relational import relation, parser, optimizer, rtypes -import about -import survey -import surveyForm -import maingui -import compatibility +from relational_gui import about +from relational_gui import survey +from relational_gui import surveyForm +from relational_gui import maingui +from relational_gui import compatibility -class relForm(QtGui.QMainWindow): +class relForm(QtWidgets.QMainWindow): def __init__(self, ui): - QtGui.QMainWindow.__init__(self) + QtWidgets.QMainWindow.__init__(self) self.About = None self.Survey = None self.relations = {} # Dictionary for relations @@ -49,17 +49,17 @@ class relForm(QtGui.QMainWindow): online = maintenance.check_latest_version() if online > version: - r = QtGui.QApplication.translate( + r = QtWidgets.QApplication.translate( "Form", "New version available online: %s." % online) elif online == version: - r = QtGui.QApplication.translate( + r = QtWidgets.QApplication.translate( "Form", "Latest version installed.") else: - r = QtGui.QApplication.translate( + r = QtWidgets.QApplication.translate( "Form", "You are using an unstable version.") - QtGui.QMessageBox.information( - self, QtGui.QApplication.translate("Form", "Version"), r) + QtWidgets.QMessageBox.information( + self, QtWidgets.QApplication.translate("Form", "Version"), r) def load_query(self, *index): self.ui.txtQuery.setText(self.savedQ.itemData(index[0]).toString()) @@ -77,9 +77,9 @@ class relForm(QtGui.QMainWindow): try: result = optimizer.optimize_all(query, self.relations) compatibility.set_utf8_text(self.ui.txtQuery, result) - except Exception, e: - QtGui.QMessageBox.information(None, QtGui.QApplication.translate("Form", "Error"), "%s\n%s" % - (QtGui.QApplication.translate("Form", "Check your query!"), e.__str__())) + except Exception as e: + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), "%s\n%s" % + (QtWidgets.QApplication.translate("Form", "Check your query!"), e.__str__())) def resumeHistory(self, item): itm = compatibility.get_py_str(item.text()).split(' = ', 1) @@ -94,14 +94,14 @@ class relForm(QtGui.QMainWindow): self.ui.txtResult.text()) # result relation's name if not rtypes.is_valid_relation_name(res_rel): - QtGui.QMessageBox.information(self, QtGui.QApplication.translate( - "Form", "Error"), QtGui.QApplication.translate("Form", "Wrong name for destination relation.")) + QtWidgets.QMessageBox.information(self, QtWidgets.QApplication.translate( + "Form", "Error"), QtWidgets.QApplication.translate("Form", "Wrong name for destination relation.")) return try: # Converting string to utf8 and then from qstring to normal string expr = parser.parse(query) # Converting expression to python code - print query, "-->", expr # Printing debug + print (query, "-->", expr) # Printing debug result = eval(expr, self.relations) # Evaluating the expression self.relations[ @@ -110,10 +110,10 @@ class relForm(QtGui.QMainWindow): self.selectedRelation = result self.showRelation(self.selectedRelation) # Show the result in the table - except Exception, e: - print e.__unicode__() - QtGui.QMessageBox.information(None, QtGui.QApplication.translate("Form", "Error"), u"%s\n%s" % - (QtGui.QApplication.translate("Form", "Check your query!"), e.__unicode__())) + except Exception as e: + print (str(e)) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), u"%s\n%s" % + (QtWidgets.QApplication.translate("Form", "Check your query!"), str(e))) return # Adds to history @@ -138,7 +138,7 @@ class relForm(QtGui.QMainWindow): # Set content for i in rel.content: - item = QtGui.QTreeWidgetItem() + item = QtWidgets.QTreeWidgetItem() for j in range(len(i)): item.setText(j, i[j]) self.ui.table.addTopLevelItem(item) @@ -168,8 +168,8 @@ class relForm(QtGui.QMainWindow): self.ui.lstRelations.addItem(i) def saveRelation(self): - filename = QtGui.QFileDialog.getSaveFileName(self, QtGui.QApplication.translate( - "Form", "Save Relation"), "", QtGui.QApplication.translate("Form", "Relations (*.csv)")) + filename = QtWidgets.QFileDialog.getSaveFileName(self, QtWidgets.QApplication.translate( + "Form", "Save Relation"), "", QtWidgets.QApplication.translate("Form", "Relations (*.csv)")) filename = compatibility.get_filename(filename) if (len(filename) == 0): # Returns if no file was selected @@ -183,7 +183,7 @@ class relForm(QtGui.QMainWindow): self.updateRelations() def editRelation(self): - import creator + from relational_gui import creator for i in self.ui.lstRelations.selectedItems(): result = creator.edit_relation( self.relations[compatibility.get_py_str(i.text())]) @@ -192,17 +192,17 @@ class relForm(QtGui.QMainWindow): self.updateRelations() def newRelation(self): - import creator + from relational_gui import creator result = creator.edit_relation() if result == None: return - res = QtGui.QInputDialog.getText( + res = QtWidgets.QInputDialog.getText( self, - QtGui.QApplication.translate("Form", "New relation"), - QtGui.QApplication.translate( + QtWidgets.QApplication.translate("Form", "New relation"), + QtWidgets.QApplication.translate( "Form", "Insert the name for the new relation"), - QtGui.QLineEdit.Normal, '') + QtWidgets.QLineEdit.Normal, '') if res[1] == False or len(res[0]) == 0: return @@ -210,18 +210,18 @@ class relForm(QtGui.QMainWindow): name = compatibility.get_py_str(res[0]) if not rtypes.is_valid_relation_name(name): - r = QtGui.QApplication.translate( + r = QtWidgets.QApplication.translate( "Form", str("Wrong name for destination relation: %s." % name)) - QtGui.QMessageBox.information( - self, QtGui.QApplication.translate("Form", "Error"), r) + QtWidgets.QMessageBox.information( + self, QtWidgets.QApplication.translate("Form", "Error"), r) return try: self.relations[name] = result - except Exception, e: - print e - QtGui.QMessageBox.information(None, QtGui.QApplication.translate("Form", "Error"), "%s\n%s" % - (QtGui.QApplication.translate("Form", "Check your query!"), e.__str__())) + except Exception as e: + print (e) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), "%s\n%s" % + (QtWidgets.QApplication.translate("Form", "Check your query!"), e.__str__())) return self.updateRelations() @@ -249,7 +249,7 @@ class relForm(QtGui.QMainWindow): def showAbout(self): if self.About == None: - self.About = QtGui.QDialog() + self.About = QtWidgets.QDialog() ui = about.Ui_Dialog() ui.setupUi(self.About) self.About.show() @@ -260,8 +260,8 @@ class relForm(QtGui.QMainWindow): It shouldn't be called giving filename but not giving name.''' # Asking for file to load if filename == None: - filename = QtGui.QFileDialog.getOpenFileName(self, QtGui.QApplication.translate( - "Form", "Load Relation"), "", QtGui.QApplication.translate("Form", "Relations (*.csv);;Text Files (*.txt);;All Files (*)")) + filename = QtWidgets.QFileDialog.getOpenFileName(self, QtWidgets.QApplication.translate( + "Form", "Load Relation"), "", QtWidgets.QApplication.translate("Form", "Relations (*.csv);;Text Files (*.txt);;All Files (*)")) filename = compatibility.get_filename(filename) # Default relation's name @@ -275,29 +275,28 @@ class relForm(QtGui.QMainWindow): defname = defname[:-4] if name == None: # Prompt dialog to insert name for the relation - res = QtGui.QInputDialog.getText( - self, QtGui.QApplication.translate("Form", "New relation"), QtGui.QApplication.translate( + res = QtWidgets.QInputDialog.getText( + self, QtWidgets.QApplication.translate("Form", "New relation"), QtWidgets.QApplication.translate( "Form", "Insert the name for the new relation"), - QtGui.QLineEdit.Normal, defname) + QtWidgets.QLineEdit.Normal, defname) if res[1] == False or len(res[0]) == 0: return - # Patch provided by Angelo 'Havoc' Puglisi name = compatibility.get_py_str(res[0]) if not rtypes.is_valid_relation_name(name): - r = QtGui.QApplication.translate( + r = QtWidgets.QApplication.translate( "Form", str("Wrong name for destination relation: %s." % name)) - QtGui.QMessageBox.information( - self, QtGui.QApplication.translate("Form", "Error"), r) + QtWidgets.QMessageBox.information( + self, QtWidgets.QApplication.translate("Form", "Error"), r) return try: self.relations[name] = relation.relation(filename) - except Exception, e: - print e - QtGui.QMessageBox.information(None, QtGui.QApplication.translate("Form", "Error"), "%s\n%s" % - (QtGui.QApplication.translate("Form", "Check your query!"), e.__str__())) + except Exception as e: + print (e) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate("Form", "Error"), "%s\n%s" % + (QtWidgets.QApplication.translate("Form", "Check your query!"), e.__str__())) return self.updateRelations() diff --git a/relational_gui/maingui.py b/relational_gui/maingui.py index eb7913c..bd7c41f 100644 --- a/relational_gui/maingui.py +++ b/relational_gui/maingui.py @@ -2,120 +2,106 @@ # Form implementation generated from reading ui file 'relational_gui/maingui.ui' # -# Created: Fri Dec 27 00:23:51 2013 -# by: PyQt4 UI code generator 4.10.3 +# Created: Thu Feb 19 13:07:47 2015 +# by: PyQt5 UI code generator 5.3.2 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui - -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) +from PyQt5 import QtCore, QtGui, QtWidgets 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.verticalLayout_7 = QtGui.QVBoxLayout(self.centralwidget) - self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) - self.splitter_4 = QtGui.QSplitter(self.centralwidget) + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout_7 = QtWidgets.QVBoxLayout(self.centralwidget) + self.verticalLayout_7.setObjectName("verticalLayout_7") + self.splitter_4 = QtWidgets.QSplitter(self.centralwidget) self.splitter_4.setOrientation(QtCore.Qt.Horizontal) - self.splitter_4.setObjectName(_fromUtf8("splitter_4")) - self.layoutWidget = QtGui.QWidget(self.splitter_4) - self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) - self.verticalLayout_11 = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout_11.setMargin(0) - self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) - self.groupBox_3 = QtGui.QGroupBox(self.layoutWidget) - self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) - self.verticalLayout_5 = QtGui.QVBoxLayout(self.groupBox_3) - self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) - self.cmdAbout = QtGui.QPushButton(self.groupBox_3) - self.cmdAbout.setObjectName(_fromUtf8("cmdAbout")) + self.splitter_4.setObjectName("splitter_4") + self.layoutWidget = QtWidgets.QWidget(self.splitter_4) + self.layoutWidget.setObjectName("layoutWidget") + self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.layoutWidget) + self.verticalLayout_11.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_11.setObjectName("verticalLayout_11") + self.groupBox_3 = QtWidgets.QGroupBox(self.layoutWidget) + self.groupBox_3.setObjectName("groupBox_3") + self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.groupBox_3) + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.cmdAbout = QtWidgets.QPushButton(self.groupBox_3) + self.cmdAbout.setObjectName("cmdAbout") self.verticalLayout_5.addWidget(self.cmdAbout) - self.cmdSurvey = QtGui.QPushButton(self.groupBox_3) - self.cmdSurvey.setObjectName(_fromUtf8("cmdSurvey")) + self.cmdSurvey = QtWidgets.QPushButton(self.groupBox_3) + 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.verticalLayout_10 = QtGui.QVBoxLayout(self.groupBox_4) - self.verticalLayout_10.setObjectName(_fromUtf8("verticalLayout_10")) - self.cmdProduct = QtGui.QPushButton(self.groupBox_4) - self.cmdProduct.setObjectName(_fromUtf8("cmdProduct")) + self.groupBox_4 = QtWidgets.QGroupBox(self.layoutWidget) + self.groupBox_4.setObjectName("groupBox_4") + self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.groupBox_4) + self.verticalLayout_10.setObjectName("verticalLayout_10") + self.cmdProduct = QtWidgets.QPushButton(self.groupBox_4) + self.cmdProduct.setObjectName("cmdProduct") self.verticalLayout_10.addWidget(self.cmdProduct) - self.cmdDifference = QtGui.QPushButton(self.groupBox_4) - self.cmdDifference.setObjectName(_fromUtf8("cmdDifference")) + self.cmdDifference = QtWidgets.QPushButton(self.groupBox_4) + self.cmdDifference.setObjectName("cmdDifference") self.verticalLayout_10.addWidget(self.cmdDifference) - self.cmdUnion = QtGui.QPushButton(self.groupBox_4) - self.cmdUnion.setObjectName(_fromUtf8("cmdUnion")) + self.cmdUnion = QtWidgets.QPushButton(self.groupBox_4) + self.cmdUnion.setObjectName("cmdUnion") self.verticalLayout_10.addWidget(self.cmdUnion) - self.cmdIntersection = QtGui.QPushButton(self.groupBox_4) - self.cmdIntersection.setObjectName(_fromUtf8("cmdIntersection")) + self.cmdIntersection = QtWidgets.QPushButton(self.groupBox_4) + self.cmdIntersection.setObjectName("cmdIntersection") self.verticalLayout_10.addWidget(self.cmdIntersection) - self.cmdDivision = QtGui.QPushButton(self.groupBox_4) - self.cmdDivision.setObjectName(_fromUtf8("cmdDivision")) + self.cmdDivision = QtWidgets.QPushButton(self.groupBox_4) + self.cmdDivision.setObjectName("cmdDivision") self.verticalLayout_10.addWidget(self.cmdDivision) - self.cmdJoin = QtGui.QPushButton(self.groupBox_4) - self.cmdJoin.setObjectName(_fromUtf8("cmdJoin")) + self.cmdJoin = QtWidgets.QPushButton(self.groupBox_4) + self.cmdJoin.setObjectName("cmdJoin") self.verticalLayout_10.addWidget(self.cmdJoin) - self.cmdOuterLeft = QtGui.QPushButton(self.groupBox_4) - self.cmdOuterLeft.setObjectName(_fromUtf8("cmdOuterLeft")) + self.cmdOuterLeft = QtWidgets.QPushButton(self.groupBox_4) + self.cmdOuterLeft.setObjectName("cmdOuterLeft") self.verticalLayout_10.addWidget(self.cmdOuterLeft) - self.cmdOuterRight = QtGui.QPushButton(self.groupBox_4) - self.cmdOuterRight.setObjectName(_fromUtf8("cmdOuterRight")) + self.cmdOuterRight = QtWidgets.QPushButton(self.groupBox_4) + self.cmdOuterRight.setObjectName("cmdOuterRight") self.verticalLayout_10.addWidget(self.cmdOuterRight) - self.cmdOuter = QtGui.QPushButton(self.groupBox_4) - self.cmdOuter.setObjectName(_fromUtf8("cmdOuter")) + self.cmdOuter = QtWidgets.QPushButton(self.groupBox_4) + self.cmdOuter.setObjectName("cmdOuter") self.verticalLayout_10.addWidget(self.cmdOuter) - self.cmdProjection = QtGui.QPushButton(self.groupBox_4) - self.cmdProjection.setObjectName(_fromUtf8("cmdProjection")) + self.cmdProjection = QtWidgets.QPushButton(self.groupBox_4) + self.cmdProjection.setObjectName("cmdProjection") self.verticalLayout_10.addWidget(self.cmdProjection) - self.cmdSelection = QtGui.QPushButton(self.groupBox_4) - self.cmdSelection.setObjectName(_fromUtf8("cmdSelection")) + self.cmdSelection = QtWidgets.QPushButton(self.groupBox_4) + self.cmdSelection.setObjectName("cmdSelection") self.verticalLayout_10.addWidget(self.cmdSelection) - self.cmdRename = QtGui.QPushButton(self.groupBox_4) - self.cmdRename.setObjectName(_fromUtf8("cmdRename")) + self.cmdRename = QtWidgets.QPushButton(self.groupBox_4) + self.cmdRename.setObjectName("cmdRename") self.verticalLayout_10.addWidget(self.cmdRename) - self.cmdArrow = QtGui.QPushButton(self.groupBox_4) - self.cmdArrow.setObjectName(_fromUtf8("cmdArrow")) + self.cmdArrow = QtWidgets.QPushButton(self.groupBox_4) + self.cmdArrow.setObjectName("cmdArrow") self.verticalLayout_10.addWidget(self.cmdArrow) - spacerItem = QtGui.QSpacerItem(20, 25, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + spacerItem = QtWidgets.QSpacerItem(20, 25, QtWidgets.QSizePolicy.Minimum, QtWidgets.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 = QtWidgets.QSplitter(self.splitter_4) self.splitter_3.setOrientation(QtCore.Qt.Horizontal) - self.splitter_3.setObjectName(_fromUtf8("splitter_3")) - self.splitter_2 = QtGui.QSplitter(self.splitter_3) + self.splitter_3.setObjectName("splitter_3") + self.splitter_2 = QtWidgets.QSplitter(self.splitter_3) self.splitter_2.setOrientation(QtCore.Qt.Vertical) - self.splitter_2.setObjectName(_fromUtf8("splitter_2")) - self.table = QtGui.QTreeWidget(self.splitter_2) + self.splitter_2.setObjectName("splitter_2") + self.table = QtWidgets.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.layoutWidget1 = QtGui.QWidget(self.splitter_2) - self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) - self.verticalLayout_6 = QtGui.QVBoxLayout(self.layoutWidget1) - self.verticalLayout_6.setSizeConstraint(QtGui.QLayout.SetMinimumSize) - self.verticalLayout_6.setMargin(0) - self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) - self.lstHistory = QtGui.QListWidget(self.layoutWidget1) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) + self.table.setObjectName("table") + self.table.headerItem().setText(0, "Empty relation") + self.layoutWidget1 = QtWidgets.QWidget(self.splitter_2) + self.layoutWidget1.setObjectName("layoutWidget1") + self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.layoutWidget1) + self.verticalLayout_6.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize) + self.verticalLayout_6.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_6.setObjectName("verticalLayout_6") + self.lstHistory = QtWidgets.QListWidget(self.layoutWidget1) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lstHistory.sizePolicy().hasHeightForWidth()) @@ -125,129 +111,129 @@ 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.cmdOptimize = QtGui.QPushButton(self.layoutWidget1) - self.cmdOptimize.setObjectName(_fromUtf8("cmdOptimize")) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.cmdOptimize = QtWidgets.QPushButton(self.layoutWidget1) + self.cmdOptimize.setObjectName("cmdOptimize") self.horizontalLayout_3.addWidget(self.cmdOptimize) - self.cmdUndoOptimize = QtGui.QPushButton(self.layoutWidget1) - self.cmdUndoOptimize.setObjectName(_fromUtf8("cmdUndoOptimize")) + self.cmdUndoOptimize = QtWidgets.QPushButton(self.layoutWidget1) + self.cmdUndoOptimize.setObjectName("cmdUndoOptimize") self.horizontalLayout_3.addWidget(self.cmdUndoOptimize) - self.cmdClearHistory = QtGui.QPushButton(self.layoutWidget1) - self.cmdClearHistory.setObjectName(_fromUtf8("cmdClearHistory")) + self.cmdClearHistory = QtWidgets.QPushButton(self.layoutWidget1) + 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 = QtWidgets.QSplitter(self.splitter_3) self.splitter.setOrientation(QtCore.Qt.Vertical) - self.splitter.setObjectName(_fromUtf8("splitter")) - self.groupBox = QtGui.QGroupBox(self.splitter) + self.splitter.setObjectName("splitter") + self.groupBox = QtWidgets.QGroupBox(self.splitter) self.groupBox.setMinimumSize(QtCore.QSize(0, 0)) self.groupBox.setMaximumSize(QtCore.QSize(300, 16777215)) - self.groupBox.setObjectName(_fromUtf8("groupBox")) - self.verticalLayout = QtGui.QVBoxLayout(self.groupBox) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.lstRelations = QtGui.QListWidget(self.groupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + self.groupBox.setObjectName("groupBox") + self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) + self.verticalLayout.setObjectName("verticalLayout") + self.lstRelations = QtWidgets.QListWidget(self.groupBox) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) 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.cmdNew = QtGui.QPushButton(self.groupBox) - self.cmdNew.setObjectName(_fromUtf8("cmdNew")) + self.cmdNew = QtWidgets.QPushButton(self.groupBox) + self.cmdNew.setObjectName("cmdNew") self.verticalLayout.addWidget(self.cmdNew) - self.cmdLoad = QtGui.QPushButton(self.groupBox) - self.cmdLoad.setObjectName(_fromUtf8("cmdLoad")) + self.cmdLoad = QtWidgets.QPushButton(self.groupBox) + self.cmdLoad.setObjectName("cmdLoad") self.verticalLayout.addWidget(self.cmdLoad) - self.cmdSave = QtGui.QPushButton(self.groupBox) - self.cmdSave.setObjectName(_fromUtf8("cmdSave")) + self.cmdSave = QtWidgets.QPushButton(self.groupBox) + self.cmdSave.setObjectName("cmdSave") self.verticalLayout.addWidget(self.cmdSave) - self.cmdEdit = QtGui.QPushButton(self.groupBox) - self.cmdEdit.setObjectName(_fromUtf8("cmdEdit")) + self.cmdEdit = QtWidgets.QPushButton(self.groupBox) + self.cmdEdit.setObjectName("cmdEdit") self.verticalLayout.addWidget(self.cmdEdit) - self.cmdUnload = QtGui.QPushButton(self.groupBox) - self.cmdUnload.setObjectName(_fromUtf8("cmdUnload")) + self.cmdUnload = QtWidgets.QPushButton(self.groupBox) + self.cmdUnload.setObjectName("cmdUnload") self.verticalLayout.addWidget(self.cmdUnload) - self.groupBox_2 = QtGui.QGroupBox(self.splitter) + self.groupBox_2 = QtWidgets.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.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_2) - self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) - self.lstAttributes = QtGui.QListWidget(self.groupBox_2) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + self.groupBox_2.setObjectName("groupBox_2") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox_2) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.lstAttributes = QtWidgets.QListWidget(self.groupBox_2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) 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.txtResult = QtGui.QLineEdit(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.txtResult = QtWidgets.QLineEdit(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.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 = QtWidgets.QLabel(self.centralwidget) + self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) - self.txtQuery = QtGui.QLineEdit(self.centralwidget) - self.txtQuery.setObjectName(_fromUtf8("txtQuery")) + self.txtQuery = QtWidgets.QLineEdit(self.centralwidget) + self.txtQuery.setObjectName("txtQuery") self.horizontalLayout_2.addWidget(self.txtQuery) - self.cmdClearQuery = QtGui.QPushButton(self.centralwidget) - self.cmdClearQuery.setObjectName(_fromUtf8("cmdClearQuery")) + self.cmdClearQuery = QtWidgets.QPushButton(self.centralwidget) + self.cmdClearQuery.setObjectName("cmdClearQuery") self.horizontalLayout_2.addWidget(self.cmdClearQuery) - self.cmdExecute = QtGui.QPushButton(self.centralwidget) - self.cmdExecute.setObjectName(_fromUtf8("cmdExecute")) + self.cmdExecute = QtWidgets.QPushButton(self.centralwidget) + 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 = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 19)) - self.menubar.setObjectName(_fromUtf8("menubar")) - self.menuFile = QtGui.QMenu(self.menubar) - self.menuFile.setObjectName(_fromUtf8("menuFile")) - self.menuAbout = QtGui.QMenu(self.menubar) - self.menuAbout.setObjectName(_fromUtf8("menuAbout")) - self.action = QtGui.QAction(MainWindow) - self.action.setObjectName(_fromUtf8("action")) - self.menuRelations = QtGui.QMenu(self.menubar) - self.menuRelations.setObjectName(_fromUtf8("menuRelations")) + self.menubar.setObjectName("menubar") + self.menuFile = QtWidgets.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + self.menuAbout = QtWidgets.QMenu(self.menubar) + self.menuAbout.setObjectName("menuAbout") + self.action = QtWidgets.QAction(MainWindow) + self.action.setObjectName("action") + self.menuRelations = QtWidgets.QMenu(self.menubar) + self.menuRelations.setObjectName("menuRelations") MainWindow.setMenuBar(self.menubar) - self.actionAbout = QtGui.QAction(MainWindow) - self.actionAbout.setMenuRole(QtGui.QAction.AboutRole) - self.actionAbout.setObjectName(_fromUtf8("actionAbout")) - self.action_Load_relation = QtGui.QAction(MainWindow) - self.action_Load_relation.setObjectName(_fromUtf8("action_Load_relation")) - self.action_Save_relation = QtGui.QAction(MainWindow) - self.action_Save_relation.setObjectName(_fromUtf8("action_Save_relation")) - self.action_Quit = QtGui.QAction(MainWindow) - self.action_Quit.setMenuRole(QtGui.QAction.QuitRole) - self.action_Quit.setObjectName(_fromUtf8("action_Quit")) - self.actionCheck_for_new_versions = QtGui.QAction(MainWindow) - self.actionCheck_for_new_versions.setObjectName(_fromUtf8("actionCheck_for_new_versions")) - self.actionNew_relation = QtGui.QAction(MainWindow) - self.actionNew_relation.setObjectName(_fromUtf8("actionNew_relation")) - self.actionEdit_relation = QtGui.QAction(MainWindow) - self.actionEdit_relation.setObjectName(_fromUtf8("actionEdit_relation")) - self.actionNew_session = QtGui.QAction(MainWindow) - self.actionNew_session.setObjectName(_fromUtf8("actionNew_session")) - self.actionSave_session_as = QtGui.QAction(MainWindow) - self.actionSave_session_as.setObjectName(_fromUtf8("actionSave_session_as")) - self.actionManage_sessions = QtGui.QAction(MainWindow) - self.actionManage_sessions.setObjectName(_fromUtf8("actionManage_sessions")) - self.actionUnload_relation = QtGui.QAction(MainWindow) - self.actionUnload_relation.setObjectName(_fromUtf8("actionUnload_relation")) + self.actionAbout = QtWidgets.QAction(MainWindow) + self.actionAbout.setMenuRole(QtWidgets.QAction.AboutRole) + self.actionAbout.setObjectName("actionAbout") + self.action_Load_relation = QtWidgets.QAction(MainWindow) + self.action_Load_relation.setObjectName("action_Load_relation") + self.action_Save_relation = QtWidgets.QAction(MainWindow) + self.action_Save_relation.setObjectName("action_Save_relation") + self.action_Quit = QtWidgets.QAction(MainWindow) + self.action_Quit.setMenuRole(QtWidgets.QAction.QuitRole) + self.action_Quit.setObjectName("action_Quit") + self.actionCheck_for_new_versions = QtWidgets.QAction(MainWindow) + self.actionCheck_for_new_versions.setObjectName("actionCheck_for_new_versions") + self.actionNew_relation = QtWidgets.QAction(MainWindow) + self.actionNew_relation.setObjectName("actionNew_relation") + self.actionEdit_relation = QtWidgets.QAction(MainWindow) + self.actionEdit_relation.setObjectName("actionEdit_relation") + self.actionNew_session = QtWidgets.QAction(MainWindow) + self.actionNew_session.setObjectName("actionNew_session") + self.actionSave_session_as = QtWidgets.QAction(MainWindow) + self.actionSave_session_as.setObjectName("actionSave_session_as") + self.actionManage_sessions = QtWidgets.QAction(MainWindow) + self.actionManage_sessions.setObjectName("actionManage_sessions") + self.actionUnload_relation = QtWidgets.QAction(MainWindow) + self.actionUnload_relation.setObjectName("actionUnload_relation") self.menuFile.addSeparator() self.menuFile.addAction(self.action_Quit) self.menuAbout.addAction(self.actionAbout) @@ -263,45 +249,45 @@ 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.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.actionCheck_for_new_versions, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.checkVersion) - QtCore.QObject.connect(self.cmdEdit, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.editRelation) - QtCore.QObject.connect(self.actionEdit_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.editRelation) - QtCore.QObject.connect(self.cmdNew, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.newRelation) - QtCore.QObject.connect(self.actionNew_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.newRelation) - QtCore.QObject.connect(self.actionUnload_relation, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindow.unloadRelation) + self.cmdClearQuery.clicked.connect(self.txtQuery.clear) + self.cmdClearHistory.clicked.connect(self.lstHistory.clear) + self.txtQuery.returnPressed.connect(MainWindow.execute) + self.cmdExecute.clicked.connect(MainWindow.execute) + self.cmdAbout.clicked.connect(MainWindow.showAbout) + self.cmdSurvey.clicked.connect(MainWindow.showSurvey) + self.cmdProduct.clicked.connect(MainWindow.addProduct) + self.cmdDifference.clicked.connect(MainWindow.addDifference) + self.cmdArrow.clicked.connect(MainWindow.addArrow) + self.cmdRename.clicked.connect(MainWindow.addRename) + self.cmdSelection.clicked.connect(MainWindow.addSelection) + self.cmdProjection.clicked.connect(MainWindow.addProjection) + self.cmdUnload.clicked.connect(MainWindow.unloadRelation) + self.cmdSave.clicked.connect(MainWindow.saveRelation) + self.cmdLoad.clicked.connect(MainWindow.loadRelation) + self.cmdOptimize.clicked.connect(MainWindow.optimize) + self.cmdUndoOptimize.clicked.connect(MainWindow.undoOptimize) + self.txtResult.returnPressed.connect(self.txtQuery.setFocus) + self.cmdOuterRight.clicked.connect(MainWindow.addORight) + self.cmdOuter.clicked.connect(MainWindow.addOuter) + self.cmdOuterLeft.clicked.connect(MainWindow.addOLeft) + self.cmdJoin.clicked.connect(MainWindow.addJoin) + self.cmdDivision.clicked.connect(MainWindow.addDivision) + self.cmdIntersection.clicked.connect(MainWindow.addIntersection) + self.cmdUnion.clicked.connect(MainWindow.addUnion) + self.lstRelations.itemDoubleClicked['QListWidgetItem*'].connect(MainWindow.printRelation) + self.lstRelations.itemClicked['QListWidgetItem*'].connect(MainWindow.showAttributes) + self.cmdClearQuery.clicked.connect(self.txtQuery.setFocus) + self.lstHistory.itemDoubleClicked['QListWidgetItem*'].connect(MainWindow.resumeHistory) + self.actionAbout.triggered.connect(MainWindow.showAbout) + self.action_Load_relation.triggered.connect(MainWindow.loadRelation) + self.action_Save_relation.triggered.connect(MainWindow.saveRelation) + self.action_Quit.triggered.connect(MainWindow.close) + self.actionCheck_for_new_versions.triggered.connect(MainWindow.checkVersion) + self.cmdEdit.clicked.connect(MainWindow.editRelation) + self.actionEdit_relation.triggered.connect(MainWindow.editRelation) + self.cmdNew.clicked.connect(MainWindow.newRelation) + self.actionNew_relation.triggered.connect(MainWindow.newRelation) + self.actionUnload_relation.triggered.connect(MainWindow.unloadRelation) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.cmdAbout, self.cmdSurvey) MainWindow.setTabOrder(self.cmdSurvey, self.cmdProduct) @@ -333,69 +319,70 @@ class Ui_MainWindow(object): MainWindow.setTabOrder(self.cmdClearQuery, self.cmdExecute) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(_translate("MainWindow", "Relational", None)) - self.groupBox_3.setTitle(_translate("MainWindow", "Menu", None)) - self.cmdAbout.setText(_translate("MainWindow", "About", None)) - self.cmdSurvey.setText(_translate("MainWindow", "Survey", None)) - self.groupBox_4.setTitle(_translate("MainWindow", "Operators", None)) - self.cmdProduct.setToolTip(_translate("MainWindow", "Product", None)) - self.cmdProduct.setText(_translate("MainWindow", "*", None)) - self.cmdDifference.setToolTip(_translate("MainWindow", "Difference", None)) - self.cmdDifference.setText(_translate("MainWindow", "-", None)) - self.cmdUnion.setToolTip(_translate("MainWindow", "Union", None)) - self.cmdUnion.setText(_translate("MainWindow", "ᑌ", None)) - self.cmdIntersection.setToolTip(_translate("MainWindow", "Intersection", None)) - self.cmdIntersection.setText(_translate("MainWindow", "ᑎ", None)) - self.cmdDivision.setToolTip(_translate("MainWindow", "Division", None)) - self.cmdDivision.setText(_translate("MainWindow", "÷", None)) - self.cmdJoin.setToolTip(_translate("MainWindow", "Natural join", None)) - self.cmdJoin.setText(_translate("MainWindow", "ᐅᐊ", None)) - self.cmdOuterLeft.setToolTip(_translate("MainWindow", "Left outer join", None)) - self.cmdOuterLeft.setText(_translate("MainWindow", "ᐅLEFTᐊ", None)) - self.cmdOuterRight.setToolTip(_translate("MainWindow", "Right outer join", None)) - self.cmdOuterRight.setText(_translate("MainWindow", "ᐅRIGHTᐊ", None)) - self.cmdOuter.setToolTip(_translate("MainWindow", "Full outer join", None)) - self.cmdOuter.setText(_translate("MainWindow", "ᐅFULLᐊ", None)) - self.cmdProjection.setToolTip(_translate("MainWindow", "Projection", None)) - self.cmdProjection.setText(_translate("MainWindow", "π", None)) - self.cmdSelection.setToolTip(_translate("MainWindow", "Selection", None)) - self.cmdSelection.setText(_translate("MainWindow", "σ", None)) - self.cmdRename.setToolTip(_translate("MainWindow", "Rename", None)) - self.cmdRename.setText(_translate("MainWindow", "ρ", None)) - self.cmdArrow.setText(_translate("MainWindow", "➡", None)) - self.cmdOptimize.setText(_translate("MainWindow", "Optimize", None)) - self.cmdUndoOptimize.setText(_translate("MainWindow", "Undo optimize", None)) - self.cmdClearHistory.setText(_translate("MainWindow", "Clear history", None)) - self.groupBox.setTitle(_translate("MainWindow", "Relations", None)) + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "Relational")) + self.groupBox_3.setTitle(_translate("MainWindow", "Menu")) + self.cmdAbout.setText(_translate("MainWindow", "About")) + self.cmdSurvey.setText(_translate("MainWindow", "Survey")) + self.groupBox_4.setTitle(_translate("MainWindow", "Operators")) + self.cmdProduct.setToolTip(_translate("MainWindow", "Product")) + self.cmdProduct.setText(_translate("MainWindow", "*")) + self.cmdDifference.setToolTip(_translate("MainWindow", "Difference")) + self.cmdDifference.setText(_translate("MainWindow", "-")) + self.cmdUnion.setToolTip(_translate("MainWindow", "Union")) + self.cmdUnion.setText(_translate("MainWindow", "ᑌ")) + self.cmdIntersection.setToolTip(_translate("MainWindow", "Intersection")) + self.cmdIntersection.setText(_translate("MainWindow", "ᑎ")) + self.cmdDivision.setToolTip(_translate("MainWindow", "Division")) + self.cmdDivision.setText(_translate("MainWindow", "÷")) + self.cmdJoin.setToolTip(_translate("MainWindow", "Natural join")) + self.cmdJoin.setText(_translate("MainWindow", "ᐅᐊ")) + self.cmdOuterLeft.setToolTip(_translate("MainWindow", "Left outer join")) + self.cmdOuterLeft.setText(_translate("MainWindow", "ᐅLEFTᐊ")) + self.cmdOuterRight.setToolTip(_translate("MainWindow", "Right outer join")) + self.cmdOuterRight.setText(_translate("MainWindow", "ᐅRIGHTᐊ")) + self.cmdOuter.setToolTip(_translate("MainWindow", "Full outer join")) + self.cmdOuter.setText(_translate("MainWindow", "ᐅFULLᐊ")) + self.cmdProjection.setToolTip(_translate("MainWindow", "Projection")) + self.cmdProjection.setText(_translate("MainWindow", "π")) + self.cmdSelection.setToolTip(_translate("MainWindow", "Selection")) + self.cmdSelection.setText(_translate("MainWindow", "σ")) + self.cmdRename.setToolTip(_translate("MainWindow", "Rename")) + self.cmdRename.setText(_translate("MainWindow", "ρ")) + self.cmdArrow.setText(_translate("MainWindow", "➡")) + self.cmdOptimize.setText(_translate("MainWindow", "Optimize")) + self.cmdUndoOptimize.setText(_translate("MainWindow", "Undo optimize")) + self.cmdClearHistory.setText(_translate("MainWindow", "Clear history")) + self.groupBox.setTitle(_translate("MainWindow", "Relations")) self.lstRelations.setSortingEnabled(True) - self.cmdNew.setText(_translate("MainWindow", "New relation", None)) - self.cmdLoad.setText(_translate("MainWindow", "Load relation", None)) - self.cmdSave.setText(_translate("MainWindow", "Save relation", None)) - self.cmdEdit.setText(_translate("MainWindow", "Edit relation", None)) - self.cmdUnload.setText(_translate("MainWindow", "Unload relation", None)) - self.groupBox_2.setTitle(_translate("MainWindow", "Attributes", None)) - self.txtResult.setText(_translate("MainWindow", "_last1", None)) - self.label.setText(_translate("MainWindow", "=", None)) - self.cmdClearQuery.setText(_translate("MainWindow", "⌫", None)) - self.cmdExecute.setText(_translate("MainWindow", "Execute", None)) - self.menuFile.setTitle(_translate("MainWindow", "&File", None)) - self.menuAbout.setTitle(_translate("MainWindow", "&Help", None)) - self.menuRelations.setTitle(_translate("MainWindow", "Relations", None)) - self.actionAbout.setText(_translate("MainWindow", "&About", None)) - self.action_Load_relation.setText(_translate("MainWindow", "&Load relation", None)) - self.action_Load_relation.setShortcut(_translate("MainWindow", "Ctrl+O", None)) - self.action_Save_relation.setText(_translate("MainWindow", "&Save relation", None)) - self.action_Save_relation.setShortcut(_translate("MainWindow", "Ctrl+S", None)) - self.action_Quit.setText(_translate("MainWindow", "&Quit", None)) - self.action_Quit.setShortcut(_translate("MainWindow", "Ctrl+Q", None)) - self.actionCheck_for_new_versions.setText(_translate("MainWindow", "Check for new versions", None)) - self.actionNew_relation.setText(_translate("MainWindow", "New relation", None)) - self.actionNew_relation.setShortcut(_translate("MainWindow", "Ctrl+N", None)) - self.actionEdit_relation.setText(_translate("MainWindow", "Edit relation", None)) - self.actionEdit_relation.setShortcut(_translate("MainWindow", "Ctrl+E", None)) - self.actionNew_session.setText(_translate("MainWindow", "New session", None)) - self.actionSave_session_as.setText(_translate("MainWindow", "Save session as", None)) - self.actionSave_session_as.setToolTip(_translate("MainWindow", "Save session as", None)) - self.actionManage_sessions.setText(_translate("MainWindow", "Manage sessions", None)) - self.actionUnload_relation.setText(_translate("MainWindow", "Unload relation", None)) + self.cmdNew.setText(_translate("MainWindow", "New relation")) + self.cmdLoad.setText(_translate("MainWindow", "Load relation")) + self.cmdSave.setText(_translate("MainWindow", "Save relation")) + self.cmdEdit.setText(_translate("MainWindow", "Edit relation")) + self.cmdUnload.setText(_translate("MainWindow", "Unload relation")) + self.groupBox_2.setTitle(_translate("MainWindow", "Attributes")) + self.txtResult.setText(_translate("MainWindow", "_last1")) + self.label.setText(_translate("MainWindow", "=")) + self.cmdClearQuery.setText(_translate("MainWindow", "⌫")) + self.cmdExecute.setText(_translate("MainWindow", "Execute")) + self.menuFile.setTitle(_translate("MainWindow", "&File")) + self.menuAbout.setTitle(_translate("MainWindow", "&Help")) + self.menuRelations.setTitle(_translate("MainWindow", "Relations")) + self.actionAbout.setText(_translate("MainWindow", "&About")) + self.action_Load_relation.setText(_translate("MainWindow", "&Load relation")) + self.action_Load_relation.setShortcut(_translate("MainWindow", "Ctrl+O")) + self.action_Save_relation.setText(_translate("MainWindow", "&Save relation")) + self.action_Save_relation.setShortcut(_translate("MainWindow", "Ctrl+S")) + self.action_Quit.setText(_translate("MainWindow", "&Quit")) + self.action_Quit.setShortcut(_translate("MainWindow", "Ctrl+Q")) + self.actionCheck_for_new_versions.setText(_translate("MainWindow", "Check for new versions")) + self.actionNew_relation.setText(_translate("MainWindow", "New relation")) + self.actionNew_relation.setShortcut(_translate("MainWindow", "Ctrl+N")) + self.actionEdit_relation.setText(_translate("MainWindow", "Edit relation")) + self.actionEdit_relation.setShortcut(_translate("MainWindow", "Ctrl+E")) + self.actionNew_session.setText(_translate("MainWindow", "New session")) + self.actionSave_session_as.setText(_translate("MainWindow", "Save session as")) + self.actionSave_session_as.setToolTip(_translate("MainWindow", "Save session as")) + self.actionManage_sessions.setText(_translate("MainWindow", "Manage sessions")) + self.actionUnload_relation.setText(_translate("MainWindow", "Unload relation")) diff --git a/relational_gui/rel_edit.py b/relational_gui/rel_edit.py index 30c0811..f08c5b2 100644 --- a/relational_gui/rel_edit.py +++ b/relational_gui/rel_edit.py @@ -2,82 +2,69 @@ # Form implementation generated from reading ui file 'relational_gui/rel_edit.ui' # -# Created: Fri Dec 27 00:23:51 2013 -# by: PyQt4 UI code generator 4.10.3 +# Created: Thu Feb 19 13:07:47 2015 +# by: PyQt5 UI code generator 5.3.2 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui - -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) +from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): - Dialog.setObjectName(_fromUtf8("Dialog")) + Dialog.setObjectName("Dialog") Dialog.resize(594, 444) - self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog) - self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.groupBox = QtGui.QGroupBox(Dialog) - self.groupBox.setObjectName(_fromUtf8("groupBox")) - self.verticalLayout = QtGui.QVBoxLayout(self.groupBox) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.cmdAddTuple = QtGui.QPushButton(self.groupBox) - self.cmdAddTuple.setObjectName(_fromUtf8("cmdAddTuple")) + self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.groupBox = QtWidgets.QGroupBox(Dialog) + self.groupBox.setObjectName("groupBox") + self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) + self.verticalLayout.setObjectName("verticalLayout") + self.cmdAddTuple = QtWidgets.QPushButton(self.groupBox) + self.cmdAddTuple.setObjectName("cmdAddTuple") self.verticalLayout.addWidget(self.cmdAddTuple) - self.cmdRemoveTuple = QtGui.QPushButton(self.groupBox) - self.cmdRemoveTuple.setObjectName(_fromUtf8("cmdRemoveTuple")) + self.cmdRemoveTuple = QtWidgets.QPushButton(self.groupBox) + self.cmdRemoveTuple.setObjectName("cmdRemoveTuple") self.verticalLayout.addWidget(self.cmdRemoveTuple) - self.cmdAddColumn = QtGui.QPushButton(self.groupBox) - self.cmdAddColumn.setObjectName(_fromUtf8("cmdAddColumn")) + self.cmdAddColumn = QtWidgets.QPushButton(self.groupBox) + self.cmdAddColumn.setObjectName("cmdAddColumn") self.verticalLayout.addWidget(self.cmdAddColumn) - self.cmdRemoveColumn = QtGui.QPushButton(self.groupBox) - self.cmdRemoveColumn.setObjectName(_fromUtf8("cmdRemoveColumn")) + self.cmdRemoveColumn = QtWidgets.QPushButton(self.groupBox) + self.cmdRemoveColumn.setObjectName("cmdRemoveColumn") self.verticalLayout.addWidget(self.cmdRemoveColumn) self.horizontalLayout.addWidget(self.groupBox) - self.table = QtGui.QTableWidget(Dialog) - self.table.setObjectName(_fromUtf8("table")) + self.table = QtWidgets.QTableWidget(Dialog) + self.table.setObjectName("table") self.table.setColumnCount(0) self.table.setRowCount(0) self.horizontalLayout.addWidget(self.table) self.verticalLayout_2.addLayout(self.horizontalLayout) - self.label = QtGui.QLabel(Dialog) - self.label.setObjectName(_fromUtf8("label")) + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) - self.buttonBox = QtGui.QDialogButtonBox(Dialog) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(_fromUtf8("buttonBox")) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") self.verticalLayout_2.addWidget(self.buttonBox) self.retranslateUi(Dialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) - QtCore.QObject.connect(self.cmdAddColumn, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.addColumn) - QtCore.QObject.connect(self.cmdRemoveColumn, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.deleteColumn) - QtCore.QObject.connect(self.cmdAddTuple, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.addRow) - QtCore.QObject.connect(self.cmdRemoveTuple, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.deleteRow) + self.buttonBox.accepted.connect(Dialog.accept) + self.buttonBox.rejected.connect(Dialog.reject) + self.cmdAddColumn.clicked.connect(Dialog.addColumn) + self.cmdRemoveColumn.clicked.connect(Dialog.deleteColumn) + self.cmdAddTuple.clicked.connect(Dialog.addRow) + self.cmdRemoveTuple.clicked.connect(Dialog.deleteRow) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): - Dialog.setWindowTitle(_translate("Dialog", "Relation editor", None)) - self.groupBox.setTitle(_translate("Dialog", "Edit", None)) - self.cmdAddTuple.setText(_translate("Dialog", "Add tuple", None)) - self.cmdRemoveTuple.setText(_translate("Dialog", "Remove tuple", None)) - self.cmdAddColumn.setText(_translate("Dialog", "Add column", None)) - self.cmdRemoveColumn.setText(_translate("Dialog", "Remove column", None)) - self.label.setText(_translate("Dialog", "Remember that new relations and modified relations are not automatically saved", None)) + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Relation editor")) + self.groupBox.setTitle(_translate("Dialog", "Edit")) + self.cmdAddTuple.setText(_translate("Dialog", "Add tuple")) + self.cmdRemoveTuple.setText(_translate("Dialog", "Remove tuple")) + self.cmdAddColumn.setText(_translate("Dialog", "Add column")) + self.cmdRemoveColumn.setText(_translate("Dialog", "Remove column")) + self.label.setText(_translate("Dialog", "Remember that new relations and modified relations are not automatically saved")) diff --git a/relational_gui/survey.py b/relational_gui/survey.py index 3b4fa81..f6add18 100644 --- a/relational_gui/survey.py +++ b/relational_gui/survey.py @@ -2,98 +2,84 @@ # Form implementation generated from reading ui file 'relational_gui/survey.ui' # -# Created: Fri Dec 27 00:23:51 2013 -# by: PyQt4 UI code generator 4.10.3 +# Created: Thu Feb 19 13:07:47 2015 +# by: PyQt5 UI code generator 5.3.2 # # WARNING! All changes made in this file will be lost! -from PyQt4 import QtCore, QtGui - -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) +from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): def setupUi(self, Form): - Form.setObjectName(_fromUtf8("Form")) + Form.setObjectName("Form") Form.resize(422, 313) Form.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.verticalLayout = QtGui.QVBoxLayout(Form) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.formLayout = QtGui.QGridLayout() - self.formLayout.setObjectName(_fromUtf8("formLayout")) - self.txtSystem = QtGui.QLineEdit(Form) - self.txtSystem.setObjectName(_fromUtf8("txtSystem")) + self.verticalLayout = QtWidgets.QVBoxLayout(Form) + self.verticalLayout.setObjectName("verticalLayout") + self.formLayout = QtWidgets.QGridLayout() + self.formLayout.setObjectName("formLayout") + self.txtSystem = QtWidgets.QLineEdit(Form) + self.txtSystem.setObjectName("txtSystem") self.formLayout.addWidget(self.txtSystem, 0, 1, 1, 1) - self.label = QtGui.QLabel(Form) + self.label = QtWidgets.QLabel(Form) self.label.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.label.setObjectName(_fromUtf8("label")) + self.label.setObjectName("label") self.formLayout.addWidget(self.label, 1, 0, 1, 1) - self.txtCountry = QtGui.QLineEdit(Form) - self.txtCountry.setObjectName(_fromUtf8("txtCountry")) + self.txtCountry = QtWidgets.QLineEdit(Form) + self.txtCountry.setObjectName("txtCountry") self.formLayout.addWidget(self.txtCountry, 1, 1, 1, 1) - self.label_2 = QtGui.QLabel(Form) + self.label_2 = QtWidgets.QLabel(Form) self.label_2.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.label_2.setObjectName(_fromUtf8("label_2")) + self.label_2.setObjectName("label_2") self.formLayout.addWidget(self.label_2, 2, 0, 1, 1) - self.txtSchool = QtGui.QLineEdit(Form) - self.txtSchool.setObjectName(_fromUtf8("txtSchool")) + self.txtSchool = QtWidgets.QLineEdit(Form) + self.txtSchool.setObjectName("txtSchool") self.formLayout.addWidget(self.txtSchool, 2, 1, 1, 1) - self.label_3 = QtGui.QLabel(Form) + self.label_3 = QtWidgets.QLabel(Form) self.label_3.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.label_3.setObjectName(_fromUtf8("label_3")) + self.label_3.setObjectName("label_3") self.formLayout.addWidget(self.label_3, 3, 0, 1, 1) - self.txtAge = QtGui.QLineEdit(Form) - self.txtAge.setObjectName(_fromUtf8("txtAge")) + self.txtAge = QtWidgets.QLineEdit(Form) + self.txtAge.setObjectName("txtAge") self.formLayout.addWidget(self.txtAge, 3, 1, 1, 1) - self.label_4 = QtGui.QLabel(Form) + self.label_4 = QtWidgets.QLabel(Form) self.label_4.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.label_4.setObjectName(_fromUtf8("label_4")) + self.label_4.setObjectName("label_4") self.formLayout.addWidget(self.label_4, 4, 0, 1, 1) - self.txtFind = QtGui.QLineEdit(Form) - self.txtFind.setObjectName(_fromUtf8("txtFind")) + self.txtFind = QtWidgets.QLineEdit(Form) + self.txtFind.setObjectName("txtFind") self.formLayout.addWidget(self.txtFind, 4, 1, 1, 1) - self.label_5 = QtGui.QLabel(Form) + self.label_5 = QtWidgets.QLabel(Form) self.label_5.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) - self.label_5.setObjectName(_fromUtf8("label_5")) + self.label_5.setObjectName("label_5") self.formLayout.addWidget(self.label_5, 0, 0, 1, 1) - self.label_6 = QtGui.QLabel(Form) - self.label_6.setObjectName(_fromUtf8("label_6")) + self.label_6 = QtWidgets.QLabel(Form) + self.label_6.setObjectName("label_6") self.formLayout.addWidget(self.label_6, 6, 0, 1, 1) - self.txtComments = QtGui.QTextEdit(Form) + self.txtComments = QtWidgets.QTextEdit(Form) self.txtComments.setTabChangesFocus(True) - self.txtComments.setObjectName(_fromUtf8("txtComments")) + self.txtComments.setObjectName("txtComments") self.formLayout.addWidget(self.txtComments, 6, 1, 1, 1) - self.label_7 = QtGui.QLabel(Form) - self.label_7.setObjectName(_fromUtf8("label_7")) + self.label_7 = QtWidgets.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(_fromUtf8("txtEmail")) + self.txtEmail = QtWidgets.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(_fromUtf8("horizontalLayout")) - spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) - self.cmdCancel = QtGui.QPushButton(Form) - self.cmdCancel.setObjectName(_fromUtf8("cmdCancel")) + self.cmdCancel = QtWidgets.QPushButton(Form) + self.cmdCancel.setObjectName("cmdCancel") self.horizontalLayout.addWidget(self.cmdCancel) - self.cmdClear = QtGui.QPushButton(Form) - self.cmdClear.setObjectName(_fromUtf8("cmdClear")) + self.cmdClear = QtWidgets.QPushButton(Form) + self.cmdClear.setObjectName("cmdClear") self.horizontalLayout.addWidget(self.cmdClear) - self.cmdSend = QtGui.QPushButton(Form) + self.cmdSend = QtWidgets.QPushButton(Form) self.cmdSend.setDefault(True) - self.cmdSend.setObjectName(_fromUtf8("cmdSend")) + self.cmdSend.setObjectName("cmdSend") self.horizontalLayout.addWidget(self.cmdSend) self.verticalLayout.addLayout(self.horizontalLayout) self.label.setBuddy(self.txtCountry) @@ -105,21 +91,21 @@ class Ui_Form(object): self.label_7.setBuddy(self.txtEmail) self.retranslateUi(Form) - QtCore.QObject.connect(self.cmdCancel, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.close) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtComments.clear) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtFind.clear) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtAge.clear) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtSchool.clear) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtCountry.clear) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtSystem.clear) - QtCore.QObject.connect(self.txtSystem, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtCountry.setFocus) - QtCore.QObject.connect(self.txtCountry, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtSchool.setFocus) - QtCore.QObject.connect(self.txtSchool, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtAge.setFocus) - QtCore.QObject.connect(self.txtAge, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtFind.setFocus) - QtCore.QObject.connect(self.cmdSend, QtCore.SIGNAL(_fromUtf8("clicked()")), Form.send) - QtCore.QObject.connect(self.cmdClear, QtCore.SIGNAL(_fromUtf8("clicked()")), self.txtEmail.clear) - QtCore.QObject.connect(self.txtFind, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtEmail.setFocus) - QtCore.QObject.connect(self.txtEmail, QtCore.SIGNAL(_fromUtf8("returnPressed()")), self.txtComments.setFocus) + self.cmdCancel.clicked.connect(Form.close) + self.cmdClear.clicked.connect(self.txtComments.clear) + self.cmdClear.clicked.connect(self.txtFind.clear) + self.cmdClear.clicked.connect(self.txtAge.clear) + self.cmdClear.clicked.connect(self.txtSchool.clear) + self.cmdClear.clicked.connect(self.txtCountry.clear) + self.cmdClear.clicked.connect(self.txtSystem.clear) + self.txtSystem.returnPressed.connect(self.txtCountry.setFocus) + self.txtCountry.returnPressed.connect(self.txtSchool.setFocus) + self.txtSchool.returnPressed.connect(self.txtAge.setFocus) + self.txtAge.returnPressed.connect(self.txtFind.setFocus) + self.cmdSend.clicked.connect(Form.send) + self.cmdClear.clicked.connect(self.txtEmail.clear) + self.txtFind.returnPressed.connect(self.txtEmail.setFocus) + self.txtEmail.returnPressed.connect(self.txtComments.setFocus) QtCore.QMetaObject.connectSlotsByName(Form) Form.setTabOrder(self.txtSystem, self.txtCountry) Form.setTabOrder(self.txtCountry, self.txtSchool) @@ -132,15 +118,16 @@ class Ui_Form(object): Form.setTabOrder(self.cmdClear, self.cmdCancel) def retranslateUi(self, Form): - Form.setWindowTitle(_translate("Form", "Survey", None)) - self.label.setText(_translate("Form", "Country", None)) - self.label_2.setText(_translate("Form", "School", None)) - self.label_3.setText(_translate("Form", "Age", None)) - self.label_4.setText(_translate("Form", "How did you find relational", None)) - self.label_5.setText(_translate("Form", "System", None)) - self.label_6.setText(_translate("Form", "Comments", None)) - self.label_7.setText(_translate("Form", "Email (only if you want a reply)", None)) - self.cmdCancel.setText(_translate("Form", "Cancel", None)) - self.cmdClear.setText(_translate("Form", "Clear", None)) - self.cmdSend.setText(_translate("Form", "Send", None)) + _translate = QtCore.QCoreApplication.translate + Form.setWindowTitle(_translate("Form", "Survey")) + self.label.setText(_translate("Form", "Country")) + self.label_2.setText(_translate("Form", "School")) + self.label_3.setText(_translate("Form", "Age")) + self.label_4.setText(_translate("Form", "How did you find relational")) + self.label_5.setText(_translate("Form", "System")) + self.label_6.setText(_translate("Form", "Comments")) + self.label_7.setText(_translate("Form", "Email (only if you want a reply)")) + self.cmdCancel.setText(_translate("Form", "Cancel")) + self.cmdClear.setText(_translate("Form", "Clear")) + self.cmdSend.setText(_translate("Form", "Send")) diff --git a/relational_gui/surveyForm.py b/relational_gui/surveyForm.py index 09820e6..6a4812b 100644 --- a/relational_gui/surveyForm.py +++ b/relational_gui/surveyForm.py @@ -17,15 +17,17 @@ # # author Salvo "LtWorf" Tomaselli -from PyQt4 import QtCore, QtGui - -import compatibility -from relational import maintenance import platform import locale +from PyQt5 import QtCore, QtGui, QtWidgets -class surveyForm (QtGui.QWidget): +from relational_gui import compatibility +from relational import maintenance + + + +class surveyForm (QtWidgets.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''' @@ -85,10 +87,10 @@ class surveyForm (QtGui.QWidget): response = maintenance.send_survey(post) if response.status != 200: - QtGui.QMessageBox.information(None, QtGui.QApplication.translate( - "Form", "Error"), QtGui.QApplication.translate("Form", "Unable to send the data!")) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate( + "Form", "Error"), QtWidgets.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!")) + QtWidgets.QMessageBox.information(None, QtWidgets.QApplication.translate( + "Form", "Thanks"), QtWidgets.QApplication.translate("Form", "Thanks for sending!")) self.hide()