From 1da74a9636e2b70457317a3c16387594977416fb Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 4 Jul 2018 13:28:13 +0200 Subject: Simplify plugins path changes. --- poezio/core/core.py | 18 ++---------------- poezio/plugin_manager.py | 8 ++++---- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/poezio/core/core.py b/poezio/core/core.py index 37bf7752..bea42f11 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -321,9 +321,9 @@ class Core(object): self.add_configuration_handler("ack_message_receipts", self.on_ack_receipts_config_change) self.add_configuration_handler("plugins_dir", - self.on_plugins_dir_config_change) + self.plugin_manager.on_plugins_dir_change) self.add_configuration_handler("plugins_conf_dir", - self.on_plugins_conf_dir_config_change) + self.plugin_manager.on_plugins_conf_dir_change) self.add_configuration_handler("connection_timeout_delay", self.xmpp.set_keepalive_values) self.add_configuration_handler("connection_check_interval", @@ -414,26 +414,12 @@ class Core(object): self.xmpp.plugin['xep_0184'].auto_ack = config.get( option, default=True) - def on_plugins_dir_config_change(self, option, value): - """ - Called when the plugins_dir option is changed - """ - path = os.path.expanduser(value) - self.plugin_manager.on_plugins_dir_change(path) - def on_vertical_tab_list_config_change(self, option, value): """ Called when the enable_vertical_tab_list option is changed """ self.call_for_resize() - def on_plugins_conf_dir_config_change(self, option, value): - """ - Called when the plugins_conf_dir option is changed - """ - 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 diff --git a/poezio/plugin_manager.py b/poezio/plugin_manager.py index 8bcb7a3b..15f0db8a 100644 --- a/poezio/plugin_manager.py +++ b/poezio/plugin_manager.py @@ -313,13 +313,13 @@ class PluginManager(object): '', quotify=False) - def on_plugins_dir_change(self, new_value): - self.plugins_dir = new_value + def on_plugins_dir_change(self, _, new_value): + self.plugins_dir = Path(new_value).expanduser() self.check_create_plugins_dir() self.fill_load_path() - def on_plugins_conf_dir_change(self, new_value): - self.plugins_conf_dir = new_value + def on_plugins_conf_dir_change(self, _, new_value): + self.plugins_conf_dir = Path(new_value).expanduser() self.check_create_plugins_conf_dir() def initial_set_plugins_conf_dir(self): -- cgit v1.2.3