Skip to content

Commit cb08af2

Browse files
committed
Merge branch 'master' of git://github.com/tito/kivy into pdf
2 parents 942a118 + aa83ab6 commit cb08af2

25 files changed

+516
-117
lines changed

examples/demo/showcase/main.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from kivy.uix.label import Label
1717
from kivy.uix.popup import Popup
1818
from kivy.uix.accordion import Accordion, AccordionItem
19+
from kivy.uix.filechooser import FileChooserIconView, FileChooserListView
1920

2021

2122
class Showcase(FloatLayout):
@@ -60,22 +61,20 @@ def attach_node(text, n):
6061
n = create_tree('Buttons')
6162
attach_node('Standard buttons', n)
6263
attach_node('Options buttons', n)
63-
n = create_tree('Sliders')
6464
attach_node('Horizontal sliders', n)
6565
attach_node('Vertical sliders', n)
66-
n = create_tree('Scatter')
6766
attach_node('Scatter with image', n)
6867
attach_node('Scatter with buttons', n)
69-
n = create_tree('Textinput')
7068
attach_node('Monoline textinput', n)
7169
attach_node('Multiline textinput', n)
72-
n = create_tree('TreeView')
7370
attach_node('Standard treeview', n)
7471
attach_node('Treeview without root', n)
75-
n = create_tree('Others')
7672
attach_node('Accordion', n)
7773
attach_node('Popup', n)
7874
attach_node('Switch', n)
75+
n = create_tree('Experimentals')
76+
attach_node('Filechooser icon', n)
77+
attach_node('Filechooser list', n)
7978
root.add_widget(tree)
8079
self.content = content = BoxLayout()
8180
root.add_widget(content)
@@ -192,6 +191,12 @@ def show_accordion(self):
192191
col.add_widget(root)
193192
return col
194193

194+
def show_filechooser_icon(self):
195+
return FileChooserIconView()
196+
197+
def show_filechooser_list(self):
198+
return FileChooserListView()
199+
195200

196201
if __name__ in ('__main__', '__android__'):
197202
ShowcaseApp().run()

kivy/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
'kivy_config_fn', 'kivy_usermodules_dir',
2929
)
3030

31-
__version__ = '1.0.9-dev'
31+
__version__ = '1.0.10-dev'
3232

3333
import sys
3434
import shutil
@@ -175,6 +175,7 @@ def kivy_usage():
175175

176176

177177
# Start !
178+
Logger.setLevel(level=LOG_LEVELS.get('info'))
178179
Logger.info('Kivy v%s' % (__version__))
179180

180181
#: Global settings options for kivy

kivy/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ def write(self):
313313
Config.setdefault('input', 'mouse', 'mouse')
314314

315315
# activate native input provider in configuration
316-
if platform == 'darwin':
317-
Config.setdefault('input', 'mactouch', 'mactouch')
318-
elif platform == 'win32':
316+
# from 1.0.9, don't activate mactouch by default, or app are
317+
# unusable.
318+
if platform == 'win32':
319319
Config.setdefault('input', 'wm_touch', 'wm_touch')
320320
Config.setdefault('input', 'wm_pen', 'wm_pen')
321321
elif platform == 'linux2':

kivy/core/camera/__init__.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import sys
1212

13-
from kivy.clock import Clock
1413
from kivy.event import EventDispatcher
1514
from kivy.logger import Logger
1615
from kivy.core import core_select_lib
@@ -58,7 +57,7 @@ def __init__(self, **kwargs):
5857
super(CameraBase, self).__init__()
5958

6059
self.register_event_type('on_load')
61-
self.register_event_type('on_frame')
60+
self.register_event_type('on_texture')
6261

6362
self.init_camera()
6463

@@ -101,13 +100,10 @@ def init_camera(self):
101100
def start(self):
102101
'''Start the camera acquire'''
103102
self.stopped = False
104-
Clock.unschedule(self._update)
105-
Clock.schedule_interval(self._update, 1. / 30)
106103

107104
def stop(self):
108105
'''Release the camera'''
109106
self.stopped = True
110-
Clock.unschedule(self._update)
111107

112108
def _update(self, dt):
113109
'''Update the camera (internal)'''
@@ -120,9 +116,9 @@ def _copy_to_gpu(self):
120116
return
121117
self._texture.blit_buffer(self._buffer, colorfmt=self._format)
122118
self._buffer = None
123-
self.dispatch('on_frame')
119+
self.dispatch('on_texture')
124120

125-
def on_frame(self):
121+
def on_texture(self):
126122
pass
127123

128124
def on_load(self):

kivy/core/camera/camera_gstreamer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
__all__ = ('CameraGStreamer', )
66

7-
7+
from kivy.clock import Clock
88
from kivy.graphics.texture import Texture
99
from . import CameraBase
1010

@@ -77,7 +77,9 @@ def _gst_new_buffer(self, *largs):
7777
for x in self._decodebin.src_pads():
7878
for cap in x.get_caps():
7979
self._texturesize = (cap['width'], cap['height'])
80+
Clock.schedule_once(self._update)
8081
return
82+
Clock.schedule_once(self._update)
8183

8284
def start(self):
8385
super(CameraGStreamer, self).start()

kivy/core/camera/camera_opencv.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
__all__ = ('CameraOpenCV')
1010

1111
from kivy.logger import Logger
12+
from kivy.clock import Clock
1213
from kivy.graphics.texture import Texture
1314
from . import CameraBase
1415

@@ -59,6 +60,11 @@ def init_camera(self):
5960
# with self.init_camera (but slowly as we'd have to always get a frame).
6061
self._resolution = (int(frame.width), int(frame.height))
6162

63+
#get fps
64+
self.fps = cv.GetCaptureProperty(self._device, cv.CV_CAP_PROP_FPS)
65+
if self.fps <= 0:
66+
self.fps = 1 / 30.
67+
6268
if not self.stopped:
6369
self.start()
6470

@@ -83,3 +89,12 @@ def _update(self, dt):
8389
except:
8490
Logger.exception('OpenCV: Couldn\'t get image from Camera')
8591

92+
def start(self):
93+
super(CameraOpenCV, self).start()
94+
Clock.unschedule(self._update)
95+
Clock.schedule_interval(self._update, self.fps)
96+
97+
def stop(self):
98+
super(CameraOpenCV, self).stop()
99+
Clock.unschedule(self._update)
100+

kivy/core/camera/camera_videocapture.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
__all__ = ('CameraVideoCapture', )
1010

1111
from . import CameraBase
12+
from kivy.clock import Clock
1213

1314
try:
1415
from VideoCapture import Device
@@ -33,6 +34,7 @@ def init_camera(self):
3334
self._device.setResolution(self.resolution[0], self.resolution[1])
3435
except:
3536
raise Exception('VideoCapture: Resolution not supported')
37+
self.fps = 1 / 30.
3638

3739
def _update(self, dt):
3840
data, camera_width, camera_height = self._device.getBuffer()
@@ -47,3 +49,14 @@ def _update(self, dt):
4749
# update buffer
4850
self._buffer = data
4951
self._copy_to_gpu()
52+
53+
def start(self):
54+
super(CameraVideoCapture, self).start()
55+
Clock.unschedule(self._update)
56+
Clock.schedule_interval(self._update, self.fps)
57+
58+
def stop(self):
59+
super(CameraVideoCapture, self).stop()
60+
Clock.unschedule(self._update)
61+
62+

kivy/core/video/video_gstreamer.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from os import path
2222
from threading import Lock
23+
from urllib import pathname2url
2324
from kivy.graphics.texture import Texture
2425
from kivy.logger import Logger
2526
from functools import partial
@@ -143,9 +144,13 @@ def seek(self, percent):
143144
self._buffer = self._videosink.emit('pull-preroll')
144145

145146
def _get_uri(self):
146-
if ':' in self.filename:
147-
return self.filename
148-
return 'file://'+path.abspath(self.filename)
147+
uri = self.filename
148+
if not uri:
149+
return
150+
if uri.split(':')[0] not in (
151+
'http', 'https', 'file', 'udp', 'rtp', 'rtsp'):
152+
uri = 'file:' + pathname2url(path.realpath(uri))
153+
return uri
149154

150155
def _do_eos(self, *args):
151156
self.seek(0)

kivy/data/logo/kivy-icon-128.png

100644100755
9.24 KB
Loading

kivy/data/logo/kivy-icon-16.png

3.58 KB
Loading

kivy/data/logo/kivy-icon-24.png

100644100755
240 Bytes
Loading

kivy/data/logo/kivy-icon-256.png

100644100755
20.4 KB
Loading

kivy/data/logo/kivy-icon-32.png

100644100755
3.47 KB
Loading

kivy/data/logo/kivy-icon-512.png

100644100755
46.7 KB
Loading

kivy/data/logo/kivy-icon-64.png

100644100755
4.84 KB
Loading

kivy/data/style.kv

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<Button,ToggleButton>:
1313
canvas:
14+
Clear
1415
Color:
1516
rgba: self.background_color
1617
BorderImage:
@@ -200,6 +201,7 @@
200201
# Don't allow expansion of the ../ node
201202
is_leaf: not ctx.isdir or ctx.name.endswith('..' + ctx.sep) or self.locked
202203
on_touch_down: self.collide_point(*args[1].pos) and ctx.controller.entry_touched(self, args[1])
204+
on_touch_up: self.collide_point(*args[1].pos) and ctx.controller.entry_released(self, args[1])
203205
BoxLayout:
204206
pos: root.pos
205207
Label:
@@ -243,6 +245,7 @@
243245
size_hint: None, None
244246

245247
on_touch_down: self.collide_point(*args[1].pos) and ctx.controller.entry_touched(self, args[1])
248+
on_touch_up: self.collide_point(*args[1].pos) and ctx.controller.entry_released(self, args[1])
246249

247250
canvas:
248251
Color:
@@ -253,25 +256,25 @@
253256
size: root.size
254257
source: 'data/images/filechooser_selected.png'
255258

256-
Image:
257-
size: 48, 48
258-
source: 'data/images/filechooser_%s.png' % ('folder' if ctx.isdir else 'file')
259-
pos: root.x + 24, root.y + 40
260-
Label:
261-
text: unicode(ctx.name)
262-
text_size: (root.width, self.height)
263-
halign: 'center'
264-
shorten: True
265-
size: 100, 16
266-
pos: root.x, root.y + 16
267-
268-
Label:
269-
text: unicode(ctx.get_nice_size())
270-
font_size: 8
271-
color: .8, .8, .8, 1
272-
size: 100, 16
273-
pos: root.pos
274-
halign: 'center'
259+
Image:
260+
size: 48, 48
261+
source: 'data/images/filechooser_%s.png' % ('folder' if ctx.isdir else 'file')
262+
pos: root.x + 24, root.y + 40
263+
Label:
264+
text: unicode(ctx.name)
265+
text_size: (root.width, self.height)
266+
halign: 'center'
267+
shorten: True
268+
size: 100, 16
269+
pos: root.x, root.y + 16
270+
271+
Label:
272+
text: unicode(ctx.get_nice_size())
273+
font_size: 8
274+
color: .8, .8, .8, 1
275+
size: 100, 16
276+
pos: root.pos
277+
halign: 'center'
275278

276279

277280
# Switch widget

0 commit comments

Comments
 (0)