Commit d2c97fba authored by Guillaume Seguin's avatar Guillaume Seguin

Allow setting an empty background color to use default window color

parent 70727b20
......@@ -124,14 +124,14 @@ class MainWindow(wx.Frame):
def newPanel(self, parent, add_to_list = True):
panel = wx.Panel(parent)
panel.SetBackgroundColour(self.settings.bgcolor)
panel.SetBackgroundColour(self.bgcolor)
if add_to_list: self.panels.append(panel)
return panel
def createTabbedGui(self):
self.notesizer = wx.BoxSizer(wx.VERTICAL)
self.notebook = wx.Notebook(self.panel)
self.notebook.SetBackgroundColour(self.settings.bgcolor)
self.notebook.SetBackgroundColour(self.bgcolor)
page1panel = self.newPanel(self.notebook)
page2panel = self.newPanel(self.notebook)
self.mainsizer_page1 = wx.BoxSizer(wx.VERTICAL)
......
......@@ -28,9 +28,9 @@ class XYZControlsSizer(wx.GridBagSizer):
def __init__(self, root, parentpanel = None):
super(XYZControlsSizer, self).__init__()
if not parentpanel: parentpanel = root.panel
root.xyb = XYButtons(parentpanel, root.moveXY, root.homeButtonClicked, root.spacebarAction, root.settings.bgcolor, zcallback=root.moveZ)
root.xyb = XYButtons(parentpanel, root.moveXY, root.homeButtonClicked, root.spacebarAction, root.bgcolor, zcallback=root.moveZ)
self.Add(root.xyb, pos = (0, 1), flag = wx.ALIGN_CENTER)
root.zb = ZButtons(parentpanel, root.moveZ, root.settings.bgcolor)
root.zb = ZButtons(parentpanel, root.moveZ, root.bgcolor)
self.Add(root.zb, pos = (0, 2), flag = wx.ALIGN_CENTER)
wx.CallAfter(root.xyb.SetFocus)
......@@ -391,10 +391,10 @@ class ControlsSizer(wx.GridBagSizer):
def make_mini(self, root, parentpanel):
root.xyb = XYButtonsMini(parentpanel, root.moveXY, root.homeButtonClicked,
root.spacebarAction, root.settings.bgcolor,
root.spacebarAction, root.bgcolor,
zcallback = root.moveZ)
self.Add(root.xyb, pos = (1, 0), span = (1, 4), flag = wx.ALIGN_CENTER)
root.zb = ZButtonsMini(parentpanel, root.moveZ, root.settings.bgcolor)
root.zb = ZButtonsMini(parentpanel, root.moveZ, root.bgcolor)
self.Add(root.zb, pos = (0, 4), span = (2, 1), flag = wx.ALIGN_CENTER)
wx.CallAfter(root.xyb.SetFocus)
......
......@@ -305,7 +305,7 @@ class Graph(BufferedCanvas):
if self.window: self.window.graph.StopPlotting()
def draw(self, dc, w, h):
dc.SetBackground(wx.Brush(self.root.settings.bgcolor))
dc.SetBackground(wx.Brush(self.root.bgcolor))
dc.Clear()
gc = wx.GraphicsContext.Create(dc)
self.width = w
......
......@@ -61,7 +61,7 @@ class VizPane(wx.BoxSizer):
build_dimensions = root.build_dimensions_list,
grid = (root.settings.preview_grid_step1, root.settings.preview_grid_step2),
extrusion_width = root.settings.preview_extrusion_width,
bgcolor = root.settings.bgcolor)
bgcolor = root.bgcolor)
root.gviz.SetToolTip(wx.ToolTip(_("Click to examine / edit\n layers of loaded file")))
root.gviz.showall = 1
root.gviz.Bind(wx.EVT_LEFT_DOWN, root.show_viz_window)
......@@ -82,7 +82,7 @@ class VizPane(wx.BoxSizer):
root.gwindow = gviz.GvizWindow(build_dimensions = root.build_dimensions_list,
grid = (root.settings.preview_grid_step1, root.settings.preview_grid_step2),
extrusion_width = root.settings.preview_extrusion_width,
bgcolor = root.settings.bgcolor)
bgcolor = root.bgcolor)
root.gwindow.Bind(wx.EVT_CLOSE, lambda x: root.gwindow.Hide())
if not isinstance(root.gviz, NoViz):
self.Add(root.gviz.widget, 1, flag = wx.EXPAND | wx.ALIGN_CENTER_HORIZONTAL)
......@@ -181,7 +181,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
self.p.xy_feedrate = self.settings.xy_feedrate
self.p.z_feedrate = self.settings.z_feedrate
self.panel.SetBackgroundColour(self.settings.bgcolor)
self.panel.SetBackgroundColour(self.bgcolor)
customdict = {}
try:
execfile(configfile("custombtn.txt"), customdict)
......@@ -324,6 +324,13 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx.CallAfter(self.gwindow.Destroy)
wx.CallAfter(self.Destroy)
def _get_bgcolor(self):
if self.settings.bgcolor:
return self.settings.bgcolor
else:
return wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWFRAME)
bgcolor = property(_get_bgcolor)
# --------------------------------------------------------------
# Main interface actions
# --------------------------------------------------------------
......@@ -745,7 +752,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return
if not self.excluder:
self.excluder = Excluder()
self.excluder.pop_window(self.fgcode, bgcolor = self.settings.bgcolor,
self.excluder.pop_window(self.fgcode, bgcolor = self.bgcolor,
build_dimensions = self.build_dimensions_list)
def about(self, event):
......
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