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 @@ ...@@ -17,7 +17,6 @@
import os import os
import math import math
import copy
import wx import wx
from wx import glcanvas from wx import glcanvas
...@@ -530,7 +529,7 @@ class GcodeViewFrame(wx.Frame): ...@@ -530,7 +529,7 @@ class GcodeViewFrame(wx.Frame):
def addfile(self, gcode = None): def addfile(self, gcode = None):
if self.clonefrom: if self.clonefrom:
self.model = copy.deepcopy(self.clonefrom[-1].model) self.model = self.clonefrom[-1].model.copy()
else: else:
self.model = actors.GcodeModel() self.model = actors.GcodeModel()
if gcode: if gcode:
......
...@@ -273,6 +273,14 @@ class GcodeModel(Model): ...@@ -273,6 +273,14 @@ class GcodeModel(Model):
print >> sys.stderr, _('Initialized 3D visualization in %.2f seconds') % (t_end - t_start) print >> sys.stderr, _('Initialized 3D visualization in %.2f seconds') % (t_end - t_start)
print >> sys.stderr, _('Vertex count: %d') % len(self.vertices) 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): def movement_color(self, move):
""" """
Return the color to use for particular type of movement. 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