diff --git a/modules/plugin_dbui/modifier.py b/modules/plugin_dbui/modifier.py index 55a6ad716763e4b88c6a2b629eee36eb286bdcd2..d23feefd5258dbe4fcb5ecd3f4860d4f43a1c86f 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 b87d6b4385efda007f7d9329f2a3b090bc175594..2ce0afaf3df128afc3180bcff51878318da62009 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).