프로젝트

일반

사용자정보

개정판 d47f142b

IDd47f142b2bd7cc67c50fe60f780368c40f5813e5
상위 f1ea7cad
하위 a593ce15, 316a397b

함의성이(가) 약 5년 전에 추가함

issue #563: linenotracer change thread testing

Change-Id: I7c081b51ab818e9e61a640be91c4c4beaede6452

차이점 보기:

DTI_PID/DTI_PID/ConnectAttrDialog.py
19 19

  
20 20
'''
21 21
'''
22
class Worker(QThread):
22
class Worker(QObject):
23 23
    """ This is Worker class """
24 24
    from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QGridLayout, QListWidget
25 25
    from QtImageViewer import QtImageViewer
......
33 33
    updateProgress = pyqtSignal(int)
34 34

  
35 35
    def __init__(self, graphicsView, update_line_type, update_flow_mark, update_spec):
36
        QThread.__init__(self)
36
        super(Worker, self).__init__()
37 37
        self.graphicsView = graphicsView
38 38
        self._update_line_type = update_line_type
39 39
        self._update_flow_mark = update_flow_mark
......
129 129

  
130 130
            # 1 - create Worker and Thread inside the Form
131 131
            self.obj = Worker(self.graphicsView, self.ui.checkBoxUpdateLineType.isChecked(), self.ui.checkBoxUpdateFlowMark.isChecked(), self.ui.checkBoxUpdateSpec.isChecked())
132
            self.thread = QThread()
132 133

  
133
            # 2 - Connect Worker Signals to the Thread slots
134
            # 2 - Move the Worker object to the Thread object
135
            self.obj.moveToThread(self.thread)
136

  
137
            # 3 - Connect Worker Signals to the Thread slots
138
            self.obj.finished.connect(self.thread.quit)
134 139
            self.obj.displayMessage.connect(self.addListItem)
135 140
            self.obj.updateProgress.connect(self.updateProgress)
136 141

  
137
            # 3 - Thread finished signal will close the app if you want!
138
            self.obj.finished.connect(self.dlgExit)
142
            # 4 - Connect Thread started signal to Worker operational slot method
143
            self.thread.started.connect(self.obj.run)
144

  
145
            # 5 - Thread finished signal will close the app if you want!
146
            self.thread.finished.connect(self.dlgExit)
139 147

  
140
            # 4 - Start the thread
141
            self.obj.start()
148
            # 6 - Start the thread
149
            self.thread.start()
142 150

  
143 151
            self.tmStart = timeit.default_timer()
144 152
        except Exception as ex:

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)