Commit 3d4c191e authored by Guillaume Seguin's avatar Guillaume Seguin

Add parameter for 3D view background color (#481)

parent 0e37eee7
......@@ -273,6 +273,8 @@ class GcodeViewMainWrapper(object):
self.glpanel = GcodeViewPanel(parent, realparent = self,
build_dimensions = build_dimensions)
self.glpanel.SetMinSize((150, 150))
if self.root and hasattr(self.root, "gcview_color_background"):
self.glpanel.color_background = self.root.gcview_color_background
self.clickcb = None
self.widget = self.glpanel
self.refresh_timer = wx.CallLater(100, self.Refresh)
......
......@@ -31,6 +31,7 @@ class wxGLPanel(wx.Panel):
'''A simple class for using OpenGL with wxPython.'''
orthographic = True
color_background = (0.98, 0.98, 0.78, 1)
def __init__(self, parent, id, pos = wx.DefaultPosition,
size = wx.DefaultSize, style = 0):
......@@ -104,7 +105,7 @@ class wxGLPanel(wx.Panel):
self.pygletcontext.canvas = self
self.pygletcontext.set_current()
#normal gl init
glClearColor(0.98, 0.98, 0.78, 1)
glClearColor(*self.color_background)
glClearDepth(1.0) # set depth value to 1
glDepthFunc(GL_LEQUAL)
glEnable(GL_COLOR_MATERIAL)
......@@ -158,6 +159,7 @@ class wxGLPanel(wx.Panel):
def OnDraw(self, *args, **kwargs):
"""Draw the window."""
self.pygletcontext.set_current()
glClearColor(*self.color_background)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
self.draw_objects()
self.canvas.SwapBuffers()
......
......@@ -149,6 +149,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.settings._add(SpinSetting("preview_grid_step1", 10., 0, 200, _("Fine grid spacing"), _("Fine Grid Spacing"), "UI"), self.update_gviz_params)
self.settings._add(SpinSetting("preview_grid_step2", 50., 0, 200, _("Coarse grid spacing"), _("Coarse Grid Spacing"), "UI"), self.update_gviz_params)
self.settings._add(StringSetting("bgcolor", "#FFFFFF", _("Background color"), _("Pronterface background color"), "Colors"))
self.settings._add(StringSetting("gcview_color_background", "#FAFAC7FF", _("3D view background color"), _("Color of the 3D view background"), "Colors"), self.update_gcview_colors)
self.settings._add(StringSetting("gcview_color_travel", "#99999999", _("3D view travel moves color"), _("Color of travel moves in 3D view"), "Colors"), self.update_gcview_colors)
self.settings._add(StringSetting("gcview_color_tool0", "#FF000099", _("3D view print moves color"), _("Color of print moves with tool 0 in 3D view"), "Colors"), self.update_gcview_colors)
self.settings._add(StringSetting("gcview_color_tool1", "#4F0CE599", _("3D view tool 1 moves color"), _("Color of print moves with tool 1 in 3D view"), "Colors"), self.update_gcview_colors)
......
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