Spaces:
Runtime error

m1m02530125 Claude Sonnet 4.6 commited on
Commit
8cb7e47
·
1 Parent(s): 3931870

feat: アップデート通知ダイアログ追加・ダイアログの氏名に「さん」付け

Browse files

- アップデート検出時に手順説明ダイアログを表示(バックアップ・旧EXE削除を促す)
- サイドバーバナーをクリックしても同じダイアログを再表示
- 各種ダイアログの従業員名表示に「さん」を追加

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

ui/employee_view.py CHANGED
@@ -128,7 +128,7 @@ class EmployeeView(QWidget):
128
  def _on_delete(self, emp: Employee):
129
  reply = QMessageBox.question(
130
  self, "削除確認",
131
- f"「{emp.name}」を削除しますか?\n(過去のシフトデータは保持されます)",
132
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
133
  )
134
  if reply == QMessageBox.StandardButton.Yes:
 
128
  def _on_delete(self, emp: Employee):
129
  reply = QMessageBox.question(
130
  self, "削除確認",
131
+ f"「{emp.name}さん」を削除しますか?\n(過去のシフトデータは保持されます)",
132
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
133
  )
134
  if reply == QMessageBox.StandardButton.Yes:
ui/main_window.py CHANGED
@@ -2,7 +2,8 @@
2
  from __future__ import annotations
3
  from PyQt6.QtWidgets import (
4
  QMainWindow, QWidget, QHBoxLayout, QVBoxLayout,
5
- QPushButton, QLabel, QStackedWidget, QFrame, QSizePolicy
 
6
  )
7
  from PyQt6.QtCore import Qt, QSize, QThread, pyqtSignal
8
  from PyQt6.QtGui import QFont, QDesktopServices
@@ -28,6 +29,66 @@ NAV_ITEMS = [
28
  SIDEBAR_W = 160
29
 
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  # ── アップデートチェッカー(バックグラウンドスレッド)──────────────────────
32
 
33
  class _UpdateChecker(QThread):
@@ -233,17 +294,25 @@ class MainWindow(QMainWindow):
233
 
234
  def _on_update_result(self, is_newer: bool, tag: str, url: str):
235
  self._update_url = url
236
- if is_newer:
237
- self._update_label.setText(
238
- f"🆕 {tag} が\n利用可能です\nクリックして\nダウンロード"
239
- )
240
- self._update_label.setVisible(True)
241
- self._update_label.setStyleSheet(
242
- "background:#1d4ed8; color:white; font-size:10px; "
243
- "padding:6px 4px; border-radius:4px; margin:4px;"
244
- )
 
 
 
 
 
 
245
 
246
  def _on_update_label_clicked(self, event):
247
  url = getattr(self, "_update_url", "")
248
  if url:
249
- QDesktopServices.openUrl(QUrl(url))
 
 
 
2
  from __future__ import annotations
3
  from PyQt6.QtWidgets import (
4
  QMainWindow, QWidget, QHBoxLayout, QVBoxLayout,
5
+ QPushButton, QLabel, QStackedWidget, QFrame, QSizePolicy,
6
+ QDialog
7
  )
8
  from PyQt6.QtCore import Qt, QSize, QThread, pyqtSignal
9
  from PyQt6.QtGui import QFont, QDesktopServices
 
29
  SIDEBAR_W = 160
30
 
31
 
32
+ # ── アップデートダイアログ ────────────────────────────────────────────────
33
+
34
+ class _UpdateDialog(QDialog):
35
+ def __init__(self, tag: str, url: str, parent=None):
36
+ super().__init__(parent)
37
+ self._url = url
38
+ self.setWindowTitle("アップデートのお知らせ")
39
+ self.setFixedWidth(460)
40
+
41
+ layout = QVBoxLayout(self)
42
+ layout.setSpacing(12)
43
+
44
+ # タイトル
45
+ title = QLabel(f"🆕 新しいバージョン {tag} が利用可能です")
46
+ from PyQt6.QtGui import QFont
47
+ title.setFont(QFont("", 12, QFont.Weight.Bold))
48
+ layout.addWidget(title)
49
+
50
+ # 手順説明
51
+ steps = QLabel(
52
+ "ダウンロード・インストール前に以下の手順を必ず守ってください。\n\n"
53
+ " ① 「設定」画面の「バックアップ」ボタンでデータを保存する\n"
54
+ " ② 旧バージョンの EXE ファイルを削除する\n"
55
+ " ③ 新しい EXE をダウンロードして起動する\n\n"
56
+ "※ バックアップを取らずに更新すると、まれにデータが引き継げない場合があります。"
57
+ )
58
+ steps.setWordWrap(True)
59
+ steps.setStyleSheet(
60
+ "background:#fffbeb; border:1px solid #fcd34d; "
61
+ "border-radius:6px; padding:10px; line-height:1.6;"
62
+ )
63
+ layout.addWidget(steps)
64
+
65
+ # ボタン行
66
+ btn_row = QHBoxLayout()
67
+ btn_later = QPushButton("後で")
68
+ btn_later.setFixedHeight(34)
69
+ btn_later.clicked.connect(self.reject)
70
+
71
+ btn_open = QPushButton("ダウンロードページを開く →")
72
+ btn_open.setFixedHeight(34)
73
+ btn_open.setStyleSheet(
74
+ "QPushButton { background:#2563eb; color:white; border-radius:5px; "
75
+ "padding:0 16px; font-weight:bold; }"
76
+ " QPushButton:hover { background:#1d4ed8; }"
77
+ )
78
+ btn_open.clicked.connect(self._open_and_close)
79
+
80
+ btn_row.addWidget(btn_later)
81
+ btn_row.addStretch()
82
+ btn_row.addWidget(btn_open)
83
+ layout.addLayout(btn_row)
84
+
85
+ def _open_and_close(self):
86
+ from PyQt6.QtGui import QDesktopServices
87
+ from PyQt6.QtCore import QUrl
88
+ QDesktopServices.openUrl(QUrl(self._url))
89
+ self.accept()
90
+
91
+
92
  # ── アップデートチェッカー(バックグラウンドスレッド)──────────────────────
93
 
94
  class _UpdateChecker(QThread):
 
294
 
295
  def _on_update_result(self, is_newer: bool, tag: str, url: str):
296
  self._update_url = url
297
+ self._update_tag = tag
298
+ if not is_newer:
299
+ return
300
+
301
+ # サイドバーに常駐バナーを表示
302
+ self._update_label.setText(f"🆕 {tag}\n利用可能\nクリックで開く")
303
+ self._update_label.setVisible(True)
304
+ self._update_label.setStyleSheet(
305
+ "background:#1d4ed8; color:white; font-size:10px; "
306
+ "padding:6px 4px; border-radius:4px; margin:4px;"
307
+ )
308
+
309
+ # 初回通知ダイアログを表示
310
+ dlg = _UpdateDialog(tag, url, parent=self)
311
+ dlg.exec()
312
 
313
  def _on_update_label_clicked(self, event):
314
  url = getattr(self, "_update_url", "")
315
  if url:
316
+ tag = getattr(self, "_update_tag", "")
317
+ dlg = _UpdateDialog(tag, url, parent=self)
318
+ dlg.exec()
ui/schedule_view.py CHANGED
@@ -517,7 +517,7 @@ class ScheduleView(QWidget):
517
  reinf_note = "(応援要員)" if is_reinf else ""
518
  reply = QMessageBox.question(
519
  self, "シフト削除",
520
- f"{emp.name}{reinf_note} の {ds} {slot.short_label()} のアサインを削除しますか?",
521
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
522
  )
523
  if reply == QMessageBox.StandardButton.Yes:
@@ -547,7 +547,7 @@ class ScheduleView(QWidget):
547
  return
548
  reply = QMessageBox.question(
549
  self, "応援要員追加",
550
- f"「{emp.name}」はこの時間帯の希望を出していませんが、\n"
551
  f"応援要員として {ds} {slot.short_label()} に追加しますか?",
552
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
553
  )
@@ -781,7 +781,7 @@ class PositionSelectDialog(QDialog):
781
  super().__init__(parent)
782
  self.selected_position = None
783
  suffix = "(応援要員)" if is_reinforcement else ""
784
- self.setWindowTitle(f"{emp.name} のポジション選択{suffix}")
785
  self.setFixedWidth(340)
786
 
787
  layout = __import__("PyQt6.QtWidgets", fromlist=["QVBoxLayout"]).QVBoxLayout(self)
@@ -789,7 +789,7 @@ class PositionSelectDialog(QDialog):
789
  d = date.fromisoformat(ds)
790
  dow = DAY_OF_WEEK_LABELS[d.weekday()]
791
  layout.addWidget(QLabel(f"日付: {d.month}/{d.day}({dow}) {slot.short_label()}"))
792
- layout.addWidget(QLabel(f"従業員: {emp.name}"))
793
  if is_reinforcement:
794
  warn = QLabel("⚠️ この従業員は希望を出していません(応援要員として追加)")
795
  warn.setStyleSheet("color:#b45309; font-size:11px;")
 
517
  reinf_note = "(応援要員)" if is_reinf else ""
518
  reply = QMessageBox.question(
519
  self, "シフト削除",
520
+ f"{emp.name}さん{reinf_note} の {ds} {slot.short_label()} のアサインを削除しますか?",
521
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
522
  )
523
  if reply == QMessageBox.StandardButton.Yes:
 
547
  return
548
  reply = QMessageBox.question(
549
  self, "応援要員追加",
550
+ f"「{emp.name}さん」はこの時間帯の希望を出していませんが、\n"
551
  f"応援要員として {ds} {slot.short_label()} に追加しますか?",
552
  QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
553
  )
 
781
  super().__init__(parent)
782
  self.selected_position = None
783
  suffix = "(応援要員)" if is_reinforcement else ""
784
+ self.setWindowTitle(f"{emp.name}さんのポジション選択{suffix}")
785
  self.setFixedWidth(340)
786
 
787
  layout = __import__("PyQt6.QtWidgets", fromlist=["QVBoxLayout"]).QVBoxLayout(self)
 
789
  d = date.fromisoformat(ds)
790
  dow = DAY_OF_WEEK_LABELS[d.weekday()]
791
  layout.addWidget(QLabel(f"日付: {d.month}/{d.day}({dow}) {slot.short_label()}"))
792
+ layout.addWidget(QLabel(f"従業員: {emp.name}さん"))
793
  if is_reinforcement:
794
  warn = QLabel("⚠️ この従業員は希望を出していません(応援要員として追加)")
795
  warn.setStyleSheet("color:#b45309; font-size:11px;")
ui/shift_input_view.py CHANGED
@@ -481,4 +481,4 @@ class ShiftInputView(QWidget):
481
 
482
  repo.save_shift_requests(self._period.id, requests)
483
  self._update_progress()
484
- QMessageBox.information(self, "保存完了", f"「{emp.name}」の希望シフトを保存しました")
 
481
 
482
  repo.save_shift_requests(self._period.id, requests)
483
  self._update_progress()
484
+ QMessageBox.information(self, "保存完了", f"「{emp.name}さん」の希望シフトを保存しました")