Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 863494 | Differences between
and this patch

Collapse All | Expand All

(-)wxPython-4.0.7.post2/etg/region.py (-2 / +3 lines)
Lines 88-98 Link Here
88
    c.mustHaveApp()
88
    c.mustHaveApp()
89
    c.find('operator++').ignore()
89
    c.find('operator++').ignore()
90
90
91
    # SIP maps operator bool() to __int__, but Classic used __nonzero__. Does
92
    # it make any difference either way?
93
    c.find('operator bool').ignore()
91
    c.find('operator bool').ignore()
94
    c.addCppMethod('int', '__nonzero__', '()', 'return (int)self->operator bool();',
92
    c.addCppMethod('int', '__nonzero__', '()', 'return (int)self->operator bool();',
95
                   'Returns true while there are still rectangles available in the iteration.')
93
                   'Returns true while there are still rectangles available in the iteration.')
94
    c.addCppMethod('int', '__bool__', '()', 'return (int)self->operator bool();',
95
                   'Returns true while there are still rectangles available in the iteration.')
96
96
97
97
    c.addCppMethod('void', 'Next', '()', 'self->operator++();',
98
    c.addCppMethod('void', 'Next', '()', 'self->operator++();',
98
                   'Move the iterator to the next rectangle in the region.')
99
                   'Move the iterator to the next rectangle in the region.')
(-)wxPython-4.0.7.post2/etg/windowid.py (-15 / +17 lines)
Lines 53-64 Link Here
53
                MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True,
53
                MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True,
54
                    briefDoc='Create reference from an ID',
54
                    briefDoc='Create reference from an ID',
55
                    items=[ ParamDef(type='int', name='id') ]),
55
                    items=[ ParamDef(type='int', name='id') ]),
56
                
56
57
                MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True,
57
                MethodDef(name='wxWindowIDRef', className='wxWindowIDRef', isCtor=True,
58
                    briefDoc='Copy an ID reference',
58
                    briefDoc='Copy an ID reference',
59
                    items=[ ParamDef(type='const wxWindowIDRef&', name='idref') ]),
59
                    items=[ ParamDef(type='const wxWindowIDRef&', name='idref') ]),
60
                ]),
60
                ]),
61
            
61
62
            MethodDef(name='~wxWindowIDRef', className='wxWindowIDRef', isDtor=True),
62
            MethodDef(name='~wxWindowIDRef', className='wxWindowIDRef', isDtor=True),
63
63
64
            MethodDef(type='int', name='GetValue',
64
            MethodDef(type='int', name='GetValue',
Lines 73-83 Link Here
73
            """)
73
            """)
74
74
75
    klass.addCppMethod('int', '__int__', '()',
75
    klass.addCppMethod('int', '__int__', '()',
76
        doc="Alias for GetValue allowing the IDRef to be passed as the WindowID parameter when creating widgets or etc.",
76
        doc="Alias for GetValue allowing the IDRef to be passed as the WindowID parameter when creating widgets or other places an integer type is needed.",
77
        body="""\
77
        body="return self->GetValue();")
78
            return self->GetValue();
78
    klass.addCppMethod('int', '__index__', '()',
79
            """)
79
        doc="See :meth:`__int__`",
80
    
80
        body="return self->GetValue();")
81
82
81
    klass.addCppMethod('bool', '__eq__', '(wxWindowID id)', "return self->GetValue() == id;")
83
    klass.addCppMethod('bool', '__eq__', '(wxWindowID id)', "return self->GetValue() == id;")
82
    klass.addCppMethod('bool', '__ne__', '(wxWindowID id)', "return self->GetValue() != id;")
84
    klass.addCppMethod('bool', '__ne__', '(wxWindowID id)', "return self->GetValue() != id;")
83
    klass.addCppMethod('bool', '__lt__', '(wxWindowID id)', "return self->GetValue() < id;")
85
    klass.addCppMethod('bool', '__lt__', '(wxWindowID id)', "return self->GetValue() < id;")
Lines 92-108 Link Here
92
    # and finish it up by adding it to the module
94
    # and finish it up by adding it to the module
93
    module.addItem(klass)
95
    module.addItem(klass)
94
96
95
    # Now, let's add a new Python function to the global scope that reserves an 
97
    # Now, let's add a new Python function to the global scope that reserves an
96
    # ID (or range) and returns a ref object for it. 
98
    # ID (or range) and returns a ref object for it.
97
    module.addPyFunction('NewIdRef', '(count=1)', 
99
    module.addPyFunction('NewIdRef', '(count=1)',
98
        doc="""\
100
        doc="""\
99
            Reserves a new Window ID (or range of WindowIDs) and returns a 
101
            Reserves a new Window ID (or range of WindowIDs) and returns a
100
            :class:`wx.WindowIDRef` object (or list of them) that will help 
102
            :class:`wx.WindowIDRef` object (or list of them) that will help
101
            manage the reservation of that ID.
103
            manage the reservation of that ID.
102
104
103
            This function is intended to be a drop-in replacement of the old 
105
            This function is intended to be a drop-in replacement of the old
104
            and deprecated :func:`wx.NewId` function, with the added benefit 
106
            and deprecated :func:`wx.NewId` function, with the added benefit
105
            that the ID should never conflict with an in-use ID or other IDs 
107
            that the ID should never conflict with an in-use ID or other IDs
106
            generated by this function.
108
            generated by this function.
107
            """,
109
            """,
108
        body="""\
110
        body="""\
(-)wxPython-4.0.7.post2/unittests/test_windowid.py (+19 lines)
Lines 75-80 Link Here
75
        val = ref1 <= ref2
75
        val = ref1 <= ref2
76
        assert type(val) == bool
76
        assert type(val) == bool
77
77
78
78
    def test_WindowIDRef02(self):
79
    def test_WindowIDRef02(self):
79
        d = {wx.NewIdRef(): 'one',
80
        d = {wx.NewIdRef(): 'one',
80
             wx.NewIdRef(): 'two'}
81
             wx.NewIdRef(): 'two'}
Lines 82-87 Link Here
82
        for k in keys:
83
        for k in keys:
83
            val = d[k]
84
            val = d[k]
84
85
86
87
    def test_WindowIDRef03(self):
88
        # Ensure wx.WindowIDRef can be converted to int without warning when
89
        # making a call to warrped method. In Py3.8+ this means there needs to
90
        # be an __index__ method.
91
92
        # Turn warnings into exceptions so this test will fail if there is
93
        # a warning
94
        import warnings
95
        warnings.simplefilter('error')
96
97
        wid = wx.NewIdRef()
98
        assert isinstance(wid, wx.WindowIDRef)
99
100
        b = wx.Button(self.frame, wid, 'button')
101
        assert b.GetId() == wid.GetId()
102
103
85
#---------------------------------------------------------------------------
104
#---------------------------------------------------------------------------
86
105
87
106

Return to bug 863494