Skip to content

Commit 706eee6

Browse files
committed
在闪抽动画播放结束后,同时显示“x秒后关闭”和“连续点击3下关闭”
1 parent 231f213 commit 706eee6

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

app/Language/modules/notification_settings.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
"notification_result": {
1616
"name": "通知结果",
1717
"description": "通用通知结果窗口标题",
18-
}
18+
},
19+
"auto_close_hint": "{0}秒后自动关闭\n连续点击3次关闭窗口",
20+
"manual_close_hint": "连续点击3次关闭窗口",
1921
},
2022
"EN_US": {
2123
"notification_result": {
2224
"name": "Notice results",
2325
"description": "Generic notification result window title",
24-
}
26+
},
27+
"auto_close_hint": "Auto close in {0}s\nClick 3 times to close window",
28+
"manual_close_hint": "Click 3 times to close window",
2529
},
2630
}
2731

app/common/notification/notification_service.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from app.page_building.page_template import PageTemplate
99
from app.tools.variable import WINDOW_BOTTOM_POSITION_FACTOR
10+
from app.Language.obtain_language import get_any_position_value
1011

1112

1213
class NotificationContentWidget(QWidget):
@@ -331,18 +332,26 @@ def apply_settings(self, settings=None):
331332
else:
332333
# 停止倒计时更新定时器并显示手动关闭提示
333334
self.countdown_timer.stop()
334-
self.countdown_label.setText("连续点击3次关闭窗口")
335+
self.countdown_label.setText(
336+
get_any_position_value("notification_common", "manual_close_hint")
337+
)
335338

336339
def update_countdown_display(self):
337340
"""更新倒计时显示"""
338341
self.remaining_time -= 1
339342
# 动画完成时显示倒计时
340343
if self.remaining_time >= 0:
341-
self.countdown_label.setText(f"{self.remaining_time + 1}秒后自动关闭")
344+
self.countdown_label.setText(
345+
get_any_position_value("notification_common", "auto_close_hint").format(
346+
self.remaining_time + 1
347+
)
348+
)
342349
else:
343350
# 当倒计时结束时停止定时器
344351
self.countdown_timer.stop()
345-
self.countdown_label.setText("连续点击3次关闭窗口")
352+
self.countdown_label.setText(
353+
get_any_position_value("notification_common", "manual_close_hint")
354+
)
346355

347356
def _on_theme_changed(self):
348357
"""主题切换时更新浮窗内文字和背景颜色"""

0 commit comments

Comments
 (0)