Compare commits

...

6 Commits

Author SHA1 Message Date
adventuretc 98e6fcd9f1
Merge 6ac8b602bc into 766e9a9795 2024-02-19 08:10:36 -07:00
Сергій 766e9a9795
Translated using Weblate (Ukrainian)
Currently translated at 100.0% (116 of 116 strings)

Translation: Safe Eyes/Translations
Translate-URL: https://hosted.weblate.org/projects/safe-eyes/translations/uk/
2024-02-15 14:01:56 +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 24 additions and 14 deletions

View File

@ -6,17 +6,17 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2021-08-18 00:37+0000\n"
"Last-Translator: Tymofii Lytvynenko <till.svit@gmail.com>\n"
"PO-Revision-Date: 2024-02-15 13:01+0000\n"
"Last-Translator: Сергій <sergiy.goncharuk.1@gmail.com>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/uk/>\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.8-dev\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.4-dev\n"
# Short break
msgid "Tightly close your eyes"
@ -48,7 +48,7 @@ msgstr "Випийте води"
# Long break
msgid "Walk for a while"
msgstr "Трохи походіть"
msgstr "Прогуляйтесь"
# Long break
msgid "Lean back at your seat and relax"
@ -289,7 +289,7 @@ msgstr "Нова перерва"
# Settings dialog
msgid "Remove"
msgstr "Видалити"
msgstr "Вилучити"
# Settings dialog
msgid "Discard"

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