From e5c8c283d0f43e35bc76898f099fb50de252d3b0 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 27 Jul 2011 23:48:14 +0000 Subject: clean up block rescaling code; move more constants inits to plugins --- (limited to 'TurtleArt') diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index b39c1b7..857801e 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -103,15 +103,6 @@ COLLAPSIBLE = ['sandwichbottom', 'sandwichcollapsed'] OLD_DOCK = ['and', 'or', 'plus', 'minus', 'division', 'product', 'remainder'] # -# These blocks get a special skin -# -BLOCKS_WITH_SKIN = ['journal', 'audio', 'description', 'nop', 'userdefined', - 'video', 'userdefined2args', 'userdefined3args', 'camera'] - -PYTHON_SKIN = ['nop', 'userdefined', 'userdefined2args', 'userdefined3args'] - - -# # Blocks that can interchange strings and numbers for their arguments # STRING_OR_NUMBER_ARGS = ['plus2', 'equal2', 'less2', 'greater2', 'box', @@ -125,12 +116,15 @@ STRING_OR_NUMBER_ARGS = ['plus2', 'equal2', 'less2', 'greater2', 'box', CONTENT_ARGS = ['show', 'showaligned', 'push', 'storein', 'storeinbox1', 'storeinbox2'] -PREFIX_DICTIONARY = {'journal': '#smedia_', 'description': '#sdescr_', - 'audio': '#saudio_', 'video': '#svideo_'} +PREFIX_DICTIONARY = {} # -# Status blocks +# These blocks get a special skin # +BLOCKS_WITH_SKIN = [] + +PYTHON_SKIN = [] + SKIN_PATHS = ['images'] MEDIA_SHAPES = [] @@ -139,6 +133,9 @@ NO_IMPORT = [] EXPAND_SKIN = {} +# +# Status blocks +# 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 09f9273..f8ff41c 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -772,9 +772,9 @@ class TurtleArtWindow(): # Some proto blocks get a skin. if name in block_styles['box-style-media']: self._proto_skin(name + 'small', n, i) - elif name[:8] == 'template': + elif name[:8] == 'template': # Deprecated self._proto_skin(name[8:], n, i) - elif name[:7] == 'picture': + elif name[:7] == 'picture': # Deprecated self._proto_skin(name[7:], n, i) elif name in PYTHON_SKIN: self._proto_skin('pythonsmall', n, i) @@ -2622,11 +2622,11 @@ class TurtleArtWindow(): else: self._block_skin('pythonoff', blk) elif btype in block_styles['box-style-media'] and blk.spr is not None: + if btype in EXPAND_SKIN: + if blk.ex == 0: + blk.expand_in_x(EXPAND_SKIN[btype]) if len(blk.values) == 0 or blk.values[0] == 'None' or \ blk.values[0] is None or btype in NO_IMPORT: - if btype in EXPAND_SKIN: - if blk.ex == 0: - blk.expand_in_x(EXPAND_SKIN[btype]) self._block_skin(btype + 'off', blk) elif btype in ['video', 'audio', 'description']: self._block_skin(btype + 'on', blk) @@ -2920,6 +2920,7 @@ class TurtleArtWindow(): target_w = spr.label_safe_width() target_h = spr.label_safe_height() if name == '': + debug_output("%d, %d" % (target_w, target_h)) return target_w, target_h image_w = self.media_shapes[name].get_width() image_h = self.media_shapes[name].get_height() -- cgit v0.9.1