From 39fcd9a4f6ace2e00f133bfaa15b1eaf0a0dce9a Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 Nov 2011 19:43:31 +0100 Subject: Allow a plugin to add a keybinding --- src/plugin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugin.py') diff --git a/src/plugin.py b/src/plugin.py index 92adbc4b..ddc3253e 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -96,6 +96,18 @@ class BasePlugin(object, metaclass=SafetyMetaclass): """ return self.plugin_manager.del_command(self.__module__, name) + def add_key(self, key, handler): + """ + Add a global keybind + """ + return self.plugin_manager.add_key(self.__module__, key, handler) + + def del_key(self, key): + """ + Remove a global keybind + """ + return self.plugin_manager.del_key(self.__module__, key) + def add_tab_command(self, tab_type, name, handler, help, completion=None): """ Add a command only for a type of tab. -- cgit v1.2.3 From 338a4b571711dcdd3ad523ad8e27a99d3b7d403c Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 13 Nov 2011 20:17:33 +0100 Subject: Add a way for a plugin to add a keybind only for a type of tab --- src/plugin.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugin.py') diff --git a/src/plugin.py b/src/plugin.py index ddc3253e..15f7d1cf 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -108,6 +108,18 @@ class BasePlugin(object, metaclass=SafetyMetaclass): """ return self.plugin_manager.del_key(self.__module__, key) + def add_tab_key(self, tab_type, key, handler): + """ + Add a keybind only for a type of tab. + """ + return self.plugin_manager.add_tab_key(self.__module__, tab_type, key, handler) + + def del_tab_key(self, tab_type, key): + """ + Remove a keybind added through add_tab_key. + """ + return self.plugin_manager.del_tab_key(self.__module__, tab_type, key) + def add_tab_command(self, tab_type, name, handler, help, completion=None): """ Add a command only for a type of tab. -- cgit v1.2.3 From a5f115a6e202a07f3f2dc7ac5ece0d0ea9af4099 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 14 Nov 2011 00:45:15 +0100 Subject: Fix Plugin.config.get to use the right section instead of Poezio --- src/plugin.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugin.py') diff --git a/src/plugin.py b/src/plugin.py index 15f7d1cf..137f704f 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -11,6 +11,11 @@ class PluginConfig(config.Config): RawConfigParser.__init__(self, None) self.read() + def get(self, option, default, section=None): + if not section: + section = self.module_name + return config.Config.get(self, option, default, section) + def read(self): """Read the config file""" RawConfigParser.read(self, self.file_name) -- cgit v1.2.3