From 23740eea4d46b5817be417addbf7e263212925c2 Mon Sep 17 00:00:00 2001 From: LtWorf Date: Wed, 6 May 2009 13:38:58 +0000 Subject: [PATCH] added button to optimize git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@148 014f5005-505e-4b48-8d0a-63407b615a7c --- relational_gui/maingui.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/relational_gui/maingui.py b/relational_gui/maingui.py index febe614..8f7369e 100644 --- a/relational_gui/maingui.py +++ b/relational_gui/maingui.py @@ -17,7 +17,7 @@ # # author Salvo "LtWorf" Tomaselli from PyQt4 import QtCore, QtGui -from relational import relation, parser +from relational import relation, parser, optimizer import sys import about @@ -31,7 +31,10 @@ class Ui_Form(object): self.Survey=None self.relations={} #Dictionary for relations self.selectedRelation=None - + def optimize(self): + result=optimizer.general_optimize(str(self.txtQuery.text().toUtf8())) + self.txtQuery.setText(QtCore.QString.fromUtf8(result)) + #self.txtQuery.setText(result) def execute(self): try: #Converting string to utf8 and then from qstring to normal string @@ -373,6 +376,16 @@ class Ui_Form(object): self.cmdExecute.setFlat(False) self.cmdExecute.setObjectName("cmdExecute") self.horizontalLayout.addWidget(self.cmdExecute) + + + self.cmdOptimize = QtGui.QPushButton(Form) + self.cmdOptimize.setAutoDefault(False) + self.cmdOptimize.setDefault(True) + self.cmdOptimize.setFlat(False) + self.cmdOptimize.setObjectName("cmdOptimize") + self.horizontalLayout.addWidget(self.cmdOptimize) + + self.verticalLayout_7.addLayout(self.horizontalLayout) self.label.setBuddy(self.txtResult) self.label_2.setBuddy(self.txtQuery) @@ -394,6 +407,7 @@ class Ui_Form(object): QtCore.QObject.connect(self.cmdRename,QtCore.SIGNAL("clicked()"),self.addRename) QtCore.QObject.connect(self.cmdArrow,QtCore.SIGNAL("clicked()"),self.addArrow) QtCore.QObject.connect(self.cmdExecute,QtCore.SIGNAL("clicked()"),self.execute) + QtCore.QObject.connect(self.cmdOptimize,QtCore.SIGNAL("clicked()"),self.optimize) QtCore.QObject.connect(self.cmdLoad,QtCore.SIGNAL("clicked()"),self.loadRelation) QtCore.QObject.connect(self.cmdSave,QtCore.SIGNAL("clicked()"),self.saveRelation) QtCore.QObject.connect(self.cmdUnload,QtCore.SIGNAL("clicked()"),self.unloadRelation) @@ -404,7 +418,9 @@ class Ui_Form(object): QtCore.QMetaObject.connectSlotsByName(Form) Form.setTabOrder(self.txtResult,self.txtQuery) Form.setTabOrder(self.txtQuery,self.cmdExecute) + Form.setTabOrder(self.txtQuery,self.cmdOptimize) Form.setTabOrder(self.cmdExecute,self.lstRelations) + Form.setTabOrder(self.cmdOptimize,self.lstRelations) Form.setTabOrder(self.lstRelations,self.cmdLoad) Form.setTabOrder(self.cmdLoad,self.cmdUnload) Form.setTabOrder(self.cmdLoad,self.cmdSave) @@ -465,6 +481,7 @@ class Ui_Form(object): self.label.setText(QtGui.QApplication.translate("Form", "Query", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("Form", "=", None, QtGui.QApplication.UnicodeUTF8)) self.cmdExecute.setText(QtGui.QApplication.translate("Form", "Execute", None, QtGui.QApplication.UnicodeUTF8)) + self.cmdOptimize.setText(QtGui.QApplication.translate("Form", "Optimize", None, QtGui.QApplication.UnicodeUTF8)) if __name__ == "__main__": import sys