Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/taconstants.py2
-rw-r--r--TurtleArt/tautils.py10
-rw-r--r--TurtleArt/tawindow.py6
3 files changed, 16 insertions, 2 deletions
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 8f52d9b..c8ca7e0 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -646,7 +646,7 @@ STRING_OR_NUMBER_ARGS = ['plus2', 'equal2', 'less2', 'greater2', 'box',
'userdefined2args', 'userdefined3args', 'storein']
CONTENT_ARGS = ['show', 'showaligned', 'push', 'storein', 'storeinbox1',
- 'storeinbox2', 'skin']
+ 'storeinbox2']
#
# Status blocks
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 9798614..e251ccf 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -573,6 +573,16 @@ def dock_dx_dy(block1, dock1n, block2, dock2n):
(_b2x, _b2y) = block2.spr.get_xy()
return ((_b1x + _d1x) - (_b2x + _d2x), (_b1y + _d1y) - (_b2y + _d2y))
+def journal_check(blk1, blk2, dock1, dock2):
+ """ Dock blocks only if arg is Journal block """
+ if blk1 == None or blk2 == None:
+ return True
+ if (blk1.name == 'skin' and dock1 == 1) and blk2.name != 'journal':
+ return False
+ if (blk2.name == 'skin' and dock2 == 1) and blk1.name != 'journal':
+ return False
+ return True
+
def arithmetic_check(blk1, blk2, dock1, dock2):
""" Dock strings only if they convert to numbers. Avoid /0 and root(-1)"""
if blk1 == None or blk2 == None:
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 3e6546c..19029f6 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -66,7 +66,7 @@ from tautils import magnitude, get_load_name, get_save_name, data_from_file, \
collapsed, collapsible, hide_button_hit, show_button_hit, \
arithmetic_check, xy, find_block_to_run, find_top_block, \
find_start_stack, find_group, find_blk_below, olpc_xo_1, \
- dock_dx_dy, data_to_string
+ dock_dx_dy, data_to_string, journal_check
from tasprite_factory import SVG, svg_str_to_pixbuf, svg_from_file
from sprites import Sprites, Sprite
@@ -1622,6 +1622,10 @@ class TurtleArtWindow():
best_selected_block_dockn,
best_destination_dockn):
return
+ if not journal_check(selected_block, best_destination,
+ best_selected_block_dockn,
+ best_destination_dockn):
+ return
for blk in self.drag_group:
(sx, sy) = blk.spr.get_xy()
blk.spr.move((sx + best_xy[0], sy + best_xy[1]))