Package horizons :: Package gui :: Package mousetools :: Module cursortool :: Class CursorTool
[hide private]
[frames] | no frames]

Class CursorTool

source code

fife.fife.IMouseListener --+
                           |
                          CursorTool

Basic tool for cursors.

Instance Methods [hide private]
 
__init__(self, session) source code
 
enable(self)
Call this to get events.
source code
 
disable(self)
Call this to not get events.
source code
 
remove(self) source code
 
mousePressed(self, evt) source code
 
mouseReleased(self, evt) source code
 
mouseEntered(self, evt) source code
 
mouseExited(self, evt) source code
 
mouseClicked(self, evt) source code
 
mouseWheelMovedUp(self, evt) source code
 
mouseWheelMovedDown(self, evt) source code
 
mouseMoved(self, evt) source code
 
mouseDragged(self, evt) source code
 
_round_map_coords(self, map_x, map_y)
Returns the coordinates of an event at the map.
source code
 
get_world_location(self, evt) source code
 
get_exact_world_location(self, evt)
Returns the coordinates of an event at the map.
source code
 
_get_screenpoint(self, arg)
Python lacks polymorphism.
source code
 
end(self) source code
Class Variables [hide private]
  log = logging.getLogger("gui.mousetools")
Method Details [hide private]

_round_map_coords(self, map_x, map_y)

source code 
Returns the coordinates of an event at the map.

Why roundhalfplus?

        a      b     a-b   round(a)-round(b)  roundplus(a)-roundplus(b)

       1.50   0.50   1.00       1.00               1.0
       0.50  -0.49   0.99       1.00               1.0
      -0.49  -1.49   1.00       1.00               1.0
Error: 0.50  -0.50   1.00       2.00               1.0

This error would result in fields at position 0 to be smaller than the others,
because both sides (-0.5 and 0.5) would be wrongly assigned to the other fields.

@return Point with int coordinates

get_exact_world_location(self, evt)

source code 

Returns the coordinates of an event at the map. @return FifePoint with float coordinates or something with getX/getY