- tests with pyside and fixes
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@332 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
parent
466c72ab2c
commit
ee1e103c8f
@ -32,11 +32,11 @@ def get_py_str(a):
|
|||||||
'''Returns a python string out of a QString'''
|
'''Returns a python string out of a QString'''
|
||||||
if pyqt:
|
if pyqt:
|
||||||
return unicode(a.toUtf8(),'utf-8')
|
return unicode(a.toUtf8(),'utf-8')
|
||||||
return unicode(a.encode("utf-8")) #Already a python string in PySide
|
return a #Already a python string in PySide
|
||||||
|
|
||||||
def set_utf8_text(component,text):
|
def set_utf8_text(component,text):
|
||||||
if not pyqt:
|
if not pyqt:
|
||||||
component.setText(text.decode("utf-8"))
|
component.setText(text)
|
||||||
else:
|
else:
|
||||||
component.setText(QtCore.QString.fromUtf8(text))
|
component.setText(QtCore.QString.fromUtf8(text))
|
||||||
def get_filename(filename):
|
def get_filename(filename):
|
||||||
|
@ -69,8 +69,13 @@ class relForm(QtGui.QMainWindow):
|
|||||||
self.undo=self.ui.txtQuery.text() #Storing the query in undo list
|
self.undo=self.ui.txtQuery.text() #Storing the query in undo list
|
||||||
|
|
||||||
query=compatibility.get_py_str(self.ui.txtQuery.text())
|
query=compatibility.get_py_str(self.ui.txtQuery.text())
|
||||||
result=optimizer.optimize_all(query,self.relations)
|
try:
|
||||||
compatibility.set_utf8_text(self.ui.txtQuery,result)
|
result=optimizer.optimize_all(query,self.relations)
|
||||||
|
compatibility.set_utf8_text(self.ui.txtQuery,result)
|
||||||
|
except Exception, e:
|
||||||
|
QtGui.QMessageBox.information(None,QtGui.QApplication.translate("Form", "Error"),"%s\n%s" % (QtGui.QApplication.translate("Form", "Check your query!"),e.__str__()) )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def resumeHistory(self,item):
|
def resumeHistory(self,item):
|
||||||
itm=compatibility.get_py_str(item.text()).split(' = ',1)
|
itm=compatibility.get_py_str(item.text()).split(' = ',1)
|
||||||
@ -87,7 +92,6 @@ class relForm(QtGui.QMainWindow):
|
|||||||
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
|
||||||
|
|
||||||
expr=parser.parse(query)#Converting expression to python code
|
|
||||||
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
|
||||||
@ -104,7 +108,7 @@ class relForm(QtGui.QMainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
#Adds to history
|
#Adds to history
|
||||||
item='%s = %s' % (compatibility.get_py_str(self.ui.txtResult.text()),compatibility.get_py_str(self.ui.txtQuery.text()))
|
item=u'%s = %s' % (compatibility.get_py_str(self.ui.txtResult.text()),compatibility.get_py_str(self.ui.txtQuery.text()))
|
||||||
#item=item.decode('utf-8'))
|
#item=item.decode('utf-8'))
|
||||||
compatibility.add_list_item(self.ui.lstHistory,item)
|
compatibility.add_list_item(self.ui.lstHistory,item)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user