@@ -1145,7 +1145,7 @@ def __init__(self, ax, onselect, useblit=False, button=None,
1145
1145
self .connect_default_events ()
1146
1146
1147
1147
self .state_modifier_keys = dict (move = ' ' , clear = 'escape' ,
1148
- square = 'shift' , center = 'ctrl ' )
1148
+ square = 'shift' , center = 'control ' )
1149
1149
self .state_modifier_keys .update (state_modifier_keys or {})
1150
1150
1151
1151
self .background = None
@@ -1273,7 +1273,8 @@ def press(self, event):
1273
1273
self .eventpress = event
1274
1274
self ._prev_event = event
1275
1275
key = event .key or ''
1276
- key = key .replace ('control' , 'ctrl' )
1276
+ key = key .replace ('ctrl' , 'control' )
1277
+ # move state is locked in on a button press
1277
1278
if key == self .state_modifier_keys ['move' ]:
1278
1279
self .state .add ('move' )
1279
1280
self ._press (event )
@@ -1322,10 +1323,10 @@ def _on_scroll(self, event):
1322
1323
pass
1323
1324
1324
1325
def on_key_press (self , event ):
1325
- """Key press event handler and validator"""
1326
+ """Key press event handler and validator for all selection widgets """
1326
1327
if self .active :
1327
1328
key = event .key or ''
1328
- key = key .replace ('control ' , 'ctrl ' )
1329
+ key = key .replace ('ctrl ' , 'control ' )
1329
1330
if key == self .state_modifier_keys ['clear' ]:
1330
1331
for artist in self .artists :
1331
1332
artist .set_visible (False )
@@ -1337,7 +1338,8 @@ def on_key_press(self, event):
1337
1338
self ._on_key_press (event )
1338
1339
1339
1340
def _on_key_press (self , event ):
1340
- """Key press event handler"""
1341
+ """Key press event handler - use for widget-specific key press actions.
1342
+ """
1341
1343
pass
1342
1344
1343
1345
def on_key_release (self , event ):
@@ -1424,7 +1426,7 @@ def __init__(self, ax, onselect, direction, minspan=None, useblit=False,
1424
1426
if rectprops is None :
1425
1427
rectprops = dict (facecolor = 'red' , alpha = 0.5 )
1426
1428
1427
- rectprops ['animated' ] = useblit
1429
+ rectprops ['animated' ] = self . useblit
1428
1430
1429
1431
if direction not in ['horizontal' , 'vertical' ]:
1430
1432
msg = "direction must be in [ 'horizontal' | 'vertical' ]"
@@ -1567,7 +1569,6 @@ def _onmove(self, event):
1567
1569
1568
1570
1569
1571
class ToolHandles (object ):
1570
-
1571
1572
"""Control handles for canvas tools.
1572
1573
1573
1574
Parameters
0 commit comments