File: brightness.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 (58 lines) | stat: -rwxr-xr-x 1,269 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'''
Brightness
==========

This API helps you to control the brightness of your primary display screen.

The :class:`Brightness` provides access to public methods to control the
brightness of screen.

NOTE:: For Android, make sure to add permission, WRITE_SETTINGS

Simple Examples
---------------
To know the current brightness level of device::

    >>> from plyer import brightness
    >>> brightness.current_level()

To set the brightness level to half of maximum::

    >>> from plyer import brightness
    >>> brightness.set_level(50)

Supported Platforms
-------------------
Android, iOS, Linux
'''


class Brightness:
    '''
    Brightness facade.
    '''

    def current_level(self):
        '''
        Know the current level of device's brightness.
        '''
        return self._current_level()

    def set_level(self, level):
        '''
        Adjust the brightness of the screen.
        Minimum brightness level:: 1
        Maximum brightness level:: 100

        :param level: New level of brightness between 1 and 100
        :type level: int
        '''
        return self._set_level(level)

    # private

    def _set_level(self, level):
        raise NotImplementedError()

    def _current_level(self):
        raise NotImplementedError()