Commit 9d2baa3e authored by Guillaume Seguin's avatar Guillaume Seguin

Add setting to switch to the light visualization

parent 039d7626
...@@ -31,6 +31,12 @@ from .gviz import GvizBaseFrame ...@@ -31,6 +31,12 @@ 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,
...@@ -247,7 +253,8 @@ class GCObject(object): ...@@ -247,7 +253,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))
...@@ -275,7 +282,8 @@ class GcodeViewMainWrapper(object): ...@@ -275,7 +282,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
...@@ -291,9 +299,10 @@ class GcodeViewFrame(GvizBaseFrame): ...@@ -291,9 +299,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()
...@@ -341,7 +350,8 @@ class GcodeViewFrame(GvizBaseFrame): ...@@ -341,7 +350,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
......
...@@ -285,7 +285,7 @@ class VizPane(wx.BoxSizer): ...@@ -285,7 +285,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 +308,7 @@ class VizPane(wx.BoxSizer): ...@@ -308,7 +308,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."
......
...@@ -203,6 +203,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -203,6 +203,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", False, _("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"))
......
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