Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugins/camera_plugin.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-03-05 03:02:21 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-03-05 03:02:21 (GMT)
commit08ac16fe7bbaa46673b495687325240745b21033 (patch)
tree68d4843fbd9fe320459a8d46c9aebb9ae9791135 /plugins/camera_plugin.py
parentbe2b74ec9dcea90bd16a7c4928682aefabfedbc2 (diff)
made add_block a method of Palette
Diffstat (limited to 'plugins/camera_plugin.py')
-rw-r--r--plugins/camera_plugin.py50
1 files changed, 24 insertions, 26 deletions
diff --git a/plugins/camera_plugin.py b/plugins/camera_plugin.py
index 0a2ec02..48e807f 100644
--- a/plugins/camera_plugin.py
+++ b/plugins/camera_plugin.py
@@ -27,7 +27,7 @@ from camera.v4l2 import v4l2_control, V4L2_CID_AUTOGAIN, VIDIOC_G_CTRL, \
from plugin import Plugin
-from TurtleArt.taprimitive import make_palette, make_prim
+from TurtleArt.taprimitive import make_palette
from TurtleArt.talogo import MEDIA_BLOCKS_DICTIONARY, PLUGIN_DICTIONARY
from TurtleArt.tautils import get_path
@@ -54,44 +54,42 @@ class Camera_plugin(Plugin):
self._status = True
def setup(self):
- make_palette('sensor',
- colors=["#FF6060", "#A06060"],
- help_string=_('Palette of sensor blocks'))
+ palette = make_palette('sensor',
+ colors=["#FF6060", "#A06060"],
+ help_string=_('Palette of sensor blocks'))
# set up camera-specific blocks
if self._status:
PLUGIN_DICTIONARY['luminance'] = self.prim_read_camera
- make_prim('luminance',
- palette='sensor',
- style='box-style',
- label=_('brightness'),
- help_string=_('light level detected by camera'),
- value_block=True,
- prim_name='luminance')
+ palette.add_block('luminance',
+ style='box-style',
+ label=_('brightness'),
+ help_string=_('light level detected by camera'),
+ value_block=True,
+ prim_name='luminance')
self._parent.lc.def_prim('luminance', 0,
lambda self: PLUGIN_DICTIONARY['luminance'](True))
# Depreciated block
PLUGIN_DICTIONARY['read_camera'] = self.prim_read_camera
- make_prim('read_camera',
- palette='sensor',
- style='box-style',
- label=_('brightness'),
- help_string=_('Average RGB color from camera is pushed \
-to the stack'),
- value_block=True,
- prim_name='luminance')
+ palette.add_block('read_camera',
+ hidden=True,
+ style='box-style',
+ label=_('brightness'),
+ help_string=_('Average RGB color from camera \
+is pushed to the stack'),
+ value_block=True,
+ prim_name='luminance')
self._parent.lc.def_prim('read_camera', 0,
lambda self: PLUGIN_DICTIONARY['read_camera'](True))
MEDIA_BLOCKS_DICTIONARY['camera'] = self.prim_take_picture
- make_prim('camera',
- palette='sensor',
- style='box-style-media',
- label=' ',
- default='CAMERA',
- help_string=_('camera output'),
- content_block=True)
+ palette.add_block('camera',
+ style='box-style-media',
+ label=' ',
+ default='CAMERA',
+ help_string=_('camera output'),
+ content_block=True)
def stop(self):
# This gets called by the stop button