From 425dcaae753311d1c8f786b06b4b5565f9f8c58b Mon Sep 17 00:00:00 2001 From: Daid Date: Fri, 9 Mar 2012 17:00:09 +0100 Subject: [PATCH] Only save the alteration file if it was loaded --- SkeinPyPy_NewUI/newui/alterationPanel.py | 11 +++++++---- SkeinPyPy_NewUI/newui/preview3d.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/SkeinPyPy_NewUI/newui/alterationPanel.py b/SkeinPyPy_NewUI/newui/alterationPanel.py index 8e610a8b..fbbeedeb 100644 --- a/SkeinPyPy_NewUI/newui/alterationPanel.py +++ b/SkeinPyPy_NewUI/newui/alterationPanel.py @@ -9,6 +9,7 @@ class alterationPanel(wx.Panel): wx.Panel.__init__(self, parent,-1) self.alterationFileList = ['start.gcode', 'end.gcode', 'cool_start.gcode', 'cool_end.gcode'] + self.currentFile = None self.textArea = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_PROCESS_TAB) self.textArea.SetFont(wx.Font(8, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) @@ -28,12 +29,14 @@ class alterationPanel(wx.Panel): def OnSelect(self, e): self.loadFile(self.alterationFileList[self.list.GetSelection()]) + self.currentFile = self.list.GetSelection() def loadFile(self, filename): self.textArea.SetValue(settings.getAlterationFile(filename, False)) def OnFocusLost(self, e): - filename = os.path.join(archive.getSkeinforgePath('alterations'), self.alterationFileList[self.list.GetSelection()]) - f = open(filename, "wb") - f.write(self.textArea.GetValue()) - f.close() + if self.currentFile == self.list.GetSelection(): + filename = os.path.join(archive.getSkeinforgePath('alterations'), self.alterationFileList[self.list.GetSelection()]) + f = open(filename, "wb") + f.write(self.textArea.GetValue()) + f.close() diff --git a/SkeinPyPy_NewUI/newui/preview3d.py b/SkeinPyPy_NewUI/newui/preview3d.py index a30194a7..a9e31128 100644 --- a/SkeinPyPy_NewUI/newui/preview3d.py +++ b/SkeinPyPy_NewUI/newui/preview3d.py @@ -47,7 +47,7 @@ class previewPanel(wx.Panel): self.transparentButton = wx.Button(self.toolbar, -1, "T", size=(21,21)) self.toolbar.AddControl(self.transparentButton) self.Bind(wx.EVT_BUTTON, self.OnTransparentClick, self.transparentButton) - self.depthComplexityButton = wx.Button(self.toolbar, -1, "DC", size=(21*2,21)) + self.depthComplexityButton = wx.Button(self.toolbar, -1, "X-RAY", size=(21*2,21)) self.toolbar.AddControl(self.depthComplexityButton) self.Bind(wx.EVT_BUTTON, self.OnDepthComplexityClick, self.depthComplexityButton) -- 2.30.2