diff options
author | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
---|---|---|
committer | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
commit | 9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch) | |
tree | 9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /external/plyer/facades/vibrator.py | |
parent | 11cc316b74d5f3f283413a33e7693b314741aa4a (diff) | |
download | manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2 manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip |
Initial commit
Diffstat (limited to 'external/plyer/facades/vibrator.py')
-rw-r--r-- | external/plyer/facades/vibrator.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/external/plyer/facades/vibrator.py b/external/plyer/facades/vibrator.py new file mode 100644 index 0000000..94fe9aa --- /dev/null +++ b/external/plyer/facades/vibrator.py @@ -0,0 +1,53 @@ +class Vibrator(object): + '''Vibration facade. + + .. note:: + On Android your app needs the VIBRATE permission to + access the vibrator. + ''' + + def vibrate(self, time=1): + '''Ask the vibrator to vibrate for the given period. + + :param time: Time to vibrate for, in seconds. Default is 1. + ''' + self._vibrate(time=time) + + def _vibrate(self, **kwargs): + raise NotImplementedError() + + def pattern(self, pattern=(0, 1), repeat=-1): + '''Ask the vibrator to vibrate with the given pattern, with an + optional repeat. + + :param pattern: Pattern to vibrate with. Should be a list of + times in seconds. The first number is how long to wait + before vibrating, and subsequent numbers are times to + vibrate and not vibrate alternately. + Defaults to ``[0, 1]``. + + :param repeat: Index at which to repeat the pattern. When the + vibration pattern reaches this index, it will start again + from the beginning. Defaults to ``-1``, which means no + repeat. + ''' + self._pattern(pattern=pattern, repeat=repeat) + + def _pattern(self, **kwargs): + raise NotImplementedError() + + def exists(self): + '''Check if the device has a vibrator. Returns True or + False. + ''' + return self._exists() + + def _exists(self, **kwargs): + raise NotImplementedError() + + def cancel(self): + '''Cancels any current vibration, and stops the vibrator.''' + self._cancel() + + def _cancel(self, **kwargs): + raise NotImplementedError() |