@@ -31,6 +31,7 @@ class SearchThread(QThread):
31
31
ThreadMessageEvent = pyqtSignal (str ) # 사용자 정의 시그널
32
32
QLabelWidgetUpdate = pyqtSignal (str ) # 라벨 위젯 업데이트
33
33
QTableWidgetUpdate = pyqtSignal (list ) # 테이블 위젯 업데이트
34
+ QTableWidgetSetSort = pyqtSignal (bool ) # 테이블 위젯 컬럼 정렬 기능 ON/OFF
34
35
35
36
# 메인폼에서 상속받기
36
37
def __init__ (self , parent ): # parent는 WindowClass에서 전달하는 self이다.(WidnowClass의 인스턴스)
@@ -50,6 +51,9 @@ def run(self):
50
51
parser = DCArticleParser (dc_id = id ) # 객체 생성
51
52
52
53
idx = 0
54
+
55
+ #데이터 삽입 중엔 Column 정렬기능을 OFF 하자. (ON 할 경우 다운될 수도 있음.)
56
+ self .QTableWidgetSetSort .emit (False )
53
57
while True :
54
58
if not running :
55
59
return
@@ -86,6 +90,7 @@ def run(self):
86
90
idx += 1 # 글을 못찾고 넘어가도 + 1
87
91
88
92
search_pos = page ['next_pos' ]
93
+ self .QTableWidgetSetSort .emit (True )
89
94
90
95
def stop (self ):
91
96
self .quit ()
@@ -108,7 +113,7 @@ def __init__(self):
108
113
self .setupUi (self )
109
114
self .initializer ()
110
115
111
- window_ico = resource_path ('resource/ main.ico' )
116
+ window_ico = resource_path ('main.ico' )
112
117
self .setWindowIcon (QIcon (window_ico ))
113
118
self .show ()
114
119
@@ -184,10 +189,11 @@ def search(self): # 글검색
184
189
'검색이 진행중입니다. 새로 검색을 시작하시겠습니까?' ,
185
190
QMessageBox .Yes | QMessageBox .No , QMessageBox .No )
186
191
if dialog == QMessageBox .Yes :
192
+ # self.thread.quit()
193
+ running = False
187
194
self .thread .terminate ()
188
- self .thread .quit ()
189
195
self .thread .stop () # 쓰레드 종료
190
- running = False
196
+
191
197
192
198
if self .txt_id .text () != '' and self .txt_keyword .text () != '' and self .txt_repeat .text () != '' :
193
199
running = True
@@ -202,6 +208,8 @@ def search(self): # 글검색
202
208
self .thread .ThreadMessageEvent .connect (self .ThreadMessageEvent )
203
209
self .thread .QTableWidgetUpdate .connect (self .QTableWidgetUpdate )
204
210
self .thread .QLabelWidgetUpdate .connect (self .QLabelWidgetUpdate )
211
+ self .thread .QTableWidgetSetSort .connect (self .QTableWidgetSetSort )
212
+
205
213
self .thread .finished .connect (self .on_finished )
206
214
207
215
# 쓰레드 작업 시작
@@ -238,6 +246,10 @@ def item_dbl_click(self):
238
246
def ThreadMessageEvent (self , n ):
239
247
QMessageBox .information (self , '알림' , n , QMessageBox .Yes )
240
248
249
+ @pyqtSlot (bool )
250
+ def QTableWidgetSetSort (self , bool ):
251
+ self .articleView .setSortingEnabled (bool )
252
+
241
253
@pyqtSlot (list )
242
254
def QTableWidgetUpdate (self , article ):
243
255
for data in article :
@@ -281,6 +293,8 @@ def on_finished(self):
281
293
pass
282
294
283
295
296
+
297
+
284
298
app = QApplication ([])
285
299
main = Main ()
286
300
QApplication .processEvents ()
0 commit comments