QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
res_rel=compatibility.get_py_str(self.ui.txtResult.text())#result relation's name
res_rel=compatibility.get_py_str(self.ui.txtResult.text())#result relation's name
ifnotrtypes.is_valid_relation_name(res_rel):
ifnotrtypes.is_valid_relation_name(res_rel):
QtGui.QMessageBox.information(self,QtGui.QApplication.translate("Form","Error"),QtGui.QApplication.translate("Form","Wrong name for destination relation."))
QtGui.QMessageBox.information(self,QtGui.QApplication.translate("Form","Error"),QtGui.QApplication.translate("Form","Wrong name for destination relation."))
return
return
try:
try:
#Converting string to utf8 and then from qstring to normal string
#Converting string to utf8 and then from qstring to normal string
expr=parser.parse(query)#Converting expression to python code
expr=parser.parse(query)#Converting expression to python code
printquery,"-->",expr#Printing debug
printquery,"-->",expr#Printing debug
result=eval(expr,self.relations)#Evaluating the expression
result=eval(expr,self.relations)#Evaluating the expression
self.relations[res_rel]=result#Add the relation to the dictionary
self.relations[res_rel]=result#Add the relation to the dictionary
self.updateRelations()#update the list
self.updateRelations()#update the list
self.selectedRelation=result
self.selectedRelation=result
@ -111,44 +119,44 @@ class relForm(QtGui.QMainWindow):
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
@ -214,6 +231,7 @@ class relForm(QtGui.QMainWindow):
ui.setupUi(self.Survey)
ui.setupUi(self.Survey)
self.Survey.setDefaultValues()
self.Survey.setDefaultValues()
self.Survey.show()
self.Survey.show()
defshowAbout(self):
defshowAbout(self):
ifself.About==None:
ifself.About==None:
self.About=QtGui.QDialog()
self.About=QtGui.QDialog()
@ -233,35 +251,35 @@ class relForm(QtGui.QMainWindow):
#Default relation's name
#Default relation's name
f=filename.split('/')#Split the full path
f=filename.split('/')#Split the full path
defname=f[len(f)-1].lower()#Takes only the lowercase filename
defname=f[len(f)-1].lower()#Takes only the lowercase filename
iflen(defname)==0:
iflen(defname)==0:
return
return
if(defname.endswith(".csv")):#removes the extension
if(defname.endswith(".csv")):#removes the extension
defname=defname[:-4]
defname=defname[:-4]
ifname==None:#Prompt dialog to insert name for the relation
ifname==None:#Prompt dialog to insert name for the relation
res=QtGui.QInputDialog.getText(self,QtGui.QApplication.translate("Form","New relation"),QtGui.QApplication.translate("Form","Insert the name for the new relation"),
res=QtGui.QInputDialog.getText(self,QtGui.QApplication.translate("Form","New relation"),QtGui.QApplication.translate("Form","Insert the name for the new relation"),
QtGui.QLineEdit.Normal,defname)
QtGui.QLineEdit.Normal,defname)
ifres[1]==Falseorlen(res[0])==0:
ifres[1]==Falseorlen(res[0])==0:
return
return
#Patch provided by Angelo 'Havoc' Puglisi
#Patch provided by Angelo 'Havoc' Puglisi
name=compatibility.get_py_str(res[0])
name=compatibility.get_py_str(res[0])
ifnotrtypes.is_valid_relation_name(name):
ifnotrtypes.is_valid_relation_name(name):
r=QtGui.QApplication.translate("Form",str("Wrong name for destination relation: %s."%name))
r=QtGui.QApplication.translate("Form",str("Wrong name for destination relation: %s."%name))
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form","Error"),"%s\n%s"%(QtGui.QApplication.translate("Form","Check your query!"),e.__str__()))
return
return
self.updateRelations()
self.updateRelations()
defaddProduct(self):
defaddProduct(self):
@ -290,8 +308,7 @@ class relForm(QtGui.QMainWindow):