Package peppy :: Package lib :: Module bitmapscroller :: Class MouseSelector
[frames] | no frames]

Class MouseSelector

object --+
         |
        MouseSelector
Known Subclasses:

Base class for user interaction classes.

A selector is a class that represents a user interaction with the bitmap. User interactions are triggered by a certain mouse event combination, and once triggered, the BitmapScroller makes that the current selector.

Mouse event processing for the BitmapScroller is directed to the current selector through the processEvent method, which directs the action depending on which combination of mouse events occur. The processEvent handler should return False when an event combination is reached that signals the end of the selector's processing. The selector will be destroyed by the BitmapScroller when this occurs.

Instance Methods
 
__init__(self, scroller, ev=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
processEvent(self, ev)
Process a mouse event for this selector.
 
startEvent(self, ev)
Set up the initial state to begin event processing.
 
handleEvent(self, ev)
General event handler.
 
handleEventPostHook(self, ev)
 
finishEvent(self, ev)
User interaction is complete.
 
draw(self)
 
cleanup(self)
 
recalc(self)
 
recalc_and_draw(self)
 
getOverlayDC(self)
 
getViewOffset(self)
 
setWorldCoordsFromImageCoords(self, x, y)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods
 
trigger(self, ev)
Identify the trigger event to turn on this selector.
Class Variables
  cursor = 1
Properties

Inherited from object: __class__

Method Details

__init__(self, scroller, ev=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

trigger(self, ev)
Class Method

 

Identify the trigger event to turn on this selector.

Return True if the event passed in is the event that triggers this selector to begin.

processEvent(self, ev)

 

Process a mouse event for this selector.

This callback is called for any mouse event once the selector is active in the scroller. The selector is not deactivated until this handler returns False, so make sure some event will cause it to return False.

startEvent(self, ev)

 

Set up the initial state to begin event processing.

This is generally called by the constructor to set up whatever initial state is necessary to allow further events to be handled by the processEvent method.

handleEvent(self, ev)

 

General event handler.

This method is called by processEvent to show the results of the user interaction on the bitmap.

finishEvent(self, ev)

 

User interaction is complete.

This method is called when the user has completed the interaction. This does not necessarily destroy the selector -- it's up to the processEvent returning False to signal the BitmapScroller to kill the selector.

This could be used in multi-stage processing; see the RubberBand for an example where finishEvent doesn't mean that the selector should be destroyed.