Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS9
-rw-r--r--TurtleArt/tawindow.py7
-rw-r--r--activity/activity.info2
-rw-r--r--plugins/camera_sensor/camera_sensor.py48
-rwxr-xr-xturtleart.py4
5 files changed, 43 insertions, 27 deletions
diff --git a/NEWS b/NEWS
index e85d758..9073fab 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+128
+
+BUG FIXES:
+* Fixed logic error preventing camera capture of multiple frames
+* Fixed problem with camera autogain (#2651)
+* Don't zoom text in alert blocks (#3175)
+
+Note: Still working on #2624, repeated show camera fails after awhile
+
127
ENHANCEMENTS:
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index a5d1a37..dae617c 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -290,8 +290,8 @@ class TurtleArtWindow():
self._plugins.append(plugins.values()[0](self))
debug_output('successfully importing %s' % (plugin_class),
self.running_sugar)
- except ImportError:
- debug_output('failed to import %s' % (plugin_class),
+ except ImportError as e:
+ debug_output('failed to import %s: %s' % (plugin_class, str(e)),
self.running_sugar)
'''
exec f in globals(), plugins
@@ -2938,8 +2938,7 @@ class TurtleArtWindow():
shp = shp[1:]
label = ''
self.status_spr.set_shape(self.status_shapes[shp])
- self.status_spr.set_label_attributes(6.0 * self.block_scale,
- rescale=False)
+ self.status_spr.set_label_attributes(12.0, rescale=False)
self.status_spr.set_label(str(label))
self.status_spr.set_layer(STATUS_LAYER)
if shp == 'info':
diff --git a/activity/activity.info b/activity/activity.info
index 142badf..9a970fb 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
name = Turtle Art
-activity_version = 127
+activity_version = 128
license = MIT
bundle_id = org.laptop.TurtleArtActivity
exec = sugar-activity TurtleArtActivity.TurtleArtActivity
diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py
index bb9698f..663c10f 100644
--- a/plugins/camera_sensor/camera_sensor.py
+++ b/plugins/camera_sensor/camera_sensor.py
@@ -42,7 +42,7 @@ class Camera_sensor(Plugin):
''' Make sure there is a camera device '''
self._parent = parent
self._status = False
- self.function = None
+ self._ag_control = None
self.camera = None
v4l2src = gst.element_factory_make('v4l2src')
@@ -135,15 +135,22 @@ is pushed to the stack'),
if self._status and self.camera is None:
self.camera = Camera()
+ def quit(self):
+ ''' This gets called when the activity quits '''
+ self._reset_the_camera()
+
def stop(self):
''' This gets called by the stop button '''
- if self._status and self.camera is not None:
- self.camera.stop_camera_input()
+ self._reset_the_camera()
def clear(self):
''' This gets called by the clean button and erase button '''
+ self._reset_the_camera()
+
+ def _reset_the_camera(self):
if self._status and self.camera is not None:
self.camera.stop_camera_input()
+ self._set_autogain(1) # enable AUTOGAIN
def _status_report(self):
debug_output('Reporting camera status: %s' % (str(self._status)),
@@ -154,6 +161,7 @@ is pushed to the stack'),
def prim_take_picture(self):
''' method called by media block '''
+ self._set_autogain(1) # enable AUTOGAIN
self._get_pixbuf_from_camera()
self._parent.lc.pixbuf = self.camera.pixbuf
@@ -170,12 +178,6 @@ is pushed to the stack'),
return
array = None
- try:
- self._video_capture_device = open('/dev/video0', 'rw')
- except:
- self._video_capture_device = None
- debug_output('video capture device not available',
- self._parent.running_sugar)
self._set_autogain(0) # disable AUTOGAIN
self._get_pixbuf_from_camera()
self.calc_luminance()
@@ -191,7 +193,6 @@ is pushed to the stack'),
array = self.camera.pixbuf.get_pixels()
width = self.camera.pixbuf.get_width()
height = self.camera.pixbuf.get_height()
- self._set_autogain(1) # reenable AUTOGAIN
if array is not None:
length = int(len(array) / 3)
@@ -230,16 +231,23 @@ is pushed to the stack'),
def _set_autogain(self, state):
''' 0 is off; 1 is on '''
- if self._video_capture_device is not None:
- self._ag_control = v4l2_control(V4L2_CID_AUTOGAIN)
- try:
- ioctl(self._video_capture_device, VIDIOC_G_CTRL,
- self._ag_control)
- self._ag_control.value = state
- ioctl(self._video_capture_device, VIDIOC_S_CTRL,
- self._ag_control)
- except:
- pass
+ if self._ag_control is not None and self._ag_control.value == state:
+ return
+ try:
+ video_capture_device = open('/dev/video0', 'rw')
+ except:
+ video_capture_device = None
+ debug_output('video capture device not available',
+ self._parent.running_sugar)
+ return
+ self._ag_control = v4l2_control(V4L2_CID_AUTOGAIN)
+ try:
+ ioctl(video_capture_device, VIDIOC_G_CTRL, self._ag_control)
+ self._ag_control.value = state
+ ioctl(video_capture_device, VIDIOC_S_CTRL, self._ag_control)
+ except:
+ pass
+ video_capture_device.close()
def _get_pixbuf_from_camera(self):
''' Regardless of how we get it, we want to return a pixbuf '''
diff --git a/turtleart.py b/turtleart.py
index 9669e21..52192d5 100755
--- a/turtleart.py
+++ b/turtleart.py
@@ -131,8 +131,8 @@ class TurtleMain():
try:
exec f in globals(), plugin
self._plugins.append(plugin.values()[0](self))
- except ImportError:
- print 'failed to import %s' % (P)
+ except ImportError as e:
+ print 'failed to import %s: %s' % (P, str(e))
def _run_plugins(self):
''' Tell the plugin about the TurtleWindow instance. '''