BottomLineProgress.py:解决线程销毁bug

This commit is contained in:
Pandacoolcool 2019-08-21 11:11:20 +08:00 committed by GitHub
parent c28e04de25
commit 37194e4e76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,7 +10,7 @@ Created on 2018年2月1日
@description: @description:
''' '''
from random import randint from random import randint
import sys import sys, time
from PyQt5.QtCore import QTimer, QThread, pyqtSignal from PyQt5.QtCore import QTimer, QThread, pyqtSignal
from PyQt5.QtGui import QPainter, QColor, QPen from PyQt5.QtGui import QPainter, QColor, QPen
@ -82,6 +82,7 @@ class PushButtonLine(QPushButton):
self.loadingThread.valueChanged.disconnect(self.setPercent) self.loadingThread.valueChanged.disconnect(self.setPercent)
self.loadingThread.terminate() self.loadingThread.terminate()
self.loadingThread.deleteLater() self.loadingThread.deleteLater()
time.sleep(1) #延迟等待deleteLater执行完毕
del self.loadingThread del self.loadingThread
self._percent = 0 self._percent = 0
self._timer.stop() self._timer.stop()