Commit a7c915bb authored by D1plo1d's avatar D1plo1d

Merge branch 'master' of github.com:kliment/Printrun

parents 182476ad d6f485a3
...@@ -549,7 +549,10 @@ class printcore(): ...@@ -549,7 +549,10 @@ class printcore():
if self.printer: if self.printer:
self.sent.append(command) self.sent.append(command)
# run the command through the analyzer # run the command through the analyzer
self.analyzer.Analyze(command) try: self.analyzer.Analyze(command)
except:
print "Warning: could not analyze command %s:" % command
traceback.print_exc(file = sys.stdout)
if self.loud: if self.loud:
print "SENT:", command print "SENT:", command
if self.sendcb: if self.sendcb:
......
...@@ -22,15 +22,23 @@ from . import gcoder ...@@ -22,15 +22,23 @@ from . import gcoder
from .gl.panel import wxGLPanel from .gl.panel import wxGLPanel
from .gl.trackball import build_rotmatrix from .gl.trackball import build_rotmatrix
from .gl.libtatlin import actors from .gl.libtatlin import actors
from .gl.libtatlin.actors import vec
from pyglet.gl import glPushMatrix, glPopMatrix, \ from pyglet.gl import glPushMatrix, glPopMatrix, \
glTranslatef, glRotatef, glScalef, glMultMatrixd glTranslatef, glRotatef, glScalef, glMultMatrixd
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
install_locale('pronterface') install_locale('pronterface')
def create_model(light):
if light:
return actors.GcodeModelLight()
else:
return actors.GcodeModel()
class GcodeViewPanel(wxGLPanel): class GcodeViewPanel(wxGLPanel):
def __init__(self, parent, id = wx.ID_ANY, def __init__(self, parent, id = wx.ID_ANY,
...@@ -61,6 +69,8 @@ class GcodeViewPanel(wxGLPanel): ...@@ -61,6 +69,8 @@ class GcodeViewPanel(wxGLPanel):
for filename in self.parent.filenames: for filename in self.parent.filenames:
self.parent.load_file(filename) self.parent.load_file(filename)
self.parent.autoplate() self.parent.autoplate()
if hasattr(self.parent, "loadcb"):
self.parent.loadcb()
self.parent.filenames = None self.parent.filenames = None
def create_objects(self): def create_objects(self):
...@@ -78,10 +88,6 @@ class GcodeViewPanel(wxGLPanel): ...@@ -78,10 +88,6 @@ class GcodeViewPanel(wxGLPanel):
self.create_objects() self.create_objects()
glPushMatrix() glPushMatrix()
if self.orthographic:
glTranslatef(0, 0, -3 * self.dist) # Move back
else:
glTranslatef(0, 0, -self.dist) # Move back
# Rotate according to trackball # Rotate according to trackball
glMultMatrixd(build_rotmatrix(self.basequat)) glMultMatrixd(build_rotmatrix(self.basequat))
# Move origin to bottom left of platform # Move origin to bottom left of platform
...@@ -89,6 +95,14 @@ class GcodeViewPanel(wxGLPanel): ...@@ -89,6 +95,14 @@ class GcodeViewPanel(wxGLPanel):
platformy0 = -self.build_dimensions[4] - self.parent.platform.depth / 2 platformy0 = -self.build_dimensions[4] - self.parent.platform.depth / 2
glTranslatef(platformx0, platformy0, 0) glTranslatef(platformx0, platformy0, 0)
light_z = max(self.parent.platform.width, self.parent.platform.depth)
glLightfv(GL_LIGHT0, GL_POSITION, vec(0,
self.parent.platform.depth / 2,
light_z, 0))
glLightfv(GL_LIGHT1, GL_POSITION, vec(self.parent.platform.width,
self.parent.platform.depth / 2,
light_z, 0))
for obj in self.parent.objects: for obj in self.parent.objects:
if not obj.model \ if not obj.model \
or not obj.model.loaded \ or not obj.model.loaded \
...@@ -224,6 +238,7 @@ class GcodeViewPanel(wxGLPanel): ...@@ -224,6 +238,7 @@ class GcodeViewPanel(wxGLPanel):
if not self.parent.model or not self.parent.model.loaded: if not self.parent.model or not self.parent.model.loaded:
return return
self.parent.model.only_current = not self.parent.model.only_current self.parent.model.only_current = not self.parent.model.only_current
wx.CallAfter(self.Refresh)
if key in kreset: if key in kreset:
self.resetview() self.resetview()
event.Skip() event.Skip()
...@@ -246,7 +261,8 @@ class GCObject(object): ...@@ -246,7 +261,8 @@ class GCObject(object):
class GcodeViewMainWrapper(object): class GcodeViewMainWrapper(object):
def __init__(self, parent, build_dimensions): def __init__(self, parent, build_dimensions, root):
self.root = root
self.glpanel = GcodeViewPanel(parent, realparent = self, self.glpanel = GcodeViewPanel(parent, realparent = self,
build_dimensions = build_dimensions) build_dimensions = build_dimensions)
self.glpanel.SetMinSize((150, 150)) self.glpanel.SetMinSize((150, 150))
...@@ -262,7 +278,8 @@ class GcodeViewMainWrapper(object): ...@@ -262,7 +278,8 @@ class GcodeViewMainWrapper(object):
return getattr(self.glpanel, name) return getattr(self.glpanel, name)
def set_current_gline(self, gline): def set_current_gline(self, gline):
if gline.is_move and self.model and self.model.loaded: if gline.is_move and gline.gcview_end_vertex is not None \
and self.model and self.model.loaded:
self.model.printed_until = gline.gcview_end_vertex self.model.printed_until = gline.gcview_end_vertex
if not self.refresh_timer.IsRunning(): if not self.refresh_timer.IsRunning():
self.refresh_timer.Start() self.refresh_timer.Start()
...@@ -274,7 +291,8 @@ class GcodeViewMainWrapper(object): ...@@ -274,7 +291,8 @@ class GcodeViewMainWrapper(object):
pass pass
def addfile(self, gcode = None): def addfile(self, gcode = None):
self.model = actors.GcodeModel() self.model = create_model(self.root.settings.light3d
if self.root else False)
if gcode: if gcode:
self.model.load_data(gcode) self.model.load_data(gcode)
self.objects[-1].model = self.model self.objects[-1].model = self.model
...@@ -290,9 +308,10 @@ class GcodeViewFrame(GvizBaseFrame): ...@@ -290,9 +308,10 @@ class GcodeViewFrame(GvizBaseFrame):
def __init__(self, parent, ID, title, build_dimensions, objects = None, def __init__(self, parent, ID, title, build_dimensions, objects = None,
pos = wx.DefaultPosition, size = wx.DefaultSize, pos = wx.DefaultPosition, size = wx.DefaultSize,
style = wx.DEFAULT_FRAME_STYLE): style = wx.DEFAULT_FRAME_STYLE, root = None):
super(GcodeViewFrame, self).__init__(parent, ID, title, super(GcodeViewFrame, self).__init__(parent, ID, title,
pos, size, style) pos, size, style)
self.root = root
panel, vbox = self.create_base_ui() panel, vbox = self.create_base_ui()
...@@ -331,7 +350,8 @@ class GcodeViewFrame(GvizBaseFrame): ...@@ -331,7 +350,8 @@ class GcodeViewFrame(GvizBaseFrame):
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def set_current_gline(self, gline): def set_current_gline(self, gline):
if gline.is_move and self.model and self.model.loaded: if gline.is_move and gline.gcview_end_vertex is not None \
and self.model and self.model.loaded:
self.model.printed_until = gline.gcview_end_vertex self.model.printed_until = gline.gcview_end_vertex
if not self.refresh_timer.IsRunning(): if not self.refresh_timer.IsRunning():
self.refresh_timer.Start() self.refresh_timer.Start()
...@@ -340,7 +360,8 @@ class GcodeViewFrame(GvizBaseFrame): ...@@ -340,7 +360,8 @@ class GcodeViewFrame(GvizBaseFrame):
if self.clonefrom: if self.clonefrom:
self.model = self.clonefrom[-1].model.copy() self.model = self.clonefrom[-1].model.copy()
else: else:
self.model = actors.GcodeModel() self.model = create_model(self.root.settings.light3d
if self.root else False)
if gcode: if gcode:
self.model.load_data(gcode) self.model.load_data(gcode)
self.objects[-1].model = self.model self.objects[-1].model = self.model
......
This diff is collapsed.
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>. # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
from threading import Lock
import wx import wx
from wx import glcanvas from wx import glcanvas
...@@ -23,7 +25,7 @@ pyglet.options['debug_gl'] = True ...@@ -23,7 +25,7 @@ pyglet.options['debug_gl'] = True
from pyglet.gl import * from pyglet.gl import *
from pyglet import gl from pyglet import gl
from .trackball import trackball, mulquat from .trackball import trackball, mulquat, build_rotmatrix
class wxGLPanel(wx.Panel): class wxGLPanel(wx.Panel):
'''A simple class for using OpenGL with wxPython.''' '''A simple class for using OpenGL with wxPython.'''
...@@ -51,6 +53,10 @@ class wxGLPanel(wx.Panel): ...@@ -51,6 +53,10 @@ class wxGLPanel(wx.Panel):
self.sizer.Add(self.canvas, 1, wx.EXPAND) self.sizer.Add(self.canvas, 1, wx.EXPAND)
self.SetSizerAndFit(self.sizer) self.SetSizerAndFit(self.sizer)
self.rot_lock = Lock()
self.basequat = [0, 0, 0, 1]
self.zoom_factor = 1.0
# bind events # bind events
self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self.processEraseBackgroundEvent) self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self.processEraseBackgroundEvent)
self.canvas.Bind(wx.EVT_SIZE, self.processSizeEvent) self.canvas.Bind(wx.EVT_SIZE, self.processSizeEvent)
...@@ -119,9 +125,11 @@ class wxGLPanel(wx.Panel): ...@@ -119,9 +125,11 @@ class wxGLPanel(wx.Panel):
glMatrixMode(GL_PROJECTION) glMatrixMode(GL_PROJECTION)
glLoadIdentity() glLoadIdentity()
if self.orthographic: if self.orthographic:
glOrtho(-width / 2, width / 2, -height / 2, height / 2, 0.1, 5 * self.dist) glOrtho(-width / 2, width / 2, -height / 2, height / 2,
-5 * self.dist, 5 * self.dist)
else: else:
gluPerspective(60., float(width) / height, 10.0, 3 * self.dist) gluPerspective(60., float(width) / height, 10.0, 3 * self.dist)
glTranslatef(0, 0, -self.dist) # Move back
glMatrixMode(GL_MODELVIEW) glMatrixMode(GL_MODELVIEW)
if not self.mview_initialized: if not self.mview_initialized:
...@@ -142,6 +150,7 @@ class wxGLPanel(wx.Panel): ...@@ -142,6 +150,7 @@ class wxGLPanel(wx.Panel):
glLoadIdentity() glLoadIdentity()
if self.orthographic: if self.orthographic:
ratio = factor * float(min(self.width, self.height)) / self.dist ratio = factor * float(min(self.width, self.height)) / self.dist
self.zoom_factor = 1.0
glScalef(ratio, ratio, 1) glScalef(ratio, ratio, 1)
def OnDraw(self, *args, **kwargs): def OnDraw(self, *args, **kwargs):
...@@ -195,6 +204,7 @@ class wxGLPanel(wx.Panel): ...@@ -195,6 +204,7 @@ class wxGLPanel(wx.Panel):
delta_y = to[1] delta_y = to[1]
glTranslatef(delta_x, delta_y, 0) glTranslatef(delta_x, delta_y, 0)
glScalef(factor, factor, 1) glScalef(factor, factor, 1)
self.zoom_factor *= factor
if to: if to:
glTranslatef(-delta_x, -delta_y, 0) glTranslatef(-delta_x, -delta_y, 0)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
...@@ -216,7 +226,8 @@ class wxGLPanel(wx.Panel): ...@@ -216,7 +226,8 @@ class wxGLPanel(wx.Panel):
p2x = float(p2[0]) / (sz[0] / 2) - 1 p2x = float(p2[0]) / (sz[0] / 2) - 1
p2y = 1 - float(p2[1]) / (sz[1] / 2) p2y = 1 - float(p2[1]) / (sz[1] / 2)
quat = trackball(p1x, p1y, p2x, p2y, self.dist / 250.0) quat = trackball(p1x, p1y, p2x, p2y, self.dist / 250.0)
self.basequat = mulquat(self.basequat, quat) with self.rot_lock:
self.basequat = mulquat(self.basequat, quat)
self.initpos = p2 self.initpos = p2
def handle_translation(self, event): def handle_translation(self, event):
......
...@@ -44,8 +44,9 @@ def make_sized_button(*args): ...@@ -44,8 +44,9 @@ def make_sized_button(*args):
def make_autosize_button(*args): def make_autosize_button(*args):
return make_button(*args, size = (-1, buttonSize[1]), style = wx.BU_EXACTFIT) return make_button(*args, size = (-1, buttonSize[1]), style = wx.BU_EXACTFIT)
def make_custom_button(root, parentpanel, i): def make_custom_button(root, parentpanel, i, style = 0):
btn = make_button(parentpanel, i.label, root.procbutton, i.tooltip) btn = make_button(parentpanel, i.label, root.procbutton,
i.tooltip, style = style)
btn.SetBackgroundColour(i.background) btn.SetBackgroundColour(i.background)
btn.SetForegroundColour("black") btn.SetForegroundColour("black")
btn.properties = i btn.properties = i
...@@ -138,6 +139,32 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None): ...@@ -138,6 +139,32 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None):
if not extra_buttons: if not extra_buttons:
ebuttonspanel = root.newPanel(parentpanel) ebuttonspanel = root.newPanel(parentpanel)
ebuttonssizer = wx.BoxSizer(wx.HORIZONTAL) ebuttonssizer = wx.BoxSizer(wx.HORIZONTAL)
if root.settings.extruders > 1:
ebuttonssizer.Add(wx.StaticText(ebuttonspanel, -1, _("Tool:")), flag = wx.ALIGN_CENTER)
if root.settings.extruders == 2:
root.extrudersel = wx.Button(ebuttonspanel, -1, "0", style = wx.BU_EXACTFIT)
root.extrudersel.SetToolTip(wx.ToolTip(_("Click to switch current extruder")))
def extrudersel_cb(event):
if root.extrudersel.GetLabel() == "1":
new = "0"
else:
new = "1"
root.extrudersel.SetLabel(new)
root.tool_change(event)
root.extrudersel.Bind(wx.EVT_BUTTON, extrudersel_cb)
root.extrudersel.GetValue = root.extrudersel.GetLabel
root.extrudersel.SetValue = root.extrudersel.SetLabel
else:
choices = [str(i) for i in range(0, root.settings.extruders)]
root.extrudersel = wx.ComboBox(ebuttonspanel, -1, choices = choices,
style = wx.CB_DROPDOWN | wx.CB_READONLY,
size = (50, -1))
root.extrudersel.SetToolTip(wx.ToolTip(_("Select current extruder")))
root.extrudersel.SetValue(choices[0])
root.extrudersel.Bind(wx.EVT_COMBOBOX, root.tool_change)
root.printerControls.append(root.extrudersel)
ebuttonssizer.Add(root.extrudersel)
ebuttonspanel.SetSizer(ebuttonssizer) ebuttonspanel.SetSizer(ebuttonssizer)
self.Add(ebuttonspanel, pos = (base_line + 2, 0), span = (1, 5), flag = wx.EXPAND) self.Add(ebuttonspanel, pos = (base_line + 2, 0), span = (1, 5), flag = wx.EXPAND)
...@@ -210,7 +237,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None): ...@@ -210,7 +237,8 @@ def add_extra_controls(self, root, parentpanel, extra_buttons = None):
for i in root.cpbuttons: for i in root.cpbuttons:
if not i.pos or i.pos[0] != 4: if not i.pos or i.pos[0] != 4:
continue continue
btn = make_custom_button(root, ebuttonspanel, i) btn = make_custom_button(root, ebuttonspanel, i,
style = wx.BU_EXACTFIT)
ebuttonssizer.Add(btn, 1, flag = wx.EXPAND) ebuttonssizer.Add(btn, 1, flag = wx.EXPAND)
class LeftPane(wx.GridBagSizer): class LeftPane(wx.GridBagSizer):
...@@ -285,7 +313,7 @@ class VizPane(wx.BoxSizer): ...@@ -285,7 +313,7 @@ class VizPane(wx.BoxSizer):
if root.settings.mainviz == "3D": if root.settings.mainviz == "3D":
try: try:
import printrun.gcview import printrun.gcview
root.gviz = printrun.gcview.GcodeViewMainWrapper(parentpanel, root.build_dimensions_list) root.gviz = printrun.gcview.GcodeViewMainWrapper(parentpanel, root.build_dimensions_list, root = root)
root.gviz.clickcb = root.showwin root.gviz.clickcb = root.showwin
except: except:
use2dview = True use2dview = True
...@@ -308,7 +336,7 @@ class VizPane(wx.BoxSizer): ...@@ -308,7 +336,7 @@ class VizPane(wx.BoxSizer):
objects = None objects = None
if isinstance(root.gviz, printrun.gcview.GcodeViewMainWrapper): if isinstance(root.gviz, printrun.gcview.GcodeViewMainWrapper):
objects = root.gviz.objects objects = root.gviz.objects
root.gwindow = printrun.gcview.GcodeViewFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (600, 600), build_dimensions = root.build_dimensions_list, objects = objects) root.gwindow = printrun.gcview.GcodeViewFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (600, 600), build_dimensions = root.build_dimensions_list, objects = objects, root = root)
except: except:
use3dview = False use3dview = False
print "3D view mode requested, but we failed to initialize it." print "3D view mode requested, but we failed to initialize it."
......
...@@ -108,10 +108,6 @@ class StlViewPanel(wxGLPanel): ...@@ -108,10 +108,6 @@ class StlViewPanel(wxGLPanel):
glEnable(GL_LIGHT0) glEnable(GL_LIGHT0)
glEnable(GL_LIGHT1) glEnable(GL_LIGHT1)
# Define a simple function to create ctypes arrays of floats:
def vec(*args):
return (GLfloat * len(args))(*args)
glLightfv(GL_LIGHT0, GL_POSITION, vec(.5, .5, 1, 0)) glLightfv(GL_LIGHT0, GL_POSITION, vec(.5, .5, 1, 0))
glLightfv(GL_LIGHT0, GL_SPECULAR, vec(.5, .5, 1, 1)) glLightfv(GL_LIGHT0, GL_SPECULAR, vec(.5, .5, 1, 1))
glLightfv(GL_LIGHT0, GL_DIFFUSE, vec(1, 1, 1, 1)) glLightfv(GL_LIGHT0, GL_DIFFUSE, vec(1, 1, 1, 1))
...@@ -129,6 +125,8 @@ class StlViewPanel(wxGLPanel): ...@@ -129,6 +125,8 @@ class StlViewPanel(wxGLPanel):
for filename in self.parent.filenames: for filename in self.parent.filenames:
self.parent.load_file(filename) self.parent.load_file(filename)
self.parent.autoplate() self.parent.autoplate()
if hasattr(self.parent, "loadcb"):
self.parent.loadcb()
self.parent.filenames = None self.parent.filenames = None
def double(self, event): def double(self, event):
......
...@@ -1156,6 +1156,24 @@ class pronsole(cmd.Cmd): ...@@ -1156,6 +1156,24 @@ class pronsole(cmd.Cmd):
if (len(line.split()) == 2 and line[-1] != " ") or (len(line.split()) == 1 and line[-1] == " "): if (len(line.split()) == 2 and line[-1] != " ") or (len(line.split()) == 1 and line[-1] == " "):
return [i for i in self.bedtemps.keys() if i.startswith(text)] return [i for i in self.bedtemps.keys() if i.startswith(text)]
def do_tool(self, l):
tool = None
try:
tool = int(l.lower().strip())
except:
self.logError(_("You must specify the tool index as an integer."))
if tool is not None and tool >= 0:
if self.p.online:
self.p.send_now("T%d" % tool)
self.log(_("Using tool %d.") % tool)
else:
self.logError(_("Printer is not online."))
else:
self.logError(_("You cannot set negative tool numbers."))
def help_tool(self):
self.log(_("Switches to the specified tool (e.g. doing tool 1 will emit a T1 G-Code)."))
def do_move(self, l): def do_move(self, l):
if(len(l.split()) < 2): if(len(l.split()) < 2):
self.logError(_("No move specified.")) self.logError(_("No move specified."))
......
...@@ -196,6 +196,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -196,6 +196,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
monitorsetting = BooleanSetting("monitor", False) monitorsetting = BooleanSetting("monitor", False)
monitorsetting.hidden = True monitorsetting.hidden = True
self.settings._add(monitorsetting) self.settings._add(monitorsetting)
self.settings._add(SpinSetting("extruders", 0, 1, 5, _("Extruders count"), _("Number of extruders"), "Printer"))
self.settings._add(BuildDimensionsSetting("build_dimensions", "200x200x100+0+0+0+0+0+0", _("Build dimensions"), _("Dimensions of Build Platform\n & optional offset of origin\n & optional switch position\n\nExamples:\n XXXxYYY\n XXX,YYY,ZZZ\n XXXxYYYxZZZ+OffX+OffY+OffZ\nXXXxYYYxZZZ+OffX+OffY+OffZ+HomeX+HomeY+HomeZ"), "Printer")) self.settings._add(BuildDimensionsSetting("build_dimensions", "200x200x100+0+0+0+0+0+0", _("Build dimensions"), _("Dimensions of Build Platform\n & optional offset of origin\n & optional switch position\n\nExamples:\n XXXxYYY\n XXX,YYY,ZZZ\n XXXxYYYxZZZ+OffX+OffY+OffZ\nXXXxYYYxZZZ+OffX+OffY+OffZ+HomeX+HomeY+HomeZ"), "Printer"))
self.settings._add(BooleanSetting("clamp_jogging", False, _("Clamp manual moves"), _("Prevent manual moves from leaving the specified build dimensions"), "Printer")) self.settings._add(BooleanSetting("clamp_jogging", False, _("Clamp manual moves"), _("Prevent manual moves from leaving the specified build dimensions"), "Printer"))
self.settings._add(StringSetting("bgcolor", "#FFFFFF", _("Background color"), _("Pronterface background color"), "UI")) self.settings._add(StringSetting("bgcolor", "#FFFFFF", _("Background color"), _("Pronterface background color"), "UI"))
...@@ -203,6 +204,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -203,6 +204,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.settings._add(BooleanSetting("slic3rintegration", False, _("Enable Slic3r integration"), _("Add a menu to select Slic3r profiles directly from Pronterface"), "UI")) self.settings._add(BooleanSetting("slic3rintegration", False, _("Enable Slic3r integration"), _("Add a menu to select Slic3r profiles directly from Pronterface"), "UI"))
self.settings._add(ComboSetting("mainviz", "2D", ["2D", "3D", "None"], _("Main visualization"), _("Select visualization for main window."), "UI")) self.settings._add(ComboSetting("mainviz", "2D", ["2D", "3D", "None"], _("Main visualization"), _("Select visualization for main window."), "UI"))
self.settings._add(BooleanSetting("viz3d", False, _("Use 3D in GCode viewer window"), _("Use 3D mode instead of 2D layered mode in the visualization window"), "UI")) self.settings._add(BooleanSetting("viz3d", False, _("Use 3D in GCode viewer window"), _("Use 3D mode instead of 2D layered mode in the visualization window"), "UI"))
self.settings._add(BooleanSetting("light3d", True, _("Use a lighter 3D visualization"), _("Use a lighter visualization with simple lines instead of extruded paths for 3D viewer"), "UI"))
self.settings._add(BooleanSetting("tempgraph", True, _("Display temperature graph"), _("Display time-lapse temperature graph"), "UI")) self.settings._add(BooleanSetting("tempgraph", True, _("Display temperature graph"), _("Display time-lapse temperature graph"), "UI"))
self.settings._add(BooleanSetting("tempgauges", False, _("Display temperature gauges"), _("Display graphical gauges for temperatures visualization"), "UI")) self.settings._add(BooleanSetting("tempgauges", False, _("Display temperature gauges"), _("Display graphical gauges for temperatures visualization"), "UI"))
self.settings._add(BooleanSetting("lockbox", False, _("Display interface lock checkbox"), _("Display a checkbox that, when check, locks most of Pronterface"), "UI")) self.settings._add(BooleanSetting("lockbox", False, _("Display interface lock checkbox"), _("Display a checkbox that, when check, locks most of Pronterface"), "UI"))
...@@ -373,6 +375,9 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -373,6 +375,9 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.connectbtn.SetToolTip(wx.ToolTip("Disconnect from the printer")) self.connectbtn.SetToolTip(wx.ToolTip("Disconnect from the printer"))
self.connectbtn.Bind(wx.EVT_BUTTON, self.disconnect) self.connectbtn.Bind(wx.EVT_BUTTON, self.disconnect)
if hasattr(self, "extrudersel"):
self.do_tool(self.extrudersel.GetValue())
for i in self.printerControls: for i in self.printerControls:
i.Enable() i.Enable()
...@@ -406,13 +411,16 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -406,13 +411,16 @@ class PronterWindow(MainWindow, pronsole.pronsole):
temp = gline_s temp = gline_s
if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp) if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp) if self.display_graph: wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp)
elif gline.command == "M140": elif gline.command in ["M140", "M190"]:
gline.parse_coordinates(gline, split_raw, imperial = False, force = True) gline.parse_coordinates(gline, split_raw, imperial = False, force = True)
gline_s = gcoder.S(gline) gline_s = gcoder.S(gline)
if gline_s is not None: if gline_s is not None:
temp = gline_s temp = gline_s
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, temp) if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, temp)
if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, temp) if self.display_graph: wx.CallAfter(self.graph.SetBedTargetTemperature, temp)
elif gline.command.startswith("T"):
tool = gline.command[1:]
if hasattr(self, "extrudersel"): wx.CallAfter(self.extrudersel.SetValue, tool)
else: else:
return return
self.sentlines.put_nowait(line) self.sentlines.put_nowait(line)
...@@ -840,6 +848,9 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -840,6 +848,9 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.do_bedtemp("") self.do_bedtemp("")
wx.CallAfter(self.btemp.SetInsertionPoint, 0) wx.CallAfter(self.btemp.SetInsertionPoint, 0)
def tool_change(self, event):
self.do_tool(self.extrudersel.GetValue())
def showwin(self, event): def showwin(self, event):
if self.fgcode: if self.fgcode:
self.gwindow.Show(True) self.gwindow.Show(True)
......
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