File: gravity.py

package info (click to toggle)
python-plyer 2.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,808 kB
  • sloc: python: 13,395; sh: 217; makefile: 177
file content (38 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Gravity:
    '''Gravity facade.

    .. versionadded:: 1.2.5

    Supported Platforms:: Android

    '''

    @property
    def gravity(self):
        '''Property that returns values of the current gravity force
        as a (x, y, z) tuple. Returns (None, None, None)
        if no data is currently available.
        '''
        return self._get_gravity()

    def enable(self):
        '''Activate the gravity sensor. Throws an error if the
        hardware is not available or not implemented on.
        '''
        self._enable()

    def disable(self):
        '''Disable the gravity sensor.
        '''
        self._disable()

    # private

    def _enable(self):
        raise NotImplementedError()

    def _disable(self):
        raise NotImplementedError()

    def _get_gravity(self):
        raise NotImplementedError()