| 101 | |
| 102 | |
| 103 | class OpenFitsThread(threading.Thread): |
| 104 | |
| 105 | def __init__(self, fits, callback): |
| 106 | threading.Thread.__init__(self) |
| 107 | self.name = "LoadingOpenFits" |
| 108 | self.mainFrame = MainFrame.getInstance() |
| 109 | self.callback = callback |
| 110 | self.fits = fits |
| 111 | self.running = True |
| 112 | self.start() |
| 113 | |
| 114 | def run(self): |
| 115 | # `startup` tells FitSpawner that we are loading fits are startup, and |
| 116 | # has 3 values: |
| 117 | # False = Set as default in FitSpawner itself, never set here |
| 118 | # 1 = Create new fit page, but do not calculate page |
| 119 | # 2 = Create new page and calculate |
| 120 | # We use 1 for all fits except the last one where we use 2 so that we |
| 121 | # have correct calculations displayed at startup |
| 122 | for fitID in self.fits[:-1]: |
| 123 | if self.running: |
| 124 | wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID, startup=1)) |
| 125 | |
| 126 | if self.running: |
| 127 | wx.PostEvent(self.mainFrame, FitSelected(fitID=self.fits[-1], startup=2)) |
| 128 | wx.CallAfter(self.callback) |
| 129 | |
| 130 | def stop(self): |
| 131 | self.running = False |
| 132 | |
| 133 | |
| 134 | class MainFrame(wx.Frame): |
no outgoing calls
no test coverage detected