Add the terminated status in the gui

This commit is contained in:
DevilXD committed 2022-08-19 10:18:41 +02:00
1 parent 05466364d1
commit 5b1089e3cc
4 files changed
+9 -5

No files matched your search

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