Phoenix: CustomTreeCtrl::SortChildren doesn't work

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Phoenix: CustomTreeCtrl::SortChildren doesn't work

Tiziano Tissino
Hi,

I'm just trying to port my wxPython applications to Phoenix and I got a couple of bugs in the CustomTreeCtrl::SortChildren method.

First, it uses six.sort method, that's undefinited in six module
Second, it uses a compare method (defaulting to CustomTreeCtrl.OnCompareItems) to sort children, instead of using a key function. This way, it will not work under python 3.x
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phoenix: CustomTreeCtrl::SortChildren doesn't work

Thomas
Hi,

this issues are not resolved in wxpython 4!

Thomas
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phoenix: CustomTreeCtrl::SortChildren doesn't work

Thomas
Possible patch:

-children = six.sort(children, self.OnCompareItems)
+from functools import cmp_to_key
+sorted(children, key=cmp_to_key(self.OnCompareItems))
Loading...