Skip to content

Commit 0c53912

Browse files
committed
Merge branch 'master' of ssh://github.com/kivy/kivy
2 parents 426fbee + a5a8c10 commit 0c53912

File tree

10 files changed

+104
-98
lines changed

10 files changed

+104
-98
lines changed

kivy/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
------------------------------
3131
3232
:kivy:
33+
3334
`desktop`: (0, 1)
3435
Enable/disable specific features if True/False. For example enabling
3536
drag-able scroll-bar in scroll views, disabling of bubbles in
3637
TextInput... True etc.
37-
3838
`log_level`: (debug, info, warning, error, critical)
3939
Set the minimum log level to use
4040
`log_dir`: string
@@ -44,7 +44,7 @@
4444
`log_enable`: (0, 1)
4545
Activate file logging
4646
`keyboard_mode`: ('', 'system', 'dock', 'multi', 'systemanddock',
47-
'systemandmulti')
47+
'systemandmulti')
4848
Keyboard mode to use. If empty, Kivy will decide for you what is the
4949
best for your current platform. Otherwise, you can set one of 'system'
5050
(real keyboard), 'dock' (one virtual keyboard docked in a screen side),

kivy/core/window/__init__.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ class Keyboard(EventDispatcher):
7171
# numpad
7272
'numpad0': 256, 'numpad1': 257, 'numpad2': 258, 'numpad3': 259,
7373
'numpad4': 260, 'numpad5': 261, 'numpad6': 262, 'numpad7': 263,
74-
'numpad8': 264, 'numpad9': 265, 'numpaddecimal': 266, 'numpaddivide': 267,
75-
'numpadmul': 268, 'numpadsubstract': 269, 'numpadadd': 270,
74+
'numpad8': 264, 'numpad9': 265, 'numpaddecimal': 266,
75+
'numpaddivide': 267, 'numpadmul': 268, 'numpadsubstract': 269,
76+
'numpadadd': 270,
7677

7778
# F1-15
7879
'f1': 282, 'f2': 283, 'f3': 282, 'f4': 285, 'f5': 286, 'f6': 287,
@@ -436,7 +437,8 @@ def __init__(self, **kwargs):
436437
if 'rotation' not in kwargs:
437438
kwargs['rotation'] = Config.getint('graphics', 'rotation')
438439
if 'position' not in kwargs:
439-
kwargs['position'] = Config.getdefault('graphics', 'position', 'auto')
440+
kwargs['position'] = Config.getdefault('graphics', 'position',
441+
'auto')
440442
if 'top' in kwargs:
441443
kwargs['position'] = 'custom'
442444
kwargs['top'] = kwargs['top']
@@ -968,12 +970,11 @@ def request_keyboard(self, callback, target):
968970
keyboard.target = target
969971

970972
# use system (hardware) keyboard according to flag
971-
if self.use_syskeyboard:
972-
self.bind(
973+
if self.allow_vkeyboard and self.use_syskeyboard:
974+
self.unbind(
973975
on_key_down=keyboard._on_window_key_down,
974976
on_key_up=keyboard._on_window_key_up)
975-
else:
976-
self.unbind(
977+
self.bind(
977978
on_key_down=keyboard._on_window_key_down,
978979
on_key_up=keyboard._on_window_key_up)
979980

kivy/data/style.kv

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@
576576
source: root.app_icon
577577
allow_stretch: True
578578
size_hint_x: None
579-
width: self.height
579+
width: min(self.height, self.texture_size[0]) if self.texture else self.height
580580
mipmap: root.mipmap
581581
Widget:
582582
size_hint_x: None

kivy/graphics/fbo.pyx

+2-3
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,8 @@ cdef class Fbo(RenderContext):
392392
return data
393393

394394
cpdef get_pixel_color(self, int wx, int wy):
395-
"""
396-
Get the color of the pixel with specified window
397-
coordinates wx, wy. It returns result in RGBA format
395+
"""Get the color of the pixel with specified window
396+
coordinates wx, wy. It returns result in RGBA format.
398397
399398
.. versionadded:: 1.8.0
400399
"""

kivy/input/provider.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Motion Event Provider
33
=====================
44
5-
Abstract class for a implement a :class:`~kivy.input.motionevent.MotionEvent`
5+
Abstract class for the implemention of a
6+
:class:`~kivy.input.motionevent.MotionEvent`
67
provider. The implementation must support the
78
:func:`~MotionEventProvider.start`, :func:`~MotionEventProvider.stop` and
89
:func:`~MotionEventProvider.update` methods.
@@ -22,18 +23,18 @@ def __init__(self, device, args):
2223

2324
def start(self):
2425
'''Start the provider. This method is automatically called when the
25-
application is started, and if the configuration use the current
26+
application is started and if the configuration uses the current
2627
provider.
2728
'''
2829
pass
2930

3031
def stop(self):
31-
'''Stop the provider
32+
'''Stop the provider.
3233
'''
3334
pass
3435

3536
def update(self, dispatch_fn):
36-
'''Update the provider, and dispatch all the new touch event though the
37+
'''Update the provider and dispatch all the new touch events though the
3738
`dispatch_fn` argument.
3839
'''
3940
pass

kivy/input/recorder.py

+37-37
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
77
.. warning::
88
9-
This part of Kivy is still experimental, and his API is subject to change in
9+
This part of Kivy is still experimental and this API is subject to change in
1010
a future version.
1111
12-
This is a class that can record and replay some part of input events. This can
13-
be used for test case, screen saver etc.
12+
This is a class that can record and replay some input events. This can
13+
be used for test cases, screen savers etc.
1414
15-
Once activated, the recorder will listen to any input event, and save some
16-
properties in a file + the delta time. Later, you can play the input file: it
17-
will generate fake touch with saved properties, and dispatch it to the event
18-
loop.
15+
Once activated, the recorder will listen for any input event and save its
16+
properties in a file with the delta time. Later, you can play the input file: it
17+
will generate fake touch events with the saved properties and dispatch it to
18+
the event loop.
1919
20-
By default, only the position are saved ('pos' profile and 'sx', 'sy',
21-
attributes). Changes it only if you understand how input is working.
20+
By default, only the position is saved ('pos' profile and 'sx', 'sy',
21+
attributes). Change it only if you understand how input handling works.
2222
2323
Recording events
2424
----------------
2525
2626
The best way is to use the "recorder" module. Check the :doc:`api-kivy.modules`
27-
documentation for learning about how to activate a module.
27+
documentation to see how to activate a module.
2828
29-
When activated, you can press F8 to start the recording. By default, events will
30-
be written at `<currentpath>/recorder.kvi`. When you want to stop recording,
29+
Once activated, you can press F8 to start the recording. By default, events will
30+
be written to `<currentpath>/recorder.kvi`. When you want to stop recording,
3131
press F8 again.
3232
3333
You can replay the file by pressing F7.
@@ -60,10 +60,10 @@ def recorder_loop(instance, value):
6060
Recording more attributes
6161
-------------------------
6262
63-
You can extend the attributes to save, at one condition: attributes values must
64-
be simple value, not instance of complex class. Aka, saving shape will not work.
63+
You can extend the attributes to save on one condition: attributes values must
64+
be simple values, not instances of complex classes.
6565
66-
Let's say you want to save angle and pressure of the touch, if available::
66+
Let's say you want to save the angle and pressure of the touch, if available::
6767
6868
from kivy.input.recorder import Recorder
6969
@@ -80,11 +80,11 @@ def recorder_loop(instance, value):
8080
Known limitations
8181
-----------------
8282
83-
- Unable to save attributes with instance of complex class
84-
- Values that represent time will be not adjusted
85-
- Can replay only complete record, if a begin/update/end event is missing,
86-
this could lead to ghost touch.
87-
- Stopping the replay before the end can lead to ghost touch.
83+
- Unable to save attributes with instances of complex classes.
84+
- Values that represent time will not be adjusted.
85+
- Can replay only complete records. If a begin/update/end event is missing,
86+
this could lead to ghost touches.
87+
- Stopping the replay before the end can lead to ghost touches.
8888
8989
'''
9090

@@ -111,57 +111,57 @@ def depack(self, args):
111111

112112

113113
class Recorder(EventDispatcher):
114-
'''Recorder class, check module documentation for more information.
114+
'''Recorder class. Please check module documentation for more information.
115115
'''
116116

117117
window = ObjectProperty(None)
118-
'''Window instance to attach the recorder. If None set, it will use the
119-
default one.
118+
'''Window instance to attach the recorder. If None, it will use the
119+
default instance.
120120
121-
:data:`window` is a :class:`~kivy.properties.ObjectProperty`, default to
121+
:data:`window` is a :class:`~kivy.properties.ObjectProperty` and defaults to
122122
None.
123123
'''
124124

125125
counter = NumericProperty(0)
126126
'''Number of events recorded in the last session.
127127
128-
:data:`counter` is a :class:`~kivy.properties.NumericProperty`, default to
129-
0, read-only.
128+
:data:`counter` is a :class:`~kivy.properties.NumericProperty` and defaults
129+
to 0, read-only.
130130
'''
131131

132132
play = BooleanProperty(False)
133-
'''Boolean to start/stop the replay of the current file (if exist.)
133+
'''Boolean to start/stop the replay of the current file (if it exists).
134134
135-
:data:`play` is a :class:`~kivy.properties.BooleanProperty`, default to
135+
:data:`play` is a :class:`~kivy.properties.BooleanProperty` and defaults to
136136
False.
137137
'''
138138

139139
record = BooleanProperty(False)
140140
'''Boolean to start/stop the recording of input events.
141141
142-
:data:`record` is a :class:`~kivy.properties.BooleanProperty`, default to
143-
False.
142+
:data:`record` is a :class:`~kivy.properties.BooleanProperty` and defaults
143+
to False.
144144
'''
145145

146146
filename = StringProperty('recorder.kvi')
147-
'''Filename to save the output of recorder.
147+
'''Filename to save the output of the recorder.
148148
149-
:data:`filename` is a :class:`~kivy.properties.StringProperty`, default to
150-
'recorder.kvi'.
149+
:data:`filename` is a :class:`~kivy.properties.StringProperty` and defaults
150+
to 'recorder.kvi'.
151151
'''
152152

153153
record_attrs = ListProperty(['is_touch', 'sx', 'sy'])
154154
'''Attributes to record from the motion event.
155155
156-
:data:`record_attrs` is a :class:`~kivy.properties.ListProperty`, default to
157-
['is_touch', 'sx', 'sy'].
156+
:data:`record_attrs` is a :class:`~kivy.properties.ListProperty` and
157+
defaults to ['is_touch', 'sx', 'sy'].
158158
'''
159159

160160
record_profile_mask = ListProperty(['pos'])
161161
'''Profile to save in the fake motion event when replayed.
162162
163-
:data:`record_profile_mask` is a :class:`~kivy.properties.ListProperty`,
164-
default to ['pos'].
163+
:data:`record_profile_mask` is a :class:`~kivy.properties.ListProperty` and
164+
defaults to ['pos'].
165165
'''
166166

167167
# internals

kivy/input/shape.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010

1111
class Shape(object):
12-
'''Abstract class for all implementation of a shape'''
12+
'''Abstract class for all implementations of a shape'''
1313
pass
1414

1515

1616
class ShapeRect(Shape):
17-
'''Represent a rectangle shape.'''
17+
'''Class for the representation of a rectangle.'''
1818
__slots__ = ('width', 'height')
1919

2020
def __init__(self):

kivy/loader.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,27 @@ def _update(self, *largs):
375375
self._trigger_update()
376376

377377
def image(self, filename, load_callback=None, post_callback=None, **kwargs):
378-
'''Load a image using loader. A Proxy image is returned with a loading
379-
image.
380-
381-
::
382-
img = Loader.image(filename)
383-
# img will be a ProxyImage.
384-
# You'll use it the same as an Image class.
385-
# Later, when the image is really loaded,
386-
# the loader will change the img.image property
387-
# to the new loaded image
388-
378+
'''Load a image using the Loader. A ProxyImage is returned with a
379+
loading image. You can use it as follows::
380+
381+
from kivy.app import App
382+
from kivy.uix.image import Image
383+
from kivy.loader import Loader
384+
385+
class TestApp(App):
386+
def _image_loaded(self, proxyImage):
387+
if proxyImage.image.texture:
388+
self.image.texture = proxyImage.image.texture
389+
390+
def build(self):
391+
proxyImage = Loader.image("myPic.jpg")
392+
proxyImage.bind(on_load=self._image_loaded)
393+
self.image = Image()
394+
return self.image
395+
396+
TestApp().run()
397+
398+
In order to cancel all background loading, call *Loader.stop()*.
389399
'''
390400
data = Cache.get('kv.loader', filename)
391401
if data not in (None, False):

0 commit comments

Comments
 (0)