Compare commits

...

6 Commits

Author SHA1 Message Date
adventuretc 221d38fe66
Merge 6ac8b602bc into 00c33908a3 2024-02-29 08:21:31 -07:00
aerowolf 00c33908a3
Translated using Weblate (Chinese (Simplified))
Currently translated at 100.0% (116 of 116 strings)

Translation: Safe Eyes/Translations
Translate-URL: https://hosted.weblate.org/projects/safe-eyes/translations/zh_Hans/
2024-02-21 11:01:57 +01:00
adventuretc 6ac8b602bc . 2024-01-27 15:32:33 +01:00
adventuretc 72eb1575d9 Fixed SafeEyes breaks not being called , (Chromium snap refuses dbus)
Fixed SafeEyes breaks not being called (crashing) when Chromium snap refuses dbus access
2024-01-19 18:37:17 +01:00
adventuretc 756e2f641d Fixed SafeEyes not being able to run on ubuntu 20.04 LTS 2024-01-19 18:35:58 +01:00
adventuretc 0e2a13110f Fixed smartpause plugin not working. 2024-01-19 18:35:26 +01:00
4 changed files with 43 additions and 33 deletions

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-10-10 05:05+0000\n"
"Last-Translator: Frank.wu <me@wuzhiping.top>\n"
"PO-Revision-Date: 2024-02-21 10:01+0000\n"
"Last-Translator: aerowolf <aerowolf@tom.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"safe-eyes/translations/zh_Hans/>\n"
"Language: zh_CN\n"
@ -15,23 +15,23 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.9-dev\n"
"X-Generator: Weblate 5.5-dev\n"
# Short break
msgid "Tightly close your eyes"
msgstr "闭上您的眼睛休息一会"
msgstr "闭上眼睛休息一下"
# Short break
msgid "Roll your eyes a few times to each side"
msgstr "向两边各翻几下眼睛"
msgstr "左右转动眼球"
# Short break
msgid "Rotate your eyes in clockwise direction"
msgstr "按顺时针方向旋转你的眼球"
msgstr "顺时针方向转动眼球"
# Short break
msgid "Rotate your eyes in counterclockwise direction"
msgstr "按逆时针方向旋转你的眼球"
msgstr "逆时针方向转动眼球"
# Short break
msgid "Blink your eyes"
@ -39,11 +39,11 @@ msgstr "眨眨眼"
# Short break
msgid "Focus on a point in the far distance"
msgstr "望远:将视线聚焦到远处物体上"
msgstr "远眺:看看尽可能远的远处"
# Short break
msgid "Have some water"
msgstr "喝点水"
msgstr "喝点水"
# Long break
msgid "Walk for a while"
@ -51,7 +51,7 @@ msgstr "站起来走走"
# Long break
msgid "Lean back at your seat and relax"
msgstr "靠在椅背上休息一"
msgstr "靠在椅背上休息一"
# Commandline arg description
msgid "show the about dialog"
@ -59,15 +59,15 @@ msgstr "显示“关于”对话框"
# Commandline arg description
msgid "disable the currently running safeeyes instance"
msgstr "禁用当前正在运行的Safe Eyes"
msgstr "暂停当前正在运行的Safe Eyes"
# Commandline arg description
msgid "enable the currently running safeeyes instance"
msgstr "启用当前正在运行的Safe Eyes"
msgstr "恢复当前正在运行的Safe Eyes"
# Commandline arg description
msgid "quit the running safeeyes instance and exit"
msgstr "退出正在运行的Safe Eeyes"
msgstr "退出Safe Eeyes"
# Commandline arg description
msgid "show the settings dialog"
@ -79,17 +79,17 @@ msgstr "以调试模式运行Safe Eyes"
# Commandline arg description
msgid "print the status of running safeeyes instance and exit"
msgstr "打印Safe Eyes运行状态后退出"
msgstr "显示Safe Eyes运行状态后退出"
# Status message
msgid "Safe Eyes is not running"
msgstr "Safe Eyes 尚未运行"
msgstr "Safe Eyes 没有运行"
# RPC not enabled message
msgid ""
"Safe Eyes is running without an RPC server. Turn it on to use command-line "
"arguments."
msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开以使用命令行参数。"
msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开RPC服务器可以使用命令行参数。"
# About dialog
msgid "Close"
@ -106,7 +106,7 @@ msgstr ""
# About dialog
msgid "License"
msgstr "许可"
msgstr "许可"
# Break screen
msgid "Skip"
@ -142,7 +142,7 @@ msgstr "以随机顺序显示休息"
# Settings dialog
msgid "Strict break (No way to skip breaks)"
msgstr "坚持休息(无法跳过)"
msgstr "坚持休息(不允许跳过)"
# Settings dialog
msgid "Allow postponing breaks"
@ -150,7 +150,7 @@ msgstr "允许推迟休息"
# Settings dialog
msgid "Persist the internal state"
msgstr "持内部状态"
msgstr "持内部状态"
# Settings dialog
msgid "Use RPC server to receive runtime commands"
@ -414,11 +414,11 @@ msgstr "在通知区域显示托盘图标"
#: plugins/trayicon
msgid "Show next break time in tray icon"
msgstr "在托盘图标显示下次休息时间"
msgstr "在托盘图标显示下次休息时间"
#: plugins/trayicon
msgid "Allow disabling Safe Eyes"
msgstr "允许禁用Safe Eyes"
msgstr "允许暂停Safe Eyes"
#: plugins/trayicon
msgid "About"
@ -426,19 +426,19 @@ msgstr "关于"
#: plugins/trayicon
msgid "Disable Safe Eyes"
msgstr "禁用 Safe Eyes"
msgstr "暂停 Safe Eyes"
#: plugins/trayicon
msgid "Disabled until %s"
msgstr "禁用软件直到 %s"
msgstr "暂停,直到 %s"
#: plugins/trayicon
msgid "Disabled until restart"
msgstr "禁用软件直到重启"
msgstr "暂停,直到重启"
#: plugins/trayicon
msgid "Enable Safe Eyes"
msgstr "启用 Safe Eyes"
msgstr "恢复 Safe Eyes"
#: plugins/trayicon
msgid "For %d Hour"
@ -457,7 +457,7 @@ msgstr[0] "%d 秒"
#: plugins/trayicon
msgid "Next break at %s"
msgstr "下次休息在 %s"
msgstr "下次休息在 %s"
#: plugins/trayicon
msgid "No Breaks Available"

View File

@ -55,7 +55,8 @@ def init(ctx, safeeyes_config, plugin_config):
'total_resets': 0,
}
session = context['session']['plugin'].get('healthstats', {}) | defaults
session = context['session']['plugin'].get('healthstats', {}).copy()
session.update(defaults) # refactored to maintain compatibility with python3.8 on Ubuntu 20.04 LTS (dict | dict syntax was introduced in python3.9).
if 'no_of_breaks' in session:
# Ignore old format session.
session = defaults

View File

@ -23,6 +23,7 @@ Media Control plugin lets users to pause currently playing media player from the
import logging
import os
import dbus
import dbus.exceptions
import re
import gi
from safeeyes.model import TrayAction
@ -41,11 +42,18 @@ def __active_players():
for service in bus.list_names():
if re.match('org.mpris.MediaPlayer2.', service):
player = bus.get_object(service, "/org/mpris/MediaPlayer2")
interface = dbus.Interface(player, 'org.freedesktop.DBus.Properties')
status = str(interface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')).lower()
if status == "playing":
players.append(player)
try:
player = bus.get_object(service, "/org/mpris/MediaPlayer2")
interface = dbus.Interface(player, 'org.freedesktop.DBus.Properties')
status = str(interface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')).lower()
if status == "playing":
players.append(player)
except dbus.exceptions.DBusException as e:
# Purpose of this: The Chromium snap (at least on ubuntu 20.04 LTS) forbids SafeEyes from sending dbus messages to Chromium and we must catch that exception and ignore that particular player. If we don't, the the method and plugin fails and the break itself fails to be called. With this fix, only impossible-to-reach players are ignored and all else works.
# The specific exception is (dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied)
# We don't care about logging the error but maybe we should log it in debug mode:
logging.debug(f"DBusException: {e}")
return players

View File

@ -194,7 +194,8 @@ def __start_idle_monitor():
smart_pause_activated = True
idle_start_time = datetime.datetime.now() - datetime.timedelta(seconds=system_idle_time)
logging.info('Pause Safe Eyes due to system idle')
disable_safeeyes(None, True)
info = _('Paused Safe Eyes due to system being idle')
disable_safeeyes(info, True)
elif system_idle_time < idle_time and context['state'] == State.RESTING and idle_start_time is not None:
logging.info('Resume Safe Eyes due to user activity')
smart_pause_activated = False