Compare commits
6 Commits
0565084554
...
98e6fcd9f1
Author | SHA1 | Date |
---|---|---|
adventuretc | 98e6fcd9f1 | |
Сергій | 766e9a9795 | |
adventuretc | 6ac8b602bc | |
adventuretc | 72eb1575d9 | |
adventuretc | 756e2f641d | |
adventuretc | 0e2a13110f |
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue