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:
parent
9c12a662ea
commit
ffa7140c6d
@ -95,3 +95,4 @@
|
||||
- Improved futile_union_intersection_subtraction, handles when a branch of subtracion has a selection (Rev 209)
|
||||
- Can load relations specified in command line (Rev 210)
|
||||
- Using fakeroot instead of su in make debian (Rev 214)
|
||||
- Fixed problem with float numbers with selection of certain relations (Rev 215)
|
@ -106,17 +106,16 @@ class relation (object):
|
||||
newt.header=header(list(self.header.attributes))
|
||||
for i in self.content:
|
||||
for j in range(len(self.header.attributes)):
|
||||
if i[j].isdigit():
|
||||
if len(i[j])>0 and i[j].isdigit():
|
||||
attributes[self.header.attributes[j]]=int(i[j])
|
||||
elif rstring(i[j]).isFloat():
|
||||
elif len(i[j])>0 and rstring(i[j]).isFloat():
|
||||
attributes[self.header.attributes[j]]=float(i[j])
|
||||
elif isDate(i[j]):
|
||||
elif len(i[j])>0 and isDate(i[j]):
|
||||
attributes[self.header.attributes[j]]=rdate(i[j])
|
||||
else:
|
||||
attributes[self.header.attributes[j]]=i[j]
|
||||
|
||||
|
||||
|
||||
if eval(expr,attributes):
|
||||
newt.content.append(i)
|
||||
return newt
|
||||
@ -259,8 +258,6 @@ class relation (object):
|
||||
'''Does a left and a right outer join and returns their union.'''
|
||||
a=self.outer_right(other)
|
||||
b=self.outer_left(other)
|
||||
print a
|
||||
print b
|
||||
|
||||
return a.union(b)
|
||||
|
||||
|
@ -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:
|
||||
else: #name was decided by caller
|
||||
self.relations[name]=relation.relation(filename,use_csv)
|
||||
|
||||
self.updateRelations()
|
||||
|
Loading…
x
Reference in New Issue
Block a user