import threading import time import service class exportHtml(): _instance = None @classmethod def getInstance(cls): if cls._instance == None: cls._instance = exportHtml() return cls._instance def __init__(self): self.thread = exportHtmlThread() def refreshFittingHTMl(self): settings = service.settings.HTMLExportSettings.getInstance() if (settings.getEnabled()): self.thread.stop() self.thread = exportHtmlThread() self.thread.start() class exportHtmlThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.stopRunning = False def stop(self): self.stopRunning = True def run(self): # wait 1 second just in case a lot of modifications get made time.sleep(1); if self.stopRunning: return; sMarket = service.Market.getInstance() sFit = service.Fit.getInstance() settings = service.settings.HTMLExportSettings.getInstance() HTML = """