summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@friendly-machines.com>2026-02-13 11:37:09 +0000
committerDanny Milosavljevic <dannym@friendly-machines.com>2026-02-21 21:52:40 +0100
commit202d682caffaf19abe62913a133a18ec15bbd589 (patch)
tree68c6b467ef95e8ecf08b08f283e1a398072ae40a /gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch
parenteb3d2b85f97599c18d5133dd6c151003b78804dd (diff)
gnu: Add python-mslice.
* gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch: New file. * gnu/local.mk (dist_patch_DATA): Add reference to it. * gnu/packages/physics.scm (python-mslice): New variable. Change-Id: I55b884b53bef3f59d466e8980a643e4ef78fa544
Diffstat (limited to 'gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch')
-rw-r--r--gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch b/gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch
new file mode 100644
index 00000000000..8bbb81224da
--- /dev/null
+++ b/gnu/packages/patches/python-mslice-matplotlib-3.6-compatibility.patch
@@ -0,0 +1,46 @@
+From: Danny Milosavljevic <dannym@friendly-machines.com>
+Date: 2026-02-13
+Subject: Fix compatibility with matplotlib 3.6+
+
+Matplotlib 3.6 removed the `message` Qt signal from NavigationToolbar2QT.
+The old API was:
+
+ message = QtCore.Signal(str)
+
+ def set_message(self, s):
+ self.message.emit(s)
+ self.locLabel.setText(s)
+
+The new API just updates the label directly with no signal:
+
+ def set_message(self, s):
+ self.locLabel.setText(s)
+
+Matplotlib provides no replacement signal. The only way to intercept
+toolbar messages is to override the set_message method.
+
+This patch replaces the signal connection with a method override that
+forwards messages to the status bar.
+
+--- a/src/mslice/plotting/plot_window/plot_window.py
++++ b/src/mslice/plotting/plot_window/plot_window.py
+@@ -274,7 +274,18 @@ class PlotWindow(QtWidgets.QMainWindow):
+
+ def create_status_bar(self):
+ self.statusbar = QtWidgets.QStatusBar(self)
+- self.stock_toolbar.message.connect(self.statusbar.showMessage)
++ # Matplotlib 3.6 removed the `message` Qt signal from
++ # NavigationToolbar2QT. The old code was:
++ #
++ # self.stock_toolbar.message.connect(self.statusbar.showMessage)
++ #
++ # Since matplotlib provides no replacement signal, we override
++ # set_message to forward messages to the status bar.
++ original_set_message = self.stock_toolbar.set_message
++ def set_message_forwarding_to_statusbar(s):
++ original_set_message(s)
++ self.statusbar.showMessage(s)
++ self.stock_toolbar.set_message = set_message_forwarding_to_statusbar
+ self.setStatusBar(self.statusbar)
+
+ def flag_as_kept(self):