Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugins/audio_sensors_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/audio_sensors_plugin.py
parentbe2b74ec9dcea90bd16a7c4928682aefabfedbc2 (diff)
made add_block a method of Palette
Diffstat (limited to 'plugins/audio_sensors_plugin.py')
-rw-r--r--plugins/audio_sensors_plugin.py86
1 files changed, 41 insertions, 45 deletions
diff --git a/plugins/audio_sensors_plugin.py b/plugins/audio_sensors_plugin.py
index 6723b9c..e5bd759 100644
--- a/plugins/audio_sensors_plugin.py
+++ b/plugins/audio_sensors_plugin.py
@@ -31,7 +31,7 @@ from audio.audiograb import AudioGrab_Unknown, AudioGrab_XO1, AudioGrab_XO15, \
from audio.ringbuffer import RingBuffer1d
-from TurtleArt.taprimitive import make_palette, make_prim
+from TurtleArt.taprimitive import make_palette
from TurtleArt.taconstants import XO1, XO15
from TurtleArt.talogo import PLUGIN_DICTIONARY
@@ -77,71 +77,67 @@ class Audio_sensors_plugin(Plugin):
self.voltage_gain = -0.0001471
self.voltage_bias = 1.695
- 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'))
PLUGIN_DICTIONARY['sound'] = self.prim_sound
- make_prim('sound',
- palette='sensor',
- style='box-style',
- label=_('sound'),
- help_string=_('raw microphone input signal'),
- value_block=True,
- prim_name='sound')
+ palette.add_block('sound',
+ style='box-style',
+ label=_('sound'),
+ help_string=_('raw microphone input signal'),
+ value_block=True,
+ prim_name='sound')
self._parent.lc.def_prim('sound', 0,
lambda self: PLUGIN_DICTIONARY['sound']())
PLUGIN_DICTIONARY['volume'] = self.prim_volume
- make_prim('volume',
- palette='sensor',
- style='box-style',
- label=_('loudness'),
- help_string=_('microphone input volume'),
- value_block=True,
- prim_name='volume')
+ palette.add_block('volume',
+ style='box-style',
+ label=_('loudness'),
+ help_string=_('microphone input volume'),
+ value_block=True,
+ prim_name='volume')
self._parent.lc.def_prim('volume', 0,
lambda self: PLUGIN_DICTIONARY['volume']())
PLUGIN_DICTIONARY['pitch'] = self.prim_pitch
if PITCH_AVAILABLE:
- make_prim('pitch',
- palette='sensor',
- style='box-style',
- label=_('pitch'),
- help_string=_('microphone input pitch'),
- value_block=True,
- prim_name='pitch')
+ palette.add_block('pitch',
+ style='box-style',
+ label=_('pitch'),
+ help_string=_('microphone input pitch'),
+ value_block=True,
+ prim_name='pitch')
else:
- make_prim('pitch',
- style='box-style',
- label=_('pitch'),
- help_string=_('microphone input pitch'),
- value_block=True,
- prim_name='pitch')
+ palette.add_block('pitch',
+ hidden=True,
+ style='box-style',
+ label=_('pitch'),
+ help_string=_('microphone input pitch'),
+ value_block=True,
+ prim_name='pitch')
self._parent.lc.def_prim('pitch', 0,
lambda self: PLUGIN_DICTIONARY['pitch']())
if self.hw in [XO1, XO15]:
PLUGIN_DICTIONARY['resistance'] = self.prim_resistance
- make_prim('resistance',
- palette='sensor',
- style='box-style',
- label=_('resistance'),
- help_string=_('microphone input resistance'),
- value_block=True,
- prim_name='resistance')
+ palette.add_block('resistance',
+ style='box-style',
+ label=_('resistance'),
+ help_string=_('microphone input resistance'),
+ value_block=True,
+ prim_name='resistance')
self._parent.lc.def_prim('resistance', 0,
lambda self: PLUGIN_DICTIONARY['resistance']())
PLUGIN_DICTIONARY['voltage'] = self.prim_voltage
- make_prim('voltage',
- palette='sensor',
- style='box-style',
- label=_('voltage'),
- help_string=_('microphone input voltage'),
- value_block=True,
- prim_name='voltage')
+ palette.add_block('voltage',
+ style='box-style',
+ label=_('voltage'),
+ help_string=_('microphone input voltage'),
+ value_block=True,
+ prim_name='voltage')
self._parent.lc.def_prim('voltage', 0,
lambda self: PLUGIN_DICTIONARY['voltage']())