Visitar URL original
Merge pull request #3 from OceanWolf/navigation-by-events-textual · KevKeating/matplotlib@a687be2 · GitHub
Skip to content

Commit a687be2

Browse files
committed
Merge pull request matplotlib#3 from OceanWolf/navigation-by-events-textual
Spelling mistakes, and general tidying up of sentences.
2 parents da1ebcb + 05b06c6 commit a687be2

2 files changed

Lines changed: 34 additions & 36 deletions

File tree

‎lib/matplotlib/backend_bases.py‎

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,9 +3224,9 @@ def __init__(self, name, sender, tool, canvasevent=None, data=None):
32243224

32253225

32263226
class NavigationMessageEvent(object):
3227-
"""Event carring messages from navigation
3227+
"""Event carrying messages from navigation
32283228
3229-
Messages are generaly displayed to the user by the toolbar
3229+
Messages usually get displayed to the user by the toolbar
32303230
"""
32313231
def __init__(self, name, sender, message):
32323232
self.name = name
@@ -3313,7 +3313,7 @@ def active_toggle(self):
33133313
return self._toggled
33143314

33153315
def get_tool_keymap(self, name):
3316-
"""Get the keymap associated with a tool
3316+
"""Get the keymap associated with the specified tool
33173317
33183318
Parameters
33193319
----------
@@ -3334,13 +3334,13 @@ def _remove_keys(self, name):
33343334
del self._keys[k]
33353335

33363336
def set_tool_keymap(self, name, *keys):
3337-
"""Set the keymap associated with a tool
3337+
"""Set the keymap to associate with the specified tool
33383338
33393339
Parameters
33403340
----------
33413341
name : string
33423342
Name of the Tool
3343-
keys : keys to associated with the Tool
3343+
keys : keys to associate with the Tool
33443344
"""
33453345

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

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

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

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

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

3467-
# If it is the same tool that is toggled in the radio_group
3468-
# untoggle it
3467+
# If the tool already has a toggled state, untoggle it
34693468
if self._toggled[radio_group] == tool.name:
34703469
toggled = None
34713470
# If no tool was toggled in the radio_group
@@ -3510,7 +3509,7 @@ def tool_trigger_event(self, name, sender=None, canvasevent=None,
35103509
name : string
35113510
Name of the tool
35123511
sender: object
3513-
Object that wish to trigger the tool
3512+
Object that wishes to trigger the tool
35143513
canvasevent : Event
35153514
Original Canvas event or None
35163515
data : Object
@@ -3541,7 +3540,7 @@ def _trigger_tool(self, name, sender=None, canvasevent=None, data=None):
35413540
self._handle_toggle(tool, sender, canvasevent, data)
35423541

35433542
# Important!!!
3544-
# This is where the Tool object is triggered
3543+
# This is where the Tool object gets triggered
35453544
tool.trigger(sender, canvasevent, data)
35463545

35473546
def _key_press(self, event):
@@ -3590,21 +3589,21 @@ def __init__(self, manager):
35903589
self._remove_tool_cbk)
35913590

35923591
def _message_cbk(self, event):
3593-
"""Captures the 'tool_message_event' to set message on the toolbar"""
3592+
"""Captures the 'tool_message_event' to set the message on the toolbar"""
35943593
self.set_message(event.message)
35953594

35963595
def _tool_triggered_cbk(self, event):
35973596
"""Captures the 'tool-trigger-toolname
35983597
3599-
This is only used for toggled tools
3598+
This only gets used for toggled tools
36003599
"""
36013600
if event.sender is self:
36023601
return
36033602

36043603
self.toggle_toolitem(event.tool.name)
36053604

36063605
def _add_tool_cbk(self, event):
3607-
"""Captures 'tool_added_event' and add the tool to the toolbar"""
3606+
"""Captures 'tool_added_event' and adds the tool to the toolbar"""
36083607
image = self._get_image_filename(event.tool.image)
36093608
toggle = getattr(event.tool, 'toggled', None) is not None
36103609
self.add_toolitem(event.tool.name,
@@ -3618,11 +3617,11 @@ def _add_tool_cbk(self, event):
36183617
self._tool_triggered_cbk)
36193618

36203619
def _remove_tool_cbk(self, event):
3621-
"""Captures the 'tool_removed_event' signal and remove the tool"""
3620+
"""Captures the 'tool_removed_event' signal and removes the tool"""
36223621
self.remove_toolitem(event.tool.name)
36233622

36243623
def _get_image_filename(self, image):
3625-
""""Base on the image name find the corresponding image"""
3624+
"""Find the image based on its name"""
36263625
# TODO: better search for images, they are not always in the
36273626
# datapath
36283627
basedir = os.path.join(rcParams['datapath'], 'images')
@@ -3638,28 +3637,28 @@ def trigger_tool(self, name):
36383637
Parameters
36393638
----------
36403639
name : String
3641-
Name(id) of the tool that was triggered in the toolbar
3640+
Name(id) of the tool triggered from within the toolbar
36423641
36433642
"""
36443643
self.navigation.tool_trigger_event(name, sender=self)
36453644

36463645
def add_toolitem(self, name, group, position, image, description, toggle):
36473646
"""Add a toolitem to the toolbar
36483647
3649-
This method has to be implemented per backend
3648+
This method must get implemented per backend
36503649
36513650
The callback associated with the button click event,
36523651
must be **EXACTLY** `self.trigger_tool(name)`
36533652
36543653
Parameters
36553654
----------
36563655
name : string
3657-
Name of the tool to add, this is used as ID and as default label
3658-
of the buttons
3656+
Name of the tool to add, this gets used as the tool's ID and as the
3657+
default label of the buttons
36593658
group : String
3660-
Name of the group that the tool belongs to
3659+
Name of the group that this tool belongs to
36613660
position : Int
3662-
Position of the tool whthin its group if -1 at the End
3661+
Position of the tool within its group, if -1 it goes at the End
36633662
image_file : String
36643663
Filename of the image for the button or `None`
36653664
description : String
@@ -3697,9 +3696,9 @@ def toggle_toolitem(self, name):
36973696
def remove_toolitem(self, name):
36983697
"""Remove a toolitem from the `Toolbar`
36993698
3700-
This method has to be implemented per backend
3699+
This method must get implemented per backend
37013700
3702-
Called when `tool_removed_event` is emited by `NavigationBase`
3701+
Called when `NavigationBase` emits a `tool_removed_event`
37033702
37043703
Parameters
37053704
----------

‎lib/matplotlib/backend_tools.py‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ def trigger(self, sender, event, data=None):
143143
def enable(self, event=None):
144144
"""Enable the toggle tool
145145
146-
This method is called dby `trigger` when the `toggled` is False
146+
`trigger` calls this method when `toggled` is False
147147
"""
148148

149149
pass
150150

151151
def disable(self, event=None):
152152
"""Disable the toggle tool
153153
154-
This method is called by `trigger` when the `toggled` is True.
154+
`trigger` call this methond when `toggled` is True.
155155
156156
This can happen in different circumstances
157157
@@ -174,7 +174,7 @@ class SetCursorBase(ToolBase):
174174
"""Change to the current cursor while inaxes
175175
176176
This tool, keeps track of all `ToolToggleBase` derived tools, and calls
177-
set_cursor when one of these tools is triggered
177+
set_cursor when a tool gets triggered
178178
"""
179179
def __init__(self, *args, **kwargs):
180180
ToolBase.__init__(self, *args, **kwargs)
@@ -251,7 +251,6 @@ def send_message(self, event):
251251
message = ' '
252252

253253
if event.inaxes and event.inaxes.get_navigate():
254-
255254
try:
256255
s = event.inaxes.format_coord(event.xdata, event.ydata)
257256
except (ValueError, OverflowError):
@@ -275,14 +274,14 @@ def trigger(self, sender, event, data):
275274
def draw_rubberband(self, *data):
276275
"""Draw rubberband
277276
278-
This method has to be implemented per backend
277+
This method must get implemented per backend
279278
"""
280279
pass
281280

282281
def remove_rubberband(self):
283282
"""Remove rubberband
284283
285-
This method has to be implemented per backend
284+
This method must get implemented per backend
286285
"""
287286
pass
288287

@@ -383,7 +382,7 @@ def disable(self, event):
383382

384383

385384
class ToolYScale(AxisScaleBase):
386-
"""Tool to toggle between linear and logarithmic the Y axis"""
385+
"""Tool to toggle between linear and logarithmic scales on the Y axis"""
387386

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

394393

395394
class ToolXScale(AxisScaleBase):
396-
"""Tool to toggle between linear and logarithmic the X axis"""
395+
"""Tool to toggle between linear and logarithmic scales on the X axis"""
397396

398397
description = 'Toogle Scale X axis'
399398
keymap = rcParams['keymap.xscale']
@@ -405,8 +404,8 @@ def set_scale(self, ax, scale):
405404
class ToolViewsPositions(ToolBase):
406405
"""Auxiliary Tool to handle changes in views and positions
407406
408-
Runs in the background and is used by all the tools that
409-
need to access the record of views and positions of the figure
407+
Runs in the background and should get used by all the tools that
408+
need to access the figure's history of views and positions, e.g.
410409
411410
* `ToolZoom`
412411
* `ToolPan`

0 commit comments

Comments
 (0)