|
10 | 10 | from PyQt5.QtCore import *
|
11 | 11 | from PyQt5.QtGui import QIntValidator, QIcon
|
12 | 12 | from PyQt5.QtWidgets import QMessageBox, QTableWidgetItem, QAbstractItemView, QMainWindow
|
13 |
| -from module.async_article_parser import DCArticleParser |
| 13 | +from async_article_parser import DCArticleParser |
14 | 14 | from qasync import asyncSlot, QApplication
|
15 | 15 |
|
16 | 16 | from module.headers import search_type
|
@@ -76,7 +76,8 @@ def closeEvent(self, QCloseEvent):
|
76 | 76 | keyword = self.txt_keyword.text()
|
77 | 77 | comboBox = self.comboBox.currentText()
|
78 | 78 |
|
79 |
| - data = {'repeat': repeat, 'gallary_id': gallary_id, 'keyword': keyword, 'search_type': comboBox} |
| 79 | + data = {'repeat': repeat, 'gallary_id': gallary_id, |
| 80 | + 'keyword': keyword, 'search_type': comboBox} |
80 | 81 | self.save_data(data, '../user_save.dat')
|
81 | 82 |
|
82 | 83 | self.deleteLater()
|
@@ -104,15 +105,16 @@ def set_only_int(self):
|
104 | 105 | self.txt_repeat.setValidator(self.onlyInt)
|
105 | 106 |
|
106 | 107 | def setTableWidget(self):
|
107 |
| - self.articleView.setEditTriggers(QAbstractItemView.NoEditTriggers) # TableWidget 읽기 전용 설정 |
108 |
| - self.articleView.setColumnWidth(0, 60); # 글 번호 |
109 |
| - self.articleView.setColumnWidth(1, 430); # 제목 |
110 |
| - self.articleView.setColumnWidth(2, 50); # 댓글수 |
| 108 | + self.articleView.setEditTriggers( |
| 109 | + QAbstractItemView.NoEditTriggers) # TableWidget 읽기 전용 설정 |
| 110 | + self.articleView.setColumnWidth(0, 60) # 글 번호 |
| 111 | + self.articleView.setColumnWidth(1, 430) # 제목 |
| 112 | + self.articleView.setColumnWidth(2, 50) # 댓글수 |
111 | 113 |
|
112 |
| - self.articleView.setColumnWidth(3, 100); # 글쓴이 |
113 |
| - self.articleView.setColumnWidth(4, 60); # 작성일 |
114 |
| - self.articleView.setColumnWidth(5, 40); # 조회 |
115 |
| - self.articleView.setColumnWidth(6, 40); # 추천 |
| 114 | + self.articleView.setColumnWidth(3, 100) # 글쓴이 |
| 115 | + self.articleView.setColumnWidth(4, 60) # 작성일 |
| 116 | + self.articleView.setColumnWidth(5, 40) # 조회 |
| 117 | + self.articleView.setColumnWidth(6, 40) # 추천 |
116 | 118 |
|
117 | 119 | def setTableAutoSize(self):
|
118 | 120 | header = self.articleView.horizontalHeader()
|
@@ -141,7 +143,8 @@ async def search(self): # 글검색 버튼
|
141 | 143 | if self.txt_id.text() != '' and self.txt_keyword.text() != '' and self.txt_repeat.text() != '':
|
142 | 144 | task = asyncio.create_task(self.run())
|
143 | 145 | else:
|
144 |
| - QMessageBox.information(self, '알림', '값을 전부 입력해주세요.', QMessageBox.Yes) |
| 146 | + QMessageBox.information( |
| 147 | + self, '알림', '값을 전부 입력해주세요.', QMessageBox.Yes) |
145 | 148 |
|
146 | 149 | async def run(self):
|
147 | 150 | global running, parser
|
@@ -195,7 +198,8 @@ async def run(self):
|
195 | 198 | if idx > loop_count or search_pos == 'last':
|
196 | 199 | break
|
197 | 200 |
|
198 |
| - await asyncio.sleep(0.1) # 디시 서버를 위한 딜레이 (비동기 Non-Blocking 을 위해 동기 time.sleep 을 사용하지 않는다.) |
| 201 | + # 디시 서버를 위한 딜레이 (비동기 Non-Blocking 을 위해 동기 time.sleep 을 사용하지 않는다.) |
| 202 | + await asyncio.sleep(0.1) |
199 | 203 |
|
200 | 204 | label.run(f'상태 : {idx}/{loop_count} 탐색중...')
|
201 | 205 | idx += 1 # 글을 못찾고 넘어가도 + 1
|
@@ -238,24 +242,31 @@ def QTableWidgetUpdate(self, article):
|
238 | 242 | self.articleView.insertRow(row_position)
|
239 | 243 |
|
240 | 244 | item_num = QTableWidgetItem()
|
241 |
| - item_num.setData(Qt.DisplayRole, int(data['num'])) # 숫자로 설정 (정렬을 위해) |
| 245 | + item_num.setData(Qt.DisplayRole, int( |
| 246 | + data['num'])) # 숫자로 설정 (정렬을 위해) |
242 | 247 | self.articleView.setItem(row_position, 0, item_num)
|
243 | 248 |
|
244 |
| - self.articleView.setItem(row_position, 1, QTableWidgetItem(data['title'])) |
| 249 | + self.articleView.setItem( |
| 250 | + row_position, 1, QTableWidgetItem(data['title'])) |
245 | 251 |
|
246 | 252 | item_reply = QTableWidgetItem()
|
247 |
| - item_reply.setData(Qt.DisplayRole, int(data['reply'])) # 숫자로 설정 (정렬을 위해) |
| 253 | + item_reply.setData(Qt.DisplayRole, int( |
| 254 | + data['reply'])) # 숫자로 설정 (정렬을 위해) |
248 | 255 | self.articleView.setItem(row_position, 2, item_reply)
|
249 | 256 |
|
250 |
| - self.articleView.setItem(row_position, 3, QTableWidgetItem(data['nickname'])) |
251 |
| - self.articleView.setItem(row_position, 4, QTableWidgetItem(data['timestamp'])) |
| 257 | + self.articleView.setItem( |
| 258 | + row_position, 3, QTableWidgetItem(data['nickname'])) |
| 259 | + self.articleView.setItem( |
| 260 | + row_position, 4, QTableWidgetItem(data['timestamp'])) |
252 | 261 |
|
253 | 262 | item_refresh = QTableWidgetItem()
|
254 |
| - item_refresh.setData(Qt.DisplayRole, int(data['refresh'])) # 숫자로 설정 (정렬을 위해) |
| 263 | + item_refresh.setData(Qt.DisplayRole, int( |
| 264 | + data['refresh'])) # 숫자로 설정 (정렬을 위해) |
255 | 265 | self.articleView.setItem(row_position, 5, item_refresh)
|
256 | 266 |
|
257 | 267 | item_recommend = QTableWidgetItem()
|
258 |
| - item_recommend.setData(Qt.DisplayRole, int(data['recommend'])) # 숫자로 설정 (정렬을 위해) |
| 268 | + item_recommend.setData(Qt.DisplayRole, int( |
| 269 | + data['recommend'])) # 숫자로 설정 (정렬을 위해) |
259 | 270 | self.articleView.setItem(row_position, 6, item_recommend)
|
260 | 271 |
|
261 | 272 | @pyqtSlot(str)
|
|
0 commit comments