File: _debugger_case_qthread4.py

package info (click to toggle)
pydevd 3.3.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,892 kB
  • sloc: python: 77,508; cpp: 1,869; sh: 368; makefile: 50; ansic: 4
file content (47 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (3)
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
try:
    from PySide import QtCore
except:
    try:
        from PySide2 import QtCore
    except:
        try:
            from PyQt4 import QtCore
        except:
            from PyQt5 import QtCore


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')


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()
app.exec_()
print('TEST SUCEEDED!')