More notes about the type conversion fragment.
Cross linked CHANGES and MigrarionGuide. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<h1 class="title">Recent Changes for wxPython</h1>
|
<h1 class="title">Recent Changes for wxPython</h1>
|
||||||
<div class="section" id="id1">
|
<div class="section" id="id1">
|
||||||
<h1><a name="id1">2.5.1.4</a></h1>
|
<h1><a name="id1">2.5.1.4</a></h1>
|
||||||
<p>(See also the MigrationGuide.txt file for details about some of the
|
<p>(See also the <a class="reference" href="MigrationGuide.html">MigrationGuide</a> file for details about some of the
|
||||||
big changes that have happened in this release and how you should
|
big changes that have happened in this release and how you should
|
||||||
adapt your code.)</p>
|
adapt your code.)</p>
|
||||||
<p>The wxWindows project and library is now known as wxWidgets. Please
|
<p>The wxWindows project and library is now known as wxWidgets. Please
|
||||||
|
@@ -4,10 +4,13 @@ Recent Changes for wxPython
|
|||||||
2.5.1.4
|
2.5.1.4
|
||||||
-------
|
-------
|
||||||
|
|
||||||
(See also the MigrationGuide.txt file for details about some of the
|
(See also the MigrationGuide_ file for details about some of the
|
||||||
big changes that have happened in this release and how you should
|
big changes that have happened in this release and how you should
|
||||||
adapt your code.)
|
adapt your code.)
|
||||||
|
|
||||||
|
.. _MigrationGuide: MigrationGuide.html
|
||||||
|
|
||||||
|
|
||||||
The wxWindows project and library is now known as wxWidgets. Please
|
The wxWindows project and library is now known as wxWidgets. Please
|
||||||
see http://www.wxwindows.org/name.htm for more details. This won't
|
see http://www.wxwindows.org/name.htm for more details. This won't
|
||||||
really affect wxPython all that much, other than the fact that the
|
really affect wxPython all that much, other than the fact that the
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
<h1 class="title">wxPython 2.5 Migration Guide</h1>
|
<h1 class="title">wxPython 2.5 Migration Guide</h1>
|
||||||
<p>This document will help explain some of the major changes in wxPython
|
<p>This document will help explain some of the major changes in wxPython
|
||||||
2.5 and let you know what you need to do to adapt your programs to
|
2.5 and let you know what you need to do to adapt your programs to
|
||||||
those changes. Be sure to also check in the CHANGES.txt file like
|
those changes. Be sure to also check in the <a class="reference" href="CHANGES.html">CHANGES</a> file like
|
||||||
usual to see info about the not so major changes and other things that
|
usual to see info about the not so major changes and other things that
|
||||||
have been added to wxPython.</p>
|
have been added to wxPython.</p>
|
||||||
<div class="section" id="wxname-change">
|
<div class="section" id="wxname-change">
|
||||||
@@ -555,6 +555,26 @@ when your last Frame is closed. For wxPython apps it is usually
|
|||||||
enough if your main frame object holds the only reference to the
|
enough if your main frame object holds the only reference to the
|
||||||
wx.TaskBarIcon, then when the frame is closed Python reference
|
wx.TaskBarIcon, then when the frame is closed Python reference
|
||||||
counting takes care of the rest.</p>
|
counting takes care of the rest.</p>
|
||||||
|
<p>Before Python 2.3 it was possible to pass a floating point object as a
|
||||||
|
parameter to a function that expected an integer, and the
|
||||||
|
PyArg_ParseTuple family of functions would automatically convert to
|
||||||
|
integer by truncating the fractional portion of the number. With
|
||||||
|
Python 2.3 that behavior was deprecated and a deprecation warning is
|
||||||
|
raised when you pass a floating point value, (for example, calling
|
||||||
|
wx.DC.DrawLineXY with floats for the position and size,) and lots of
|
||||||
|
developers using wxPython had to scramble to change their code to call
|
||||||
|
int() before calling wxPython methods. Recent changes in SWIG have
|
||||||
|
moved the conversion out of PyArg_ParseTuple to custom code that SWIG
|
||||||
|
generates. Since the default conversion fragment was a little too
|
||||||
|
strict and didn't generate a very meaningful exception when it failed,
|
||||||
|
I decided to use a custom fragment instead, and it turned out that
|
||||||
|
it's very easy to allow floats to be converted again just like they
|
||||||
|
used to be. So, in a nutshell, any numeric type that can be
|
||||||
|
converted to an integer is now legal to be passed to SWIG wrapped
|
||||||
|
functions in wxPython for parameters that are expecting an integer.
|
||||||
|
If the object is not already an integer then it will be asked to
|
||||||
|
convert itself to one. A similar conversion fragment is in place for
|
||||||
|
parameters that expect floating point values.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@@ -4,10 +4,12 @@ wxPython 2.5 Migration Guide
|
|||||||
|
|
||||||
This document will help explain some of the major changes in wxPython
|
This document will help explain some of the major changes in wxPython
|
||||||
2.5 and let you know what you need to do to adapt your programs to
|
2.5 and let you know what you need to do to adapt your programs to
|
||||||
those changes. Be sure to also check in the CHANGES.txt file like
|
those changes. Be sure to also check in the CHANGES_ file like
|
||||||
usual to see info about the not so major changes and other things that
|
usual to see info about the not so major changes and other things that
|
||||||
have been added to wxPython.
|
have been added to wxPython.
|
||||||
|
|
||||||
|
.. _CHANGES: CHANGES.html
|
||||||
|
|
||||||
|
|
||||||
wxName Change
|
wxName Change
|
||||||
-------------
|
-------------
|
||||||
@@ -626,3 +628,23 @@ enough if your main frame object holds the only reference to the
|
|||||||
wx.TaskBarIcon, then when the frame is closed Python reference
|
wx.TaskBarIcon, then when the frame is closed Python reference
|
||||||
counting takes care of the rest.
|
counting takes care of the rest.
|
||||||
|
|
||||||
|
Before Python 2.3 it was possible to pass a floating point object as a
|
||||||
|
parameter to a function that expected an integer, and the
|
||||||
|
PyArg_ParseTuple family of functions would automatically convert to
|
||||||
|
integer by truncating the fractional portion of the number. With
|
||||||
|
Python 2.3 that behavior was deprecated and a deprecation warning is
|
||||||
|
raised when you pass a floating point value, (for example, calling
|
||||||
|
wx.DC.DrawLineXY with floats for the position and size,) and lots of
|
||||||
|
developers using wxPython had to scramble to change their code to call
|
||||||
|
int() before calling wxPython methods. Recent changes in SWIG have
|
||||||
|
moved the conversion out of PyArg_ParseTuple to custom code that SWIG
|
||||||
|
generates. Since the default conversion fragment was a little too
|
||||||
|
strict and didn't generate a very meaningful exception when it failed,
|
||||||
|
I decided to use a custom fragment instead, and it turned out that
|
||||||
|
it's very easy to allow floats to be converted again just like they
|
||||||
|
used to be. So, in a nutshell, any numeric type that can be
|
||||||
|
converted to an integer is now legal to be passed to SWIG wrapped
|
||||||
|
functions in wxPython for parameters that are expecting an integer.
|
||||||
|
If the object is not already an integer then it will be asked to
|
||||||
|
convert itself to one. A similar conversion fragment is in place for
|
||||||
|
parameters that expect floating point values.
|
||||||
|
Reference in New Issue
Block a user