Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-12-26 19:22:19 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-12-26 19:22:19 (GMT)
commitf69ce9912b08dbba82044b4337dec2ec498cc36f (patch)
tree23de74570d197c7312471700ee643b7e9198301a /TurtleArt
parenta3fe29531694a36557b816bc690b81e7b231f8ad (diff)
add variable pause for camera capture depending upon hardware
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/tacamera.py4
-rwxr-xr-xTurtleArt/talogo.py9
2 files changed, 9 insertions, 4 deletions
diff --git a/TurtleArt/tacamera.py b/TurtleArt/tacamera.py
index f7e08ff..a4227ed 100644
--- a/TurtleArt/tacamera.py
+++ b/TurtleArt/tacamera.py
@@ -22,7 +22,7 @@
import gst, time
-def save_camera_input_to_file(imagepath):
+def save_camera_input_to_file(imagepath, pause=2.0):
""" Grab a frame from the video camera and save to a temporary file """
pipeline = gst.parse_launch(
@@ -30,6 +30,6 @@ def save_camera_input_to_file(imagepath):
pipeline.set_state(gst.STATE_PLAYING)
# Need to pause for pipeline to stablize
- time.sleep(2)
+ time.sleep(pause)
pipeline.set_state(gst.STATE_NULL)
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 8cdd9b5..399b5b4 100755
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -526,9 +526,13 @@ class LogoCode:
if self.tw.hw == XO1:
self.voltage_gain = 0.00002225
self.voltage_bias = 1.140
+ self.camera_pause = 0.6
elif self.tw.hw == XO15:
self.voltage_gain = -0.0001471
self.voltage_bias = 1.695
+ self.camera_pause = 0.5
+ else:
+ self.camera_pause = 2.0
if self.tw.running_sugar:
self.imagepath = get_path(self.tw.activity,
@@ -1324,7 +1328,8 @@ class LogoCode:
dsobject = None
if string[6:] == 'CAMERA':
if self.tw.camera:
- save_camera_input_to_file(self.imagepath)
+ save_camera_input_to_file(self.imagepath,
+ self.camera_pause)
self.filepath = self.imagepath
elif os.path.exists(string[6:]): # is it a path?
self.filepath = string[6:]
@@ -1472,7 +1477,7 @@ class LogoCode:
w = self._w()
h = self._h()
if w > 0 and h > 0 and self.tw.camera:
- save_camera_input_to_file(self.imagepath)
+ save_camera_input_to_file(self.imagepath, self.camera_pause)
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(self.imagepath, w, h)
try:
array = pixbuf.get_pixels()