@@ -31,7 +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
+ QTableWidgetSetSort = pyqtSignal (bool ) # 테이블 위젯 컬럼 정렬 기능 ON/OFF
35
35
36
36
# 메인폼에서 상속받기
37
37
def __init__ (self , parent ): # parent는 WindowClass에서 전달하는 self이다.(WidnowClass의 인스턴스)
@@ -52,7 +52,7 @@ def run(self):
52
52
53
53
idx = 0
54
54
55
- #데이터 삽입 중엔 Column 정렬기능을 OFF 하자. (ON 할 경우 다운될 수도 있음.)
55
+ # 데이터 삽입 중엔 Column 정렬기능을 OFF 하자. (ON 할 경우 다운될 수도 있음.)
56
56
self .QTableWidgetSetSort .emit (False )
57
57
while True :
58
58
if not running :
@@ -97,17 +97,29 @@ def stop(self):
97
97
self .wait (3000 )
98
98
99
99
# 모듈화에 문제가 생겨서 우선 하드 코딩
100
+
101
+
100
102
def resource_path (relative_path ):
101
- base_path = getattr (sys , '_MEIPASS' , os .path .dirname (os .path .abspath (__file__ )))
103
+ base_path = getattr (sys , '_MEIPASS' , os .path .dirname (
104
+ os .path .abspath (__file__ )))
102
105
return os .path .join (base_path , relative_path )
103
106
104
107
105
108
# Main UI Load
106
109
main_ui = resource_path ('main.ui' )
107
- Ui_MainWindow = uic .loadUiType (main_ui )[0 ] # ui 가져오기
110
+ Ui_MainWindow = uic .loadUiType (main_ui )[0 ] # UI 가져오기
108
111
109
112
110
113
class Main (QMainWindow , Ui_MainWindow ):
114
+ # 타입 힌트 (IDE 자동 완성 지원을 위해)
115
+ articleView : QTableWidget
116
+ txt_repeat : QLineEdit
117
+ txt_id : QLineEdit
118
+ txt_keyword : QLineEdit
119
+ btn_search : QPushButton
120
+ comboBox : QComboBox
121
+ txt_status : QLabel
122
+
111
123
def __init__ (self ):
112
124
super ().__init__ ()
113
125
self .setupUi (self )
@@ -163,7 +175,6 @@ def setTableWidget(self):
163
175
self .articleView .setColumnWidth (0 , 60 ) # 글 번호
164
176
self .articleView .setColumnWidth (1 , 430 ) # 제목
165
177
self .articleView .setColumnWidth (2 , 50 ) # 댓글수
166
-
167
178
self .articleView .setColumnWidth (3 , 100 ) # 글쓴이
168
179
self .articleView .setColumnWidth (4 , 60 ) # 작성일
169
180
self .articleView .setColumnWidth (5 , 40 ) # 조회
@@ -194,7 +205,6 @@ def search(self): # 글검색
194
205
self .thread .terminate ()
195
206
self .thread .stop () # 쓰레드 종료
196
207
197
-
198
208
if self .txt_id .text () != '' and self .txt_keyword .text () != '' and self .txt_repeat .text () != '' :
199
209
running = True
200
210
self .articleView .setRowCount (0 ) # 글 초기화
@@ -293,8 +303,6 @@ def on_finished(self):
293
303
pass
294
304
295
305
296
-
297
-
298
306
app = QApplication ([])
299
307
main = Main ()
300
308
QApplication .processEvents ()
0 commit comments