Debian Codegraph @

plyer/facades/spatialorientation.py

raw symbols SCIP
1 # coding=utf-8
2
3
4 class SpatialOrientation:
5 '''Spatial Orientation facade.
6
7 Computes the device's orientation based on the rotation matrix.
8
9 .. versionadded:: 1.3.1
10 '''
11
12 @property
13 def orientation(self):
14 '''Property that returns values of the current device orientation
15 as a (azimuth, pitch, roll) tuple.
16
17 Azimuth, angle of rotation about the -z axis. This value represents the
18 angle between the device's y axis and the magnetic north pole.
19 The range of values is -π to π.
20
21 Pitch, angle of rotation about the x axis. This value represents the
22 angle between a plane parallel to the device's screen and a plane
23 parallel to the ground.
24 The range of values is -π to π.
25
26 Roll, angle of rotation about the y axis. This value represents the
27 angle between a plane perpendicular to the device's screen and a plane
28 perpendicular to the ground.
29 The range of values is -π/2 to π/2.
30
31 Returns (None, None, None) if no data is currently available.
32
33 Supported Platforms:: Android
34 '''
35 return self._get_orientation() or (None, None, None)
36
37 def _get_orientation(self):
38 raise NotImplementedError()
39
40 def enable_listener(self):
41 '''Enable the orientation sensor.
42 '''
43 self._enable_listener()
44
45 def _enable_listener(self, **kwargs):
46 raise NotImplementedError()
47
48 def disable_listener(self):
49 '''Disable the orientation sensor.
50 '''
51 self._disable_listener()
52
53 def _disable_listener(self, **kwargs):
54 raise NotImplementedError()