Fix some bugs with notes view - exception happening due to lack of fit, and possibility of notes saving under the wrong fit
This commit is contained in:
@@ -24,8 +24,14 @@ class NotesView(wx.Panel):
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
|
||||
self.saveTimer.Stop() # cancel any pending timers
|
||||
|
||||
self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# when switching fits, ensure that we save the notes for the previous fit
|
||||
if self.lastFitId is not None:
|
||||
sFit.editNotes(self.lastFitId, self.editNotes.GetValue())
|
||||
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
self.lastFitId = None
|
||||
event.Skip()
|
||||
@@ -41,7 +47,4 @@ class NotesView(wx.Panel):
|
||||
|
||||
def delayedSave(self, event):
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.lastFitId)
|
||||
newNotes = self.editNotes.GetValue()
|
||||
fit.notes = newNotes
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fit.ID))
|
||||
sFit.editNotes(self.lastFitId, self.editNotes.GetValue())
|
||||
|
||||
Reference in New Issue
Block a user