Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
docstring corrections
  • Loading branch information
Federico Ariza committed Jul 17, 2020
commit ef686fcfc2d440b5960f951ac105390466b723f2
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3306,7 +3306,7 @@ def __init__(self, toolmanager):
lambda event: self.set_message(event.message))
toolmanager.toolmanager_connect(
'tool_removed_event',
lambda event: self.remove_toolitem(event.tool.name))
lambda event: self.remove_toolitem(event.tool_name))

def _tool_toggled_cbk(self, event):
"""
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/backend_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class ToolEvent:
"""Event for tool manipulation (add/remove)"""
"""Event for tool manipulation (add/remove)."""
def __init__(self, name, sender, tool, tool_name, data=None):
self.name = name
self.sender = sender
Expand All @@ -19,7 +19,7 @@ def __init__(self, name, sender, tool, tool_name, data=None):


class ToolTriggerEvent(ToolEvent):
"""Event to inform that a tool has been triggered"""
"""Event to inform that a tool has been triggered."""
def __init__(self, name, sender, tool, tool_name,
canvasevent=None, data=None):
ToolEvent.__init__(self, name, sender, tool, tool_name, data)
Expand Down Expand Up @@ -274,7 +274,7 @@ def add_tool(self, name, tool, *args, **kwargs):
'exists, not added')
return self._tools[name]

tool_obj = tool_cls(self, name, *args, **kwargs)
tool_obj = tool_cls(self, *args, **kwargs)
self._tools[name] = tool_obj

if tool_cls.default_keymap is not None:
Expand Down Expand Up @@ -437,7 +437,7 @@ def get_tool(self, name, warn=True):
`.ToolBase` or None
The tool or None if no tool with the given name exists.
"""
if isinstance(name, tools.ToolBase) and name.name in self._tools:
if isinstance(name, tools.ToolBase) and name in self._tools.values():
return name
if name not in self._tools:
if warn:
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ToolBase:

Attributes
----------
toolmanager: `matplotlib.backend_managers.ToolManager`
ToolManager that controls this Tool
figure: `FigureCanvas`
Figure instance that is affected by this Tool
toolmanager : `matplotlib.backend_managers.ToolManager`
ToolManager that controls this Tool.
figure : `FigureCanvas`
Figure instance that is affected by this Tool.
"""

default_keymap = None
Expand All @@ -76,7 +76,7 @@ class ToolBase:
*name* is used as a label in the toolbar button.
"""

def __init__(self, toolmanager, name):
def __init__(self, toolmanager):
cbook._warn_external(
'The new Tool classes introduced in v1.5 are experimental; their '
'API (including names) will likely change in future versions.')
Expand Down Expand Up @@ -273,7 +273,7 @@ def _tool_trigger_cbk(self, event):
self._set_cursor_cbk(event.canvasevent)

def _add_tool(self, tool_name, tool):
"""set the cursor when the tool is triggered"""
"""Set the cursor when the tool is triggered."""
if getattr(tool, 'cursor', None) is not None:
self.toolmanager.toolmanager_connect('tool_trigger_%s' % tool_name,
self._tool_trigger_cbk)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ def _show_shortcuts_window(self):
self._normalize_shortcut(key)
for key in self.toolmanager.get_tool_keymap(name)
if self._is_valid_shortcut(key)),
title=tool.name,
title=name,
subtitle=tool.description)
group.add(shortcut)

Expand Down