~ubuntu-branches/debian/stretch/electrum/stretch

« back to all changes in this revision

Viewing changes to gui/kivy/tools/.buildozer/android/platform/python-for-android/dist/kivy/python-install/lib/python2.7/site-packages/kivy/effects/opacityscroll.py

  • Committer: Package Import Robot
  • Author(s): Tristan Seligmann
  • Date: 2016-04-04 03:02:39 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20160404030239-0szgkio8yryjv7c9
Tags: 2.6.3-1
* New upstream release.
  - Drop backported install-wizard-connect.patch.
* Add Suggests: python-zbar and update the installation hint to suggest
  apt-get instead of pip (closes: #819517).
* Bump Standards-Version to 3.9.7 (no changes).
* Update Vcs-* links.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''
 
2
Opacity scroll effect
 
3
=====================
 
4
 
 
5
Based on the :class:`~kivy.effects.damped.DampedScrollEffect`, this one will
 
6
also decrease the opacity of the target widget during the overscroll.
 
7
 
 
8
'''
 
9
 
 
10
__all__ = ('OpacityScrollEffect', )
 
11
 
 
12
 
 
13
from kivy.effects.dampedscroll import DampedScrollEffect
 
14
 
 
15
 
 
16
class OpacityScrollEffect(DampedScrollEffect):
 
17
    '''OpacityScrollEffect class. Uses the overscroll
 
18
    information to reduce the opacity of the scrollview widget. When the user
 
19
    stops the drag, the opacity is set back to 1.
 
20
    '''
 
21
 
 
22
    def on_overscroll(self, *args):
 
23
        if self.target_widget and self.target_widget.height != 0:
 
24
            alpha = (1.0 -
 
25
                     abs(self.overscroll / float(self.target_widget.height)))
 
26
            self.target_widget.opacity = min(1, alpha)
 
27
        self.trigger_velocity_update()