summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-04-09 20:10:07 +0200
committermathieui <mathieui@mathieui.net>2014-04-09 20:10:07 +0200
commitd1609b97e4b2f6a34cfa6756a856317b35196603 (patch)
tree22d8775d61e3b8cdc6f4016a2d0d3bb158dbf9cb /src
parentf165d3a4a0dd2bcd6fe0a080821e317e136d81cb (diff)
downloadpoezio-d1609b97e4b2f6a34cfa6756a856317b35196603.tar.gz
poezio-d1609b97e4b2f6a34cfa6756a856317b35196603.tar.bz2
poezio-d1609b97e4b2f6a34cfa6756a856317b35196603.tar.xz
poezio-d1609b97e4b2f6a34cfa6756a856317b35196603.zip
Fix #2497/#2498 (/theme should return an error when loading fails)
It was actually doing that for old python version but not recent onces
Diffstat (limited to 'src')
-rw-r--r--src/core/commands.py4
-rw-r--r--src/core/core.py10
-rw-r--r--src/theming.py2
3 files changed, 11 insertions, 5 deletions
diff --git a/src/core/commands.py b/src/core/commands.py
index 5be95207..68a6eacf 100644
--- a/src/core/commands.py
+++ b/src/core/commands.py
@@ -173,10 +173,6 @@ def command_theme(self, arg=''):
args = arg.split()
if args:
self.command_set('theme %s' % (args[0],))
- warning = theming.reload_theme()
- if warning:
- self.information(warning, 'Warning')
- self.refresh_window()
def command_win(self, arg):
"""
diff --git a/src/core/core.py b/src/core/core.py
index 4b9a2e22..c3090bf6 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -250,6 +250,7 @@ class Core(object):
self.add_configuration_handler("connection_timeout_delay", self.xmpp.set_keepalive_values)
self.add_configuration_handler("connection_check_interval", self.xmpp.set_keepalive_values)
self.add_configuration_handler("themes_dir", theming.update_themes_dir)
+ self.add_configuration_handler("theme", self.on_theme_config_change)
self.add_configuration_handler("", self.on_any_config_change)
def on_any_config_change(self, option, value):
@@ -305,6 +306,15 @@ class Core(object):
path = os.path.expanduser(value)
self.plugin_manager.on_plugins_conf_dir_change(path)
+ def on_theme_config_change(self, option, value):
+ """
+ Called when the theme option is changed
+ """
+ error_msg = theming.reload_theme()
+ if error_msg:
+ self.information(error_msg, 'Warning')
+ self.refresh_window()
+
def sigusr_handler(self, num, stack):
"""
Handle SIGUSR1 (10)
diff --git a/src/theming.py b/src/theming.py
index 4a578ca7..8576a2a0 100644
--- a/src/theming.py
+++ b/src/theming.py
@@ -491,7 +491,7 @@ def reload_theme():
else:
loader = finder.find_module(theme_name, load_path)
if not loader:
- return
+ return 'Failed to load the theme %s' % theme_name
new_theme = loader.load_module()
except Exception as e:
log.error('Failed to load the theme %s', theme_name, exc_info=True)