Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Spelling mistakes, and general tidying up of sentences. #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
51 changes: 25 additions & 26 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -3224,9 +3224,9 @@ def __init__(self, name, sender, tool, canvasevent=None, data=None):


class NavigationMessageEvent(object):
"""Event carring messages from navigation
"""Event carrying messages from navigation

Messages are generaly displayed to the user by the toolbar
Messages usually get displayed to the user by the toolbar
"""
def __init__(self, name, sender, message):
self.name = name
Expand Down Expand Up @@ -3313,7 +3313,7 @@ def active_toggle(self):
return self._toggled

def get_tool_keymap(self, name):
"""Get the keymap associated with a tool
"""Get the keymap associated with the specified tool

Parameters
----------
Expand All @@ -3334,13 +3334,13 @@ def _remove_keys(self, name):
del self._keys[k]

def set_tool_keymap(self, name, *keys):
"""Set the keymap associated with a tool
"""Set the keymap to associate with the specified tool

Parameters
----------
name : string
Name of the Tool
keys : keys to associated with the Tool
keys : keys to associate with the Tool
"""

if name not in self._tools:
Expand Down Expand Up @@ -3414,7 +3414,7 @@ def add_tool(self, name, tool, group=None, position=None):
group: String
Group to position the tool in
position : int or None (default)
Position within its group in the toolbar, if None, is positioned at the end
Position within its group in the toolbar, if None, it goes at the end
"""

tool_cls = self._get_cls_to_instantiate(tool)
Expand All @@ -3431,7 +3431,7 @@ def add_tool(self, name, tool, group=None, position=None):
if tool_cls.keymap is not None:
self.set_tool_keymap(name, tool_cls.keymap)

# For toggle tools init the radio_grop in self._toggled
# For toggle tools init the radio_group in self._toggled
if getattr(tool_cls, 'toggled', False) is not False:
# None group is not mutually exclusive, a set is used to keep track
# of all toggled tools in this group
Expand All @@ -3451,8 +3451,8 @@ def _tool_added_event(self, tool, group, position):
self._callbacks.process(s, event)

def _handle_toggle(self, tool, sender, canvasevent, data):
# Toggle tools, need to be untoggled before other Toggle tool is used
# This is called from tool_trigger_event
# Toggle tools, need to untoggle prior to using other Toggle tool
# Called from tool_trigger_event

radio_group = tool.radio_group
# radio_group None is not mutually exclusive
Expand All @@ -3464,8 +3464,7 @@ def _handle_toggle(self, tool, sender, canvasevent, data):
self._toggled[None].add(tool.name)
return

# If it is the same tool that is toggled in the radio_group
# untoggle it
# If the tool already has a toggled state, untoggle it
if self._toggled[radio_group] == tool.name:
toggled = None
# If no tool was toggled in the radio_group
Expand Down Expand Up @@ -3510,7 +3509,7 @@ def tool_trigger_event(self, name, sender=None, canvasevent=None,
name : string
Name of the tool
sender: object
Object that wish to trigger the tool
Object that wishes to trigger the tool
canvasevent : Event
Original Canvas event or None
data : Object
Expand Down Expand Up @@ -3541,7 +3540,7 @@ def _trigger_tool(self, name, sender=None, canvasevent=None, data=None):
self._handle_toggle(tool, sender, canvasevent, data)

# Important!!!
# This is where the Tool object is triggered
# This is where the Tool object gets triggered
tool.trigger(sender, canvasevent, data)

def _key_press(self, event):
Expand Down Expand Up @@ -3590,21 +3589,21 @@ def __init__(self, manager):
self._remove_tool_cbk)

def _message_cbk(self, event):
"""Captures the 'tool_message_event' to set message on the toolbar"""
"""Captures the 'tool_message_event' to set the message on the toolbar"""
self.set_message(event.message)

def _tool_triggered_cbk(self, event):
"""Captures the 'tool-trigger-toolname

This is only used for toggled tools
This only gets used for toggled tools
"""
if event.sender is self:
return

self.toggle_toolitem(event.tool.name)

def _add_tool_cbk(self, event):
"""Captures 'tool_added_event' and add the tool to the toolbar"""
"""Captures 'tool_added_event' and adds the tool to the toolbar"""
image = self._get_image_filename(event.tool.image)
toggle = getattr(event.tool, 'toggled', None) is not None
self.add_toolitem(event.tool.name,
Expand All @@ -3618,11 +3617,11 @@ def _add_tool_cbk(self, event):
self._tool_triggered_cbk)

def _remove_tool_cbk(self, event):
"""Captures the 'tool_removed_event' signal and remove the tool"""
"""Captures the 'tool_removed_event' signal and removes the tool"""
self.remove_toolitem(event.tool.name)

def _get_image_filename(self, image):
""""Base on the image name find the corresponding image"""
"""Find the image based on its name"""
# TODO: better search for images, they are not always in the
# datapath
basedir = os.path.join(rcParams['datapath'], 'images')
Expand All @@ -3638,28 +3637,28 @@ def trigger_tool(self, name):
Parameters
----------
name : String
Name(id) of the tool that was triggered in the toolbar
Name(id) of the tool triggered from within the toolbar

"""
self.navigation.tool_trigger_event(name, sender=self)

def add_toolitem(self, name, group, position, image, description, toggle):
"""Add a toolitem to the toolbar

This method has to be implemented per backend
This method must get implemented per backend

The callback associated with the button click event,
must be **EXACTLY** `self.trigger_tool(name)`

Parameters
----------
name : string
Name of the tool to add, this is used as ID and as default label
of the buttons
Name of the tool to add, this gets used as the tool's ID and as the
default label of the buttons
group : String
Name of the group that the tool belongs to
Name of the group that this tool belongs to
position : Int
Position of the tool whthin its group if -1 at the End
Position of the tool within its group, if -1 it goes at the End
image_file : String
Filename of the image for the button or `None`
description : String
Expand Down Expand Up @@ -3697,9 +3696,9 @@ def toggle_toolitem(self, name):
def remove_toolitem(self, name):
"""Remove a toolitem from the `Toolbar`

This method has to be implemented per backend
This method must get implemented per backend

Called when `tool_removed_event` is emited by `NavigationBase`
Called when `NavigationBase` emits a `tool_removed_event`

Parameters
----------
Expand Down
19 changes: 9 additions & 10 deletions lib/matplotlib/backend_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,15 @@ def trigger(self, sender, event, data=None):
def enable(self, event=None):
"""Enable the toggle tool

This method is called dby `trigger` when the `toggled` is False
`trigger` calls this method when `toggled` is False
"""

pass

def disable(self, event=None):
"""Disable the toggle tool

This method is called by `trigger` when the `toggled` is True.
`trigger` call this methond when `toggled` is True.

This can happen in different circumstances

Expand All @@ -174,7 +174,7 @@ class SetCursorBase(ToolBase):
"""Change to the current cursor while inaxes

This tool, keeps track of all `ToolToggleBase` derived tools, and calls
set_cursor when one of these tools is triggered
set_cursor when a tool gets triggered
"""
def __init__(self, *args, **kwargs):
ToolBase.__init__(self, *args, **kwargs)
Expand Down Expand Up @@ -251,7 +251,6 @@ def send_message(self, event):
message = ' '

if event.inaxes and event.inaxes.get_navigate():

try:
s = event.inaxes.format_coord(event.xdata, event.ydata)
except (ValueError, OverflowError):
Expand All @@ -275,14 +274,14 @@ def trigger(self, sender, event, data):
def draw_rubberband(self, *data):
"""Draw rubberband

This method has to be implemented per backend
This method must get implemented per backend
"""
pass

def remove_rubberband(self):
"""Remove rubberband

This method has to be implemented per backend
This method must get implemented per backend
"""
pass

Expand Down Expand Up @@ -383,7 +382,7 @@ def disable(self, event):


class ToolYScale(AxisScaleBase):
"""Tool to toggle between linear and logarithmic the Y axis"""
"""Tool to toggle between linear and logarithmic scales on the Y axis"""

description = 'Toogle Scale Y axis'
keymap = rcParams['keymap.yscale']
Expand All @@ -393,7 +392,7 @@ def set_scale(self, ax, scale):


class ToolXScale(AxisScaleBase):
"""Tool to toggle between linear and logarithmic the X axis"""
"""Tool to toggle between linear and logarithmic scales on the X axis"""

description = 'Toogle Scale X axis'
keymap = rcParams['keymap.xscale']
Expand All @@ -405,8 +404,8 @@ def set_scale(self, ax, scale):
class ToolViewsPositions(ToolBase):
"""Auxiliary Tool to handle changes in views and positions

Runs in the background and is used by all the tools that
need to access the record of views and positions of the figure
Runs in the background and should get used by all the tools that
need to access the figure's history of views and positions, e.g.

* `ToolZoom`
* `ToolPan`
Expand Down