Commit Graph

73 Commits

Author SHA1 Message Date
Kazuya O'moto
1fb1e84012 Use unwrap before isbuiltin check
`inspect.isbuiltin` does not unwrap obj, but `inspect.signature` does,
which can result in a ValueError.

    >>> wx.Bell
    <built-in function Bell>
    >>> bell #= dcor(wx.Bell)
    <function Bell at 0x0000015E53D92B60>
    >>> inspect.isbuiltin(bell)
    False
    >>> inspect.signature(bell)
    ... (snip) ...
    ValueError: no signature found for builtin <built-in function Bell>
2023-11-26 16:32:57 +09:00
Kazuya O'moto
e0a71625e2 Extract argspec inside paren using re
ex.
argspec = '(x, /, y, z=3, *args, value: int = 0, **kwargs) -> int'
      --> 'x, /, y, z=3, *args, value: int = 0, **kwargs'
2023-02-24 23:21:59 +09:00
Kazuya O'moto
8e98e8b442 Use inspect.signature instead of formatargspec
inspect.formatargspec has been deprecated since Python 3.5,
and removed in Python 3.11.
2023-02-24 23:02:48 +09:00
Robin Dunn
727f3aff2a Merge pull request #2158 from komoto48g/shell-stc
Fix issue #2157: wx.py.shell.Shell.OnHistorySearch
2022-05-22 23:01:11 -07:00
komoto
de5abf4219 Override editwindow SetSelection as a temporary patch
Better to override editwindow (a common parent of shell and sliceshell)
2022-05-20 13:22:43 +09:00
komoto
85466c87b8 Revert "Override SetSelection as a temporary patch"
Better to override editwindow
2022-05-20 13:09:07 +09:00
komoto
3381f5bfb4 Override SetSelection as a temporary patch
Patch for miss-insertion position when from_ > to_.
    This is needed until the stc.StyledText.SetSelection bug is fixed.
2022-05-12 23:47:22 +09:00
komoto
efa85f1798 Fix OnHistorySearch range+ error
Fix TypeError: unsupported operand type(s) for +: 'range' and 'range'
2022-05-12 23:24:25 +09:00
komoto
ab6ec5b9fd Fix shell getMultilineCommand
Add limitation to avoid an infinite loop at EOF,
    when programmatically called on the current prompt.
2022-04-26 22:30:49 +09:00
Scott Talbert
2871c46d33 Fix a bunch of DeprecationWarnings due to invalid escape sequences
Fixes #1454.
2022-01-11 11:23:06 -05:00
komoto
d8a0f0e639 Remove comments and cleanup 2021-12-14 14:42:04 +09:00
Kazuya O'moto
0d6031df60 Merge branch 'wxWidgets:master' into feature-shell 2021-12-14 14:24:43 +09:00
Robin Dunn
cbe539efd9 Merge pull request #2047 from swt2c/df_unicode
Use wx.DF_UNICODETEXT instead of wx.DF_TEXT
2021-12-13 20:46:14 -08:00
Scott Talbert
2791fd7016 Use wx.DF_UNICODETEXT instead of wx.DF_TEXT
wx.DF_TEXT doesn't work on macOS and Unicode should be available under
all platforms.
2021-12-06 19:56:04 -05:00
Christian Clauss
25ba122168 Fix typos discovered by codespell 2021-08-07 18:55:49 +02:00
komoto
fd0560f256 Add Shell EVT_UPDATE_UI handler for each id
(revert)
self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateContextMenu) without specifing id
triggers EVT_UPDATE_UI frequently.
2021-07-29 16:09:56 +09:00
komoto
5d1b6e0d28 Fix Shell update event handler
Rename the handler so that it does not override the base class EditWindow.OnUpdateUI.
2021-07-29 16:09:56 +09:00
komoto
7ff7d46a7e Add Shell missing keywords
Add the keyword 'finally' in Execute, to fix miss-indentation
when pasting the following code:
try:
    1
    finally: <-- indent error
        0

Add the keyword 'with' to fix mis-indentation when typing:
with xxx:
| <-- incorrect auto-indentation in the next line
2021-07-29 16:01:10 +09:00
Robin Dunn
732ff6752b Revert "Spelling fixes in wx.lib"
This reverts commit c00b8950da.
The spelling changes were a bit too aggressive.
2020-08-31 13:01:31 -07:00
Robin Dunn
c00b8950da Spelling fixes in wx.lib 2020-07-14 12:53:31 -07:00
Metallicow
6e681835a6 Remove exception in py shell wrap() method
This exists in Scintilla when wxPython 4.0 Phoenix came out, so remove it as cruft.
2020-06-09 22:14:18 -05:00
efahl
2c571edc23 Eliminate deprecation warning
Remove import of 'imp' module to eliminate deprecation warning.
2020-05-14 12:00:56 -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
7a05d20d82 Merge pull request #1572 from pbrod/Fix_issue1571
Fixes issue 1571:
2020-03-23 16:07:22 -07:00
Robin Dunn
41c5af9cde Merge pull request #1569 from pbrod/Fix_issue1554
Fixes issue # 1554:
2020-03-23 15:35:41 -07: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
Per A. Brodtkorb
fc1823315b Fixes issue # 1554:
Replaced "== None" and "!= None" with "is None" and "is not None", respectively, because the former is slower and error-prone.
2020-03-23 11:53:36 +01:00
Robin Dunn
8e2627e8e3 Merge pull request #1564 from pbrod/Fix_issue1556
Fixes issue #1556
2020-03-20 15:19:40 -07:00
Per A. Brodtkorb
033c18fd9f Fixes issue #1556
Replaced XXX.keys() calls with idiomatic python 3 calls that are compatible with python 2 such as eg:
 * replaced "y = xxx.keys()" or "y = list(xxx.keys())" with just "y = list(xxx)"
 * replaced "sorted(xxx.keys())" or "sorted(list(xxx.keys()))" with just "sorted(xxx)"
 * replaced "if not A in B.keys():" with "if A not in B:"
 * replaced "for A in B.keys():"  with "for A in B:"

See also https://python-future.org/compatible_idioms.html
https://python-future.org/compatible_idioms.html#dict-keys-values-items-as-a-list
2020-03-20 18:51:19 +01:00
Per A. Brodtkorb
05ac589e2d Fixes issue 1555
Replace open-close statements by the use of "with"-blocks.

With the "With" statement, you get better syntax and exceptions handling.

"The with statement simplifies exception handling by encapsulating common
preparation and cleanup tasks."

In addition, it will automatically close the file. The with statement provides
a way for ensuring that a clean-up is always used.
2020-03-20 15:03:09 +01:00
Robin Dunn
6206d20bad Various small tweaks and fixes 2019-09-11 12:56:11 -07:00
Paul Kienzle
37a575c1fb python 2/3 compatible file handling. Refs #1193. 2019-04-13 02:19:52 -04:00
jensgoe
714a9a222d ignore newline added by Tokenize module since Python 3.6 (fixes #1109) 2018-12-12 16:00:46 +01:00
Metallicow
230bf5d6d3 Optimize All PNGs Nov2018
Since I had to fix a image issue and optimize it. I decided to rerun FileOptimizer 13.30.2393 over all pngs. Small bytes for some that had been optimized before, but this comit covers all pngs that may have been missed in the past. Maybe revisit running them all again in 2 years. Total time to process all pngs: approx 8 hours.
As technology improves this will only get better/faster when downloading, loading in browser, embedded, etc...
2018-11-13 16:08:12 -06:00
Robin Dunn
e92d572267 Merge pull request #1057 from RobinD42/fix-issue1025
fix test suite errors in wx/py/tests

(cherry picked from commit ebb3de75ed)
2018-10-26 18:17:52 -07:00
Felipe Calliari
94e9a38085 fix DeprecationWarnings in frame.py (#1043)
This commit solves the following messages:
    DeprecationWarning: Menu.Append() is deprecated
2018-10-24 19:27:47 -07:00
David N. Mashburn
12aed76e6b Fixes save/ load bugs Pyslices 2018-08-26 11:25:15 -04:00
Mesalu
0f1861990d Update introspect.py
Adds a check to determine if getfullargspec should be used. This is added in Py3 to get elements like type annotations.
2018-07-25 13:52:29 -07:00
Robin Dunn
705aa63d75 Merge branch 'more-windowidref' into wxPy-4.0.x
(cherry picked from commit ada7b2fc51)
2018-06-25 19:12:00 -07:00
Robin Dunn
ce6f585444 Merge pull request #894 from tianzhuqiao/py
Fix a bug in py.introspect.getTokens
(cherry picked from commit 4b43671746)
2018-06-23 18:26:36 -07:00
Robin Dunn
b1b0c9e297 wx.NewId() --> wx.ID_ANY or wx.Window.NewControlId() as appropriate 2018-06-19 10:31:56 -07:00
Robin Dunn
0c75ee6277 Merge pull request #867 from RobinD42/fix-issue855
im_func --> __func__
(cherry picked from commit 6b858b5966)
2018-05-30 21:07:53 -07:00
Tianzhu Qiao
587c24957f Add option to not use stock IDs in context-menu of pyshell.
Otherwise, the context-menu may not work on Mac without adding the proper IDs
to the menu bar.
2018-05-01 23:02:37 -07:00
Tianzhu Qiao
8b8bd630f2 Fix a python3 compatibility issue to get class instance and function objects 2018-04-21 08:51:28 -07:00
Robin Dunn
bbb19777b3 QnD fix for missing self.shell attribute 2018-03-27 19:30:36 -07:00
Metallicow
99834ab3ec ⁉️ Trim trailing whitespace misc files
All these files seem like legit trailing whitespace that can be removed.
2018-01-16 09:37:04 -06:00
Bob White
7b41a3e58f Using functools.cmp_to_key for old style sorts. 2017-09-07 12:15:38 -05:00
Bob White
251f9d7d5a Fix for list.sort requiring keywords in python3.5
Python3.5 changed the parameters in list.sort to be keyword only
arguments.

This fixes all the instances I could find.
2017-09-07 09:35:33 -05:00
Robin Dunn
4d00ac9b93 Wait a little longer before splitting 2017-07-21 13:20:27 -07:00
Robin Dunn
96adef7c60 Fix some Py3 compatibility issues 2017-05-17 17:46:33 -07:00