File: light.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 (39 lines) | stat: -rw-r--r-- 923 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
39
class Light:
    '''Light facade.

    Light sensor measures the ambient light level(illumination) in lx.
    Common uses include controlling screen brightness.

    With method `enable` you can turn on the sensor and
    `disable` method stops the sensor.

    Use property `illumination` to get current illumination in lx.

    .. versionadded:: 1.2.5

    Supported Platforms:: Android
    '''

    @property
    def illumination(self):
        '''Current illumination in lx.'''
        return self._get_illumination()

    def enable(self):
        '''Enable light sensor.'''
        self._enable()

    def disable(self):
        '''Disable light sensor.'''
        self._disable()

    # private

    def _get_illumination(self, **kwargs):
        raise NotImplementedError()

    def _enable(self, **kwargs):
        raise NotImplementedError()

    def _disable(self, **kwargs):
        raise NotImplementedError()