Made file import threaded with nice animation

This commit is contained in:
HomeWorld
2011-01-18 08:24:11 +02:00
parent 2c6a951cae
commit 50afa50388
2 changed files with 29 additions and 8 deletions

View File

@@ -48,6 +48,20 @@ class FitBackupThread(threading.Thread):
backupFile.close()
wx.CallAfter(self.callback)
class FitImportThread(threading.Thread):
def __init__(self, paths, callback):
threading.Thread.__init__(self)
self.paths = paths
self.callback = callback
def run(self):
importedFits = []
paths = self.paths
sFit = Fit.getInstance()
for path in paths:
importedFits += sFit.importFit(path)
wx.CallAfter(self.callback, importedFits)
class Fit(object):
instance = None
@classmethod
@@ -513,6 +527,10 @@ class Fit(object):
thread = FitBackupThread(path, callback)
thread.start()
def importFitsThreaded(self, paths, callback):
thread = FitImportThread(paths, callback)
thread.start()
def importFit(self, path):
filename = os.path.split(path)[1]