Sideband/sbapp/plyer/platforms/macosx/accelerometer.py

26 lines
551 B
Python
Raw Normal View History

2022-09-16 10:07:57 -06:00
'''
MacOSX accelerometer
---------------------
'''
2024-06-02 10:31:58 -06:00
from sbapp.plyer.facades import Accelerometer
from sbapp.plyer.platforms.macosx.libs import osx_motion_sensor
2022-09-16 10:07:57 -06:00
class OSXAccelerometer(Accelerometer):
def _enable(self):
try:
osx_motion_sensor.get_coord()
except Exception:
raise Exception('Could not enable motion sensor on this macbook!')
def _disable(self):
pass
def _get_acceleration(self):
return osx_motion_sensor.get_coord()
def instance():
return OSXAccelerometer()