- Support for division operator in interfaces (not yet in the backend)

- Fixed error printing in qt ui for python 2.6



git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@238 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf 2010-07-02 13:50:06 +00:00
parent 84172d78bb
commit 215386350d
3 changed files with 15 additions and 3 deletions

View File

@ -101,6 +101,6 @@
- When a query fails, shows the message of the exception (Rev220)
- Improved tokenizer for select in optimizations, now can accept operators in identifiers (Rev220)
- Uses getopt to handle the command line in a more standard way
- Organized code so the ui can be either qt or curses
- Organized code so the ui can be either qt or command line
- Does not depend on QT anymore
- Added readline user interface

View File

@ -86,7 +86,7 @@ class Ui_Form(object):
self.showRelation(self.selectedRelation) #Show the result in the table
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.message) )
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"),"%s\n%s" % (QtGui.QApplication.translate("Form", "Check your query!"),e.__str__()) )
def showRelation(self,rel):
'''Shows the selected relation into the table'''
self.table.clear()
@ -236,6 +236,9 @@ class Ui_Form(object):
def addIntersection(self):
self.txtQuery.insert(u"")
self.txtQuery.setFocus()
def addDivision(self):
self.txtQuery.insert(u"÷")
self.txtQuery.setFocus()
def addOLeft(self):
self.txtQuery.insert(u"ᐅLEFTᐊ")
self.txtQuery.setFocus()
@ -260,6 +263,7 @@ class Ui_Form(object):
def addArrow(self):
self.txtQuery.insert(u"")
self.txtQuery.setFocus()
def setupUi(self, Form):
self.Form=Form
@ -305,6 +309,10 @@ class Ui_Form(object):
self.cmdIntersection.setMaximumSize(QtCore.QSize(16777215,16777215))
self.cmdIntersection.setObjectName("cmdIntersection")
self.verticalLayout.addWidget(self.cmdIntersection)
self.cmdDivision = QtGui.QPushButton(self.groupBox)
self.cmdDivision.setMaximumSize(QtCore.QSize(16777215,16777215))
self.cmdDivision.setObjectName("cmdDivision")
self.verticalLayout.addWidget(self.cmdDivision)
self.cmdJoin = QtGui.QPushButton(self.groupBox)
self.cmdJoin.setMaximumSize(QtCore.QSize(16777215,16777215))
self.cmdJoin.setObjectName("cmdJoin")
@ -483,6 +491,7 @@ class Ui_Form(object):
QtCore.QObject.connect(self.cmdDifference,QtCore.SIGNAL("clicked()"),self.addDifference)
QtCore.QObject.connect(self.cmdUnion,QtCore.SIGNAL("clicked()"),self.addUnion)
QtCore.QObject.connect(self.cmdIntersection,QtCore.SIGNAL("clicked()"),self.addIntersection)
QtCore.QObject.connect(self.cmdDivision,QtCore.SIGNAL("clicked()"),self.addDivision)
QtCore.QObject.connect(self.cmdOuterLeft,QtCore.SIGNAL("clicked()"),self.addOLeft)
QtCore.QObject.connect(self.cmdJoin,QtCore.SIGNAL("clicked()"),self.addJoin)
QtCore.QObject.connect(self.cmdOuterRight,QtCore.SIGNAL("clicked()"),self.addORight)
@ -542,6 +551,8 @@ class Ui_Form(object):
self.cmdUnion.setText(QtGui.QApplication.translate("Form", "", None, QtGui.QApplication.UnicodeUTF8))
self.cmdIntersection.setToolTip(QtGui.QApplication.translate("Form", "Intersection operator", None, QtGui.QApplication.UnicodeUTF8))
self.cmdIntersection.setText(QtGui.QApplication.translate("Form", "", None, QtGui.QApplication.UnicodeUTF8))
self.cmdDivision.setToolTip(QtGui.QApplication.translate("Form", "Division operator", None, QtGui.QApplication.UnicodeUTF8))
self.cmdDivision.setText(QtGui.QApplication.translate("Form", "÷", None, QtGui.QApplication.UnicodeUTF8))
self.cmdJoin.setToolTip(QtGui.QApplication.translate("Form", "Natural join operator", None, QtGui.QApplication.UnicodeUTF8))
self.cmdJoin.setText(QtGui.QApplication.translate("Form", "ᐅᐊ", None, QtGui.QApplication.UnicodeUTF8))
self.cmdOuterLeft.setToolTip(QtGui.QApplication.translate("Form", "Outer join left operator", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -91,7 +91,7 @@ class SimpleCompleter(object):
relations={}
completer=SimpleCompleter(['LIST','LOAD ','UNLOAD ','HELP ','QUIT','SAVE ','_PRODUCT ','_UNION ','_INTERSECTION ','_DIFFERENCE ','_JOIN ','_LJOIN ','_RJOIN ','_FJOIN ','_PROJECTION ','_RENAME_TO ','_SELECTION ','_RENAME '])
completer=SimpleCompleter(['LIST','LOAD ','UNLOAD ','HELP ','QUIT','SAVE ','_PRODUCT ','_UNION ','_INTERSECTION ','_DIFFERENCE ','_JOIN ','_LJOIN ','_RJOIN ','_FJOIN ','_PROJECTION ','_RENAME_TO ','_SELECTION ','_RENAME ','_DIVISION '])
def load_relation(filename,defname=None):
if not os.path.isfile(filename):
@ -212,6 +212,7 @@ def replacements(query):
query=query.replace( '_RENAME_TO' , '')
query=query.replace( '_SELECTION' , 'σ')
query=query.replace( '_RENAME' , 'ρ')
query=query.replace( '_DIVISION' , '÷')
return query
def exec_query(command):