62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
from PySide6.QtWidgets import QStatusBar, QLabel, QHBoxLayout
|
|
from PySide6.QtCore import Qt
|
|
from qfluentwidgets import StateToolTip, ProgressBar, PushButton, FluentIcon
|
|
|
|
class StatusBar(QStatusBar):
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
self.setup_ui()
|
|
|
|
def setup_ui(self):
|
|
# 상태 메시지 레이블
|
|
self.status_label = QLabel()
|
|
self.status_label.setStyleSheet("color: #555555; padding: 2px;")
|
|
self.addWidget(self.status_label)
|
|
|
|
# 로그인 상태 레이블
|
|
self.login_status_label = QLabel("로그인되지 않음")
|
|
self.login_status_label.setStyleSheet("color: #777777; padding: 2px;")
|
|
self.addPermanentWidget(self.login_status_label)
|
|
|
|
# 전체 상태바 스타일 설정
|
|
self.setStyleSheet("""
|
|
QStatusBar {
|
|
background-color: #f5f5f5;
|
|
border-top: 1px solid #e0e0e0;
|
|
min-height: 24px;
|
|
padding: 0;
|
|
}
|
|
QLabel {
|
|
font-size: 12px;
|
|
margin: 0 5px;
|
|
}
|
|
""")
|
|
|
|
def set_status_message(self, message):
|
|
"""상태 메시지 설정"""
|
|
self.status_label.setText(message)
|
|
|
|
def set_login_status(self, is_logged_in):
|
|
"""로그인 상태 설정"""
|
|
if is_logged_in:
|
|
self.login_status_label.setText("로그인됨")
|
|
self.login_status_label.setStyleSheet("color: #4caf50; padding: 2px; font-weight: bold;")
|
|
else:
|
|
self.login_status_label.setText("로그인되지 않음")
|
|
self.login_status_label.setStyleSheet("color: #777777; padding: 2px;")
|
|
|
|
def show_progress(self, title, content):
|
|
"""진행 상태 툴팁 표시 (오버레이 형태)"""
|
|
state_tooltip = StateToolTip(title, content, self.parent())
|
|
state_tooltip.show()
|
|
return state_tooltip
|
|
|
|
def update_progress(self, state_tooltip, progress, content=None):
|
|
"""진행 상태 업데이트"""
|
|
if progress >= 100:
|
|
state_tooltip.setContent(content or "완료되었습니다")
|
|
state_tooltip.setState(True)
|
|
else:
|
|
if content:
|
|
state_tooltip.setContent(content)
|
|
state_tooltip.setProgress(progress) |