Updated Position for mix-ins and decorators

develop
RusAnon 2010-05-03 18:10:00 +11:00
parent 3c9abeff07
commit 5908e1ca71
1 changed files with 16 additions and 9 deletions

@ -4,20 +4,27 @@ Python class for DF_Hack::Position
"""
from ._pydfhack import _PositionManager
from .blocks import Point, Block
class Position(_PositionManager):
from .mixins import NoStart
from .decorators import suspend
class Position(NoStart, _PositionManager):
api = None
cls = _PositionManager
def __init__(self, api, *args, **kwds):
_PositionManager.__init__(self, args, kwds)
self.cls.__init__(self, args, kwds)
self.api = api
def prepare(self):
"""
Enforce Suspend/Start
"""
return self.api.prepare()
@suspend
def get_cursor(self):
self.prepare()
coords = self.cursor_coords
return Point(*coords)
@suspend
def get_window_size(self):
wsize = self.window_size
return wsize
@suspend
def get_view_coords(self):
coords = self.view_coords
return Point(*coords)