From f5124393c236adc146bf942990a7d5af8a6df7ff Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <renaud.legac@free.fr> Date: Sun, 20 Mar 2011 16:49:16 +0000 Subject: [PATCH] the method get_tables is now public. --- modules/plugin_dbui/cfgsvc.py | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/plugin_dbui/cfgsvc.py b/modules/plugin_dbui/cfgsvc.py index d94899b2..c295e5cf 100644 --- a/modules/plugin_dbui/cfgsvc.py +++ b/modules/plugin_dbui/cfgsvc.py @@ -427,26 +427,6 @@ class CfgSvc(BaseSvc): return di - def _get_tables(self): - """Return a dictionary with list of tables - and a list with the translation of their names - - The method take into accounts hidden tables defined - by the viewport modifiers - - """ - T = self.environment['T'] - db = self.environment['db'] - - viewport_modifiers = self.environment['plugins'].dbui.viewport_modifiers - hidden_tables = viewport_modifiers.hidden_tables - li_1 = [el for el in db.tables if el not in hidden_tables] - li_1.sort() - li_2 = [str(T(el)) for el in li_1] - - return {'tables': li_1, 'tablesText': li_2} - - def _is_foreign_field(self, tablename, fieldname): """ Wrapper method @@ -471,7 +451,7 @@ class CfgSvc(BaseSvc): T = self.environment['T'] cfg = {'items': self._get_form_items(tablename), - 'store': self.get_jsonstore(tablename), + 'store': STOREID % tablename, 'xtype': 'xform'} form_modifiers = self.environment['plugins'].dbui.form_modifiers @@ -496,7 +476,7 @@ class CfgSvc(BaseSvc): # where: define inner join, mainly to resolve foreign key base_params = {'tableName': tablename, 'dbFields': []} - cfg = {'autoLoad': True, + cfg = {'autoLoad': False, 'autoSave': True, 'baseParams': base_params, 'fields': [], @@ -560,7 +540,7 @@ class CfgSvc(BaseSvc): cfg = {'columns': self._get_columns_model(tablename), 'frame': False, - 'store': self.get_jsonstore(tablename), + 'store': STOREID % tablename, 'viewConfig': {'forceFit': True}, 'xtype': 'xgrid'} @@ -576,6 +556,26 @@ class CfgSvc(BaseSvc): return cfg + def get_tables(self): + """Return a dictionary with list of tables + and a list with the translation of their names + + The method take into accounts hidden tables defined + by the viewport modifiers + + """ + T = self.environment['T'] + db = self.environment['db'] + + viewport_modifiers = self.environment['plugins'].dbui.viewport_modifiers + hidden_tables = viewport_modifiers.hidden_tables + li_1 = [el for el in db.tables if el not in hidden_tables] + li_1.sort() + li_2 = [str(T(el)) for el in li_1] + + return {'tables': li_1, 'tablesText': li_2} + + def get_viewport(self): """Build the the configuration options of the Ext.Viewport the main widget of the user interface. @@ -591,7 +591,7 @@ class CfgSvc(BaseSvc): append_plugin of the ViewportModifier. """ - di = self._get_tables() + di = self.get_tables() plugins = [] # configure the plugin to handle entryForm -- GitLab