Skip to content

Commit 68b4ee3

Browse files
committed
Clean up calls to Gtk.Window.set_icon_from_file.
According to the docs, this function was added in GTK 2.2, so probably was only needed when we supported GTK2. It also no longer exists in GTK4.
1 parent 1d6fd65 commit 68b4ee3

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

lib/matplotlib/backends/backend_gtk3.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,7 @@ def __init__(self, canvas, num):
307307
super().__init__(canvas, num)
308308

309309
self.window.set_wmclass("matplotlib", "Matplotlib")
310-
try:
311-
self.window.set_icon_from_file(window_icon)
312-
except Exception:
313-
# Some versions of gtk throw a glib.GError but not all, so I am not
314-
# sure how to catch it. I am unhappy doing a blanket catch here,
315-
# but am not sure what a better way is - JDH
316-
_log.info('Could not load matplotlib icon: %s', sys.exc_info()[1])
310+
self.window.set_icon_from_file(window_icon)
317311

318312
self.vbox = Gtk.Box()
319313
self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)

lib/matplotlib/backends/backend_gtk4.py

-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import io
3-
import logging
43
import os
54
from pathlib import Path
65
import sys
@@ -39,9 +38,6 @@
3938
)
4039

4140

42-
_log = logging.getLogger(__name__)
43-
44-
4541
def _mpl_to_gtk_cursor(mpl_cursor):
4642
return _api.check_getitem({
4743
Cursors.MOVE: "move",
@@ -264,14 +260,6 @@ def __init__(self, canvas, num):
264260
app.add_window(self.window)
265261
super().__init__(canvas, num)
266262

267-
try:
268-
self.window.set_icon_from_file(window_icon)
269-
except Exception:
270-
# Some versions of gtk throw a glib.GError but not all, so I am not
271-
# sure how to catch it. I am unhappy doing a blanket catch here,
272-
# but am not sure what a better way is - JDH
273-
_log.info('Could not load matplotlib icon: %s', sys.exc_info()[1])
274-
275263
self.vbox = Gtk.Box()
276264
self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)
277265
self.window.set_child(self.vbox)

0 commit comments

Comments
 (0)