http://bugs.async.com.br/show_bug.cgi?id=3876

           Summary: Numeric Data is sorting as string
           Product: Kiwi
           Version: SVN trunk
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: (unset)
         Component: ObjectList
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
   Estimated Hours: 0.0


Created an attachment (id=5098)
 --> (http://bugs.async.com.br/attachment.cgi?id=5098)
The objectlist modified

The sort method is sorting data as string.
Ex. The sequence 5, 54, 2, 23 when sorted is show as 2, 23, 5, 54.

To solve this problem the method model_sort_func was reimplemented as

def _model_sort_func(self, model, iter1, iter2, (column, attr)):
        "This method is used to sort the GtkTreeModel"
        ##########################################
        ######## Correcao na ordenacao de campos numericos
        ######## Thiago de Jesus Amancio
        ######## [email protected]
        ######## 02/12/08
        if (column.attribute_type() == int or column.attribute_type() ==
float):
                if (float(column.get_attribute(model[iter1][COL_MODEL], attr))
== float(column.get_attribute(model[iter2][COL_MODEL], attr))):
                        return 0
                elif (float(column.get_attribute(model[iter1][COL_MODEL],
attr)) > float(column.get_attribute(model[iter2][COL_MODEL], attr))):  
                        return 1            
                elif (float(column.get_attribute(model[iter1][COL_MODEL],
attr)) < float(column.get_attribute(model[iter2][COL_MODEL], attr))):   
                        return -1        
        else:                   
                return column.compare(                
                        column.get_attribute(model[iter1][COL_MODEL], attr),
                        column.get_attribute(model[iter2][COL_MODEL], attr)


-- 
Configure bugmail: http://bugs.async.com.br/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
Kiwi mailing list
[email protected]
http://www.async.com.br/mailman/listinfo/kiwi

Reply via email to