Fixed problem with float numbers with selection of certain relations

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@215 014f5005-505e-4b48-8d0a-63407b615a7c
This commit is contained in:
LtWorf
2009-09-18 22:57:02 +00:00
parent 9c12a662ea
commit ffa7140c6d
3 changed files with 10 additions and 13 deletions

View File

@@ -159,7 +159,8 @@ class Ui_Form(object):
def loadRelation(self,filename=None,name=None):
'''Loads a relation. Without parameters it will ask the user which relation to load,
otherwise it will load filename, giving it name'''
otherwise it will load filename, giving it name.
It shouldn't be called giving filename but not giving name.'''
#Asking for file to load
if filename==None:
filename = QtGui.QFileDialog.getOpenFileName(None,QtGui.QApplication.translate("Form", "Load Relation"),"",QtGui.QApplication.translate("Form", "Relations (*.csv);;Old Relations (*.tlb);;Text Files (*.txt);;All Files (*)"))
@@ -183,17 +184,15 @@ class Ui_Form(object):
if (defname.endswith(".csv")): #removes the extension
defname=defname[:-4]
if name==None:
if name==None: #Prompt dialog to insert name for the relation
res=QtGui.QInputDialog.getText(self.Form, QtGui.QApplication.translate("Form", "New relation"),QtGui.QApplication.translate("Form", "Insert the name for the new relation"),
QtGui.QLineEdit.Normal,defname)
if res[1]==False or len(res[0])==0:
return
#self.relations[str(res[0].toUtf8())]=relation.relation(filename,use_csv)
#Patch provided by Angelo 'Havoc' Puglisi
self.relations[str(res[0].toUtf8())]=relation.relation(str(filename.toUtf8()),use_csv)
else:
self.relations[str(res[0].toUtf8())]=relation.relation(str(filename.toUtf8()),use_csv)
else: #name was decided by caller
self.relations[name]=relation.relation(filename,use_csv)
self.updateRelations()