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

Class RubberBand

   object --+    
            |    
MouseSelector --+
                |
               RubberBand

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)
Driver for new event.
 
startNormalEvent(self, ev, coords)
 
startResizeEvent(self, ev, coords)
 
startMoveEvent(self, ev, coords)
 
handleEvent(self, ev)
General event handler.
 
handleResizeEvent(self, ev)
 
handleMoveEvent(self, ev)
 
handleCursorChanges(self, ev)
 
finishEvent(self, ev)
User interaction is complete.
 
handleEventPostHook(self, ev)
 
drawSelector(self, dc)
 
isOnBorder(self, coords)
Are the world coordinates on the selection border?
 
getBorderCursorIndex(self, coords)
Get resize cursor depending on position on border.
 
isInside(self, coords)
Are the world coordinates on the selection border?
 
recalc(self)
 
normalizeImageCoords(self)
 
normalizeNewImageCoords(self, x0, y0, x1, y1)
 
setWorldCoordsFromImageCoords(self, x, y)
 
moveWorldCoordsFromImageCoords(self, x, y)
 
resizeWorldCoordsFromImageCoords(self, x, y)
 
getSelectedBox(self)
Return selected box in image coords.
 
setSelection(self, x0, y0, x1, y1)
Programmatically set the selection rectangle.

Inherited from MouseSelector: cleanup, draw, getOverlayDC, getViewOffset, recalc_and_draw

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

Class Methods

Inherited from MouseSelector: trigger

Class Variables
  move_cursor = 22
  resize_cursors = [20, 19, 18, 21, 20, 19, 18, 21]

Inherited from MouseSelector: cursor

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)

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.

Overrides: MouseSelector.processEvent

startEvent(self, ev)

 

Driver for new event.

This selector recognizes a few different types of events: a normal event where the user uses the mouse to select a new rectangular area, a move event where the user can drag around the area without changing its size, and a bunch of resize events where the user can grab a corner or edge and make the rectangular area bigger.

Overrides: MouseSelector.startEvent

handleEvent(self, ev)

 

General event handler.

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

Overrides: MouseSelector.handleEvent
(inherited documentation)

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.

Overrides: MouseSelector.finishEvent
(inherited documentation)

handleEventPostHook(self, ev)

 
Overrides: MouseSelector.handleEventPostHook

isOnBorder(self, coords)

 

Are the world coordinates on the selection border?

Return true if the world coordinates specified are on or within a tolerance of the selecton border.

getBorderCursorIndex(self, coords)

 
Get resize cursor depending on position on border.

Modified from wx.lib.mixins.rubberband: Return a position
number in the range 0 .. 7 to indicate where on the box border
the point is.  The layout is:

      0    1    2
      7         3
      6    5    4

isInside(self, coords)

 

Are the world coordinates on the selection border?

Return true if the world coordinates specified are on or within a tolerance of the selecton border.

recalc(self)

 
Overrides: MouseSelector.recalc

setWorldCoordsFromImageCoords(self, x, y)

 
Overrides: MouseSelector.setWorldCoordsFromImageCoords

getSelectedBox(self)

 

Return selected box in image coords.

Returns an (x, y, w, h) tuple of the selected rectangle.