Commit 47d0b016 authored by Guillaume Seguin's avatar Guillaume Seguin

Don't use thread-unsafe deepcopy() and copy GcodeModel by hand

parent 1950681f
......@@ -17,7 +17,6 @@
import os
import math
import copy
import wx
from wx import glcanvas
......@@ -530,7 +529,7 @@ class GcodeViewFrame(wx.Frame):
def addfile(self, gcode = None):
if self.clonefrom:
self.model = copy.deepcopy(self.clonefrom[-1].model)
self.model = self.clonefrom[-1].model.copy()
else:
self.model = actors.GcodeModel()
if gcode:
......
......@@ -273,6 +273,14 @@ class GcodeModel(Model):
print >> sys.stderr, _('Initialized 3D visualization in %.2f seconds') % (t_end - t_start)
print >> sys.stderr, _('Vertex count: %d') % len(self.vertices)
def copy(self):
copy = GcodeModel()
for var in ["vertices", "arrows", "colors", "max_layers", "num_layers_to_draw", "printed_until", "arrows_enabled", "layer_stops"]:
setattr(copy, var, getattr(self, var))
copy.loaded = True
copy.initialized = False
return copy
def movement_color(self, move):
"""
Return the color to use for particular type of movement.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment