@@ -28,7 +28,7 @@ class SearchThread(QThread):
28
28
29
29
ThreadMessageEvent = pyqtSignal (str ) # 사용자 정의 시그널
30
30
QLabelWidgetUpdate = pyqtSignal (str ) # 라벨 위젯 업데이트
31
- QTableWidgetUpdate = pyqtSignal (dict ) # 테이블 위젯 업데이트
31
+ QTableWidgetUpdate = pyqtSignal (list ) # 테이블 위젯 업데이트
32
32
33
33
# 메인폼에서 상속받기
34
34
def __init__ (self , parent ): # parent는 WindowClass에서 전달하는 self이다.(WidnowClass의 인스턴스)
@@ -68,8 +68,7 @@ def run(self):
68
68
69
69
self .QLabelWidgetUpdate .emit (f'상태 : { idx } /{ loop_count } 탐색중...' )
70
70
article = parser .article_parse (keyword , s_type , page = i , search_pos = search_pos )
71
- for element in article :
72
- self .QTableWidgetUpdate .emit (element )
71
+ self .QTableWidgetUpdate .emit (article )
73
72
74
73
idx += 1 # 글을 하나 탐색하면 + 1
75
74
@@ -200,51 +199,55 @@ def item_dbl_click(self):
200
199
global parser
201
200
202
201
if parser :
203
- all_link = parser .get_link_list ()
204
- row = self .articleView .currentIndex ().row ()
205
- column = self .articleView .currentIndex ().column ()
202
+ try :
203
+ all_link = parser .get_link_list ()
204
+ row = self .articleView .currentIndex ().row ()
205
+ column = self .articleView .currentIndex ().column ()
206
206
207
- # if (column == 0):
208
- # article_id = self.articleView.item(row, column).text()
209
- # webbrowser.open(all_link[article_id])
207
+ # if (column == 0):
208
+ # article_id = self.articleView.item(row, column).text()
209
+ # webbrowser.open(all_link[article_id])
210
210
211
- article_id = self .articleView .item (row , 0 ).text ()
212
- webbrowser .open (all_link [article_id ])
211
+ article_id = self .articleView .item (row , 0 ).text ()
212
+ webbrowser .open (all_link [article_id ])
213
213
214
- # 포커스 초기화 & 선택 초기화
215
- self .articleView .clearSelection ()
216
- self .articleView .clearFocus ()
214
+ # 포커스 초기화 & 선택 초기화
215
+ self .articleView .clearSelection ()
216
+ self .articleView .clearFocus ()
217
+ except Exception as e :
218
+ pass
217
219
218
220
# Slot Event
219
221
@pyqtSlot (str )
220
222
def ThreadMessageEvent (self , n ):
221
223
QMessageBox .information (self , '알림' , n , QMessageBox .Yes )
222
224
223
- @pyqtSlot (dict )
224
- def QTableWidgetUpdate (self , data ):
225
- rowPosition = self .articleView .rowCount ()
226
- self .articleView .insertRow (rowPosition )
225
+ @pyqtSlot (list )
226
+ def QTableWidgetUpdate (self , article ):
227
+ for data in article :
228
+ rowPosition = self .articleView .rowCount ()
229
+ self .articleView .insertRow (rowPosition )
227
230
228
- item_num = QTableWidgetItem ()
229
- item_num .setData (Qt .DisplayRole , int (data ['num' ])) # 숫자로 설정 (정렬을 위해)
230
- self .articleView .setItem (rowPosition , 0 , item_num )
231
+ item_num = QTableWidgetItem ()
232
+ item_num .setData (Qt .DisplayRole , int (data ['num' ])) # 숫자로 설정 (정렬을 위해)
233
+ self .articleView .setItem (rowPosition , 0 , item_num )
231
234
232
- self .articleView .setItem (rowPosition , 1 , QTableWidgetItem (data ['title' ]))
235
+ self .articleView .setItem (rowPosition , 1 , QTableWidgetItem (data ['title' ]))
233
236
234
- item_reply = QTableWidgetItem ()
235
- item_reply .setData (Qt .DisplayRole , int (data ['reply' ])) # 숫자로 설정 (정렬을 위해)
236
- self .articleView .setItem (rowPosition , 2 , item_reply )
237
+ item_reply = QTableWidgetItem ()
238
+ item_reply .setData (Qt .DisplayRole , int (data ['reply' ])) # 숫자로 설정 (정렬을 위해)
239
+ self .articleView .setItem (rowPosition , 2 , item_reply )
237
240
238
- self .articleView .setItem (rowPosition , 3 , QTableWidgetItem (data ['nickname' ]))
239
- self .articleView .setItem (rowPosition , 4 , QTableWidgetItem (data ['timestamp' ]))
241
+ self .articleView .setItem (rowPosition , 3 , QTableWidgetItem (data ['nickname' ]))
242
+ self .articleView .setItem (rowPosition , 4 , QTableWidgetItem (data ['timestamp' ]))
240
243
241
- item_refresh = QTableWidgetItem ()
242
- item_refresh .setData (Qt .DisplayRole , int (data ['refresh' ])) # 숫자로 설정 (정렬을 위해)
243
- self .articleView .setItem (rowPosition , 5 , item_refresh )
244
+ item_refresh = QTableWidgetItem ()
245
+ item_refresh .setData (Qt .DisplayRole , int (data ['refresh' ])) # 숫자로 설정 (정렬을 위해)
246
+ self .articleView .setItem (rowPosition , 5 , item_refresh )
244
247
245
- item_recommend = QTableWidgetItem ()
246
- item_recommend .setData (Qt .DisplayRole , int (data ['recommend' ])) # 숫자로 설정 (정렬을 위해)
247
- self .articleView .setItem (rowPosition , 6 , item_recommend )
248
+ item_recommend = QTableWidgetItem ()
249
+ item_recommend .setData (Qt .DisplayRole , int (data ['recommend' ])) # 숫자로 설정 (정렬을 위해)
250
+ self .articleView .setItem (rowPosition , 6 , item_recommend )
248
251
249
252
@pyqtSlot (str )
250
253
def QLabelWidgetUpdate (self , data ):
0 commit comments