modify backend_gtk3 for fix oscilloscope -h error

This commit is contained in:
wk333 2023-05-26 16:24:13 +08:00
parent 9781413524
commit 8fe329f83b
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,48 @@
refer: https://github.com/matplotlib/matplotlib/commit/014df7f0eb3139f19641e4f92d49876f7dc2b371
diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py
index 359b8fd..0a6979a 100644
--- a/lib/matplotlib/backends/backend_gtk3.py
+++ b/lib/matplotlib/backends/backend_gtk3.py
@@ -1,6 +1,6 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)
-
+import functools
import six
import logging
@@ -28,14 +28,25 @@ backend_version = "%s.%s.%s" % (
# see http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5 for some info about screen dpi
PIXELS_PER_INCH = 96
-cursord = {
- cursors.MOVE : Gdk.Cursor.new(Gdk.CursorType.FLEUR),
- cursors.HAND : Gdk.Cursor.new(Gdk.CursorType.HAND2),
- cursors.POINTER : Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR),
- cursors.SELECT_REGION : Gdk.Cursor.new(Gdk.CursorType.TCROSS),
- cursors.WAIT : Gdk.Cursor.new(Gdk.CursorType.WATCH),
- }
-
+# module-level deprecations.
+@functools.lru_cache(None)
+def __getattr__(name):
+ if name == "cursord":
+ _api.warn_deprecated("3.5", name=name)
+ try:
+ new_cursor = functools.partial(
+ Gdk.Cursor.new_from_name, Gdk.Display.get_default())
+ return {
+ Cursors.MOVE: new_cursor("move"),
+ Cursors.HAND: new_cursor("pointer"),
+ Cursors.POINTER: new_cursor("default"),
+ Cursors.SELECT_REGION: new_cursor("crosshair"),
+ Cursors.WAIT: new_cursor("wait"),
+ }
+ except TypeError as exc:
+ return {}
+ else:
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
class TimerGTK3(TimerBase):
'''

View File

@ -1,7 +1,7 @@
%global debug_package %{nil} %global debug_package %{nil}
Name: python-matplotlib Name: python-matplotlib
Version: 2.2.4 Version: 2.2.4
Release: 4 Release: 5
Summary: A comprehensive library for creating static, animated, and interactive visualizations Summary: A comprehensive library for creating static, animated, and interactive visualizations
License: Python and MIT and OFL-1.1 and BSD-3-Clause License: Python and MIT and OFL-1.1 and BSD-3-Clause
URL: https://github.com/matplotlib/matplotlib URL: https://github.com/matplotlib/matplotlib
@ -12,6 +12,7 @@ Source1000: https://github.com/QuLogic/mpl-images/archive/v2.2.3-with-freety
Patch0001: 0001-Use-packaged-jquery-and-jquery-ui.patch Patch0001: 0001-Use-packaged-jquery-and-jquery-ui.patch
Patch0002: 0001-matplotlibrc-path-search-fix.patch Patch0002: 0001-matplotlibrc-path-search-fix.patch
Patch0003: 0001-Force-using-system-qhull.patch Patch0003: 0001-Force-using-system-qhull.patch
Patch0004: modify-backend_gtk3-for-fix-oscilloscope-error.patch
BuildRequires: freetype-devel libpng-devel qhull-devel texlive-cm xorg-x11-server-Xvfb zlib-devel BuildRequires: freetype-devel libpng-devel qhull-devel texlive-cm xorg-x11-server-Xvfb zlib-devel
@ -103,6 +104,7 @@ Test data for python3-matplotlib.
%patch0001 -p1 %patch0001 -p1
%patch0002 -p1 %patch0002 -p1
%patch0003 -p1 %patch0003 -p1
%patch0004 -p1
gzip -dc %SOURCE1000 | tar xvf - --transform='s~^mpl-images-2.2.3-with-freetype-2.9.1/\([^/]\+\)/~lib/\1/tests/baseline_images/~' gzip -dc %SOURCE1000 | tar xvf - --transform='s~^mpl-images-2.2.3-with-freetype-2.9.1/\([^/]\+\)/~lib/\1/tests/baseline_images/~'
rm -r extern/libqhull rm -r extern/libqhull
sed 's/\(backend = \).*/\1TkAgg/' >setup.cfg <%{SOURCE1} sed 's/\(backend = \).*/\1TkAgg/' >setup.cfg <%{SOURCE1}
@ -163,6 +165,9 @@ chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py
%{python3_sitearch}/matplotlib/backends/{tkagg.*,__pycache__/tkagg.*,_tkagg.*} %{python3_sitearch}/matplotlib/backends/{tkagg.*,__pycache__/tkagg.*,_tkagg.*}
%changelog %changelog
* Fri May 26 2023 wangkai <13474090681@163.com> - 2.2.4-5
- modify backend_gtk3 for fix oscilloscope -h error
* Wed Mar 10 2021 caodongxia <caodongxia@huawei.com> - 2.2.4-4 * Wed Mar 10 2021 caodongxia <caodongxia@huawei.com> - 2.2.4-4
- Fix the function-import matplotlib and import matplotlib.pyplot - Fix the function-import matplotlib and import matplotlib.pyplot