Commit Graph

88 Commits

Author SHA1 Message Date
lojack5
07de1d515e [etgtools] Disable text wrapping for specific lines in docstrings
The line-wrapping causes issues once the python signatures become too long,
as textwrap isn't smart enough to split the lines on valid continuation points
for code. I had one instance of splitting a line in the middle of a string ->
SyntaxError on next run of etg due to the generated PYI file having an
unterminated string.

Specificially, disable splitting for lines that start (ignoring spaces) with
a specific string - in this case any line starting with the name of the
function or method this is a docstring for.
2023-10-18 12:18:48 -06:00
Robin Dunn
3197c46797 Add support for using setCppCode on function objects 2021-01-18 14:15:57 -08:00
Scott Talbert
730cdb2107 Fix conditional in sip_generator generateCppMethod_sip()
When I added this code in 5e190eb, it was intended to be used in all cases
except for constructors and destructors.  Instead, it was used in all cases.
This broke the wxRegion constructor and possibly other things.

Fixes #1878.
2020-12-21 23:31:17 -05:00
Robin Dunn
92f8cd2d55 Fix lots of misspelled words 2020-07-14 11:38:32 -07:00
Robin Dunn
ca257209e6 Add ability to use %PreMethodCode% for more than just the mustHaveApp check 2020-07-02 15:48:48 -07:00
Scott Talbert
5e190eb42e Fix stack overflow when overriding wx.CustomObject.SetData
In the implementation of wx.CustomData.SetData, we need to check the
sipSelfWasArg variable to determine whether to call the parent class
implementation of SetData.  To do this, we switched to using addCppMethod_sip
which allows us to access the sipSelfWasArg variable.  The sip generator
stuff for CppMethod_sip needed some additions to match the behavior of
CppMethod.
2020-05-31 13:43:32 -04:00
Per A. Brodtkorb
e4e8bf8317 Fixes issue 1571:
Adding missing close for open.
If the "close()" call is missing after a "open(filename)" call, the filename isn't guaranteed to be closed before the interpreter exits.
This is generally a bad practice as explained here: https://stackoverflow.com/questions/7395542/is-explicitly-closing-files-important

Also replaced "fid=open(filename) fid.close()" statements for files with the safer
"with open(filename) as fid:" blocks. See https://www.python.org/dev/peps/pep-0343/
2020-03-23 17:16:44 +01:00
Robin Dunn
9f2cc54b48 Update copyright years 2020-03-10 11:41:39 -07:00
Robin Dunn
0378328d45 Merge pull request #1201 from RobinD42/fix-issue1198
Fix access to members of transient wx.VisualAttributes

(cherry picked from commit d6324a0578)
2019-04-13 16:25:55 -07:00
Robin Dunn
974721b93f wxRealPoint::operator* truncates to int before assigning to the new point
object, which seems dumb. So let's make our own implementation which
preserves the floating point result.

(cherry picked from commit 8f07ca5c28)
2018-09-25 12:44:35 -07:00
Robin Dunn
b77c88a280 Merge tag 'wxPython-4.0.2' into wxPy-4.0.x
(cherry picked from commit 4c56c39e52)
2018-06-17 22:04:22 -07:00
Robin Dunn
fc2c6cda57 Add support for using the /Constrained/ annotation 2017-09-14 19:53:17 -07:00
Robin Dunn
875c9677ac Revert auto-propagating the mustHaveAppFlag from classes to their static methods, if any, and explicitly set the flag on only those static methods that need it instead. 2017-03-21 19:21:07 -07:00
Robin Dunn
9d172ddc8a Update copyright in etgtools 2017-02-13 16:18:47 -08:00
Robin Dunn
bd0927fb02 Also protect static methods in mustHaveApp classes 2017-01-21 18:59:08 -08:00
Robin Dunn
6c65fbb865 Use the new %PreMethoCode directive to implement the mustHaveApp functionality
(Raises an exception if protected items are called before the wx.App has been created.)
2017-01-21 18:56:41 -08:00
Metallicow
067569d785 Trim trailing space etgtools directory 2016-12-05 16:26:04 -06:00
Robin Dunn
1429bb0dd2 Add missing "PyErr_Clear();" for cppCtors 2016-08-05 12:00:17 -07:00
Robin Dunn
a485513e4a Update copyright text added written to %Copying blocks 2016-06-21 20:28:15 -07:00
Robin Dunn
e2f853d0e0 Put the module docstrings on the module index pages
Plus some other changes to start using using the "wx." prefix on names in the docs. (More are still needed but this is a start.
2016-05-19 21:04:14 -07:00
Robin Dunn
f8d638b64e Update copyrights in sip_generator too 2016-05-07 19:16:27 -07:00
Robin Dunn
c96d31f919 Instead of hacking the generated C++ after the fact,
generate the sip code a little differently for the int tricky constants,
and add some tests.
2016-05-07 01:27:28 -07:00
Scott Talbert
aa0be2719e Fix extraction for #define's when not an integer or string
Some #define values fall outside the range of int, so we need to override the
types.
2016-03-01 22:50:19 -05:00
Robin Dunn
30e7d68f76 Allow typedefs to be nested in classes. 2015-03-03 20:53:18 -08:00
Robin Dunn
742d02d53b Enable handling #define's that are string constants
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-02-12 05:12:23 +00:00
Robin Dunn
35fd2e16bf Update copyright year
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-01-21 02:13:03 +00:00
Robin Dunn
0e6e598099 Support isStatic for PyMethods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73261 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-12-23 03:08:03 +00:00
Robin Dunn
ae54ccbb3a Don't skip writing the overloads when one has MethodCode
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73076 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-30 22:31:05 +00:00
Robin Dunn
31d92bb01f Enable adding and generating code for a cpp dtor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72972 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-17 22:21:19 +00:00
Robin Dunn
dea1c34ef6 Allow specifying the cppSignature for regular methods too.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72969 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-17 22:20:00 +00:00
Robin Dunn
e8d7197917 Allow cppSignature and pyArgsString for CppMethods too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72929 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-09 04:38:43 +00:00
Kevin Ollivier
3670519430 Enable etg code to be used to build extensions other than Phoenix itself.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72038 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-11 17:42:05 +00:00
Robin Dunn
0fa4a65870 enable setting the new sip %InstanceCode directive
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-10 05:15:47 +00:00
Robin Dunn
aebd862d14 Provide hints for deprecated items about what should be used instead.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-10 05:15:17 +00:00
Robin Dunn
b8ca4e1102 Allow setting virtual catcher code for normal methods too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-30 21:01:16 +00:00
Robin Dunn
f697317ebc Classes without explicit bases still derive from object
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71721 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-12 20:56:15 +00:00
Robin Dunn
cb2f179d20 bug fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-08 05:13:41 +00:00
Robin Dunn
d472962864 Wordwrap the text used for docstrings.
Put the signatures for the ctors before the text, just like the other functions, methods.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-08 05:13:28 +00:00
Robin Dunn
3426d72bc3 Some little tweaks and fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-06 01:15:14 +00:00
Robin Dunn
2011586fa0 Use codecs.open in textfile_open() for Py2.7 so it can work more like open() in Py3, auto-converting to/from utf-8 and unicode. Use textfile_open in parts of the sphinx command that were having encoding errors and also in writeIfChanged().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-25 20:43:48 +00:00
Robin Dunn
b41df0b779 Many, many (many!) changes needed to build and run the Phoenix extension modules with Python 3. Where possible changes were made such that the code works with both Python 2.7 and 3.2 without conditionals. In general the following types of changes were made:
* Changed imports to use either absolute or explicit relative imports.  Implicit relative imports are no longer allowed.

 * Changes to accomodate standard library classes or modues moving to other locations, or being removed entirely.

 * Changes related to print becoming a function, execfile being removed, u'' no longer allowed, and other syntax related issues.

 * Working around C APIs that have changed or simply vanished. (PyInt, PyString, PyBytes, etc.)

 * Dealing with text file objects using strings vs binary file objects using bytes, auto-encoding, and etc.

 * Replacing the use of PyCObject with PyCapsule and dealing with an apparent bug where PyCapsule objects can't be imported from submodules within a package.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-24 23:28:02 +00:00
Robin Dunn
ec06cdb967 indent the GIL macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-10 22:39:12 +00:00
Robin Dunn
6742c20040 Release the GIL when calling the function generated for CppMethod objects.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-10 22:38:57 +00:00
Robin Dunn
15115dca23 * Allow defining the real C++ signature of a method or ctor that we are replacing with a custom method with a different signature. This is important when the original is a ctor or a virtual method, and so there will need to be a matching method/ctor for it in the custom derived class generated by SIP.
* Also support defining the code to be used in the "virtual catcher" so we can map between the real signature and our custom signature when reflecting the call to Python code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-10 22:38:45 +00:00
Robin Dunn
33a6da35ee Remove wx prefixes for default values in the pyArgsString.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71351 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-03 23:30:48 +00:00
Robin Dunn
7b6a094c4f Add support for using SIP's NoArgParser annotation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71281 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-26 01:29:28 +00:00
Robin Dunn
a143905fef Don't write sip docstrings for functions that are operators
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-29 16:58:54 +00:00
Robin Dunn
1d54d41e7b Encode generator output as utf-8 in case there is any non-ascii text
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-26 19:22:19 +00:00
Robin Dunn
16109cd7bc Support setting the HoldGIL annotation for when the -g command line flag is used to always release and reacquire by default.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 03:19:51 +00:00
Robin Dunn
32c3701e4e Allow CppMethodDefs to be static. Replace :: with . in generated pyArgsStrings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-02 21:53:15 +00:00