-
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy path_debugger_case_qthread4.py
More file actions
57 lines (45 loc) · 1.29 KB
/
_debugger_case_qthread4.py
File metadata and controls
57 lines (45 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
try:
try:
from PySide import QtCore # @UnresolvedImport
except:
try:
from PySide2 import QtCore # @UnresolvedImport
except:
from PySide6 import QtCore # @UnresolvedImport
except:
try:
from PyQt4 import QtCore # @UnresolvedImport
except:
try:
from PyQt5 import QtCore # @UnresolvedImport
except:
from PyQt6 import QtCore # @UnresolvedImport
class TestObject(QtCore.QObject):
"""
Test class providing some non-argument signal
"""
try:
testSignal = QtCore.Signal() # @UndefinedVariable
except:
testSignal = QtCore.pyqtSignal() # @UndefinedVariable
class TestThread(QtCore.QThread):
def run(self):
QtCore.QThread.sleep(4)
print('Done sleeping')
def on_start():
print('On start called1')
print('On start called2') # break here
app = QtCore.QCoreApplication([])
some_thread = TestThread()
some_object = TestObject()
# connect QThread.started to the signal
some_thread.started.connect(some_object.testSignal)
some_object.testSignal.connect(on_start)
some_thread.finished.connect(app.quit)
some_thread.start()
# Qt6: exec_ is deprecated/removed
if hasattr(app, 'exec'):
app.exec()
else:
app.exec_()
print('TEST SUCEEDED!')