Commit Graph

59 Commits

Author SHA1 Message Date
Edouard Choinière
95cafd1a3f style: Normalise numpy imports with import numpy as np
The convention when importing numpy is to use `import numpy as np`

Fixes: unconventional-import-alias (ICN001)
Ruff rule: https://docs.astral.sh/ruff/rules/unconventional-import-alias/
2025-02-08 16:48:57 +00:00
Alexandre Detiste
0257f755cf remove most of Python2 compatibility code 2025-02-02 20:17:45 -05:00
Randy Döring
f7d1d8188c Fix NumPy 2.0 deprecations via running ruff (#2580)
* Fix NumPy 2.0 deprecations via running `ruff check --select NPY201 --fix --exclude docs/sphinx/rest_substitutions/snippets/python/converted`

See https://numpy.org/devdocs/numpy_2_0_migration_guide.html#numpy-2-0-migration-guide

* Use `numpy.any` instead of `any` because the latter does not work for multidimensional arrays.
2024-08-21 19:53:57 -04:00
PChemGuy
af3721f167 Explicit NumPy.float64 to int typecasting in FCObjects.py
I cannot tell whether the original code worked before, but this explicit typecasting is necessary now.
The issue occurs, for example if attempting to execute "PieChart.py" or  "ScaledBitmap2Demo.py" in "samples\floatcanvas". Without typecasting, type errors are thrown, such as "TypeError: Image.Scale(): argument 1 has unexpected type 'numpy.float64'".
Apparently, this problem might be due to recent updates in Python and NumPy.
2022-08-20 21:43:22 +03:00
PChemGuy
112605f540 Missing NumPy package reference in FloatCanvas.py
Package reference (N) is missing when NumPy type "float_" is used.
2022-08-20 09:27:31 +03:00
Scott Talbert
37ba9563b6 Update unittests to work with wxWidgets 3.1.6 2022-05-02 22:35:18 -04:00
Scott Talbert
b5ffe91c74 wx.lib.floatcanvas: replace deprecated use of numpy float 2021-12-30 14:59:30 -05:00
Robin Dunn
d9725119d7 Merge pull request #2039 from swt2c/pygauge_py3.10
Fix a bunch of Python 3.10 issues with pure-Python classes and demos
2021-12-13 20:54:44 -08:00
Scott Talbert
173d079681 Fix a bunch of Python 3.10 issues with pure-Python classes and demos
In Python 3.10, a change[1] was implemented where extension functions
that take integer arguments will no longer silently accept non-integer
arguments (e.g., floats) that can only be converted to integers with a
loss of precision.  This PR fixes most of these issues in the pure-Python
classes and demos by explicitly converting the parameters to int before
passing them to wxWidgets.  There is loss of precision, but this was
happening before (automatically) anyway as most wxWidgets DeviceContext
functions operate using integers.

Additionally, the PR fixes a few sizing issues, mostly with SpinCtrls being
too small on GTK3.

This is an example of the relevant exception:
Traceback (most recent call last):
  File "/usr/lib64/python3.10/site-packages/wx/lib/agw/pygauge.py", line 355, in OnPaint
    r.width = w
TypeError: 'float' object cannot be interpreted as an integer

Fixes #2038.

[1] https://bugs.python.org/issue37999
2021-12-01 14:19:00 -05:00
Christian Clauss
25ba122168 Fix typos discovered by codespell 2021-08-07 18:55:49 +02: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
DKWoods
b87a4d6ed8 Fixed Case issues with FloatCanvas.Zoom method 2020-07-29 22:28:47 -05:00
DKWoods
0e5cf66fe7 Address issue #1753, fix FloatCanvas GUIMode GUIZoomIn and GUIZoomOut behavior - Part 2 2020-07-27 17:07:15 -05:00
DKWoods
b615941ee1 Address issue #1753, fix FloatCanvas GUIMode GUIZoomIn and GUIZoomOut behavior 2020-07-27 16:16:20 -05:00
Robin Dunn
c00b8950da Spelling fixes in wx.lib 2020-07-14 12:53:31 -07:00
Robin Dunn
46ca3dbc70 Merge pull request #1337 from swt2c/time_clock_removed
Replace time.clock (removed in Python 3.8) with time.process_time

(cherry picked from commit 59e70e7c76)
2019-09-05 19:46:41 -07:00
kg-2
f8add4de3f Update FCObjects.py
raises a ValueError instead of an AttributeError b/c self.Image is never set
2019-01-02 19:08:40 -08:00
Frank Vernaillen
6d24a91990 Fixed bug with image getting rescaled to zero width and height. 2018-10-23 14:41:40 +02:00
Christopher H.Barker, PhD
09223c530f added float() calls to get the proper divison when scaling bitmaps
In response to a note from Kevin Gregory:

""
Sorry to email you directly, I wanted to submit a bugfix for FloatCanvas ScaledBitmap. It changes the bmpWidth and bmpHeight from integers to floats so that the scale is computed correctly.
FCObjects.py line 2141 from the wxpython phoenix dev build
"""
2017-04-13 11:17:36 -07:00
Metallicow
546d770ddb Trim Whitespace floatcanvas directory 2016-10-12 22:38:31 -05:00
Robin Dunn
07164aba1a Merge pull request #110 from RobinD42/use-pytest
Use pytest for running unittests
2016-07-07 21:38:56 -07:00
Robin Dunn
1d1fc7c187 More docstring ref fixes in wx.lib 2016-07-07 09:58:04 -07:00
Robin Dunn
cc3190e240 Lots more docstring refs fixed 2016-07-06 20:20:10 -07:00
Robin Dunn
488f29b05a Fix docstring references to wx.Bitmap 2016-07-06 18:45:16 -07:00
Robin Dunn
4175d35105 Fix docstring references to wx.Colour 2016-07-06 18:40:04 -07:00
Robin Dunn
b8138a2a2f Fix imports in some tests and in floatcanvas 2016-07-01 01:45:53 -07:00
Robin Dunn
ed4756b902 Remove wx.lib.six and use the stock six module instead,
and add it as an installation dependency.
2016-06-30 20:07:57 -07:00
Scott Talbert
ee745fb7b3 Remove shebang from non-executable files - fixes rpmlint errors 2016-06-03 21:38:07 -04:00
Douglas Thor
f024e60255 Updated FCObjects
Updated FCObjects so that Group() creates a bounding box before attempting to add objects.
2016-03-21 13:13:47 -07:00
wernerfb
8304c859f8 - mouse move would sometime fire HitTest and cause an exception
- add the keepPointInPlace to Zoom, another change to SVN which did not make it to Phoenix
2015-09-21 17:40:25 +02:00
wernerfb
129b846066 - missed in previous commit 2015-09-21 16:37:58 +02:00
wernerfb
7100d73ec5 - missed change from SVN, _cycleidsx changes and AddObject stuff 2015-09-21 16:15:09 +02:00
wernerfb
8f8c253972 - just a spelling error 2015-09-21 15:56:10 +02:00
wernerfb
52c13a674e - missed change from SVN, zoom mixin 2015-09-21 15:48:56 +02:00
wernerfb
f8378c683a - next is a built-in function in Py3 2015-09-16 10:29:48 +02:00
wernerfb
2139fbab55 - move Group class to FCObjects 2015-09-16 10:24:42 +02:00
wernerfb
0b98209d36 fix a few Sphinx warnings 2015-04-14 17:15:52 +02:00
Werner F Bruhin
d548a5b310 - if it is not called in FCObjects we need to call it here 2015-02-11 14:45:18 +01:00
Werner F Bruhin
59f43fd818 - the crash cause for Sphinx build 2015-02-11 14:27:17 +01:00
Werner F Bruhin
384af619b5 - format changes to doc
- commented or removed a few print statements
2015-02-11 14:05:06 +01:00
Werner F Bruhin
871241c66b - refactor of FloatCanvas package, unittest and demo run on Py27 and Py33 2014-06-05 11:09:18 +02:00
Werner F Bruhin
4a46798fde - add module doc and flags 2014-06-03 15:19:56 +02:00
Werner F Bruhin
ca162ee926 - a few Py3 changes
- add tags
2014-05-26 12:58:45 +02:00
Andrea Gavana
a2b514bf53 Phoenix docs: fix floatcanvas/FloatCanvas.py docstrings to avoid Sphinx warnings
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-09 13:14:42 +00:00
Robin Dunn
a9595b241a PR64: Various Phoenix and Py3 fixes for the demo and library
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-28 04:48:21 +00:00
Robin Dunn
74ddaf3d64 Shuffle some FloatCanvas code around a little to avoid a circular import problem.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-28 03:57:37 +00:00
Robin Dunn
b0fa504d1d PR 41 from Metallicow. Pen and Brush style updates
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-11 23:12:52 +00:00
Robin Dunn
6faf213a76 Change all <> to !=
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-01 04:23:33 +00:00
Robin Dunn
20dfedff42 Fix circular import
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-08-10 20:54:22 +00:00
Robin Dunn
9f24505715 Merge of PR 11 with the whitespace-only changes omitted.
See https://github.com/RobinD42/Phoenix/pull/11

Mostly phoenix-port changes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@74463 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-10 01:15:34 +00:00