add tests for PyQt debugging

This commit is contained in:
Elizaveta Shashkova
2014-12-03 20:42:39 +03:00
parent d12fceb113
commit 381ef3565f
4 changed files with 163 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
from PyQt5 import QtCore
import sys
class AThread(QtCore.QThread):
def run(self):
for i in range(3):
print("ping %d" % i)
app = QtCore.QCoreApplication([])
thread = AThread()
thread.finished.connect(app.exit)
thread.start()
sys.exit(app.exec_())
+23
View File
@@ -0,0 +1,23 @@
from PyQt5 import QtCore
import sys
class SomeObject(QtCore.QObject):
finished = QtCore.pyqtSignal()
def longRunning(self):
for i in range(3):
print("ping %d" % i)
self.finished.emit()
app = QtCore.QCoreApplication([])
objThread = QtCore.QThread()
obj = SomeObject()
obj.moveToThread(objThread)
obj.finished.connect(objThread.quit)
objThread.started.connect(obj.longRunning)
objThread.finished.connect(app.exit)
objThread.start()
sys.exit(app.exec_())
+19
View File
@@ -0,0 +1,19 @@
from PyQt5 import QtCore
import sys
class Runnable(QtCore.QRunnable):
def run(self):
app = QtCore.QCoreApplication.instance()
for i in range(3):
print("ping %d" % i)
app.quit()
app = QtCore.QCoreApplication([])
runnable = Runnable()
QtCore.QThreadPool.globalInstance().start(runnable)
sys.exit(app.exec_())