completed GUI
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@31 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
1446e6d004
commit
2caad7a868
@ -21,3 +21,6 @@
|
|||||||
|
|
||||||
0.3
|
0.3
|
||||||
- Added support for parenthesis in relational queries
|
- Added support for parenthesis in relational queries
|
||||||
|
|
||||||
|
0.4
|
||||||
|
- Created GUI
|
4
about.py
4
about.py
@ -22,7 +22,7 @@ import relational
|
|||||||
|
|
||||||
class Ui_Dialog(object):
|
class Ui_Dialog(object):
|
||||||
def setupUi(self, Dialog):
|
def setupUi(self, Dialog):
|
||||||
Dialog.setObjectName("Documentation")
|
Dialog.setObjectName("Dialog")
|
||||||
Dialog.resize(510,453)
|
Dialog.resize(510,453)
|
||||||
self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog)
|
self.verticalLayout_2 = QtGui.QVBoxLayout(Dialog)
|
||||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||||
@ -96,7 +96,7 @@ class Ui_Dialog(object):
|
|||||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||||
|
|
||||||
def retranslateUi(self, Dialog):
|
def retranslateUi(self, Dialog):
|
||||||
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
|
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Documentation", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Relational", 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.setText(QtGui.QApplication.translate("Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8))
|
||||||
self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+relational.version, None, QtGui.QApplication.UnicodeUTF8))
|
self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+relational.version, None, QtGui.QApplication.UnicodeUTF8))
|
||||||
|
65
maingui.py
65
maingui.py
@ -24,6 +24,7 @@ import about
|
|||||||
|
|
||||||
class Ui_Form(object):
|
class Ui_Form(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.Dialog=None
|
||||||
self.relations={} #Dictionary for relations
|
self.relations={} #Dictionary for relations
|
||||||
def execute(self):
|
def execute(self):
|
||||||
try:
|
try:
|
||||||
@ -43,20 +44,15 @@ class Ui_Form(object):
|
|||||||
|
|
||||||
self.showRelation(result)
|
self.showRelation(result)
|
||||||
except:
|
except:
|
||||||
print
|
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"),QtGui.QApplication.translate("Form", "Check your query!") )
|
||||||
#QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"), str(traceback.print_exc()))
|
|
||||||
def showRelation(self,rel):
|
def showRelation(self,rel):
|
||||||
self.table.clear()
|
self.table.clear()
|
||||||
|
|
||||||
for i in range(self.table.headerItem().columnCount()):
|
|
||||||
self.table.headerItem().setText(i,"")
|
|
||||||
|
|
||||||
if rel==None:
|
if rel==None:
|
||||||
|
self.table.setColumnCount(1)
|
||||||
self.table.headerItem().setText(0,"Empty relation")
|
self.table.headerItem().setText(0,"Empty relation")
|
||||||
return
|
return
|
||||||
|
self.table.setColumnCount(len(rel.header.attributes))
|
||||||
for i in range(len(rel.header.attributes)):
|
|
||||||
self.table.headerItem().setText(i,rel.header.attributes[i])
|
|
||||||
|
|
||||||
for i in rel.content:
|
for i in rel.content:
|
||||||
item = QtGui.QTreeWidgetItem()
|
item = QtGui.QTreeWidgetItem()
|
||||||
@ -64,6 +60,11 @@ class Ui_Form(object):
|
|||||||
item.setText(j, i[j])
|
item.setText(j, i[j])
|
||||||
self.table.addTopLevelItem(item)
|
self.table.addTopLevelItem(item)
|
||||||
|
|
||||||
|
for i in range(len(rel.header.attributes)):
|
||||||
|
self.table.headerItem().setText(i,rel.header.attributes[i])
|
||||||
|
self.table.resizeColumnToContents(i)
|
||||||
|
|
||||||
|
|
||||||
def printRelation(self,*rel):
|
def printRelation(self,*rel):
|
||||||
for i in rel:
|
for i in rel:
|
||||||
self.showRelation(self.relations[str(i.text().toUtf8())])
|
self.showRelation(self.relations[str(i.text().toUtf8())])
|
||||||
@ -85,11 +86,12 @@ class Ui_Form(object):
|
|||||||
del self.relations[str(i.text().toUtf8())]
|
del self.relations[str(i.text().toUtf8())]
|
||||||
self.updateRelations()
|
self.updateRelations()
|
||||||
def showAbout(self):
|
def showAbout(self):
|
||||||
Dialog = QtGui.QDialog()
|
if self.Dialog==None:
|
||||||
ui = about.Ui_Dialog()
|
self.Dialog = QtGui.QDialog()
|
||||||
ui.setupUi(Dialog)
|
ui = about.Ui_Dialog()
|
||||||
Dialog.show()
|
ui.setupUi(self.Dialog)
|
||||||
sys.exit(app.exec_())
|
self.Dialog.show()
|
||||||
|
#sys.exit(app.exec_())
|
||||||
|
|
||||||
def loadRelation(self):
|
def loadRelation(self):
|
||||||
res=QtGui.QInputDialog.getText(None, QtGui.QApplication.translate("Form", "New relation"),QtGui.QApplication.translate("Form", "Insert the name for the new relation"))
|
res=QtGui.QInputDialog.getText(None, QtGui.QApplication.translate("Form", "New relation"),QtGui.QApplication.translate("Form", "Insert the name for the new relation"))
|
||||||
@ -100,29 +102,41 @@ class Ui_Form(object):
|
|||||||
self.updateRelations()
|
self.updateRelations()
|
||||||
|
|
||||||
def addProduct(self):
|
def addProduct(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+"*")
|
self.txtQuery.insert(u"*")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addDifference(self):
|
def addDifference(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"-")
|
self.txtQuery.insert(u"-")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addUnion(self):
|
def addUnion(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᑌ")
|
self.txtQuery.insert(u"ᑌ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addIntersection(self):
|
def addIntersection(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᑎ")
|
self.txtQuery.insert(u"ᑎ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addOLeft(self):
|
def addOLeft(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᐅLEFTᐊ")
|
self.txtQuery.insert(u"ᐅLEFTᐊ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addJoin(self):
|
def addJoin(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᐅᐊ")
|
self.txtQuery.insert(u"ᐅᐊ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addORight(self):
|
def addORight(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᐅRIGHTᐊ")
|
self.txtQuery.insert(u"ᐅRIGHTᐊ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addOuter(self):
|
def addOuter(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ᐅFULLᐊ")
|
self.txtQuery.insert(u"ᐅFULLᐊ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addProjection(self):
|
def addProjection(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"π")
|
self.txtQuery.insert(u"π")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addSelection(self):
|
def addSelection(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"σ")
|
self.txtQuery.insert(u"σ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addRename(self):
|
def addRename(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"ρ")
|
self.txtQuery.insert(u"ρ")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
def addArrow(self):
|
def addArrow(self):
|
||||||
self.txtQuery.setText(self.txtQuery.text()+u"➡")
|
self.txtQuery.insert(u"➡")
|
||||||
|
self.txtQuery.setFocus()
|
||||||
|
|
||||||
def setupUi(self, Form):
|
def setupUi(self, Form):
|
||||||
Form.setObjectName("Form")
|
Form.setObjectName("Form")
|
||||||
@ -263,6 +277,7 @@ class Ui_Form(object):
|
|||||||
self.label_2.setBuddy(self.txtQuery)
|
self.label_2.setBuddy(self.txtQuery)
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QObject.connect(self.txtQuery,QtCore.SIGNAL("returnPressed()"),self.execute)
|
||||||
QtCore.QObject.connect(self.cmdAbout,QtCore.SIGNAL("clicked()"),self.showAbout)
|
QtCore.QObject.connect(self.cmdAbout,QtCore.SIGNAL("clicked()"),self.showAbout)
|
||||||
QtCore.QObject.connect(self.cmdProduct,QtCore.SIGNAL("clicked()"),self.addProduct)
|
QtCore.QObject.connect(self.cmdProduct,QtCore.SIGNAL("clicked()"),self.addProduct)
|
||||||
QtCore.QObject.connect(self.cmdDifference,QtCore.SIGNAL("clicked()"),self.addDifference)
|
QtCore.QObject.connect(self.cmdDifference,QtCore.SIGNAL("clicked()"),self.addDifference)
|
||||||
|
@ -24,7 +24,7 @@ import parser
|
|||||||
import relation
|
import relation
|
||||||
import maingui
|
import maingui
|
||||||
|
|
||||||
version="0.4rc1"
|
version="0.4"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QtGui.QApplication(sys.argv)
|
app = QtGui.QApplication(sys.argv)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user