Commit Graph

30 Commits

Author SHA1 Message Date
Kazuya O'moto
0185bc025b Add MaxSize limit to ScaledBitmap drawing 2025-06-29 13:09:14 +09:00
Kazuya O'moto
46a7fbdda8 Fix floatcanvas Arrow, Point, Bitmap drawings
Convert float to int for dc.DrawXXX methods
2025-05-08 01:00:19 +09:00
Kazuya O'moto
25b325c224 Fix floatcanvas Text.ShiftFunDict: convert float to int
Fix typo
2025-05-07 02:53:36 +09:00
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
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
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
Robin Dunn
c00b8950da Spelling fixes in wx.lib 2020-07-14 12:53:31 -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
cc3190e240 Lots more docstring refs fixed 2016-07-06 20:20:10 -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
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
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
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
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