Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-26 15:44:25 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-07-26 15:44:25 (GMT)
commit9abaa821dadab2825fc1939bcda8c5858fb96f25 (patch)
tree81732a5085858c8133e066e8836d89bd78b610e1
parentea2b5ae10a82a359865fbfced6d870a6477b432a (diff)
have plugin append to MEDIA_SHAPES list; NO_IMPORT list
-rw-r--r--TurtleArt/taconstants.py3
-rw-r--r--TurtleArt/tawindow.py8
-rw-r--r--plugins/camera_sensor/camera_sensor.py5
3 files changed, 10 insertions, 6 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 30920d6..05c0fd6 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -134,12 +134,13 @@ PREFIX_DICTIONARY = {'journal': '#smedia_', 'description': '#sdescr_',
MEDIA_SHAPES = ['audiooff', 'audioon', 'audiosmall',
'videooff', 'videoon', 'videosmall',
- 'cameraoff', 'camerasmall',
'journaloff', 'journalon', 'journalsmall',
'descriptionoff', 'descriptionon', 'descriptionsmall',
'pythonoff', 'pythonon', 'pythonsmall',
'list', '1x1', '1x1a', '2x1', '1x2', '2x2']
+NO_IMPORT = []
+
OVERLAY_SHAPES = ['Cartesian', 'Cartesian_labeled', 'polar', 'metric']
STATUS_SHAPES = ['status', 'info', 'nostack', 'dupstack', 'noinput',
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 64a32fd..07d7488 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -55,7 +55,7 @@ from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \
TOOLBAR_SHAPES, TAB_LAYER, RETURN, OVERLAY_LAYER, CATEGORY_LAYER, \
BLOCKS_WITH_SKIN, ICON_SIZE, PALETTE_SCALE, PALETTE_WIDTH, \
MACROS, TOP_LAYER, BLOCK_LAYER, OLD_NAMES, DEFAULT_TURTLE, TURTLE_LAYER, \
- CURSOR, EXPANDABLE, COLLAPSIBLE, DEAD_DICTS, DEAD_KEYS, \
+ CURSOR, EXPANDABLE, COLLAPSIBLE, DEAD_DICTS, DEAD_KEYS, NO_IMPORT, \
TEMPLATES, PYTHON_SKIN, PALETTE_HEIGHT, STATUS_LAYER, OLD_DOCK, \
EXPANDABLE_ARGS, XO1, XO15, UNKNOWN, TITLEXY, CONTENT_ARGS, CONSTANTS
from tapalette import palette_names, palette_blocks, expandable_blocks, \
@@ -1666,8 +1666,7 @@ class TurtleArtWindow():
blk.spr.labels[0] += CURSOR
elif blk.name in block_styles['box-style-media'] and \
- blk.name != 'camera':
- # TODO: isolate reference to camera
+ blk.name not in NO_IMPORT:
self._import_from_journal(self.selected_blk)
if blk.name == 'journal' and self.running_sugar:
self._load_description_block(blk)
@@ -2617,9 +2616,8 @@ class TurtleArtWindow():
else:
self._block_skin('pythonoff', blk)
elif btype in block_styles['box-style-media'] and blk.spr is not None:
- # TODO: isolate reference to camera
if len(blk.values) == 0 or blk.values[0] == 'None' or \
- blk.values[0] is None or btype == 'camera':
+ blk.values[0] is None or btype in NO_IMPORT:
self._block_skin(btype + 'off', blk)
elif btype == 'video' or btype == 'audio' or \
btype == 'description':
diff --git a/plugins/camera_sensor/camera_sensor.py b/plugins/camera_sensor/camera_sensor.py
index 3b32be9..66ff23c 100644
--- a/plugins/camera_sensor/camera_sensor.py
+++ b/plugins/camera_sensor/camera_sensor.py
@@ -30,6 +30,7 @@ from plugins.plugin import Plugin
from TurtleArt.tapalette import make_palette
from TurtleArt.talogo import media_blocks_dictionary, primitive_dictionary
from TurtleArt.tautils import get_path, debug_output
+from TurtleArt.taconstants import MEDIA_SHAPES, NO_IMPORT
class Camera_sensor(Plugin):
@@ -120,6 +121,10 @@ is pushed to the stack'),
help_string=_('camera output'),
content_block=True)
+ NO_IMPORT.append('camera')
+ MEDIA_SHAPES.append('camerasmall')
+ MEDIA_SHAPES.append('cameraoff')
+
def start(self):
''' Initialize the camera if there is an camera block in use '''
if len(self._parent.block_list.get_similar_blocks('block',