Add interval to reset screen time option
This commit is contained in:
parent
04a10b17ff
commit
66a29c602c
|
@ -320,6 +320,10 @@ msgstr "الإحصاءات الصحية"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "وتظهر الإحصاءات استناداً إلى كيفية استخدام \"safe eyes\""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "الإشعارات"
|
||||
|
|
|
@ -317,6 +317,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Zdravotní statistiky"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Zobrazit zdravotní statistiky založené na používání Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Oznámení"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr "Sundhedsstatistikker"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Vis statistikker baseret på brug af Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Meddelelse"
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Statistik Gesundheit"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Statistik Gesundheit anzeigen"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Benachrichtigung"
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Health Statistics"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Show statistics based on how you use Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr "Interval to reset screen time (in hours)"
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Notification"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr "Estadísticas de salud"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Mostrar estadísticas basadas en cómo usa Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Notificacion"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr "Statistika"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Programmikasutuse statistika kuvamine"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Teavitus"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -326,6 +326,10 @@ msgstr "Statistiques de santé"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Afficher des statistiques basées sur votre utilisation de Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Notification"
|
||||
|
|
|
@ -318,6 +318,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -319,6 +319,10 @@ msgstr "Egészség Statisztikák"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Mutass statisztikákat arról, ahogy a Safe Eyes-t használod"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Értesítés"
|
||||
|
|
|
@ -318,6 +318,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -324,6 +324,10 @@ msgstr "Statistiche"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Mostra le statistiche basate sull'uso di Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Notifiche"
|
||||
|
|
|
@ -323,6 +323,10 @@ msgstr "Sveikatos statistika"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Rodyti statistiką pagal tai, kaip naudojate Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Pranešimas"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -8,8 +8,8 @@ msgstr ""
|
|||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2019-02-26 19:18+0000\n"
|
||||
"Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n"
|
||||
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/"
|
||||
"safe-eyes/translations/nb_NO/>\n"
|
||||
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/safe-"
|
||||
"eyes/translations/nb_NO/>\n"
|
||||
"Language: nb\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
@ -320,6 +320,10 @@ msgstr "Helsestatistikk"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Vis statistikk basert på din bruk av Øyetrygg"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Merknad"
|
||||
|
|
|
@ -326,6 +326,10 @@ msgstr "Gezondheidsstatistieken"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Toon statistieken, gebaseerd op hoe je Safe Eyes gebruikt"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Melding"
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Statystyki Zdrowotne"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Pokaż statystyki oparte o Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Powiadomienia"
|
||||
|
|
|
@ -323,6 +323,10 @@ msgstr "Estatísticas de saúde"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Mostrar estatísticas baseadas em como você usa o Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Notificação"
|
||||
|
|
|
@ -319,6 +319,10 @@ msgstr "Статистика здоровья"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Показывать статистику основанную на использовании Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Уведомления"
|
||||
|
|
|
@ -306,6 +306,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Zdravotné štatistiky"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Zobraziť štatistiky o tom, ako používate Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Oznámenia"
|
||||
|
|
|
@ -317,6 +317,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -323,6 +323,10 @@ msgstr "ஆரோக்கிய புள்ளிவிவரங்கள்"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Safe Eyes பயன்பாடு அடிப்படையிலான ஆரோக்கிய புள்ளிவிவரங்கள்"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr "திரை நேரத்தை மீட்டமைப்பதற்கான இடைவேளை (மணித்தியாலங்களில்)"
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "முன்னறிவிப்பு"
|
||||
|
|
|
@ -321,6 +321,10 @@ msgstr "Sağlık İstatistikleri"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Safe Eyes kullanımınıza ait istatistikler"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Bildirim"
|
||||
|
|
|
@ -317,6 +317,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -324,6 +324,10 @@ msgstr "Статистика здоров'я"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Показувати статистику на основі використання вами програми Safe Eyes"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Сповіщення"
|
||||
|
|
|
@ -317,6 +317,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -322,6 +322,10 @@ msgstr "Thống kê sức khoẻ"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "Hiện thống kê dựa trên việc bạn sử dụng Safe Eyes như thế nào"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "Thông báo"
|
||||
|
|
|
@ -320,6 +320,10 @@ msgstr "健康统计"
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr "基于你如何使用 Safe Eyes 展示统计数据"
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr "通知"
|
||||
|
|
|
@ -318,6 +318,10 @@ msgstr ""
|
|||
msgid "Show statistics based on how you use Safe Eyes"
|
||||
msgstr ""
|
||||
|
||||
# plugin/healthstats
|
||||
msgid "Interval to reset screen time (in hours)"
|
||||
msgstr ""
|
||||
|
||||
# plugin/notification
|
||||
msgid "Notification"
|
||||
msgstr ""
|
||||
|
|
|
@ -117,7 +117,10 @@
|
|||
{
|
||||
"id": "healthstats",
|
||||
"enabled": false,
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.2",
|
||||
"settings": {
|
||||
"screen_time_reset_interval": 24
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "mediacontrol",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"meta": {
|
||||
"name": "Health Statistics",
|
||||
"description": "Show statistics based on how you use Safe Eyes",
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"python_modules": [],
|
||||
|
@ -11,6 +11,13 @@
|
|||
"desktop_environments": [],
|
||||
"resources": []
|
||||
},
|
||||
"settings": [],
|
||||
"settings": [{
|
||||
"id": "screen_time_reset_interval",
|
||||
"label": "Interval to reset screen time (in hours)",
|
||||
"type": "INT",
|
||||
"default": 24,
|
||||
"max": 168,
|
||||
"min": 1
|
||||
}],
|
||||
"break_override_allowed": true
|
||||
}
|
|
@ -30,6 +30,7 @@ no_of_cycles = -1
|
|||
session = None
|
||||
safe_eyes_start_time = datetime.datetime.now()
|
||||
total_idle_time = 0
|
||||
reset_interval = 86400 # 24 hours in seconds
|
||||
|
||||
|
||||
def init(ctx, safeeyes_config, plugin_config):
|
||||
|
@ -41,6 +42,7 @@ def init(ctx, safeeyes_config, plugin_config):
|
|||
global no_of_skipped_breaks
|
||||
global no_of_breaks
|
||||
global no_of_cycles
|
||||
global reset_interval
|
||||
logging.debug('Initialize Health Stats plugin')
|
||||
context = ctx
|
||||
if session is None:
|
||||
|
@ -52,6 +54,7 @@ def init(ctx, safeeyes_config, plugin_config):
|
|||
no_of_skipped_breaks = session.get('no_of_skipped_breaks', 0)
|
||||
no_of_breaks = session.get('no_of_breaks', 0)
|
||||
no_of_cycles = session.get('no_of_cycles', -1)
|
||||
reset_interval = session.get('screen_time_reset_interval', 24) * 3600
|
||||
|
||||
|
||||
def on_stop_break():
|
||||
|
@ -78,11 +81,24 @@ def get_widget_title(break_obj):
|
|||
return _('Health Statistics')
|
||||
|
||||
|
||||
def _reset_screen_time():
|
||||
global safe_eyes_start_time
|
||||
global total_idle_time
|
||||
current_time = datetime.datetime.now()
|
||||
total_duration_sec = (current_time - safe_eyes_start_time).total_seconds()
|
||||
if total_duration_sec >= reset_interval:
|
||||
total_duration_sec -= reset_interval
|
||||
safe_eyes_start_time = current_time - datetime.timedelta(seconds=total_duration_sec)
|
||||
total_idle_time = 0
|
||||
return total_duration_sec
|
||||
|
||||
|
||||
def get_widget_content(break_obj):
|
||||
"""
|
||||
Return the statistics.
|
||||
"""
|
||||
screen_time = round(((datetime.datetime.now() - safe_eyes_start_time).total_seconds() - total_idle_time) / 60)
|
||||
total_duration_sec = _reset_screen_time()
|
||||
screen_time = round((total_duration_sec - total_idle_time) / 60)
|
||||
hours, minutes = divmod(screen_time, 60)
|
||||
time_format = '{:02d}:{:02d}'.format(hours, minutes)
|
||||
if hours > 6 or round((no_of_skipped_breaks / no_of_breaks), 1) >= 0.2:
|
||||
|
@ -98,6 +114,7 @@ def on_start():
|
|||
"""
|
||||
Add the idle period to the total idle time.
|
||||
"""
|
||||
_reset_screen_time()
|
||||
global total_idle_time
|
||||
# idle_period is provided by Smart Pause plugin
|
||||
total_idle_time += context.get('idle_period', 0)
|
||||
|
|
Loading…
Reference in New Issue