68 Commits

Author SHA1 Message Date
Alexandre Detiste
66a9320917 finish removing six 2025-02-02 20:30:33 -05:00
Alexandre Detiste
323e78c085 remove more Python2 hybridation 2025-02-02 20:29:49 -05:00
Alexandre Detiste
0257f755cf remove most of Python2 compatibility code 2025-02-02 20:17:45 -05:00
Alexandre Detiste
beb9932241 remove usage of six.print_() 2025-02-02 20:10:38 -05:00
Scott Talbert
832f17260f Merge pull request #2232 from StefanBruens/wxget_pip_optional
Make pip usage in wxget optional
2024-02-05 15:15:41 -05:00
Scott Talbert
01787f43a5 Fix additional SyntaxWarnings with Python 3.12
It seems that Python 3.12 has started emitting additional SyntaxWarnings
in cases where there are backslashes used in strings, so change these
strings to raw strings to avoid the warnings.
2023-12-21 20:19:57 -05:00
Stefan Brüns
5dceaa3ebe Make pip usage in wxget optional
As the code states, using pip to download is abusing it, and it is
just a fallback in case neither wget nor urllib works.
2023-09-11 17:33:51 +02:00
Scott Talbert
e5c92b3056 Use new tarfile.extractall() filter for safer tarfile extraction
The tarfile.extractall() filter argument was introduced in the most
recent CPython releases (e.g., 3.11.4) to avoid potential security
issues when extracting from potentially hostile tarballs.  Let's use
this option if it is available and provide a warning if it is now.
2023-08-03 16:25:07 -04:00
Kazuya O'moto
f514770942 Fix TypeError float to int
TypeError: ProgressDialog(): argument 'maximum' has unexpected type 'float'
TypeError: ProgressDialog.Update(): argument 1 has unexpected type 'float'
TypeError: Sleep(): argument 1 has unexpected type 'float'
2022-12-07 01:19:23 +09:00
Christian Clauss
25ba122168 Fix typos discovered by codespell 2021-08-07 18:55:49 +02:00
Jeremy Drake
4a292c3cda Revert "pywxrc: fix embedded resources in python 2.7 and 3"
This reverts commit 234491058f now that
memoryview works properly on python 2.7.
2020-07-02 22:42:27 -07:00
jeremyd2019
234491058f pywxrc: fix embedded resources in python 2.7 and 3
It turns out that memoryview() was resulting in an empty file in python 2.7, whereas bytearray is working in both 2.7 and 3.
2020-06-17 19:35:29 -07:00
jeremyd2019
0b84247e5a pywxrc: fix embedded binary resources for python3
Previously, I was getting errors 'No handler found for image type' and 'Unknown image data format' after updating from wxPython 'classic'.
2020-06-10 11:33:55 -07:00
Robin Dunn
de25f3091f Merge pull request #1576 from pbrod/Fix_issue1570_use_of_tempfile
Fixes issue #1570:
2020-04-01 15:40:07 -07:00
Per A. Brodtkorb
5cf6dc565e Fixes #1570
Replaced the unsafe "tfname = tempfile.mktemp()" call with
"with tempfile.NamedTemporaryFile(delete=False) as fid: tfname = fid.name"

Also removed unused "import glob"
2020-03-25 11:27:49 +01: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
764abb41bf Don't use relative imports in the tools scripts 2020-03-20 15:21:23 -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
Robin Dunn
9f2cc54b48 Update copyright years 2020-03-10 11:41:39 -07:00
Robin Dunn
e3ef0db163 Fix typos and trim whitespace 2019-12-31 14:13:20 -08:00
Paul Kienzle
092bb845d5 Fix wx/tools/pywxrc for py2/3 compatibility. Refs 1156. 2019-04-14 13:45:08 -04:00
Éric Piel
1b46085c97 pywxrc: fix showing the success message at the end
When generating a file, it should show a success message like "Resources written to...".
However, the print() failed, which made it sound like the whole generation failed.
2018-08-22 13:56:01 +02:00
Éric Piel
96ed353b34 pywxrc: fix Menu with variable name and label defined after sub-menus
If the XRC looked like:
<object class="wxMenu" name="menu_file">
  <object class="wxMenuItem" name="menu_item_open">
    <label>Save</label>
  </object>
  <label>File</label>
</object>

The generated code would fail, because it would try to look for a main menu called "Save"
instead of looking for "File".

=> Make the XML parsing more clever to not look for the first "label" tag,
but the first _direct_ child with tag "label".
2018-08-22 13:51:16 +02:00
Éric Piel
984a036d34 pywxrc: remove old comments
It's not using the 2 stages creation anymore.
2018-08-22 13:50:33 +02: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
Steve Barnes
517d316ba0 #817 Changes to allow wxget utility to work with pip v10+ 2018-04-17 06:50:14 +01:00
André Colomb
c655b09012 Remove obsolete argument from PreCreate().
With the `pre` object magic gone, there is no need to pass another
argument to the PreCreate() method, which can now just use `self`.

Note that this is will probably lead to incompatibilities for users of
the generated class who override this method, as advised in the
template.
2018-02-05 09:35:05 +01:00
André Colomb
6883afe8ce Simplify two stage creation process.
Remove "pre" object magic and use the parent class constructor
instead.  Remove deprecated PostCreate() call.  See
https://docs.wxpython.org/MigrationGuide.html#phase-create.

Load the XmlResource contents directly onto self.  See
https://docs.wxpython.org/MigrationGuide.html#xrc.
2018-02-02 17:37:01 +01:00
André Colomb
e17a8a907a Avoid deprecated class EmptyXmlResource.
According to the deprecation warning in wxPython Phoenix.
2018-02-02 17:29:07 +01:00
Robin Dunn
f3cbf76296 Fix more relative imports 2017-12-29 13:56:05 -08:00
Steve Barnes
22f21b369e Make trusted flag available as an option for wxget.py and fix some minor issues. 2017-09-22 12:06:38 +01:00
Steve Barnes
82a5a09b3d Add --no-check-certificate to wx/tools/wxget.py download_wget if trusted 2017-09-22 09:03:40 +01:00
Steve Barnes
69dce9e9a6 Split the URL into the link and filename parts for the error message. 2017-09-22 06:04:39 +01:00
Steve Barnes
1febcd10c3 #545 Fallback download process, wget, urllib, pip --trusted-host, to maximise possilities of success. 2017-09-21 16:16:45 +01:00
Steve Barnes
dd7bdde296 #545 Addressed import error and added --force flag 2017-09-21 09:10:22 +01:00
Robin Dunn
60dbde834b '&' --> 'and' and some other text tweaks 2017-08-08 19:44:26 -07:00
Steve Barnes
2eea0a5634 Catch URLError from firewall and give practical advice 2017-08-08 11:45:59 +01:00
Steve Barnes
404ac70b1b Minor message changes in wx/tools/wxget_docs_demo.py 2017-08-08 11:45:05 +01:00
Steve Barnes
b01de8654e Responded to inline review comments and added propmt before download 2017-08-08 06:59:04 +01:00
Steve Barnes
97de5b0f92 Added wx/tools/wxget_docs_demo.py with script entry points of wxdemo and wxdocs 2017-08-07 06:26:53 +01:00
Steve Barnes
1795b5e7c7 Added get_docs_demo_url to get the documents or demo URL. 2017-08-06 13:07:57 +01:00
Steve Barnes
125e368e1a New utility wxget to provide get where missing. 2017-08-06 12:55:39 +01:00
Mike Driscoll
435d779e8b Update img2py.py
Fix a couple of typos
2017-05-02 09:11:04 -05:00
Andrew Murray
2cfe4ad989 Fixed typos 2017-02-26 14:15:49 +11:00
Robin Dunn
a0604d128c Update copyright in wx/tools 2017-02-13 17:07:39 -08:00
Metallicow
576cf1d966 Trim Whitespace tools directory 2016-10-12 22:15:25 -05:00