Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/api/next_api_changes/deprecations/20995-AL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``backend_gtk3.icon_filename`` and ``backend_gtk3.window_icon``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... are deprecated with no replacement.
19 changes: 10 additions & 9 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def cursord(self):
except TypeError as exc:
return {}

icon_filename = _api.deprecated("3.6", obj_type="")(property(
lambda self:
"matplotlib.png" if sys.platform == "win32" else "matplotlib.svg"))
window_icon = _api.deprecated("3.6", obj_type="")(property(
lambda self:
str(cbook._get_data_path("images", __getattr__("icon_filename")))))


@functools.lru_cache()
def _mpl_to_gtk_cursor(mpl_cursor):
Expand Down Expand Up @@ -307,7 +314,9 @@ def __init__(self, canvas, num):
super().__init__(canvas, num)

self.window.set_wmclass("matplotlib", "Matplotlib")
self.window.set_icon_from_file(window_icon)
icon_ext = "png" if sys.platform == "win32" else "svg"
self.window.set_icon_from_file(
str(cbook._get_data_path(f"images/matplotlib.{icon_ext}")))

self.vbox = Gtk.Box()
self.vbox.set_property("orientation", Gtk.Orientation.VERTICAL)
Expand Down Expand Up @@ -698,14 +707,6 @@ def trigger(self, *args, **kwargs):
clipboard.set_image(pb)


# Define the file to use as the GTk icon
if sys.platform == 'win32':
icon_filename = 'matplotlib.png'
else:
icon_filename = 'matplotlib.svg'
window_icon = str(cbook._get_data_path('images', icon_filename))


def error_msg_gtk(msg, parent=None):
if parent is not None: # find the toplevel Gtk.Window
parent = parent.get_toplevel()
Expand Down