Add the terminated status in the gui
This commit is contained in:
1 parent
05466364d1
commit
5b1089e3cc
4 files changed
+9
-5
No files matched your search
+2
-1
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"status": {
|
||||
"exiting": "正在退出...",
|
||||
"terminated": "\n应用程序已终止,请关闭窗口以退出应用程序。",
|
||||
"goes_online": "{channel} 该频道已上线, 正在切换...",
|
||||
"goes_offline": "{channel} 该频道已离线, 正在切换...",
|
||||
@@ -28,6 +27,8 @@
|
||||
"status": {
|
||||
"name": "状态",
|
||||
"idle": "已完成获取",
|
||||
"exiting": "正在退出...",
|
||||
"terminated": "应用已终止运行",
|
||||
"cleanup": "清除频道中...",
|
||||
"gathering": "搜索直播频道...",
|
||||
"switching": "切换直播频道中...",
|
||||
|
||||
@@ -181,6 +181,7 @@ finally:
|
||||
loop.run_until_complete(client.shutdown())
|
||||
if not client.gui.close_requested:
|
||||
client.print(_("status", "terminated"))
|
||||
client.gui.status.update(_("gui", "status", "terminated"))
|
||||
loop.run_until_complete(client.gui.wait_until_closed())
|
||||
# save the application state
|
||||
# NOTE: we have to do it after wait_until_closed,
|
||||
|
||||
+4
-2
@@ -11,7 +11,6 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class StatusMessages(TypedDict):
|
||||
exiting: str
|
||||
terminated: str
|
||||
goes_online: str
|
||||
goes_offline: str
|
||||
@@ -40,6 +39,8 @@ class ErrorMessages(TypedDict):
|
||||
class GUIStatus(TypedDict):
|
||||
name: str
|
||||
idle: str
|
||||
exiting: str
|
||||
terminated: str
|
||||
cleanup: str
|
||||
gathering: str
|
||||
switching: str
|
||||
@@ -202,7 +203,6 @@ class Translation(TypedDict):
|
||||
|
||||
default_translation: Translation = {
|
||||
"status": {
|
||||
"exiting": "Exiting...",
|
||||
"terminated": "\nApplication Terminated.\nClose the window to exit the application.",
|
||||
"goes_online": "{channel} goes ONLINE, switching...",
|
||||
"goes_offline": "{channel} goes OFFLINE, switching...",
|
||||
@@ -233,6 +233,8 @@ default_translation: Translation = {
|
||||
"status": {
|
||||
"name": "Status",
|
||||
"idle": "Idle",
|
||||
"exiting": "Exiting...",
|
||||
"terminated": "Terminated",
|
||||
"watching": "Watching {channel}",
|
||||
"cleanup": "Cleaning up channels...",
|
||||
"gathering": "Gathering channels...",
|
||||
|
||||
@@ -88,7 +88,7 @@ class Twitch:
|
||||
|
||||
async def shutdown(self) -> None:
|
||||
start_time = time()
|
||||
self.gui.print(_("status", "exiting"))
|
||||
self.gui.print(_("gui", "status", "exiting"))
|
||||
self.stop_watching()
|
||||
if self._watching_task is not None:
|
||||
self._watching_task.cancel()
|
||||
@@ -394,7 +394,7 @@ class Twitch:
|
||||
# break the state change chain by clearing the flag
|
||||
self._state_change.clear()
|
||||
elif self._state is State.EXIT:
|
||||
self.gui.status.update(_("status", "exiting"))
|
||||
self.gui.status.update(_("gui", "status", "exiting"))
|
||||
# we've been requested to exit the application
|
||||
break
|
||||
await self._state_change.wait()
|
||||
|
||||
Reference in new issue
Block a user