Package reflectometry :: Package model1d :: Package profileview :: Module binder :: Class BindArtist

Class BindArtist

source code

Instance Methods
 
__init__(self, figure) source code
 
clear(self, h1, h2, ...)
Remove connections for artists h1, h2, ...
source code
 
clearall(self)
Clear connections to all artists.
source code
 
disconnect(self)
In case we need to disconnect from the canvas...
source code
 
__del__(self) source code
 
__call__(self, trigger, artist, action)
Register a callback for an artist to a particular trigger event.
source code
 
trigger(self, actor, action, ev)
Trigger a particular event for the artist.
source code
Class Variables
  control = False
  shift = False
  alt = False
  meta = False
  dclick_threshhold = 0.25
  events = ['enter', 'leave', 'motion', 'click', 'dclick', 'drag...
Method Details

clear(self, h1, h2, ...)

source code 
Remove connections for artists h1, h2, ...

Use clearall() to reset all connections.

clearall(self)

source code 

Clear connections to all artists.

Use clear(h1,h2,...) to reset specific artists.

__call__(self, trigger, artist, action)
(Call operator)

source code 
Register a callback for an artist to a particular trigger event.

usage:
    self.connect(eventname,artist,action)

where:
    eventname is a string
    artist is the particular graph object to respond to the event
    action(event,**kw) is called when the event is triggered

The action callback is associated with particular artists.
Different artists will have different kwargs.  See documentation
on the contains() method for each artist.  One common properties
are ind for the index of the item under the cursor, which is
returned by Line2D and by collections.

The following events are supported:
    enter: mouse cursor moves into the artist or to a new index
    leave: mouse cursor leaves the artist
    click: mouse button pressed on the artist
    drag: mouse button pressed on the artist and cursor moves
    release: mouse button released for the artist
    key: key pressed when mouse is on the artist
    keyrelease: key released for the artist

The event received by action has a number of attributes:
    name is the event name which was triggered
    artist is the object which triggered the event
    x,y are the screen coordinates of the mouse
    xdata,ydata are the graph coordinates of the mouse
    button is the mouse button being pressed/released
    key is the key being pressed/released
    shift,control,alt,meta are flags which are true if the
        corresponding key is pressed at the time of the event.
    details is a dictionary of artist specific details, such as the
        id(s) of the point that were clicked.

When receiving an event, first check the modifier state to be
sure it applies.  E.g., the callback for 'press' might be:
    if event.button == 1 and event.shift: process Shift-click

TODO: Only receive events with the correct modifiers (e.g., S-click,
TODO:   or *-click for any modifiers).
TODO: Only receive button events for the correct button (e.g., click1
TODO:   release3, or dclick* for any button)
TODO: Support virtual artist, so that and artist can be flagged as
TODO:   having a tag list and receive the correct events
TODO: Support virtual events for binding to button-3 vs shift button-1
TODO:   without changing callback code
TODO: Attach multiple callbacks to the same event?
TODO: Clean up interaction with toolbar modes
TODO: push/pushclear/pop context so that binding changes for the duration
TODO:   e.g., to support ? context sensitive help

trigger(self, actor, action, ev)

source code 
Trigger a particular event for the artist. Fallback to axes, to figure, and to 'all' if the event is not processed.

Class Variable Details

events

Value:
['enter',
 'leave',
 'motion',
 'click',
 'dclick',
 'drag',
 'release',
 'scroll',
...