Compare commits
6 Commits
7f2002c85d
...
fefffe857d
Author | SHA1 | Date |
---|---|---|
undefiened | fefffe857d | |
aerowolf | 00c33908a3 | |
undefiened | a54c16476e | |
undefiened | bc7ae63120 | |
undefiened | 3428759a85 | |
undefiened | bd51aed724 |
|
@ -500,3 +500,19 @@ msgstr "Pause media"
|
||||||
# plugin/healthstats
|
# plugin/healthstats
|
||||||
#~ msgid "Interval to reset statistics (in hours)"
|
#~ msgid "Interval to reset statistics (in hours)"
|
||||||
#~ msgstr "Interval to reset statistics (in hours)"
|
#~ msgstr "Interval to reset statistics (in hours)"
|
||||||
|
|
||||||
|
# plugin/limitconsecutiveskipping
|
||||||
|
msgid "Limit Consecutive Skipping"
|
||||||
|
msgstr "Limit Consecutive Skipping"
|
||||||
|
|
||||||
|
# plugin/limitconsecutiveskipping
|
||||||
|
msgid "How many skips or postpones are allowed in a row"
|
||||||
|
msgstr "How many skips or postpones are allowed in a row"
|
||||||
|
|
||||||
|
# plugin/limitconsecutiveskipping
|
||||||
|
msgid "Limit how many breaks can be skipped or postponed in a row"
|
||||||
|
msgstr "Limit how many breaks can be skipped or postponed in a row"
|
||||||
|
|
||||||
|
# plugin/limitconsecutiveskipping
|
||||||
|
msgid "Skipped or postponed %d/%d breaks in a row"
|
||||||
|
msgstr "Skipped or postponed %d/%d breaks in a row"
|
|
@ -6,8 +6,8 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: \n"
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: 2021-10-10 05:05+0000\n"
|
"PO-Revision-Date: 2024-02-21 10:01+0000\n"
|
||||||
"Last-Translator: Frank.wu <me@wuzhiping.top>\n"
|
"Last-Translator: aerowolf <aerowolf@tom.com>\n"
|
||||||
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
|
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
|
||||||
"safe-eyes/translations/zh_Hans/>\n"
|
"safe-eyes/translations/zh_Hans/>\n"
|
||||||
"Language: zh_CN\n"
|
"Language: zh_CN\n"
|
||||||
|
@ -15,23 +15,23 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||||
"X-Generator: Weblate 4.9-dev\n"
|
"X-Generator: Weblate 5.5-dev\n"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Tightly close your eyes"
|
msgid "Tightly close your eyes"
|
||||||
msgstr "闭上您的眼睛休息一会"
|
msgstr "闭上眼睛休息一下"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Roll your eyes a few times to each side"
|
msgid "Roll your eyes a few times to each side"
|
||||||
msgstr "向两边各翻几下眼睛"
|
msgstr "左右转动眼球"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Rotate your eyes in clockwise direction"
|
msgid "Rotate your eyes in clockwise direction"
|
||||||
msgstr "按顺时针方向旋转你的眼球"
|
msgstr "顺时针方向转动眼球"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Rotate your eyes in counterclockwise direction"
|
msgid "Rotate your eyes in counterclockwise direction"
|
||||||
msgstr "按逆时针方向旋转你的眼球"
|
msgstr "逆时针方向转动眼球"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Blink your eyes"
|
msgid "Blink your eyes"
|
||||||
|
@ -39,11 +39,11 @@ msgstr "眨眨眼"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Focus on a point in the far distance"
|
msgid "Focus on a point in the far distance"
|
||||||
msgstr "望远:将视线聚焦到远处物体上"
|
msgstr "远眺:看看尽可能远的远处"
|
||||||
|
|
||||||
# Short break
|
# Short break
|
||||||
msgid "Have some water"
|
msgid "Have some water"
|
||||||
msgstr "喝一点水"
|
msgstr "喝点水吧"
|
||||||
|
|
||||||
# Long break
|
# Long break
|
||||||
msgid "Walk for a while"
|
msgid "Walk for a while"
|
||||||
|
@ -51,7 +51,7 @@ msgstr "站起来走走"
|
||||||
|
|
||||||
# Long break
|
# Long break
|
||||||
msgid "Lean back at your seat and relax"
|
msgid "Lean back at your seat and relax"
|
||||||
msgstr "靠在椅背上休息一会"
|
msgstr "靠在椅背上休息一下"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "show the about dialog"
|
msgid "show the about dialog"
|
||||||
|
@ -59,15 +59,15 @@ msgstr "显示“关于”对话框"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "disable the currently running safeeyes instance"
|
msgid "disable the currently running safeeyes instance"
|
||||||
msgstr "禁用当前正在运行的Safe Eyes"
|
msgstr "暂停当前正在运行的Safe Eyes"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "enable the currently running safeeyes instance"
|
msgid "enable the currently running safeeyes instance"
|
||||||
msgstr "启用当前正在运行的Safe Eyes"
|
msgstr "恢复当前正在运行的Safe Eyes"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "quit the running safeeyes instance and exit"
|
msgid "quit the running safeeyes instance and exit"
|
||||||
msgstr "退出正在运行的Safe Eeyes"
|
msgstr "退出Safe Eeyes"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "show the settings dialog"
|
msgid "show the settings dialog"
|
||||||
|
@ -79,17 +79,17 @@ msgstr "以调试模式运行Safe Eyes"
|
||||||
|
|
||||||
# Commandline arg description
|
# Commandline arg description
|
||||||
msgid "print the status of running safeeyes instance and exit"
|
msgid "print the status of running safeeyes instance and exit"
|
||||||
msgstr "打印Safe Eyes运行状态后退出"
|
msgstr "显示Safe Eyes运行状态后退出"
|
||||||
|
|
||||||
# Status message
|
# Status message
|
||||||
msgid "Safe Eyes is not running"
|
msgid "Safe Eyes is not running"
|
||||||
msgstr "Safe Eyes 尚未运行"
|
msgstr "Safe Eyes 没有运行"
|
||||||
|
|
||||||
# RPC not enabled message
|
# RPC not enabled message
|
||||||
msgid ""
|
msgid ""
|
||||||
"Safe Eyes is running without an RPC server. Turn it on to use command-line "
|
"Safe Eyes is running without an RPC server. Turn it on to use command-line "
|
||||||
"arguments."
|
"arguments."
|
||||||
msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开它以使用命令行参数。"
|
msgstr "Safe Eyes 正在没有RPC服务器的情况下运行。打开RPC服务器可以使用命令行参数。"
|
||||||
|
|
||||||
# About dialog
|
# About dialog
|
||||||
msgid "Close"
|
msgid "Close"
|
||||||
|
@ -106,7 +106,7 @@ msgstr ""
|
||||||
|
|
||||||
# About dialog
|
# About dialog
|
||||||
msgid "License"
|
msgid "License"
|
||||||
msgstr "许可证"
|
msgstr "许可"
|
||||||
|
|
||||||
# Break screen
|
# Break screen
|
||||||
msgid "Skip"
|
msgid "Skip"
|
||||||
|
@ -142,7 +142,7 @@ msgstr "以随机顺序显示休息"
|
||||||
|
|
||||||
# Settings dialog
|
# Settings dialog
|
||||||
msgid "Strict break (No way to skip breaks)"
|
msgid "Strict break (No way to skip breaks)"
|
||||||
msgstr "坚持休息(无法跳过)"
|
msgstr "坚持休息(不允许跳过)"
|
||||||
|
|
||||||
# Settings dialog
|
# Settings dialog
|
||||||
msgid "Allow postponing breaks"
|
msgid "Allow postponing breaks"
|
||||||
|
@ -150,7 +150,7 @@ msgstr "允许推迟休息"
|
||||||
|
|
||||||
# Settings dialog
|
# Settings dialog
|
||||||
msgid "Persist the internal state"
|
msgid "Persist the internal state"
|
||||||
msgstr "维持内部状态"
|
msgstr "支持内部状态"
|
||||||
|
|
||||||
# Settings dialog
|
# Settings dialog
|
||||||
msgid "Use RPC server to receive runtime commands"
|
msgid "Use RPC server to receive runtime commands"
|
||||||
|
@ -414,11 +414,11 @@ msgstr "在通知区域显示托盘图标"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Show next break time in tray icon"
|
msgid "Show next break time in tray icon"
|
||||||
msgstr "在托盘图标上显示下次休息时间"
|
msgstr "在托盘图标中显示下次休息时间"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Allow disabling Safe Eyes"
|
msgid "Allow disabling Safe Eyes"
|
||||||
msgstr "允许禁用Safe Eyes"
|
msgstr "允许暂停Safe Eyes"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "About"
|
msgid "About"
|
||||||
|
@ -426,19 +426,19 @@ msgstr "关于"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Disable Safe Eyes"
|
msgid "Disable Safe Eyes"
|
||||||
msgstr "禁用 Safe Eyes"
|
msgstr "暂停 Safe Eyes"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Disabled until %s"
|
msgid "Disabled until %s"
|
||||||
msgstr "禁用软件直到 %s"
|
msgstr "暂停,直到 %s"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Disabled until restart"
|
msgid "Disabled until restart"
|
||||||
msgstr "禁用软件直到重启"
|
msgstr "暂停,直到重启"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Enable Safe Eyes"
|
msgid "Enable Safe Eyes"
|
||||||
msgstr "启用 Safe Eyes"
|
msgstr "恢复 Safe Eyes"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "For %d Hour"
|
msgid "For %d Hour"
|
||||||
|
@ -457,7 +457,7 @@ msgstr[0] "%d 秒"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "Next break at %s"
|
msgid "Next break at %s"
|
||||||
msgstr "下次休息在 %s"
|
msgstr "下次休息将在 %s"
|
||||||
|
|
||||||
#: plugins/trayicon
|
#: plugins/trayicon
|
||||||
msgid "No Breaks Available"
|
msgid "No Breaks Available"
|
||||||
|
|
|
@ -67,6 +67,8 @@ class SafeEyesCore:
|
||||||
self.context = context
|
self.context = context
|
||||||
self.context['skipped'] = False
|
self.context['skipped'] = False
|
||||||
self.context['postponed'] = False
|
self.context['postponed'] = False
|
||||||
|
self.context['skip_button_disabled'] = False
|
||||||
|
self.context['postpone_button_disabled'] = False
|
||||||
self.context['state'] = State.WAITING
|
self.context['state'] = State.WAITING
|
||||||
|
|
||||||
def initialize(self, config):
|
def initialize(self, config):
|
||||||
|
@ -299,6 +301,8 @@ class SafeEyesCore:
|
||||||
|
|
||||||
# Reset the skipped flag
|
# Reset the skipped flag
|
||||||
self.context['skipped'] = False
|
self.context['skipped'] = False
|
||||||
|
self.context['skip_button_disabled'] = False
|
||||||
|
self.context['postpone_button_disabled'] = False
|
||||||
self.__start_next_break()
|
self.__start_next_break()
|
||||||
|
|
||||||
def __wait_for(self, duration):
|
def __wait_for(self, duration):
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"name": "Limit Consecutive Skipping",
|
||||||
|
"description": "Limit how many breaks can be skipped or postponed in a row",
|
||||||
|
"version": "0.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"python_modules": [],
|
||||||
|
"shell_commands": [],
|
||||||
|
"operating_systems": [],
|
||||||
|
"desktop_environments": [],
|
||||||
|
"resources": []
|
||||||
|
},
|
||||||
|
"settings": [{
|
||||||
|
"id": "number_of_allowed_skips_in_a_row",
|
||||||
|
"label": "How many skips or postpones are allowed in a row",
|
||||||
|
"type": "INT",
|
||||||
|
"default": 2,
|
||||||
|
"min": 1,
|
||||||
|
"max": 100
|
||||||
|
}],
|
||||||
|
"break_override_allowed": true
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 959 B |
|
@ -0,0 +1,94 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
Limit how many breaks can be skipped or postponed in a row.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
context = None
|
||||||
|
no_of_skipped_breaks = 0
|
||||||
|
session = None
|
||||||
|
enabled = True
|
||||||
|
|
||||||
|
def init(ctx, safeeyes_config, plugin_config):
|
||||||
|
"""
|
||||||
|
Initialize the plugin.
|
||||||
|
"""
|
||||||
|
global enabled
|
||||||
|
global context
|
||||||
|
global session
|
||||||
|
global no_of_skipped_breaks
|
||||||
|
global no_allowed_skips
|
||||||
|
|
||||||
|
logging.debug('Initialize Limit consecutive skipping plugin')
|
||||||
|
context = ctx
|
||||||
|
|
||||||
|
no_allowed_skips = plugin_config.get('number_of_allowed_skips_in_a_row', 2)
|
||||||
|
|
||||||
|
if session is None:
|
||||||
|
# Read the session
|
||||||
|
session = context['session']['plugin'].get('limitconsecutiveskipping', None)
|
||||||
|
if session is None:
|
||||||
|
session = {'no_of_skipped_breaks': 0}
|
||||||
|
context['session']['plugin']['limitconsecutiveskipping'] = session
|
||||||
|
no_of_skipped_breaks = session.get('no_of_skipped_breaks', 0)
|
||||||
|
|
||||||
|
|
||||||
|
def on_stop_break():
|
||||||
|
"""
|
||||||
|
After the break, check if it is skipped.
|
||||||
|
"""
|
||||||
|
# Check if the plugin is enabled
|
||||||
|
if not enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
global no_of_skipped_breaks
|
||||||
|
if context['skipped'] or context['postponed']:
|
||||||
|
no_of_skipped_breaks += 1
|
||||||
|
session['no_of_skipped_breaks'] = no_of_skipped_breaks
|
||||||
|
else:
|
||||||
|
no_of_skipped_breaks = 0
|
||||||
|
session['no_of_skipped_breaks'] = no_of_skipped_breaks
|
||||||
|
|
||||||
|
|
||||||
|
def on_start_break(break_obj):
|
||||||
|
logging.debug('Skipped / allowed = {} / {}'.format(no_of_skipped_breaks, no_allowed_skips))
|
||||||
|
|
||||||
|
if no_of_skipped_breaks >= no_allowed_skips:
|
||||||
|
context['postpone_button_disabled'] = True
|
||||||
|
context['skip_button_disabled'] = True
|
||||||
|
|
||||||
|
|
||||||
|
def get_widget_title(break_obj):
|
||||||
|
"""
|
||||||
|
Return the widget title.
|
||||||
|
"""
|
||||||
|
# Check if the plugin is enabled
|
||||||
|
if not enabled:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
return _('Limit Consecutive Skipping')
|
||||||
|
|
||||||
|
|
||||||
|
def get_widget_content(break_obj):
|
||||||
|
"""
|
||||||
|
Return the statistics.
|
||||||
|
"""
|
||||||
|
# Check if the plugin is enabled
|
||||||
|
if not enabled:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
return _('Skipped or postponed %d/%d breaks in a row') % (no_of_skipped_breaks, no_allowed_skips)
|
||||||
|
|
|
@ -155,6 +155,9 @@ class BreakScreen:
|
||||||
no_of_monitors = screen.get_n_monitors()
|
no_of_monitors = screen.get_n_monitors()
|
||||||
logging.info("Show break screens in %d display(s)", no_of_monitors)
|
logging.info("Show break screens in %d display(s)", no_of_monitors)
|
||||||
|
|
||||||
|
skip_button_disabled = self.context.get('skip_button_disabled', False)
|
||||||
|
postpone_button_disabled = self.context.get('postpone_button_disabled', False)
|
||||||
|
|
||||||
for monitor in range(no_of_monitors):
|
for monitor in range(no_of_monitors):
|
||||||
monitor_gemoetry = screen.get_monitor_geometry(monitor)
|
monitor_gemoetry = screen.get_monitor_geometry(monitor)
|
||||||
x = monitor_gemoetry.x
|
x = monitor_gemoetry.x
|
||||||
|
@ -186,7 +189,7 @@ class BreakScreen:
|
||||||
toolbar_button.show()
|
toolbar_button.show()
|
||||||
|
|
||||||
# Add the buttons
|
# Add the buttons
|
||||||
if self.enable_postpone:
|
if self.enable_postpone and not postpone_button_disabled:
|
||||||
# Add postpone button
|
# Add postpone button
|
||||||
btn_postpone = Gtk.Button(_('Postpone'))
|
btn_postpone = Gtk.Button(_('Postpone'))
|
||||||
btn_postpone.get_style_context().add_class('btn_postpone')
|
btn_postpone.get_style_context().add_class('btn_postpone')
|
||||||
|
@ -194,7 +197,7 @@ class BreakScreen:
|
||||||
btn_postpone.set_visible(True)
|
btn_postpone.set_visible(True)
|
||||||
box_buttons.pack_start(btn_postpone, True, True, 0)
|
box_buttons.pack_start(btn_postpone, True, True, 0)
|
||||||
|
|
||||||
if not self.strict_break:
|
if not self.strict_break and not skip_button_disabled:
|
||||||
# Add the skip button
|
# Add the skip button
|
||||||
btn_skip = Gtk.Button(_('Skip'))
|
btn_skip = Gtk.Button(_('Skip'))
|
||||||
btn_skip.get_style_context().add_class('btn_skip')
|
btn_skip.get_style_context().add_class('btn_skip')
|
||||||
|
|
Loading…
Reference in New Issue