MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / OpenFitsThread

Class OpenFitsThread

gui/mainFrame.py:103–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101
102
103class 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
134class MainFrame(wx.Frame):

Callers 1

LoadPreviousOpenFitsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected