From 234b421c6870f532f64b28a8a9b4cfa4b1a6e726 Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <legac@cppm.in2p3.fr> Date: Sat, 25 Jan 2014 18:27:00 +0100 Subject: [PATCH] Remove the method Modifier.append_plugins, use configure instead. --- modules/plugin_dbui/modifier.py | 53 ++++++++++++++++----------------- static/plugin_dbui/CHANGELOG | 2 ++ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/modules/plugin_dbui/modifier.py b/modules/plugin_dbui/modifier.py index 55a6ad71..d23feefd 100644 --- a/modules/plugin_dbui/modifier.py +++ b/modules/plugin_dbui/modifier.py @@ -59,26 +59,6 @@ class Modifier(object): self.data = p.dbui[dpname] - def append_plugins(self, *plugins): - """Add a list of plugins to the associated Ext JS widget. - - @note: - - A plugin is defined by a string containing is C{pType}. - - A plugin is defined by a dictionary containing the C{pType} - and the plugin configuration options:: - - {'ptype': foo, 'option1': val,...} - - For more information on C{ptype} see the Ext JS documentation. - - """ - if 'plugins' in self.data.extjs: - self.data.extjs['plugins'].extend(plugins) - - else: - self.data.extjs['plugins'] = list(plugins) - - def configure(self, **extjs): """Set the configuration parameters for the associated Ext JS widget. @@ -86,15 +66,34 @@ class Modifier(object): - Existing value of the configuration parameters are replaced by those defined in the keyword arguments. - - The current list of C{plugins} are replaced by the new one - when the keyword argument C{plugins} is used. - To append C{plugins} to the existing list uses the - method L{append_plugins}. + - The keyword argument C{plugins} contains a list of plugins. + The current list of C{plugins} are extend with the new ones + defined by the keyword argument C{plugins}. + + - A plugin is defined by a string containing is C{pType}. + + - A plugin is defined by a dictionary containing the C{pType} + and the plugin configuration options:: + + {'ptype': foo, 'option1': val,...} - The widget associated by default is replaced by a new one - when the keyword argument C{xtype} is used. - See the documentation of the C{Ext.Component} to learn how to - manipulate C{xtype}. + when the keyword argument C{xtype} is used. """ + if 'plugins' in extjs: + + plugins = extjs['plugins'] + + if isinstance(plugins, str): + plugins = [plugins] + + if 'plugins' in self.data.extjs: + self.data.extjs['plugins'].extend(plugins) + + else: + self.data.extjs['plugins'] = list(plugins) + + del extjs['plugins'] + self.data.extjs.update(extjs) \ No newline at end of file diff --git a/static/plugin_dbui/CHANGELOG b/static/plugin_dbui/CHANGELOG index b87d6b43..2ce0afaf 100644 --- a/static/plugin_dbui/CHANGELOG +++ b/static/plugin_dbui/CHANGELOG @@ -10,6 +10,8 @@ HEAD - the main evolutions / uncompatibilities are: + + Modifier.append_plugins → Modifier.configure(plugins=[x,..]) + + It is recommended to setup the width of all forms: dbui.configure_forms(db, width=300). -- GitLab