From b0208259eefca6332faecc81ff9efb12549b3dde Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 25 Mar 2015 20:37:22 -0700 Subject: [PATCH] Use rich compare methods instead of __cmp__, as Python3 doesn't support the latter. --- etg/dataview.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etg/dataview.py b/etg/dataview.py index ba48854b..d0284821 100644 --- a/etg/dataview.py +++ b/etg/dataview.py @@ -82,11 +82,12 @@ def run(): c.addCppMethod('long', '__hash__', '()', """\ return (long)self->GetID(); """) - c.addCppMethod('int', '__cmp__', '(wxDataViewItem* other)', """\ - if ( self->GetID() < other->GetID() ) return -1; - if ( self->GetID() > other->GetID() ) return 1; - return 0; - """) + c.addCppMethod('bool', '__lt__', '(wxDataViewItem* other)', "return (self->GetID() < other->GetID());") + c.addCppMethod('bool', '__le__', '(wxDataViewItem* other)', "return (self->GetID() <= other->GetID());") + c.addCppMethod('bool', '__eq__', '(wxDataViewItem* other)', "return (self->GetID() == other->GetID());") + c.addCppMethod('bool', '__ne__', '(wxDataViewItem* other)', "return (self->GetID() != other->GetID());") + c.addCppMethod('bool', '__ge__', '(wxDataViewItem* other)', "return (self->GetID() >= other->GetID());") + c.addCppMethod('bool', '__gt__', '(wxDataViewItem* other)', "return (self->GetID() > other->GetID());") c.addAutoProperties()