Fixed bug with Camera widget in .kv file

The resolution property is not initialized before _on_index() is called.
So the app crashes because [-1, -1] is not a supported resolution.

...
Camera:
    resolution: (640, 480)
    index: 0
This commit is contained in:
Waldo Bronchart 2012-08-30 23:50:12 +02:00
parent c3a0f48828
commit 57808f4357
1 changed files with 2 additions and 0 deletions

View File

@ -96,6 +96,8 @@ class Camera(Image):
self._camera = None
if self.index < 0:
return
if self.resolution[0] < 0 or self.resolution[1] < 0:
return
self._camera = CoreCamera(index=self.index,
resolution=self.resolution, stopped=True)
self._camera.bind(on_load=self._camera_loaded)