Skip to content

Commit e99f1e1

Browse files
committed
- 데이터 삽입 후 정렬 가능하도록 변경
- release mode에서 검색시 튕기는 문제 해결
1 parent ae42778 commit e99f1e1

File tree

5 files changed

+395
-377
lines changed

5 files changed

+395
-377
lines changed

async/async_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self):
6060
self.setupUi(self)
6161
self.initializer()
6262

63-
window_ico = resource_path('../resource/main.ico')
63+
window_ico = resource_path('../main.ico')
6464
self.setWindowIcon(QIcon(window_ico))
6565
self.show()
6666

build.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"optionDest": "icon_file",
22-
"value": "C:/Users/pgh26/PycharmProjects/DCINSIDE_SEARCH/resource/main.ico"
22+
"value": "C:/Users/pgh26/PycharmProjects/DCINSIDE_SEARCH/main.ico"
2323
},
2424
{
2525
"optionDest": "ascii",
@@ -68,6 +68,10 @@
6868
{
6969
"optionDest": "datas",
7070
"value": "C:/Users/pgh26/PycharmProjects/DCINSIDE_SEARCH/main.ui;."
71+
},
72+
{
73+
"optionDest": "datas",
74+
"value": "C:/Users/pgh26/PycharmProjects/DCINSIDE_SEARCH/main.ico;."
7175
}
7276
],
7377
"nonPyinstallerOptions": {
File renamed without changes.

main.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class SearchThread(QThread):
3131
ThreadMessageEvent = pyqtSignal(str) # 사용자 정의 시그널
3232
QLabelWidgetUpdate = pyqtSignal(str) # 라벨 위젯 업데이트
3333
QTableWidgetUpdate = pyqtSignal(list) # 테이블 위젯 업데이트
34+
QTableWidgetSetSort = pyqtSignal(bool) # 테이블 위젯 컬럼 정렬 기능 ON/OFF
3435

3536
# 메인폼에서 상속받기
3637
def __init__(self, parent): # parent는 WindowClass에서 전달하는 self이다.(WidnowClass의 인스턴스)
@@ -50,6 +51,9 @@ def run(self):
5051
parser = DCArticleParser(dc_id=id) # 객체 생성
5152

5253
idx = 0
54+
55+
#데이터 삽입 중엔 Column 정렬기능을 OFF 하자. (ON 할 경우 다운될 수도 있음.)
56+
self.QTableWidgetSetSort.emit(False)
5357
while True:
5458
if not running:
5559
return
@@ -86,6 +90,7 @@ def run(self):
8690
idx += 1 # 글을 못찾고 넘어가도 + 1
8791

8892
search_pos = page['next_pos']
93+
self.QTableWidgetSetSort.emit(True)
8994

9095
def stop(self):
9196
self.quit()
@@ -108,7 +113,7 @@ def __init__(self):
108113
self.setupUi(self)
109114
self.initializer()
110115

111-
window_ico = resource_path('resource/main.ico')
116+
window_ico = resource_path('main.ico')
112117
self.setWindowIcon(QIcon(window_ico))
113118
self.show()
114119

@@ -184,10 +189,11 @@ def search(self): # 글검색
184189
'검색이 진행중입니다. 새로 검색을 시작하시겠습니까?',
185190
QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
186191
if dialog == QMessageBox.Yes:
192+
# self.thread.quit()
193+
running = False
187194
self.thread.terminate()
188-
self.thread.quit()
189195
self.thread.stop() # 쓰레드 종료
190-
running = False
196+
191197

192198
if self.txt_id.text() != '' and self.txt_keyword.text() != '' and self.txt_repeat.text() != '':
193199
running = True
@@ -202,6 +208,8 @@ def search(self): # 글검색
202208
self.thread.ThreadMessageEvent.connect(self.ThreadMessageEvent)
203209
self.thread.QTableWidgetUpdate.connect(self.QTableWidgetUpdate)
204210
self.thread.QLabelWidgetUpdate.connect(self.QLabelWidgetUpdate)
211+
self.thread.QTableWidgetSetSort.connect(self.QTableWidgetSetSort)
212+
205213
self.thread.finished.connect(self.on_finished)
206214

207215
# 쓰레드 작업 시작
@@ -238,6 +246,10 @@ def item_dbl_click(self):
238246
def ThreadMessageEvent(self, n):
239247
QMessageBox.information(self, '알림', n, QMessageBox.Yes)
240248

249+
@pyqtSlot(bool)
250+
def QTableWidgetSetSort(self, bool):
251+
self.articleView.setSortingEnabled(bool)
252+
241253
@pyqtSlot(list)
242254
def QTableWidgetUpdate(self, article):
243255
for data in article:
@@ -281,6 +293,8 @@ def on_finished(self):
281293
pass
282294

283295

296+
297+
284298
app = QApplication([])
285299
main = Main()
286300
QApplication.processEvents()

0 commit comments

Comments
 (0)