diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-03-03 12:14:05 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-03-03 12:14:05 (GMT) |
commit | 9d214663ba8823dd93f624595e65a4ab76c3e933 (patch) | |
tree | 11d4890e60c0b9f080c8347684dcad75d639bdeb | |
parent | c2e939def27ef50d443ceb4ddbcd9e38bf88ace6 (diff) |
naming arguments to make_palette
-rw-r--r-- | TurtleArt/tabasics.py | 39 | ||||
-rw-r--r-- | plugins/audio_sensors_plugin.py | 8 | ||||
-rw-r--r-- | plugins/camera_plugin.py | 5 | ||||
-rw-r--r-- | plugins/rfid_plugin.py | 5 | ||||
-rw-r--r-- | plugins/turtle_blocks_plugin.py | 23 |
5 files changed, 47 insertions, 33 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index de64608..1cd3941 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -47,9 +47,9 @@ That's it. When you next run Turtle Art, you will have a 'uturn' block on the Turtle Palette. Adding a new palette is simply a matter of: - p = Palette('mypalette', ["#00FF00", "#00A000"]) # assign name and colors - p.set_help(_('Palette of my custom commands')) # and a help message - p.add_palette() + make_palette('mypalette', # the name of your palette + colors=["#00FF00", "#00A000"], + help_string=_('Palette of my custom commands')) You will have to create icons for the palette-selector buttons. These are kept in the icons subdirectory. You need two icons: @@ -94,31 +94,38 @@ class Palettes(): def __init__(self, parent): self.tw = parent - make_palette('turtle', ["#00FF00", "#00A000"], - _('Palette of turtle commands')) + make_palette('turtle', + colors=["#00FF00", "#00A000"], + help_string=_('Palette of turtle commands')) self._turtle_palette() - make_palette('pen', ["#00FFFF", "#00A0A0"], - _('Palette of pen commands')) + make_palette('pen', + colors=["#00FFFF", "#00A0A0"], + help_string=_('Palette of pen commands')) self._pen_palette() - make_palette('colors', ["#00FFFF", "#00A0A0"], - _('Palette of pen colors')) + make_palette('colors', + colors=["#00FFFF", "#00A0A0"], + help_string=_('Palette of pen colors')) self._color_palette() - make_palette('numbers', ["#FF00FF", "#A000A0"], - _('Palette of numeric operators')) + make_palette('numbers', + colors=["#FF00FF", "#A000A0"], + help_string=_('Palette of numeric operators')) self._numbers_palette() - make_palette('flow', ["#FFC000", "#A08000"], - _('Palette of flow operators')) + make_palette('flow', + colors=["#FFC000", "#A08000"], + help_string=_('Palette of flow operators')) self._flow_palette() - make_palette('blocks', ["#FFFF00", "#A0A000"], - _('Palette of variable blocks')) + make_palette('blocks', + colors=["#FFFF00", "#A0A000"], + help_string=_('Palette of variable blocks')) self._blocks_palette() - make_palette('trash', ["#FFFF00", "#A0A000"]) + make_palette('trash', + colors=["#FFFF00", "#A0A000"]) self._trash_palette() # Palette definitions diff --git a/plugins/audio_sensors_plugin.py b/plugins/audio_sensors_plugin.py index 1e8dcb1..2ef05d5 100644 --- a/plugins/audio_sensors_plugin.py +++ b/plugins/audio_sensors_plugin.py @@ -35,7 +35,7 @@ from audio.audiograb import AudioGrab_Unknown, AudioGrab_XO1, AudioGrab_XO15, \ from audio.ringbuffer import RingBuffer1d -from TurtleArt.taprimitive import Palette, make_prim +from TurtleArt.taprimitive import make_palette, make_prim from TurtleArt.taconstants import XO1, XO15 from TurtleArt.talogo import PLUGIN_DICTIONARY @@ -81,9 +81,9 @@ class Audio_sensors_plugin(Plugin): self.voltage_gain = -0.0001471 self.voltage_bias = 1.695 - sensors = Palette('sensor') - sensors.set_help(_('Palette of sensor blocks')) - sensors.add_palette() + make_palette('sensor', + colors=["#FF6060", "#A06060"], + help_string=_('Palette of sensor blocks')) PLUGIN_DICTIONARY['sound'] = self.prim_sound make_prim('sound', diff --git a/plugins/camera_plugin.py b/plugins/camera_plugin.py index ebc45a0..8f896a8 100644 --- a/plugins/camera_plugin.py +++ b/plugins/camera_plugin.py @@ -58,8 +58,9 @@ class Camera_plugin(Plugin): self._status = True def setup(self): - make_palette('sensor', ["#FF6060", "#A06060"], - _('Palette of sensor blocks')) + make_palette('sensor', + colors=["#FF6060", "#A06060"], + help_string=_('Palette of sensor blocks')) # set up camera-specific blocks if self._status: diff --git a/plugins/rfid_plugin.py b/plugins/rfid_plugin.py index 03b08bd..3a00407 100644 --- a/plugins/rfid_plugin.py +++ b/plugins/rfid_plugin.py @@ -86,8 +86,9 @@ class Rfid_plugin(Plugin): def setup(self): # set up RFID-specific blocks if self._status: - make_palette('sensor', ["#FF6060", "#A06060"], - _('Palette of sensor blocks')) + make_palette('sensor', + colors=["#FF6060", "#A06060"], + help_string=_('Palette of sensor blocks')) PLUGIN_DICTIONARY['rfid'] = self.prim_read_camera make_prim('rfid', diff --git a/plugins/turtle_blocks_plugin.py b/plugins/turtle_blocks_plugin.py index ce6f73b..94332d5 100644 --- a/plugins/turtle_blocks_plugin.py +++ b/plugins/turtle_blocks_plugin.py @@ -81,20 +81,24 @@ class Turtle_blocks_plugin(Plugin): # set up Turtle Block palettes self._flow_palette() - make_palette('media', ["#A0FF00", "#80A000"], - _('Palette of media objects')) + make_palette('media', + colors=["#A0FF00", "#80A000"], + help_string=_('Palette of media objects')) self._media_palette() - make_palette('sensor', ["#FF6060", "#A06060"], - _('Palette of sensor blocks')) + make_palette('sensor', + colors=["#FF6060", "#A06060"], + help_string=_('Palette of sensor blocks')) self._sensor_palette() - make_palette('extras', ["#FF0000", "#A00000"], - _('Palette of extra options')) + make_palette('extras', + colors=["#FF0000", "#A00000"], + help_string=_('Palette of extra options')) self._extras_palette() - make_palette('portfolio', ["#0606FF", "#0606A0"], - _('Palette of presentation templates')) + make_palette('portfolio', + colors=["#0606FF", "#0606A0"], + help_string=_('Palette of presentation templates')) self._portfolio_palette() def start(self): @@ -921,7 +925,8 @@ objects')) description = None if self.tw.lc.dsobject is not None and \ 'description' in self.tw.lc.dsobject.metadata: - description = self.tw.lc.dsobject.metadata['description'] + description = self.tw.lc.dsobject.metadata[ + 'description'] self.tw.lc.insert_desc(mimetype, description) elif string[0:6] == 'audio_': self.tw.lc.play_sound() |