Files
python-matplotlib/0001-matplotlibrc-path-search-fix.patch
Elliott Sales de Andrade a5d9c6fa46 Fix button images in toolmanager
This was reported upstream in https://github.com/matplotlib/matplotlib/issues/30116.
2025-05-28 01:48:05 -04:00

120 lines
4.4 KiB
Diff

From d6ce8e5420b08b80203391f4172442249012087a Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 27 Sep 2017 19:35:59 -0400
Subject: [PATCH 1/5] matplotlibrc path search fix
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
lib/matplotlib/__init__.py | 5 ++++-
lib/matplotlib/backend_tools.py | 16 ++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
index ad4676b11a..b925a4a703 100644
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
@@ -589,7 +589,8 @@ def get_cachedir():
@_logged_cached('matplotlib data path: %s')
def get_data_path():
"""Return the path to Matplotlib data."""
- return str(Path(__file__).with_name("mpl-data"))
+ return str(Path(__file__).parent.parent.parent.parent.parent /
+ 'share/matplotlib/mpl-data')
def matplotlib_fname():
@@ -609,6 +610,7 @@ def matplotlib_fname():
is not defined)
- On other platforms,
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
+ - ``/etc/matplotlibrc``
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
exist.
"""
@@ -627,6 +629,7 @@ def matplotlib_fname():
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
yield os.path.join(get_configdir(), 'matplotlibrc')
+ yield '/etc/matplotlibrc'
yield os.path.join(get_data_path(), 'matplotlibrc')
for fname in gen_candidates():
diff --git a/lib/matplotlib/backend_tools.py b/lib/matplotlib/backend_tools.py
index 5076ae5635..e74c33678c 100644
--- a/lib/matplotlib/backend_tools.py
+++ b/lib/matplotlib/backend_tools.py
@@ -605,7 +605,7 @@ class ToolHome(ViewsPositionsBase):
"""Restore the original view limits."""
description = 'Reset original view'
- image = 'mpl-data/images/home'
+ image = '/usr/share/matplotlib/mpl-data/images/home'
default_keymap = property(lambda self: mpl.rcParams['keymap.home'])
_on_trigger = 'home'
@@ -614,7 +614,7 @@ class ToolBack(ViewsPositionsBase):
"""Move back up the view limits stack."""
description = 'Back to previous view'
- image = 'mpl-data/images/back'
+ image = '/usr/share/matplotlib/mpl-data/images/back'
default_keymap = property(lambda self: mpl.rcParams['keymap.back'])
_on_trigger = 'back'
@@ -623,7 +623,7 @@ class ToolForward(ViewsPositionsBase):
"""Move forward in the view lim stack."""
description = 'Forward to next view'
- image = 'mpl-data/images/forward'
+ image = '/usr/share/matplotlib/mpl-data/images/forward'
default_keymap = property(lambda self: mpl.rcParams['keymap.forward'])
_on_trigger = 'forward'
@@ -632,14 +632,14 @@ class ConfigureSubplotsBase(ToolBase):
"""Base tool for the configuration of subplots."""
description = 'Configure subplots'
- image = 'mpl-data/images/subplots'
+ image = '/usr/share/matplotlib/mpl-data/images/subplots'
class SaveFigureBase(ToolBase):
"""Base tool for figure saving."""
description = 'Save the figure'
- image = 'mpl-data/images/filesave'
+ image = '/usr/share/matplotlib/mpl-data/images/filesave'
default_keymap = property(lambda self: mpl.rcParams['keymap.save'])
@@ -714,7 +714,7 @@ class ToolZoom(ZoomPanBase):
"""A Tool for zooming using a rectangle selector."""
description = 'Zoom to rectangle'
- image = 'mpl-data/images/zoom_to_rect'
+ image = '/usr/share/matplotlib/mpl-data/images/zoom_to_rect'
default_keymap = property(lambda self: mpl.rcParams['keymap.zoom'])
cursor = cursors.SELECT_REGION
radio_group = 'default'
@@ -836,7 +836,7 @@ class ToolPan(ZoomPanBase):
default_keymap = property(lambda self: mpl.rcParams['keymap.pan'])
description = 'Pan axes with left mouse, zoom with right'
- image = 'mpl-data/images/move'
+ image = '/usr/share/matplotlib/mpl-data/images/move'
cursor = cursors.MOVE
radio_group = 'default'
@@ -900,7 +900,7 @@ class ToolPan(ZoomPanBase):
class ToolHelpBase(ToolBase):
description = 'Print tool list, shortcuts and description'
default_keymap = property(lambda self: mpl.rcParams['keymap.help'])
- image = 'mpl-data/images/help'
+ image = '/usr/share/matplotlib/mpl-data/images/help'
@staticmethod
def format_shortcut(key_sequence):
--
2.49.0