diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-11-14 00:56:15 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-14 00:56:15 +0100 |
commit | f0f9f670b9084761023ba9c594b97a0ad37581ed (patch) | |
tree | a6a3b72d68f0f5783875cd721ce5e6686009078a /src/plugin.py | |
parent | 3ea5eb6163181ba016cfddcc616a171d7f309e76 (diff) | |
parent | 920c43dae25b06fd843dc8f8cbbf5e6bc5bf91c0 (diff) | |
download | poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.gz poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.bz2 poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.xz poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.zip |
Merge branch 'master' of http://git.louiz.org/poezio
Diffstat (limited to 'src/plugin.py')
-rw-r--r-- | src/plugin.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugin.py b/src/plugin.py index 92adbc4b..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) @@ -96,6 +101,30 @@ 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_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. |