diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2010-02-07 23:38:31 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2010-02-07 23:38:31 (GMT) |
commit | 445b756e59b8dd7f676fe55c1a89b193717ef554 (patch) | |
tree | f5e6278cbed8443a8cb8cdb72cfeac68e4d08bfe | |
parent | d12b51e33b36b708da885b8137227b3061f4ba15 (diff) |
fixed dockig problem with old-style arithmetic blocks
-rw-r--r-- | tawindow.py | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/tawindow.py b/tawindow.py index 23a01c1..68a9f01 100644 --- a/tawindow.py +++ b/tawindow.py @@ -821,7 +821,7 @@ class TurtleArtWindow(): else: cons.append(blocks[c]) elif blocks[i].connections == 'check': - # Ugly corner case is to convert old-style booleans op. + # Corner case to convert old-style boolean and arithmetic blocks cons.append(None) # Add an extra connection. for c in data[i][4]: if c is None: @@ -829,19 +829,34 @@ class TurtleArtWindow(): else: cons.append(blocks[c]) # If the boolean op was connected, readjust the plumbing. - if data[i][4][0] is not None: - c = data[i][4][0] - cons[0] = blocks[data[c][4][0]] - c0 = data[c][4][0] - for j, cj in enumerate(data[c0][4]): - if cj == c: - blocks[c0].connections[j] = blocks[i] - if c<i: - blocks[c].connections[0] = blocks[i] - blocks[c].connections[3] = None - else: - # Connection was to a block we haven't seen yet. - print "WARNING: dock check couldn't see the future" + if blocks[i].name in BOOLEAN_STYLE: + if data[i][4][0] is not None: + c = data[i][4][0] + cons[0] = blocks[data[c][4][0]] + c0 = data[c][4][0] + for j, cj in enumerate(data[c0][4]): + if cj == c: + blocks[c0].connections[j] = blocks[i] + if c<i: + blocks[c].connections[0] = blocks[i] + blocks[c].connections[3] = None + else: + # Connection was to a block we haven't seen yet. + print "WARNING: dock check couldn't see the future" + else: + if data[i][4][0] is not None: + c = data[i][4][0] + cons[0] = blocks[data[c][4][0]] + c0 = data[c][4][0] + for j, cj in enumerate(data[c0][4]): + if cj == c: + blocks[c0].connections[j] = blocks[i] + if c<i: + blocks[c].connections[0] = blocks[i] + blocks[c].connections[1] = None + else: + # Connection was to a block we haven't seen yet. + print "WARNING: dock check couldn't see the future" else: print "WARNING: unknown connection state %s" %\ (str(blocks[i].connections)) |