Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TurtleArt/tacanvas.py5
-rw-r--r--TurtleArt/taconstants.py1
-rw-r--r--TurtleArt/talogo.py1
-rw-r--r--TurtleArt/tawindow.py108
-rw-r--r--TurtleArtActivity.py4
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py1
-rw-r--r--samples/graphics-bbq.tb89
-rw-r--r--samples/graphics-dalton.tb43
-rwxr-xr-xturtleblocks.py4
9 files changed, 199 insertions, 57 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py
index 9d44ed1..89b8ed1 100644
--- a/TurtleArt/tacanvas.py
+++ b/TurtleArt/tacanvas.py
@@ -28,7 +28,7 @@ import cairo
import pangocairo
from tautils import get_path
-from taconstants import COLORDICT
+from taconstants import COLORDICT, TMP_SVG_PATH
def wrap100(n):
@@ -127,8 +127,7 @@ class TurtleGraphics:
'output.svg'), self.width, self.height)
else:
svg_surface = cairo.SVGSurface(
- os.path.join('/tmp', 'turtle_output.svg'),
- self.width, self.height)
+ TMP_SVG_PATH, self.width, self.height)
self.cr_svg = cairo.Context(svg_surface)
self.cr_svg.set_line_cap(1) # Set the line cap to be round
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index ffacac2..835209e 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -77,6 +77,7 @@ XO175 = 'xo1.75'
XO30 = 'xo3.0'
XO4 = 'xo4'
UNKNOWN = 'unknown'
+TMP_SVG_PATH = '/tmp/turtle_output.svg'
CONSTANTS = {'leftpos': None, 'toppos': None, 'rightpos': None,
'bottompos': None, 'width': None, 'height': None,
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 646b028..7aac4ce 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -608,6 +608,7 @@ class LogoCode:
self.hidden_turtle = None
self.start_time = time()
self.clear_value_blocks()
+ self.tw.activity.restore_state()
def clear_value_blocks(self):
if not hasattr(self, 'value_blocks_to_update'):
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 6b14abf..217a6e5 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -58,7 +58,7 @@ from taconstants import (HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE,
PYTHON_SKIN, PALETTE_HEIGHT, STATUS_LAYER, OLD_DOCK,
EXPANDABLE_ARGS, XO1, XO15, XO175, XO30, XO4, TITLEXY,
CONTENT_ARGS, CONSTANTS, EXPAND_SKIN, PROTO_LAYER,
- EXPANDABLE_FLOW, SUFFIX)
+ EXPANDABLE_FLOW, SUFFIX, TMP_SVG_PATH)
from tapalette import (palette_names, palette_blocks, expandable_blocks,
block_names, content_blocks, default_values,
special_names, block_styles, help_strings,
@@ -365,7 +365,7 @@ class TurtleArtWindow():
def init_plugin(self, plugin_dir):
''' Initialize plugin in plugin_dir '''
plugin_class = plugin_dir.capitalize()
- f = "def f(self): from plugins.%s.%s import %s; return %s(self)" \
+ f = 'def f(self): from plugins.%s.%s import %s; return %s(self)' \
% (plugin_dir, plugin_dir, plugin_class, plugin_class)
plugins = {}
# NOTE: When debugging plugins, it may be useful to not trap errors
@@ -441,15 +441,15 @@ class TurtleArtWindow():
self.window.add_events(gtk.gdk.BUTTON_RELEASE_MASK)
self.window.add_events(gtk.gdk.POINTER_MOTION_MASK)
self.window.add_events(gtk.gdk.KEY_PRESS_MASK)
- self.window.connect("expose-event", self._expose_cb)
- self.window.connect("button-press-event", self._buttonpress_cb)
- self.window.connect("button-release-event", self._buttonrelease_cb)
- self.window.connect("motion-notify-event", self._move_cb)
- self.window.connect("key-press-event", self._keypress_cb)
+ self.window.connect('expose-event', self._expose_cb)
+ self.window.connect('button-press-event', self._buttonpress_cb)
+ self.window.connect('button-release-event', self._buttonrelease_cb)
+ self.window.connect('motion-notify-event', self._move_cb)
+ self.window.connect('key-press-event', self._keypress_cb)
gtk.gdk.screen_get_default().connect('size-changed',
self._configure_cb)
- target = [("text/plain", 0, 0)]
+ target = [('text/plain', 0, 0)]
self.window.drag_dest_set(gtk.DEST_DEFAULT_ALL, target,
gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
self.window.connect('drag_data_received', self._drag_data_received)
@@ -534,7 +534,7 @@ class TurtleArtWindow():
int(self.width / 2 - 600),
int(self.height / 2 - 450),
svg_str_to_pixbuf(
- svg_from_file("%s/images/%s.svg" % (self.path, name))))
+ svg_from_file('%s/images/%s.svg' % (self.path, name))))
self.overlay_shapes[name].hide()
self.overlay_shapes[name].type = 'overlay'
@@ -648,7 +648,7 @@ class TurtleArtWindow():
if find_start_stack(blk):
self.step_time = time
if self.running_sugar:
- debug_output("running stack starting from %s" % (blk.name),
+ debug_output('running stack starting from %s' % (blk.name),
self.running_sugar)
if running_from_button_push:
self.selected_blk = None
@@ -662,7 +662,7 @@ class TurtleArtWindow():
if find_block_to_run(blk):
self.step_time = time
if self.running_sugar:
- debug_output("running stack starting from %s" % (blk.name),
+ debug_output('running stack starting from %s' % (blk.name),
self.running_sugar)
if running_from_button_push:
self.selected_blk = None
@@ -739,7 +739,7 @@ class TurtleArtWindow():
int(self.width / 2 - 600),
int(self.height / 2 - 450),
svg_str_to_pixbuf(
- svg_from_file("%s/images/%s.svg" % (self.path, name))))
+ svg_from_file('%s/images/%s.svg' % (self.path, name))))
if showing:
self.overlay_shapes[name].set_layer(OVERLAY_LAYER)
else:
@@ -1090,7 +1090,7 @@ class TurtleArtWindow():
self.toolbar_offset,
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettehorizontal.svg" % (self.path)))))
+ '%s/images/palettehorizontal.svg' % (self.path)))))
self.palette_button.append(
Sprite(
self.sprite_list,
@@ -1098,7 +1098,7 @@ class TurtleArtWindow():
self.toolbar_offset,
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettevertical.svg" % (self.path)))))
+ '%s/images/palettevertical.svg' % (self.path)))))
self.palette_button[0].name = _('orientation')
self.palette_button[1].name = _('orientation')
self.palette_button[0].type = 'palette'
@@ -1113,7 +1113,7 @@ class TurtleArtWindow():
self.toolbar_offset,
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettenext.svg" % (self.path)))))
+ '%s/images/palettenext.svg' % (self.path)))))
self.palette_button[2].name = _('next')
self.palette_button[2].type = 'palette'
self.palette_button[2].set_layer(TAB_LAYER)
@@ -1127,7 +1127,7 @@ class TurtleArtWindow():
self.toolbar_offset + dims[1],
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettehshift.svg" % (self.path)))))
+ '%s/images/palettehshift.svg' % (self.path)))))
self.palette_button.append(
Sprite(
self.sprite_list,
@@ -1135,7 +1135,7 @@ class TurtleArtWindow():
self.toolbar_offset,
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettevshift.svg" % (self.path)))))
+ '%s/images/palettevshift.svg' % (self.path)))))
self.palette_button.append(
Sprite(
self.sprite_list,
@@ -1143,7 +1143,7 @@ class TurtleArtWindow():
self.toolbar_offset + dims[1],
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettehshift2.svg" % (self.path)))))
+ '%s/images/palettehshift2.svg' % (self.path)))))
self.palette_button.append(
Sprite(
self.sprite_list,
@@ -1151,7 +1151,7 @@ class TurtleArtWindow():
self.toolbar_offset,
svg_str_to_pixbuf(
svg_from_file(
- "%s/images/palettevshift2.svg" % (self.path)))))
+ '%s/images/palettevshift2.svg' % (self.path)))))
for i in range(4):
self.palette_button[3 + i].name = _('shift')
self.palette_button[3 + i].type = 'palette'
@@ -2271,7 +2271,7 @@ before making changes to your Turtle Blocks program'))
self.used_block_list.append(newblk.spr.labels[0])
def new_macro(self, name, x, y):
- ''' Create a "macro" (predefined stack of blocks). '''
+ ''' Create a 'macro' (predefined stack of blocks). '''
macro = MACROS[name]
macro[0][2] = x
macro[0][3] = y
@@ -2321,7 +2321,7 @@ before making changes to your Turtle Blocks program'))
else:
cons.append(blocks[c])
else:
- debug_output("connection error %s" %
+ debug_output('connection error %s' %
(str(self._process_block_data[i])),
self.running_sugar)
cons.append(None)
@@ -2348,7 +2348,7 @@ before making changes to your Turtle Blocks program'))
blocks[c].connections[3] = None
else:
# Connection was to a block we haven't seen yet.
- debug_output("Warning: dock to the future",
+ debug_output('Warning: dock to the future',
self.running_sugar)
else:
if self._process_block_data[i][4][0] is not None:
@@ -2364,10 +2364,10 @@ before making changes to your Turtle Blocks program'))
blocks[c].connections[1] = None
else:
# Connection was to a block we haven't seen yet.
- debug_output("Warning: dock to the future",
+ debug_output('Warning: dock to the future',
self.running_sugar)
else:
- debug_output("Warning: unknown connection state %s" %
+ debug_output('Warning: unknown connection state %s' %
(str(blk.connections)), self.running_sugar)
blk.connections = cons[:]
@@ -2464,7 +2464,7 @@ before making changes to your Turtle Blocks program'))
''' Share turtle movement and rotation after button up '''
if self.sharing():
nick = self.turtle_movement_to_share.get_name()
- self.send_event("r|%s" % (data_to_string(
+ self.send_event('r|%s' % (data_to_string(
[nick,
round_int(self.turtles.get_active_turtle().get_heading())])))
if self.turtles.get_active_turtle().get_pen_state():
@@ -2472,7 +2472,7 @@ before making changes to your Turtle Blocks program'))
put_pen_back_down = True
else:
put_pen_back_down = False
- self.send_event("x|%s" % (data_to_string(
+ self.send_event('x|%s' % (data_to_string(
[nick,
[round_int(self.turtles.get_active_turtle().get_xy()[0]),
round_int(self.turtles.get_active_turtle().get_xy()[1])]])))
@@ -3355,7 +3355,7 @@ before making changes to your Turtle Blocks program'))
else:
dy += delta
gblk = gblk.connections[-1]
- # Clamp has room for one "standard" block by default
+ # Clamp has room for one 'standard' block by default
if dy > 0:
dy -= 21 # Fixme: don't hardcode
if blk.name in block_styles['clamp-style-else'] and dockn == 3:
@@ -3483,7 +3483,7 @@ before making changes to your Turtle Blocks program'))
self.keypress = keyname
if alt_mask:
- if keyname == "p":
+ if keyname == 'p':
self.hideshow_button()
elif keyname == 'q':
self.quit_plugins()
@@ -3633,15 +3633,15 @@ before making changes to your Turtle Blocks program'))
num = float(text.replace(self.decimal_point, '.'))
if num > 1000000:
num = 1
- self.showlabel("#overflowerror")
+ self.showlabel('#overflowerror')
elif num < -1000000:
num = -1
- self.showlabel("#overflowerror")
+ self.showlabel('#overflowerror')
if int(num) == num:
num = int(num)
except ValueError:
num = 0
- self.showlabel("#notanumber")
+ self.showlabel('#notanumber')
else:
num = 0
self.selected_blk.spr.set_label(str(num))
@@ -3693,7 +3693,7 @@ before making changes to your Turtle Blocks program'))
f.close()
id = fname
except IOError:
- error_output("Unable to read Python code from %s" % (fname),
+ error_output('Unable to read Python code from %s' % (fname),
self.running_sugar)
return id
@@ -3715,12 +3715,12 @@ before making changes to your Turtle Blocks program'))
try:
datastore.write(dsobject)
id = dsobject.object_id
- debug_output("Copied %s to the datastore" % (fname),
+ debug_output('Copied %s to the datastore' % (fname),
self.running_sugar)
# Don't copy the same file more than once
self._py_cache[fname] = id
except IOError:
- error_output("Error copying %s to the datastore" % (fname),
+ error_output('Error copying %s to the datastore' % (fname),
self.running_sugar)
id = None
dsobject.destroy()
@@ -3754,11 +3754,11 @@ before making changes to your Turtle Blocks program'))
if dsobject is None:
return
try:
- file_handle = open(dsobject.file_path, "r")
+ file_handle = open(dsobject.file_path, 'r')
self.python_code = file_handle.read()
file_handle.close()
except IOError:
- debug_output("couldn't open %s" % dsobject.file_path,
+ debug_output('Could not open %s' % dsobject.file_path,
self.running_sugar)
# Save the object id as the block value
if blk is None:
@@ -3785,7 +3785,7 @@ before making changes to your Turtle Blocks program'))
def new_project(self):
''' Start a new project '''
self.lc.stop_logo()
- self._loaded_project = ""
+ self._loaded_project = ''
# Put current project in the trash.
while len(self.just_blocks()) > 0:
blk = self.just_blocks()[0]
@@ -3796,7 +3796,7 @@ before making changes to your Turtle Blocks program'))
def is_new_project(self):
''' Is this a new project or was a old project loaded from a file? '''
- return self._loaded_project == ""
+ return self._loaded_project == ''
def project_has_changed(self):
''' WARNING: order of JSON serialized data may have changed. '''
@@ -3805,9 +3805,9 @@ before making changes to your Turtle Blocks program'))
saved_project_data = f.read()
f.close()
except:
- debug_output("problem loading saved project data from %s" %
+ debug_output('problem loading saved project data from %s' %
(self._loaded_project), self.running_sugar)
- saved_project_data = ""
+ saved_project_data = ''
current_project_data = data_to_string(self.assemble_data_to_save())
return saved_project_data != current_project_data
@@ -3995,7 +3995,7 @@ before making changes to your Turtle Blocks program'))
dsobject = datastore.get(value)
except: # Should be IOError, but dbus error is raised
dsobject = None
- debug_output("couldn't get dsobject %s" % (value),
+ debug_output('Could not get dsobject %s' % (value),
self.running_sugar)
if dsobject is not None:
self.load_python_code_from_journal(dsobject, blk)
@@ -4047,7 +4047,7 @@ before making changes to your Turtle Blocks program'))
x, y = self._calc_image_offset('', blk.spr)
blk.set_image(pixbuf, x, y)
except:
- debug_output("Couldn't open dsobject (%s)" %
+ debug_output('Could not open dsobject (%s)' %
(blk.values[0]), self.running_sugar)
self._block_skin('journaloff', blk)
else:
@@ -4128,7 +4128,7 @@ before making changes to your Turtle Blocks program'))
''' Start a new project with a 'start' brick '''
if ta_file is None:
self.process_data(
- [[0, "start", PALETTE_WIDTH + 20,
+ [[0, 'start', PALETTE_WIDTH + 20,
self.toolbar_offset + PALETTE_HEIGHT + 20 + ICON_SIZE,
[None, None]]])
else:
@@ -4312,16 +4312,17 @@ before making changes to your Turtle Blocks program'))
save_picture(self.canvas, image_file)
return ta_file, image_file
- def save_as_image(self, name="", svg=False):
+ def save_as_image(self, name='', svg=False):
''' Grab the current canvas and save it. '''
if svg:
suffix = '.svg'
else:
suffix = '.png'
- if not self.interactive_mode:
+ if not self.interactive_mode: # png only
save_picture(self.canvas, name[:-3] + suffix)
return
+
if self.running_sugar:
if len(name) == 0:
filename = 'turtleblocks' + suffix
@@ -4338,6 +4339,7 @@ before making changes to your Turtle Blocks program'))
else:
datapath = os.getcwd()
filename = name + suffix
+
if filename is None:
return
@@ -4345,6 +4347,7 @@ before making changes to your Turtle Blocks program'))
if svg:
if self.canvas.cr_svg is None:
return
+ self.canvas.svg_close()
self.canvas.svg_reset()
else:
save_picture(self.canvas, file_path)
@@ -4355,14 +4358,14 @@ before making changes to your Turtle Blocks program'))
dsobject = datastore.create()
if len(name) == 0:
- dsobject.metadata['title'] = "%s %s" % \
- (self.activity.metadata['title'], _("image"))
+ dsobject.metadata['title'] = '%s %s' % \
+ (self.activity.metadata['title'], _('image'))
else:
dsobject.metadata['title'] = name
dsobject.metadata['icon-color'] = profile.get_color().to_string()
if svg:
dsobject.metadata['mime_type'] = 'image/svg+xml'
- dsobject.set_file_path(os.path.join(datapath, 'output.svg'))
+ dsobject.set_file_path(TMP_SVG_PATH)
else:
dsobject.metadata['mime_type'] = 'image/png'
dsobject.set_file_path(file_path)
@@ -4370,14 +4373,13 @@ before making changes to your Turtle Blocks program'))
dsobject.destroy()
self.saved_pictures.append((dsobject.object_id, svg))
if svg:
- os.remove(os.path.join(datapath, 'output.svg'))
+ os.remove(TMP_SVG_PATH)
else:
os.remove(file_path)
else:
if svg:
subprocess.check_output(
- ['mv', os.path.join(datapath, 'output.svg'),
- os.path.join(datapath, filename)])
+ ['cp', TMP_SVG_PATH, os.path.join(datapath, filename)])
self.saved_pictures.append((file_path, svg))
def just_blocks(self):
@@ -4591,7 +4593,7 @@ variable'))
x = int(x)
if 'stack3' + str(x) not in self.lc.stacks or \
self.lc.stacks['stack3' + str(x)] is None:
- raise logoerror("#nostack")
+ raise logoerror('#nostack')
self.lc.icall(self.lc.evline,
self.lc.stacks['stack3' + str(x)][:])
yield True
@@ -4607,7 +4609,7 @@ variable'))
try:
return self.lc.boxes['box3' + str(x)]
except KeyError:
- raise logoerror("#emptybox")
+ raise logoerror('#emptybox')
def _prim_setbox(self, name, x, val):
''' Define value of named box '''
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py
index c8f9755..3274dfc 100644
--- a/TurtleArtActivity.py
+++ b/TurtleArtActivity.py
@@ -1580,3 +1580,7 @@ in order to use the plugin.'))
alert.props.msg = msg
self.add_alert(alert)
alert.show()
+
+ def restore_state(self):
+ ''' Anything that needs restoring after a clear screen can go here '''
+ pass
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index 0d31ced..beb9bfb 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -1203,7 +1203,6 @@ Journal objects'))
def _prim_save_svg(self, name):
""" Save SVG to file """
- self.tw.canvas.svg_close()
self.tw.save_as_image(name, svg=True)
def _prim_speak(self, text):
diff --git a/samples/graphics-bbq.tb b/samples/graphics-bbq.tb
new file mode 100644
index 0000000..08083d1
--- /dev/null
+++ b/samples/graphics-bbq.tb
@@ -0,0 +1,89 @@
+[[0, ["start", 2.0], 1098, 59, [null, 1]],
+[1, "clean", 1098, 105, [0, 2]],
+[2, ["setxy2", 20], 1098, 147, [1, 86, 3, 4]],
+[3, ["number", 290.0], 1156, 229, [2, null]],
+[4, "right", 1098, 271, [2, 5, 8]],
+[5, ["number", 45.0], 1156, 271, [4, null]],
+[6, "hat", 422, 116, [null, 7, 35]],
+[7, ["string", "horizontal"], 480, 128, [6, null]],
+[8, "stack", 1098, 313, [4, 9, 78]],
+[9, ["string", "horizontal"], 1156, 313, [8, null]],
+[10, ["setxy2", 0], 1098, 397, [78, 85, 69, 79]],
+[11, "seth", 1098, 523, [79, 12, 15]],
+[12, ["number", 0], 1197, 523, [11, null]],
+[13, "hat", 423, 392, [null, 14, 29]],
+[14, ["string", "vertical"], 481, 404, [13, null]],
+[15, "stack", 1098, 565, [11, 16, 80]],
+[16, ["string", "vertical"], 1156, 565, [15, null]],
+[17, ["setxy2", 20], 1098, 649, [80, 83, 18, 23]],
+[18, ["number", 80.0], 1156, 731, [17, null]],
+[19, "stack", 1098, 857, [81, 20, 21]],
+[20, ["string", "vertical"], 1156, 857, [19, null]],
+[21, "stack", 1098, 899, [19, 22, null]],
+[22, ["string", "vertical"], 1156, 899, [21, null]],
+[23, "right", 1098, 773, [17, 24, 81]],
+[24, ["number", 135.0], 1156, 773, [23, null]],
+[25, "hat", 756, 86, [null, 26, 43]],
+[26, ["string", "action"], 814, 98, [25, null]],
+[27, "stack", 441, 530, [73, 28, 38]],
+[28, ["string", "action"], 499, 530, [27, null]],
+[29, ["repeat", 83], 423, 446, [13, 71, 73, null]],
+[30, ["setxy2", 0], 440, 296, [36, 31, 33, null]],
+[31, "xcor", 498, 296, [30, null]],
+[32, "ycor", 571, 338, [33, null]],
+[33, ["minus2", 0], 498, 338, [30, 32, 34]],
+[34, "pensize", 595, 380, [33, null]],
+[35, ["repeat", 63], 422, 170, [6, 75, 77, null]],
+[36, "stack", 440, 254, [77, 37, 30]],
+[37, ["string", "action"], 498, 254, [36, null]],
+[38, ["setxy2", 20], 441, 572, [27, 42, 39, null]],
+[39, "ycor", 499, 654, [38, null]],
+[40, "xcor", 553, 572, [42, null]],
+[41, "pensize", 553, 614, [42, null]],
+[42, ["plus2", 0], 499, 572, [38, 40, 41]],
+[43, "setpensize", 756, 140, [25, 44, 45]],
+[44, ["number", 7.0], 858, 140, [43, null]],
+[45, "setcolor", 756, 182, [43, 46, 47]],
+[46, ["number", 70.0], 833, 182, [45, null]],
+[47, "setshade", 756, 224, [45, 48, 51]],
+[48, ["number", 0.0], 841, 224, [47, null]],
+[49, "setshade", 756, 350, [53, 50, 55]],
+[50, ["number", 50], 841, 350, [49, null]],
+[51, "forward", 756, 266, [47, 52, 53]],
+[52, ["number", 1700.0], 827, 266, [51, null]],
+[53, "back", 756, 308, [51, 54, 49]],
+[54, ["number", 1700.0], 814, 308, [53, null]],
+[55, "setpensize", 756, 392, [49, 56, 59]],
+[56, ["random", 0], 858, 392, [55, 57, 58, null]],
+[57, ["number", 3.0], 944, 392, [56, null]],
+[58, ["number", 10.0], 944, 434, [56, null]],
+[59, ["vspace", 0], 756, 434, [55, 63]],
+[60, ["random", 0], 833, 476, [63, 61, 62, null]],
+[61, ["number", 0], 919, 476, [60, null]],
+[62, ["number", 20.0], 919, 518, [60, null]],
+[63, "setcolor", 756, 476, [59, 60, 64]],
+[64, ["vspace", 0], 756, 518, [63, 65]],
+[65, "forward", 756, 560, [64, 66, 67]],
+[66, ["number", 1700.0], 827, 560, [65, null]],
+[67, "back", 756, 602, [65, 68, null]],
+[68, ["number", 1700.0], 814, 602, [67, null]],
+[69, "bottompos", 1156, 439, [10, null]],
+[70, "width", 552, 446, [71, null]],
+[71, ["division2", 0], 482, 446, [29, 70, 72]],
+[72, ["number", 15.0], 576, 488, [71, null]],
+[73, ["vspace", 0], 441, 488, [29, 27]],
+[74, "width", 551, 170, [75, null]],
+[75, ["division2", 0], 481, 170, [35, 74, 76]],
+[76, ["number", 6.0], 575, 212, [75, null]],
+[77, ["vspace", 0], 440, 212, [35, 36]],
+[78, "penup", 1098, 355, [8, 10]],
+[79, "pendown", 1098, 481, [10, 11]],
+[80, "penup", 1098, 607, [15, 17]],
+[81, "pendown", 1098, 815, [23, 19]],
+[82, "leftpos", 1226, 649, [83, null]],
+[83, ["division2", 0], 1156, 649, [17, 82, 84]],
+[84, ["number", 3.0], 1250, 691, [83, null]],
+[85, "leftpos", 1156, 397, [10, null]],
+[86, ["division2", 0], 1156, 147, [2, 88, 87]],
+[87, ["number", 2.0], 1250, 189, [86, null]],
+[88, "leftpos", 1226, 147, [86, null]]]
diff --git a/samples/graphics-dalton.tb b/samples/graphics-dalton.tb
new file mode 100644
index 0000000..31232d0
--- /dev/null
+++ b/samples/graphics-dalton.tb
@@ -0,0 +1,43 @@
+[[0, ["start", 2.0], 439, 89, [null, 1]],
+[1, "clean", 439, 135, [0, 2]],
+[2, "fillscreen2", 439, 177, [1, 3, 5, 4, 15]],
+[3, ["number", 60], 521, 177, [2, null]],
+[4, ["number", 100], 521, 261, [2, null]],
+[5, "black", 521, 219, [2, null]],
+[6, "setcolor", 971, 185, [34, 9, 8]],
+[7, "setshade", 971, 269, [8, 12, 38]],
+[8, ["vspace", 0], 971, 227, [6, 7]],
+[9, ["random", 0], 1048, 185, [6, 10, 11, null]],
+[10, ["number", 60], 1134, 185, [9, null]],
+[11, ["number", 80], 1134, 227, [9, null]],
+[12, ["random", 0], 1056, 269, [7, 13, 14, null]],
+[13, ["number", 40], 1142, 269, [12, null]],
+[14, ["number", 100], 1142, 311, [12, null]],
+[15, "setpensize", 439, 303, [2, 16, 17]],
+[16, ["number", 25], 541, 303, [15, null]],
+[17, ["storein", 0], 439, 345, [15, 18, 19, 22]],
+[18, ["string", "my box_1"], 507, 345, [17, null]],
+[19, ["number", 1], 507, 387, [17, null]],
+[20, "hat", 953, 89, [null, 21, 34]],
+[21, ["string", "action"], 1011, 101, [20, null]],
+[22, ["repeat", 63], 439, 429, [17, 23, 26, null]],
+[23, ["number", 100], 498, 429, [22, null]],
+[24, "right", 457, 513, [26, 25, 28]],
+[25, ["number", 119.8], 515, 513, [24, null]],
+[26, "stack", 457, 471, [22, 27, 24]],
+[27, ["string", "action"], 515, 471, [26, null]],
+[28, ["storein", 0], 457, 555, [24, 29, 33, null]],
+[29, ["string", "my box_1"], 525, 555, [28, null]],
+[30, ["number", 1], 579, 639, [33, null]],
+[31, "box", 579, 597, [33, 32, null]],
+[32, ["string", "my box_1"], 634, 597, [31, null]],
+[33, ["plus2", 0], 525, 597, [28, 31, 30]],
+[34, ["repeat", 126], 953, 143, [20, 35, 6, null]],
+[35, "box", 1012, 143, [34, 36, null]],
+[36, ["string", "my box_1"], 1067, 143, [35, null]],
+[37, "penup", 971, 395, [39, 41]],
+[38, "pendown", 971, 311, [7, 39]],
+[39, "forward", 971, 353, [38, 40, 37]],
+[40, ["number", 1], 1042, 353, [39, null]],
+[41, "forward", 971, 437, [37, 42, null]],
+[42, ["number", 25], 1042, 437, [41, null]]]
diff --git a/turtleblocks.py b/turtleblocks.py
index 5d5808f..98d89d9 100755
--- a/turtleblocks.py
+++ b/turtleblocks.py
@@ -736,6 +736,10 @@ Would you like to save before quitting?'))
else:
return os.path.abspath(dirname)
+ def restore_state(self):
+ ''' Anything that needs restoring after a clear screen can go here '''
+ pass
+
if __name__ == '__main__':
TurtleMain()