Package horizons :: Package util :: Module lastactiveplayersettlementmanager :: Class LastActivePlayerSettlementManager
[hide private]
[frames] | no frames]

Class LastActivePlayerSettlementManager

source code

Keeps track of the last active (hovered over) player's settlement. Provides it as global reference, but stores as weak reference as not to disturb anything.

Provide new mouse info to it via update(). Retrieve settlement via get(). Hooks itself to view automatically.

Instance Methods [hide private]
 
__init__(self, session) source code
 
save(self, db) source code
 
load(self, db) source code
 
remove(self) source code
 
update(self, current)
Update to new world position.
source code
 
get(self, get_current_pos=False)
The last settlement belonging to the player the mouse has hovered above.
source code
 
get_current_settlement(self)
Returns settlement mouse currently hovers over or None
source code
 
_on_scroll(self)
Called when view changes.
source code
 
_on_new_settlement_created(self, msg) source code
Method Details [hide private]

update(self, current)

source code 

Update to new world position. Sets internal state to new settlement or no settlement

Parameters:
  • current - some kind of position coords with x- and y-values

get(self, get_current_pos=False)

source code 

The last settlement belonging to the player the mouse has hovered above.

Parameters:
  • get_current_pos - get current position even if it's None

_on_scroll(self)

source code 

Called when view changes. Scrolling and zooming can change cursor position.