Skip to content

Commit

Permalink
Fix error when loading previous fits that no longer exist in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann committed Feb 3, 2015
1 parent 3a26790 commit 7b8bb79
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gui/mainFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,18 @@ def ShowUpdateBox(self, release):
dlg.Destroy()

def LoadPreviousOpenFits(self):
sFit = service.Fit.getInstance()

self.prevOpenFits = service.SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []})
fits = self.prevOpenFits['pyfaOpenFits']

# Remove any fits that cause exception when fetching (non-existent fits)
for id in fits[:]:
try:
sFit.getFit(id)
except:
fits.remove(id)

if not self.prevOpenFits['enabled'] or len(fits) is 0:
# add blank page if there are no fits to be loaded
self.fitMultiSwitch.AddPage()
Expand Down

0 comments on commit 7b8bb79

Please sign in to comment.