Commit e933369d authored by Guillaume Seguin's avatar Guillaume Seguin

Pass home position go gcoder.GCode instances

parent 12d32a2b
...@@ -30,7 +30,7 @@ from pyglet.gl import * ...@@ -30,7 +30,7 @@ from pyglet.gl import *
from .gviz import GvizBaseFrame from .gviz import GvizBaseFrame
from printrun_utils import imagefile, install_locale from printrun_utils import imagefile, install_locale, get_home_pos
install_locale('pronterface') install_locale('pronterface')
def create_model(light): def create_model(light):
...@@ -381,7 +381,7 @@ if __name__ == "__main__": ...@@ -381,7 +381,7 @@ if __name__ == "__main__":
title = 'Gcode view, shift to move view, mousewheel to set layer' title = 'Gcode view, shift to move view, mousewheel to set layer'
frame = GcodeViewFrame(None, wx.ID_ANY, title, size = (400, 400), frame = GcodeViewFrame(None, wx.ID_ANY, title, size = (400, 400),
build_dimensions = build_dimensions) build_dimensions = build_dimensions)
gcode = gcoder.GCode(open(sys.argv[1])) gcode = gcoder.GCode(open(sys.argv[1]), get_home_pos(build_dimensions))
frame.addfile(gcode) frame.addfile(gcode)
first_move = None first_move = None
......
...@@ -19,7 +19,7 @@ import wx ...@@ -19,7 +19,7 @@ import wx
import time import time
from printrun import gcoder from printrun import gcoder
from printrun_utils import imagefile, install_locale from printrun_utils import imagefile, install_locale, get_home_pos
install_locale('pronterface') install_locale('pronterface')
class GvizBaseFrame(wx.Frame): class GvizBaseFrame(wx.Frame):
...@@ -93,7 +93,7 @@ class GvizWindow(GvizBaseFrame): ...@@ -93,7 +93,7 @@ class GvizWindow(GvizBaseFrame):
self.Bind(wx.EVT_MOUSE_EVENTS, self.mouse) self.Bind(wx.EVT_MOUSE_EVENTS, self.mouse)
if f: if f:
gcode = gcoder.GCode(f) gcode = gcoder.GCode(f, get_home_pos(self.p.build_dimensions))
self.p.addfile(gcode) self.p.addfile(gcode)
def set_current_gline(self, gline): def set_current_gline(self, gline):
...@@ -217,7 +217,7 @@ class Gviz(wx.Panel): ...@@ -217,7 +217,7 @@ class Gviz(wx.Panel):
def clear(self): def clear(self):
self.lastpos = [0, 0, 0, 0, 0, 0, 0] self.lastpos = [0, 0, 0, 0, 0, 0, 0]
self.hilightpos = self.lastpos[:] self.hilightpos = self.lastpos[:]
self.gcoder = gcoder.GCode([]) self.gcoder = gcoder.GCode([], get_home_pos(self.build_dimensions))
self.lines = {} self.lines = {}
self.pens = {} self.pens = {}
self.arcs = {} self.arcs = {}
......
...@@ -894,7 +894,8 @@ class pronsole(cmd.Cmd): ...@@ -894,7 +894,8 @@ class pronsole(cmd.Cmd):
if not os.path.exists(filename): if not os.path.exists(filename):
self.logError("File not found!") self.logError("File not found!")
return return
self.fgcode = gcoder.GCode(open(filename, "rU")) self.fgcode = gcoder.GCode(open(filename, "rU"),
get_home_pos(self.build_dimensions_list))
self.filename = filename self.filename = filename
self.log("Loaded %s, %d lines." % (filename, len(self.fgcode))) self.log("Loaded %s, %d lines." % (filename, len(self.fgcode)))
......
...@@ -1525,7 +1525,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1525,7 +1525,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
fn = self.filename fn = self.filename
try: try:
self.filename = self.model_to_gcode_filename(self.filename) self.filename = self.model_to_gcode_filename(self.filename)
self.fgcode = gcoder.GCode(open(self.filename, "rU")) self.fgcode = gcoder.GCode(open(self.filename, "rU"),
get_home_pos(self.build_dimensions_list))
if self.p.online: if self.p.online:
wx.CallAfter(self.printbtn.Enable) wx.CallAfter(self.printbtn.Enable)
...@@ -1595,7 +1596,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1595,7 +1596,8 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
self.skein(name) self.skein(name)
else: else:
self.filename = name self.filename = name
self.fgcode = gcoder.GCode(open(self.filename, "rU")) self.fgcode = gcoder.GCode(open(self.filename, "rU"),
get_home_pos(self.build_dimensions_list))
self.statusbar.SetStatusText(_("Loaded %s, %d lines") % (name, len(self.fgcode))) self.statusbar.SetStatusText(_("Loaded %s, %d lines") % (name, len(self.fgcode)))
print _("Loaded %s, %d lines") % (name, len(self.fgcode)) print _("Loaded %s, %d lines") % (name, len(self.fgcode))
wx.CallAfter(self.printbtn.SetLabel, _("Print")) wx.CallAfter(self.printbtn.SetLabel, _("Print"))
......
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