optimize ThreadProgress.py