comments and cleanup in about.py

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@207 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf
2009-07-16 06:56:39 +00:00
parent 4b6960b7be
commit 9efc56269e
4 changed files with 12 additions and 10 deletions

View File

@@ -90,4 +90,4 @@
- Selection can now accept expressions with parenthesis - Selection can now accept expressions with parenthesis
0.11 0.11
- Font is set only on windows - Font is set only on windows (Rev 206)

View File

@@ -67,9 +67,9 @@ def recoursive_scan(function,node,rels=None):
def duplicated_select(n): def duplicated_select(n):
changes=0
'''This function locates and deletes things like '''This function locates and deletes things like
σ a ( σ a(C)) and the ones like σ a ( σ b(C))''' σ a ( σ a(C)) and the ones like σ a ( σ b(C))'''
changes=0
if n.name=='σ' and n.child.name=='σ': if n.name=='σ' and n.child.name=='σ':
if n.prop != n.child.prop: #Nested but different, joining them if n.prop != n.child.prop: #Nested but different, joining them
n.prop = n.prop + " and " + n.child.prop n.prop = n.prop + " and " + n.child.prop
@@ -84,7 +84,7 @@ def futile_union_intersection_subtraction(n):
σ k (r) r with r σ k (r) r with r
σ k (r) ᑎ r with σ k (r) σ k (r) ᑎ r with σ k (r)
''' '''
#TODO document into the wiki
changes=0 changes=0
if n.name in ('','') and n.left==n.right: if n.name in ('','') and n.left==n.right:
@@ -102,6 +102,7 @@ def futile_union_intersection_subtraction(n):
replace_node(n,n.left) replace_node(n,n.left)
else: else:
replace_node(n,n.right) replace_node(n,n.right)
#TODO make work the following line...
#elif (n.name == '-' and ((n.left.name=='σ' and n.left.child==n.right) or (n.right.name=='σ' and n.right.child==n.left))): #Intersection of two equal things, but one has a selection #elif (n.name == '-' and ((n.left.name=='σ' and n.left.child==n.right) or (n.right.name=='σ' and n.right.child==n.left))): #Intersection of two equal things, but one has a selection
elif n.name=='-' and n.left==n.right:#Empty relation elif n.name=='-' and n.left==n.right:#Empty relation
changes=1 changes=1
@@ -175,7 +176,6 @@ def swap_union_renames(n):
and replaces them with and replaces them with
ρ a➡b(R Q). ρ a➡b(R Q).
Does the same with subtraction and intersection''' Does the same with subtraction and intersection'''
#TODO document into the wiki
changes=0 changes=0
if n.name in ('-','','') and n.left.name==n.right.name and n.left.name=='ρ': if n.name in ('-','','') and n.left.name==n.right.name and n.left.name=='ρ':
@@ -374,7 +374,6 @@ def swap_rename_projection(n):
and more important, will hopefully allow further optimizations. and more important, will hopefully allow further optimizations.
Will also eliminate fields in the rename that are cutted in the projection. Will also eliminate fields in the rename that are cutted in the projection.
''' '''
#TODO document into the wiki
changes=0 changes=0
if n.name=='π' and n.child.name=='ρ': if n.name=='π' and n.child.name=='ρ':

View File

@@ -110,10 +110,7 @@ class Ui_Dialog(object):
self.tabWidget.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept)
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject)
#QtCore.QObject.connect(self.label_4,QtCore.SIGNAL("linkActivated()"),self.openSite)
QtCore.QMetaObject.connectSlotsByName(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def openSite(self):
print "ciao"
def retranslateUi(self, Dialog): def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Documentation", 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))
@@ -121,7 +118,7 @@ class Ui_Dialog(object):
self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+version, None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+version, None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) self.label_3.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8))
if os.name=='nt': if os.name=='nt': #Differentiates acknowledgements depending on the system
self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>\nEmilio Di Prima <emiliodiprima [at] msn [dot] com> (For the windows version)", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>\nEmilio Di Prima <emiliodiprima [at] msn [dot] com> (For the windows version)", None, QtGui.QApplication.UnicodeUTF8))
else: else:
self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>", None, QtGui.QApplication.UnicodeUTF8))

View File

@@ -30,7 +30,7 @@ class Ui_Form(object):
self.About=None self.About=None
self.Survey=None self.Survey=None
self.relations={} #Dictionary for relations self.relations={} #Dictionary for relations
self.undo=[] #UndoQueue for relations self.undo=[] #UndoQueue for queries
self.selectedRelation=None self.selectedRelation=None
def load_query(self,*index): def load_query(self,*index):
self.txtQuery.setText(self.savedQ.itemData(index[0]).toString()) self.txtQuery.setText(self.savedQ.itemData(index[0]).toString())
@@ -44,17 +44,20 @@ class Ui_Form(object):
self.savedQ.addItem(res[0],QtCore.QVariant(self.txtQuery.text())) self.savedQ.addItem(res[0],QtCore.QVariant(self.txtQuery.text()))
def toggle_advanced(self): def toggle_advanced(self):
'''Hides or shows the advanced frame'''
if self.advancedBox.isVisible(): if self.advancedBox.isVisible():
self.advancedBox.hide() self.advancedBox.hide()
else: else:
self.advancedBox.show() self.advancedBox.show()
def undo_optimize(self): def undo_optimize(self):
'''Undoes the optimization on the query, popping one item from the undo list'''
try: try:
self.txtQuery.setText(self.undo.pop()) self.txtQuery.setText(self.undo.pop())
except:#Nothing to restore except:#Nothing to restore
pass pass
def optimize(self): def optimize(self):
'''Performs all the possible optimizations on the query'''
self.undo.insert(len(self.undo),self.txtQuery.text()) #Storing the query in undo list self.undo.insert(len(self.undo),self.txtQuery.text()) #Storing the query in undo list
result=optimizer.optimize_all(str(self.txtQuery.text().toUtf8()),self.relations) result=optimizer.optimize_all(str(self.txtQuery.text().toUtf8()),self.relations)
@@ -62,6 +65,7 @@ class Ui_Form(object):
#self.txtQuery.setText(result) #self.txtQuery.setText(result)
def execute(self): def execute(self):
'''Executes the query'''
try: try:
#Converting string to utf8 and then from qstring to normal string #Converting string to utf8 and then from qstring to normal string
query=str(self.txtQuery.text().toUtf8()) query=str(self.txtQuery.text().toUtf8())
@@ -83,6 +87,7 @@ class Ui_Form(object):
except: except:
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"),QtGui.QApplication.translate("Form", "Check your query!") )
def showRelation(self,rel): def showRelation(self,rel):
'''Shows the selected relation into the table'''
self.table.clear() self.table.clear()
if rel==None: #No relation to show if rel==None: #No relation to show
@@ -110,6 +115,7 @@ class Ui_Form(object):
self.showRelation(self.selectedRelation) self.showRelation(self.selectedRelation)
def showAttributes(self,*other): def showAttributes(self,*other):
'''Shows the attributes of the selected relation'''
for i in other: for i in other:
rel=str(i.text().toUtf8()) rel=str(i.text().toUtf8())
self.lstAttributes.clear() self.lstAttributes.clear()