Commit Graph

132 Commits

Author SHA1 Message Date
lojack5
d92db14141 Fixup from conflict resolution 2025-03-13 23:00:49 -06:00
lojack5
3c6854c138 squash 2025-03-13 18:35:14 -06:00
lojack5
68f75d28dc Fixup: using incorrect method names in some cases where they have been renamed 2025-03-13 18:35:14 -06:00
lojack5
2071ae765d Fixup: functions were being generated as if they were methods (had a 'self' parameter) 2025-03-13 18:35:14 -06:00
lojack5
bca7d10602 Implement hinting for types that are automatically converted
This handles any type with a defined `.convertFromPyObject` set in its
sip generator.
2025-03-13 18:35:13 -06:00
lojack5
03d7f1e8c9 reworks how typed-argstrings are handled
Pulls out the data into a separate class, `tweaker_tools.Signature`.
This simplifies stringizing the args string, and allows for some
checks to be written in a much less complex way. The motivator for
this was adding unions to type-hints (for the upcoming automatically
converted python->wx types). This made parsing the already stringized
args string very complex to be able to handle the potential for commas
in `Union`.
2025-03-13 18:35:13 -06:00
lojack5
c6cd496e7d Mark subclasses of wx.TopLevelWindow as allowing None for their
`parent` argument.
2025-03-13 18:31:39 -06:00
lojack5
1fe85a8907 mark stubs for __bool__ and __nonzero__ as returning bool. 2025-03-13 18:31:39 -06:00
lojack5
62f820a8cf Fixups for buildings docs (sphinx_generator):
- Remove typehints from argsString before checking signature
- lie and detect `_from`, `_is`, and `_def` as `from`, `is`, and `def for
  signature validating purposes
- Fix: don't remove const from identifiers containing const (eg: constraint)
2025-03-13 18:31:39 -06:00
Edouard Choinière
e6c0de4e32 style: Normalise ElementTree imports with import xml.etree.ElementTree as ET
The convention is that `xml.etree.ElementTree` should be imported as `ET`.

Fixes: unconventional-import-alias (ICN001)

Ruff rule: https://docs.astral.sh/ruff/rules/unconventional-import-alias/
2025-02-08 17:04:56 +00:00
Alexandre Detiste
323e78c085 remove more Python2 hybridation 2025-02-02 20:29:49 -05:00
Edouard Choinière
ff1cae7d56 Add typing annotations to methods returning self. 2025-01-21 21:38:18 -05:00
Scott Talbert
c3092be458 Merge pull request #2468 from lojack5/lojack-typed-typestubs
Some checks failed
ci-build / build-source-dist (push) Failing after 0s
ci-build / build-wheels (x64, macos-13, 3.10) (push) Has been skipped
ci-build / build-wheels (x64, macos-13, 3.11) (push) Has been skipped
ci-build / build-wheels (x64, macos-13, 3.12) (push) Has been skipped
ci-build / build-wheels (x64, macos-13, 3.13) (push) Has been skipped
ci-build / build-wheels (x64, macos-13, 3.9) (push) Has been skipped
ci-build / build-wheels (x64, ubuntu-22.04, 3.10) (push) Has been skipped
ci-build / build-wheels (x64, ubuntu-22.04, 3.11) (push) Has been skipped
ci-build / build-wheels (x64, ubuntu-22.04, 3.12) (push) Has been skipped
ci-build / build-wheels (x64, ubuntu-22.04, 3.13) (push) Has been skipped
ci-build / build-wheels (x64, ubuntu-22.04, 3.9) (push) Has been skipped
ci-build / build-wheels (x64, windows-2022, 3.10) (push) Has been skipped
ci-build / build-wheels (x64, windows-2022, 3.11) (push) Has been skipped
ci-build / build-wheels (x64, windows-2022, 3.12) (push) Has been skipped
ci-build / build-wheels (x64, windows-2022, 3.13) (push) Has been skipped
ci-build / build-wheels (x64, windows-2022, 3.9) (push) Has been skipped
ci-build / build-wheels (x86, windows-2022, 3.10) (push) Has been skipped
ci-build / build-wheels (x86, windows-2022, 3.11) (push) Has been skipped
ci-build / build-wheels (x86, windows-2022, 3.12) (push) Has been skipped
ci-build / build-wheels (x86, windows-2022, 3.13) (push) Has been skipped
ci-build / build-wheels (x86, windows-2022, 3.9) (push) Has been skipped
ci-build / Publish Python distribution to PyPI (push) Has been skipped
ci-build / Create GitHub Release and upload source (push) Has been skipped
ci-build / Upload wheels to snapshot-builds on wxpython.org (push) Has been skipped
ci-build / Build wxPython documentation (push) Has been cancelled
Improve Python type-stubs
2025-01-06 22:14:20 -05:00
Scott Talbert
6a049ccc0a Support building with Doxygen 1.9.7
Doxygen 1.9.7 made some changes whereby some method definitions are now
defined in separate XML files, with a "refid" that links to them.  In
order to support this, we need to follow these "refids" to pick up the
method definition from the separate group XML files.
2023-12-05 23:42:21 -05:00
lojack5
b23c5a83dc Python <3.9 typing compat: tuples
Subscripting builtins.tuple was added in Python 3.9, so use
`typing.Tuple` where applicable.
2023-10-18 13:10:24 -06:00
lojack5
17438ac318 Python <3.10 typing compat: unions
Use `typing.Optional` and `typing.Union` where applicable, as direct
union (`|`) type annotations were added in Python 3.10
2023-10-18 13:06:31 -06:00
lojack5
2c6100cead Enable return-type annotations
With the work from the previous commits, it's as simple as
no longer lopping off the args string at the '->' marker.
(And one minor fixup to the makePyArgsString code).
2023-10-18 12:26:58 -06:00
lojack5
fa2bde419f Extract type information in makePyArgsString
One unexpected type of '...' required adding a new transformation
that modifies both the name and the type to just '*args', so added
a preferred method `FixWxPrefix.parseNameAndType` which processes
both strings at once.

Also fixes cleanType to recursively call cleanType on sub-types
(was improperly calling cleanName).

With this, method and function signatures now have type annotations
which are mostly correct (100% correct in the "it compiles" sense).
Thankfully, the incorrect type-hints don't cause errors due to using
stringized annotations (by importing annotations from __future__).

Importantly, the overload signatures now have been fully sanitized.
Before this, there was one instance of a variable named `is`, and another
named `/Transfer/` - both invalid identifiers. I stopped looking after
those. Since theses signatures are valid Python code, this opens up the
opportunity to use `typing.overload` to fully expose those.

Edge-cases in type-hints will be addressed in later commits.
2023-10-18 12:26:58 -06:00
lojack5
d303548d43 Move local _cleanName to FixWxPrefix.cleanName
This allows for building `FixWxPrefix.cleanType` on top of it, for use
in processing type-hint strings in the future. It also exposes the method
to `FunctionDef.makePyArgString` in the future, which has easier access to
the types of arguments and returns. And possibly further in the future,
other `***Def` classes can make use of it (constant definitions, etc).
2023-10-18 12:19:00 -06:00
Robin Dunn
7a839de248 Make it possible to call a function that post-processes the generated ReST doc for a class. 2020-11-11 15:40:05 -08: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
Per A. Brodtkorb
426258b7b7 Adding missing close for open and replaced "fid=open(filename) fid.close()"
statements with the safer "with open(filename) as fid:" blocks.

Also removed unnecessary "try: ... finally: pass" statements
and refactored code from img2py function into _write_image and _replace_non_alphanumeric_with_underscore

Fixes #1574
2020-03-25 10:36:38 +01:00
Robin Dunn
b503793e5e Add ability to make global name strings from a wchar_t constant 2020-03-17 17:46:56 -07:00
Robin Dunn
9f2cc54b48 Update copyright years 2020-03-10 11:41:39 -07:00
Robin Dunn
b430a16ec3 Ensure sip knows that wxLog has a default ctor and a dtor 2019-08-13 15:25:40 -07:00
Robin Dunn
a09ddd8c27 Add some missing methods in BitmapComboBox 2019-07-17 12:00:41 -07:00
Robin Dunn
41a4841eb2 Fix extraction of the template parameter name 2019-05-29 14:14:43 -07:00
Robin Dunn
5d078557bf Lots of updates to get caught up with wxWidgets master (3.1.3+) 2019-05-23 21:43:40 -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
2f540a91e6 Merge pull request #1034 from RobinD42/fix-issue958-291-wxAccessible
Add wxAccessible and a tool to generate C++ stubs

(cherry picked from commit 3a9f37f2aa)
2018-10-10 19:40:59 -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
b5bb587145 Merge pull request #897 from RobinD42/add-windowidref
Add wx.WindowIDRef and wx.NewIdRef
2018-06-24 21:37:54 -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
156fece679 Merge pull request #838 from RobinD42/fix-issue836
Copy MethodDefs for Start and GetNext from base class
2018-04-30 22:08:21 -07:00
Robin Dunn
449e3056dc Move the deprecation check into a method and only call it from the types where we expect (and support) to find the deprecation tag. 2018-02-19 20:55:25 -08:00
Mesalu
9357988aa7 Comment fixes. 2018-02-19 15:18:14 -08:00
Mesalu
b7569e1e89 Refactor into BaseDef as per @RobinD42's request. 2018-02-19 15:15:07 -08:00
Mesalu
ddf23514e3 Use iteration over children to detect elements matching doxygen's deprecated tags. 2018-02-19 11:22:02 -08:00
Robin Dunn
8c4dffb091 Add virtual dtor for DC classes 2018-01-29 14:11:00 -08:00
Robin Dunn
03d1e1559c Add MappedType for wxMessageDialog::ButtonLabel,
so MessageDialog methods can take either string or stock IDs.
2017-11-18 19:26:42 -08:00
Robin Dunn
fc2c6cda57 Add support for using the /Constrained/ annotation 2017-09-14 19:53:17 -07:00
Robin Dunn
479d5b9db6 typos 2017-03-13 19:44:48 -07:00
Robin Dunn
c688fb0362 Port some Python code tweaks and extensions from Classic in propgrid 2017-03-11 19:05:13 -08:00
Robin Dunn
9d172ddc8a Update copyright in etgtools 2017-02-13 16:18:47 -08:00
Robin Dunn
429829f1bb Merge pull request #211 from RobinD42/mustHaveApp
mustHaveApp
2017-02-03 22:06:16 -08:00
Robin Dunn
be61a4c386 Enable skipping items only when generating docs 2017-01-28 10:41:39 -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
2f1f0ee1e9 XRC and MemoryFSHandler fixes 2016-08-10 19:46:58 -07:00