Fix error in upgrading plugins

This commit is contained in:
Gobinath 2017-10-12 09:33:44 -04:00
parent 849fee8cff
commit 5aebb3da5d
6 changed files with 14 additions and 7 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
* 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 = []

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

@ -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)