Added (6 user-friendly features):
- Onboarding wizard (5 steps, forced on first launch, re-runnable from Help menu)
- Salary estimation (optional, hourly wage + overtime multiplier)
- Inline clock-in/out time editing (click label to edit)
- Today summary card (post-clockout, auto-hide on next clock-in)
- Health break reminder (continuous N-hour at desk warning)
- Discord webhook notifications (clock-in/out/health, mobile push, no server)
Database:
- break_records.break_type column ('break'/'lunch'/'dinner')
- notification_log table (dedupe + analytics)
- Auto-complete onboarding for existing users (work_records exists)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
90 lines
3.2 KiB
Python
90 lines
3.2 KiB
Python
"""
|
|
퇴근 후 표시되는 "오늘 요약" 카드 위젯.
|
|
|
|
다음 출근 시 자동 숨김. 메인 화면 상단에 conditional하게 표시.
|
|
"""
|
|
from __future__ import annotations
|
|
from PyQt5.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
|
|
from PyQt5.QtCore import Qt
|
|
|
|
|
|
class TodaySummaryCard(QFrame):
|
|
"""퇴근 처리 직후 표시되는 요약 카드."""
|
|
|
|
def __init__(self, parent=None):
|
|
super().__init__(parent)
|
|
self.setObjectName("today_summary_card")
|
|
self.setStyleSheet("""
|
|
QFrame#today_summary_card {
|
|
background-color: rgba(76, 175, 80, 0.08);
|
|
border: 1px solid rgba(76, 175, 80, 0.4);
|
|
border-radius: 8px;
|
|
padding: 6px;
|
|
}
|
|
QLabel { padding: 1px; }
|
|
""")
|
|
self.setVisible(False)
|
|
|
|
layout = QVBoxLayout()
|
|
layout.setContentsMargins(10, 6, 10, 6)
|
|
layout.setSpacing(2)
|
|
|
|
header = QHBoxLayout()
|
|
title = QLabel("📋 오늘의 요약")
|
|
title.setStyleSheet("font-weight: bold; font-size: 13px;")
|
|
header.addWidget(title)
|
|
header.addStretch()
|
|
close_btn = QPushButton("✕")
|
|
close_btn.setFixedSize(20, 20)
|
|
close_btn.setStyleSheet("border: none; font-weight: bold;")
|
|
close_btn.clicked.connect(self.hide)
|
|
header.addWidget(close_btn)
|
|
layout.addLayout(header)
|
|
|
|
self.total_label = QLabel("")
|
|
self.detail_label = QLabel("")
|
|
self.detail_label.setStyleSheet("color: #888; font-size: 11px;")
|
|
self.salary_label = QLabel("")
|
|
self.salary_label.setStyleSheet("color: #4caf50; font-weight: bold;")
|
|
|
|
layout.addWidget(self.total_label)
|
|
layout.addWidget(self.detail_label)
|
|
layout.addWidget(self.salary_label)
|
|
|
|
self.setLayout(layout)
|
|
|
|
def show_summary(self, total_hours: float, lunch_minutes: int,
|
|
break_minutes: int, overtime_actual: int,
|
|
overtime_earned: int, salary_text: str = "") -> None:
|
|
"""카드 내용 채우고 표시.
|
|
|
|
Args:
|
|
total_hours: 총 근무시간(시간)
|
|
lunch_minutes: 점심 시간(분)
|
|
break_minutes: 외출 시간(분)
|
|
overtime_actual: 실제 연장근무(분)
|
|
overtime_earned: 적립 연장근무(분)
|
|
salary_text: 추정 급여 표시 문자열 (옵션 활성 시)
|
|
"""
|
|
h = int(total_hours)
|
|
m = int((total_hours - h) * 60)
|
|
self.total_label.setText(f"⏱ 총 근무: {h}시간 {m}분")
|
|
|
|
details = []
|
|
if lunch_minutes > 0:
|
|
details.append(f"점심 {lunch_minutes}분")
|
|
if break_minutes > 0:
|
|
details.append(f"외출 {break_minutes}분")
|
|
if overtime_actual > 0:
|
|
details.append(f"연장 {overtime_actual}분 → 적립 {overtime_earned}분")
|
|
self.detail_label.setText(" · ".join(details) if details else "")
|
|
self.detail_label.setVisible(bool(details))
|
|
|
|
if salary_text:
|
|
self.salary_label.setText(f"💰 {salary_text}")
|
|
self.salary_label.setVisible(True)
|
|
else:
|
|
self.salary_label.setVisible(False)
|
|
|
|
self.setVisible(True)
|