Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
d2005e90
Commit
d2005e90
authored
Apr 15, 2015
by
LE GAC Renaud
Browse files
Use the construct Keyword Args.
parent
b47dffe6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
131 additions
and
126 deletions
+131
-126
modules/plugin_dbui/converter.py
modules/plugin_dbui/converter.py
+49
-43
modules/plugin_dbui/dbsvc.py
modules/plugin_dbui/dbsvc.py
+3
-3
modules/plugin_dbui/extjs.py
modules/plugin_dbui/extjs.py
+3
-2
modules/plugin_dbui/formmodifier.py
modules/plugin_dbui/formmodifier.py
+25
-29
modules/plugin_dbui/gridmodifier.py
modules/plugin_dbui/gridmodifier.py
+33
-36
modules/plugin_dbui/navtree.py
modules/plugin_dbui/navtree.py
+7
-2
modules/plugin_dbui/selector.py
modules/plugin_dbui/selector.py
+5
-5
modules/plugin_dbui/storemodifier.py
modules/plugin_dbui/storemodifier.py
+6
-6
No files found.
modules/plugin_dbui/converter.py
View file @
d2005e90
...
...
@@ -54,11 +54,12 @@ def _to_field(field, linkedcombo=True, **kwargs):
but does not handle :class:`.FieldContainer`.
Args:
field (gluon.dal.Field):
field (gluon.dal.Field): database field
linkedcombo (bool): ``LinkedComboBox`` are ignored when ``False``.
Useful to build grid filter.
:k
eyword
kwa
rgs:
K
eyword
A
rgs:
any Ext JS configuration parameters of the
``Ext.form.Field`` class. They are applied in the following order:
constructor, modifiers and keyword arguments.
...
...
@@ -195,16 +196,18 @@ def to_field(field, composite=True, linkedcombo=True, **kwargs):
Args:
field (gluon.dal.Field);
composite (bool): ``FieldContainer`` is ignored when ``False``.
Useful to build grid filter.
linkedcombo (bool): ``LinkedComboBox`` are ignored when ``False``.
Useful to build grid filter.
:type kwargs: dict
:param
kwargs:
any Ext JS configuration parameter of the ``Ext.form.Field``
class. They are applied in the following order:
constructor, modifiers and keyword arguments.
Keyword Args:
kwargs
(dict)
:
any Ext JS configuration parameter of the ``Ext.form.Field``
class. They are applied in the following order:
constructor, modifiers and keyword arguments.
:returns:
:class:`.Field` or ``None``
...
...
@@ -345,12 +348,12 @@ def to_formPanel(table, **kwargs):
Args:
table (gluon.dal.Table): database table
:type kwargs: dict
:param
kwargs:
any Ext JS configuration parameter of the
``Ext.form.Panel`` class. They are
applied in the following order: constructor, modifiers
and keyword arguments.
Keyword Args:
kwargs
(dict)
:
any Ext JS configuration parameter of the
``Ext.form.Panel`` class. They are
applied in the following order: constructor, modifiers
and keyword arguments.
:returns: :class:`.FormPanel`
...
...
@@ -383,12 +386,12 @@ def to_gridColumn(field, **kwargs):
Args:
field (gluon.dal.Field): database field
:type kwargs: dict
:param
kwargs:
any Ext JS configuration parameter of the
``Ext.grid.Column`` class.
They are applied in the following order: constructor, modifiers
and keyword arguments.
Keyword Args:
kwargs
(dict)
:
any Ext JS configuration parameter of the
``Ext.grid.Column`` class.
They are applied in the following order: constructor, modifiers
and keyword arguments.
:returns: :class:`.GridColumn`
...
...
@@ -492,11 +495,11 @@ def to_gridFilter(table, **kwargs):
Args:
table (gluon.dal.Table): database table
:type kwargs: dict
:keyword kwargs
:
any of the Ext JS configuration parameters of the
``App.grid.Filter`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
Keyword Args:
kwargs (dict)
:
any of the Ext JS configuration parameters of the
``App.grid.Filter`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
A filter rule is defined in the model via the
:class:`.GridModifier`.
...
...
@@ -614,11 +617,11 @@ def to_gridPanel(table, **kwargs):
Args:
table (gluon.dal.Table): database table
:type kwargs: dict
:keyword kwargs
:
any of the Ext JS configuration parameters of the
``App.grid.Panel`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
Keyword Args:
kwargs (dict)
:
any of the Ext JS configuration parameters of the
``App.grid.Panel`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
:returns: :class:`.GridPanel`
...
...
@@ -661,11 +664,11 @@ def to_jsonstore(table, **kwargs):
Args:
table (gluon.dal.Table): database table
:type kwargs: dict
:keyword kwargs
:
any of the Ext JS configuration parameters of the
``App.data.DirectStore`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
Keyword Args:
kwargs (dict)
:
any of the Ext JS configuration parameters of the
``App.data.DirectStore`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
:returns: :class:`.DirectStore`
...
...
@@ -798,17 +801,20 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
Args:
table (gluon.dal.Table): database table
selectorTitle (str): the title of the FieldSet encapsulating
selectorTitle (str):
the title of the FieldSet encapsulating
the selector fields.
baseUrl (str): the selected values are send to a controller
defined by the baseUrl.Values are processed and results
will be published in the panel.
It is mandatory to specified the baseUrl.
:type kwargs: dict
:keyword kwargs
:
any of the Ext JS configuration parameters of the
``App.panel.WithUrlSelector`` class.
Keyword Args:
kwargs (dict)
:
any of the Ext JS configuration parameters of the
``App.panel.WithUrlSelector`` class.
:returns: :class:`.PanelWithUrlSelector`
...
...
@@ -858,10 +864,10 @@ def to_viewport(**kwargs):
The conversion takes into account the
:class:`.ViewportModifier` instructions.
:type kwargs: dict
:keyword kwargs
:
any of the Ext JS configuration parameters of the
``App.viewport.Viewport`` class.
Keyword Args:
kwargs (dict)
:
any of the Ext JS configuration parameters of the
``App.viewport.Viewport`` class.
:returns: dict
...
...
modules/plugin_dbui/dbsvc.py
View file @
d2005e90
...
...
@@ -105,9 +105,9 @@ class DbSvc(BaseSvc):
Args:
arg (dict): :ref:`input transaction dictionary <input transaction dictionary>`
:type
keywords
:
dict
:param keywords:
list of keys which have to be in ``arg``
Keyword Args:
keywords
(
dict
):
list of keys which have to be in
the
``arg``
dictionary
:raise DbSvcException:
when a keyword is missing or when the table
...
...
modules/plugin_dbui/extjs.py
View file @
d2005e90
...
...
@@ -28,8 +28,9 @@ class Base(Storage):
def
__init__
(
self
,
**
kwargs
):
"""
:type kwargs: dict
:keyword kwargs: any Ext JS configuration parameter of the target class
Keyword Args:
kwargs (dict):
any Ext JS configuration parameter of the target class
:raise ExtJSException:
if the keyword ``xtype`` is in the keyword arguments.
...
...
modules/plugin_dbui/formmodifier.py
View file @
d2005e90
...
...
@@ -111,35 +111,31 @@ class FormModifier(Modifier):
* This method modify deeply the field configuration transforming
the Ext.form.comboBox into App.form.LinkedComboBox.
:type master: gluon.dal.Field
:keyword master:
the field used as master.
It has to be defined in the table referenced in the constructor
and in the ``masterHasSlaveData`` table.
:type slave: gluon.dal.Field
:keyword slave:
the field used as salve.
It has to be defined in the table referenced in the constructor
and in the ``masterHasSlaveData`` table.
:type masterHasSlaveData: str
:keyword masterHasSlaveData:
name of the external database table.
Its contains the data defining the relation between master and slave.
It should contains fields with the name of the master and slave ones.
:type masterExtJS: dict
:keyword masterExtJS:
configuration options dictionary for the
Ext.form.Combobox associated to the master reference field.
Might be useful to set the master in readOnly mode for example.
:type slaveExtJS: dict
:keyword slaveExtJS:
configuration option dictionary for the
Ext.form.Combobox associated to the slave reference field.
Might be useful to set the salve in readOnly mode for example.
Keyword Args:
master (gluon.dal.Field):
the field used as master.
It has to be defined in the table referenced in the constructor
and in the ``masterHasSlaveData`` table.
slave (gluon.dal.Field):
the field used as salve.
It has to be defined in the table referenced in the constructor
and in the ``masterHasSlaveData`` table.
masterHasSlaveData (str):
name of the external database table.
Its contains the data defining the relation between master and slave.
It should contains fields with the name of the master and slave ones.
masterExtJS (dict):
configuration options dictionary for the
Ext.form.Combobox associated to the master reference field.
Might be useful to set the master in readOnly mode for example.
slaveExtJS (dict):
configuration option dictionary for the
Ext.form.Combobox associated to the slave reference field.
Might be useful to set the salve in readOnly mode for example.
"""
# short cuts
...
...
modules/plugin_dbui/gridmodifier.py
View file @
d2005e90
...
...
@@ -206,42 +206,39 @@ class GridModifier(Modifier):
The TemplateColumn is rendered by the ``Ext.grid.TemplateColumn``.
Each field is identified by its database field name.
:type header: str
:keyword header: the header of the TemplateColumn
:type tpl: list
:keyword tpl:
the template defining how fields are displayed
in the TemplateColumn.
* The syntax of the template is is defined in the documentation
of ``Ext.XTemplate`` constructor.
* There is some limitation when defining the template in python,
namely the use of the template member function.
* Database fields are identified using the ``CapWord`` syntax:
``TablenameFieldname``. It works for standard and reference fields.
* HTML balises are understood.
* Example of a template list::
tpl = ['<b>{PeopleLast_name}</b><br>',
'{PeopleFirst_name}<br>',
'<tpl if={PeoplePhone_number}>{PeoplePhone_number}</tpl>']
:type autohide: bool
:keyword autohide:
hide the columns associated to the fields
used in the TemplateColumn when set to ``True``.
:type position: int
:keyword position:
is a number defining where the
column will be inserted in the grid widget.
The first column is at 0.
:type extjs: dict
:keyword extjs:
contains the Ext JS configuration options
of the ``Ext.grid.TemplateColumn``.
Keyword Args:
header (str):
the header of the TemplateColumn
tpl (list):
the template defining how fields are displayed
in the TemplateColumn.
* The syntax of the template is is defined in the documentation
of ``Ext.XTemplate`` constructor.
* There is some limitation when defining the template in python,
namely the use of the template member function.
* Database fields are identified using the ``CapWord`` syntax:
``TablenameFieldname``. It works for standard and reference fields.
* HTML balises are understood.
* Example of a template list::
tpl = ['<b>{PeopleLast_name}</b><br>',
'{PeopleFirst_name}<br>',
'<tpl if={PeoplePhone_number}>{PeoplePhone_number}</tpl>']
autohide (bool):
hide the columns associated to the fields
used in the TemplateColumn when set to ``True``.
position (int):
is a number defining where the
column will be inserted in the grid widget.
The first column is at 0.
extjs (dict):
contains the Ext JS configuration options
of the ``Ext.grid.TemplateColumn``.
"""
keywords
=
[
'autohide'
,
'position'
]
...
...
modules/plugin_dbui/navtree.py
View file @
d2005e90
...
...
@@ -28,8 +28,11 @@ class Node(object):
"""Add a child (leaf) to the node.
Args:
text (str): the name of the leaf
cfg (dict): the Ext JS configuration options defining
text (str):
the name of the leaf
cfg (dict):
the Ext JS configuration options defining
the widget associated to the leaf
"""
...
...
@@ -42,10 +45,12 @@ class Node(object):
Args:
leaves (list): a list of string
func (function):
function translating the leaf name into
the Ext JS configuration options dictionary.
The latter defines the associated widget.
hidden (list): list of children to be hidden.
.. note::
...
...
modules/plugin_dbui/selector.py
View file @
d2005e90
...
...
@@ -55,7 +55,7 @@ class Selector(Storage):
"""
Args:
table (gluon.dal.Table):
table (gluon.dal.Table):
the table containing the definition of the selector
exclude_fields (tuple):
...
...
@@ -237,10 +237,10 @@ class Selector(Storage):
table (gluon.dal.Table): database table
args (list): field with operator (avg, count, max, min and sum)
:type kwargs: dict
:param
kwargs:
The keyword arguments are those of the
gluon.dal.Set.select method: orderby, groupby, ....
Keyword Args:
kwargs
(dict)
:
The keyword arguments are those of the
gluon.dal.Set.select method: orderby, groupby, ....
:returns: gluon.dal.Rows
...
...
modules/plugin_dbui/storemodifier.py
View file @
d2005e90
...
...
@@ -111,12 +111,12 @@ class StoreModifier(Modifier):
That means that only 5 pages are kept in the cache. Therefore
this is a good option to manipulate almost infinite set of data.
:type kwargs: dict
:param
kwargs:
Any configuration parameter of the ``Ext.data.Store``.
Those related to the buffering are ``buffered``, ``clearOnPaqgeLoad``,
``leadingBufferZone``, ``pageSize``, ``purgePageCount``
and ``trailingBufferZone``.
Keyword Args:
kwargs
(dict)
:
Any configuration parameter of the ``Ext.data.Store``.
Those related to the buffering are ``buffered``, ``clearOnPaqgeLoad``,
``leadingBufferZone``, ``pageSize``, ``purgePageCount``
and ``trailingBufferZone``.
"""
di
=
dict
(
autoLoad
=
False
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment