From 1b5fa400bd7cebc31d521fa00ae72c78e5522b19 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 5 Nov 2018 17:18:52 +0100 Subject: [PATCH] Move toolmanager warning from logging to warning. Using warnings.warn avoids emitting the warning once per Tool, i.e. a dozen times at each invocation. (Yes, the system is experimental, we got that part.) Also update the warning message (Matplotlib 2.1 is long past). --- lib/matplotlib/backend_tools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backend_tools.py b/lib/matplotlib/backend_tools.py index 231820b29484..27119a5b80dc 100644 --- a/lib/matplotlib/backend_tools.py +++ b/lib/matplotlib/backend_tools.py @@ -77,9 +77,9 @@ class ToolBase(object): """ def __init__(self, toolmanager, name): - _log.warning('Treat the new Tool classes introduced in v1.5 as ' - 'experimental for now, the API will likely change in ' - 'version 2.1, and some tools might change name') + cbook._warn_external( + 'The new Tool classes introduced in v1.5 are experimental; their ' + 'API (including names) will likely change in future versions.') self._name = name self._toolmanager = toolmanager self._figure = None