Skip to content
Snippets Groups Projects
Commit f5124393 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

the method get_tables is now public.

parent 4cdaa3ad
No related branches found
No related tags found
No related merge requests found
...@@ -427,26 +427,6 @@ class CfgSvc(BaseSvc): ...@@ -427,26 +427,6 @@ class CfgSvc(BaseSvc):
return di 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): def _is_foreign_field(self, tablename, fieldname):
""" Wrapper method """ Wrapper method
...@@ -471,7 +451,7 @@ class CfgSvc(BaseSvc): ...@@ -471,7 +451,7 @@ class CfgSvc(BaseSvc):
T = self.environment['T'] T = self.environment['T']
cfg = {'items': self._get_form_items(tablename), cfg = {'items': self._get_form_items(tablename),
'store': self.get_jsonstore(tablename), 'store': STOREID % tablename,
'xtype': 'xform'} 'xtype': 'xform'}
form_modifiers = self.environment['plugins'].dbui.form_modifiers form_modifiers = self.environment['plugins'].dbui.form_modifiers
...@@ -496,7 +476,7 @@ class CfgSvc(BaseSvc): ...@@ -496,7 +476,7 @@ class CfgSvc(BaseSvc):
# where: define inner join, mainly to resolve foreign key # where: define inner join, mainly to resolve foreign key
base_params = {'tableName': tablename, 'dbFields': []} base_params = {'tableName': tablename, 'dbFields': []}
cfg = {'autoLoad': True, cfg = {'autoLoad': False,
'autoSave': True, 'autoSave': True,
'baseParams': base_params, 'baseParams': base_params,
'fields': [], 'fields': [],
...@@ -560,7 +540,7 @@ class CfgSvc(BaseSvc): ...@@ -560,7 +540,7 @@ class CfgSvc(BaseSvc):
cfg = {'columns': self._get_columns_model(tablename), cfg = {'columns': self._get_columns_model(tablename),
'frame': False, 'frame': False,
'store': self.get_jsonstore(tablename), 'store': STOREID % tablename,
'viewConfig': {'forceFit': True}, 'viewConfig': {'forceFit': True},
'xtype': 'xgrid'} 'xtype': 'xgrid'}
...@@ -576,6 +556,26 @@ class CfgSvc(BaseSvc): ...@@ -576,6 +556,26 @@ class CfgSvc(BaseSvc):
return cfg 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): def get_viewport(self):
"""Build the the configuration options of the Ext.Viewport """Build the the configuration options of the Ext.Viewport
the main widget of the user interface. the main widget of the user interface.
...@@ -591,7 +591,7 @@ class CfgSvc(BaseSvc): ...@@ -591,7 +591,7 @@ class CfgSvc(BaseSvc):
append_plugin of the ViewportModifier. append_plugin of the ViewportModifier.
""" """
di = self._get_tables() di = self.get_tables()
plugins = [] plugins = []
# configure the plugin to handle entryForm # configure the plugin to handle entryForm
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment