Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-13 15:05:06 +02:00
commit c71455a877
8 changed files with 35 additions and 28 deletions

4
debian/changelog vendored
View File

@ -1,4 +1,6 @@
safeeyes (1.2.2-1) xenial; urgency=low
safeeyes (2.0.0-1) xenial; urgency=low
* Completely rededesigned architecture and user interface
* Show next break time in tray icon in supported environments

2
debian/control vendored
View File

@ -9,7 +9,7 @@ Homepage: https://github.com/slgobinath/SafeEyes/
Package: safeeyes
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}, gir1.2-appindicator3-0.1, python3 (>= 3.4.0), python3-xlib, python3-dbus, gir1.2-notify-0.7, python3-babel, x11-utils, xprintidle, python3-pyaudio, python3-psutil
Depends: ${misc:Depends}, ${python3:Depends}, gir1.2-appindicator3-0.1, python3 (>= 3.4.0), python3-xlib, python3-dbus, gir1.2-notify-0.7, python3-babel, x11-utils, xprintidle, alsa-utils, python3-psutil
Description: Safe Eyes
Safe Eyes is a simple tool to remind you to take periodic breaks for your eyes. This is essential for anyone spending more time on the computer to avoid eye strain and other physical problems.
.

View File

@ -387,7 +387,7 @@ def __update_plugin_config(plugin, plugin_config, config):
if plugin_config is None:
config['plugins'].remove(plugin)
else:
if LooseVersion(plugin['version']) < LooseVersion(plugin_config['meta']['version']):
if LooseVersion(plugin.get('version', '0.0.0')) != LooseVersion(plugin_config['meta']['version']):
# Update the configuration
plugin['version'] = plugin_config['meta']['version']
setting_ids = []
@ -398,7 +398,7 @@ def __update_plugin_config(plugin, plugin_config, config):
plugin['settings'][setting['id']] = setting['default']
# Remove the removed ids
keys_to_remove = []
for key in plugin['settings']:
for key in plugin.get('settings', []):
if key not in setting_ids:
keys_to_remove.append(key)
for key in keys_to_remove:

View File

@ -22,7 +22,9 @@
"id": "min_seconds",
"label": "Minimum seconds to skip without screensaver",
"type": "INT",
"default": 3
"default": 3,
"max": 60,
"min": 0
}
],
"break_override_allowed": true

View File

@ -16,7 +16,9 @@
"id": "idle_time",
"label": "Minimum idle time to pause Safe Eyes",
"type": "INT",
"default": 3
"default": 3,
"max": 60,
"min": 1
}
]
}

View File

@ -66,46 +66,40 @@ class RPCClient(object):
"""
def __init__(self, port):
self.port = port
self.proxy = ServerProxy('http://localhost:%d/' % self.port, allow_none=True)
def show_settings(self):
"""
Show the settings dialog.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
proxy.show_settings()
self.proxy.show_settings()
def show_about(self):
"""
Show the about dialog.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
return proxy.show_about()
self.proxy.show_about()
def enable_safeeyes(self):
"""
Enable Safe Eyes.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
return proxy.enable_safeeyes()
self.proxy.enable_safeeyes()
def disable_safeeyes(self):
"""
Disable Safe Eyes.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
return proxy.disable_safeeyes()
self.proxy.disable_safeeyes()
def take_break(self):
"""
Take a break now.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
return proxy.take_break()
self.proxy.take_break()
def quit(self):
"""
Quit Safe Eyes.
"""
with ServerProxy('http://localhost:%d/' % self.port, allow_none=True) as proxy:
return proxy.quit()
self.proxy.quit()

View File

@ -268,19 +268,20 @@ class PluginSettingsDialog(object):
self.window.set_title(_('Plugin Settings'))
for setting in config.get('settings'):
if setting['type'].upper() == 'INT':
box_settings.pack_start(self.__load_int_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0)
box_settings.pack_start(self.__load_int_item(setting['label'], setting['id'], setting['safeeyes_config'], setting.get('min', 0), setting.get('max', 120)), False, False, 0)
elif setting['type'].upper() == 'TEXT':
box_settings.pack_start(self.__load_text_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0)
elif setting['type'].upper() == 'BOOL':
box_settings.pack_start(self.__load_bool_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0)
def __load_int_item(self, name, key, settings):
def __load_int_item(self, name, key, settings, min_value, max_value):
"""
Load the UI control for int property.
"""
builder = Utility.create_gtk_builder(SETTINGS_ITEM_INT_GLADE)
builder.get_object('lbl_name').set_label(_(name))
spin_value = builder.get_object('spin_value')
spin_value.set_range(min_value, max_value)
spin_value.set_value(settings[key])
box = builder.get_object('box')
box.set_visible(True)

View File

@ -50,10 +50,16 @@ def __package_files(directory):
paths.append(os.path.join('..', path, filename))
return paths
__compile_po_files()
__package_data = ['glade/*.glade', 'resource/*']
__package_data.extend(__package_files('safeeyes/config'))
__package_data.extend(__package_files('safeeyes/plugins'))
def __package_data():
"""
Return a list of package data.
"""
__compile_po_files()
data = ['glade/*.glade', 'resource/*']
data.extend(__package_files('safeeyes/config'))
data.extend(__package_files('safeeyes/plugins'))
return data
__data_files = list(_data_files('share'))
setuptools.setup(
@ -64,9 +70,9 @@ setuptools.setup(
author="Gobinath Loganathan",
author_email="slgobinath@gmail.com",
url="https://github.com/slgobinath/SafeEyes",
download_url="https://github.com/slgobinath/SafeEyes/archive/v1.2.2.tar.gz",
download_url="https://github.com/slgobinath/SafeEyes/archive/v2.0.0.tar.gz",
packages=setuptools.find_packages(),
package_data={'safeeyes': __package_data},
package_data={'safeeyes': __package_data()},
data_files=__data_files,
install_requires=requires,
entry_points={'console_scripts': ['safeeyes = safeeyes.__main__:main']},
@ -74,7 +80,7 @@ setuptools.setup(
classifiers=[
"Operating System :: POSIX :: Linux",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Development Status :: 3 - Alpha",
"Development Status :: 5 - Production/Stable",
"Environment :: X11 Applications :: GTK",
"Intended Audience :: End Users/Desktop",
"Topic :: Utilities"] + [