fix auto configuration upgrade with betterscroll

This commit is contained in:
Mathieu Virbel 2012-10-24 12:27:29 +02:00
parent ffbc764d97
commit 8b5c0e4a1f
2 changed files with 16 additions and 4 deletions

View File

@ -184,7 +184,7 @@ from kivy.logger import Logger, logger_config_update
from kivy.utils import OrderedDict
# Version number of current configuration format
KIVY_CONFIG_VERSION = 6
KIVY_CONFIG_VERSION = 7
#: Kivy configuration object
Config = None
@ -401,8 +401,6 @@ if not environ.get('KIVY_DOC_INCLUDE'):
Config.setdefault('widgets', 'scroll_timeout', '55')
Config.setdefault('widgets', 'scroll_distance', '20')
Config.setdefault('widgets', 'scroll_friction', '1.')
Config.setdefault('widgets', 'scroll_stoptime', '300')
Config.setdefault('widgets', 'scroll_moves', '5')
# remove old list_* token
Config.remove_option('widgets', 'list_friction')
@ -420,6 +418,13 @@ if not environ.get('KIVY_DOC_INCLUDE'):
elif version == 5:
Config.setdefault('graphics', 'resizable', '1')
elif version == 6:
# if the timeout is still the default value, change it
if Config.getint('widgets', 'scroll_timeout') == 250:
Config.set('widgets', 'scroll_timeout', '55')
Config.setdefault('widgets', 'scroll_stoptime', '300')
Config.setdefault('widgets', 'scroll_moves', '5')
#elif version == 1:
# # add here the command for upgrading from configuration 0 to 1
#

View File

@ -493,6 +493,8 @@ class ScrollView(StencilView):
:data:`scroll_moves` is a :class:`~kivy.properties.NumericProperty`,
default to 5.
.. versionadded:: 1.5.0
'''
scroll_stoptime = NumericProperty(_scroll_stoptime)
@ -501,9 +503,11 @@ class ScrollView(StencilView):
start.
This is to prevent autoscroll to trigger while the user has slowed down
on purpose to prevent this.
:data:`scroll_stoptime` is a :class:`~kivy.properties.NumericProperty`,
default to 300 (milliseconds)
.. versionadded:: 1.5.0
'''
scroll_distance = NumericProperty(_scroll_distance)
@ -526,6 +530,9 @@ class ScrollView(StencilView):
:data:`scroll_timeout` is a :class:`~kivy.properties.NumericProperty`,
default to 55 (milliseconds), according to the default value in user
configuration.
.. versionchanged:: 1.5.0
Default value changed from 250 to 55.
'''
scroll_x = NumericProperty(0.)