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
tev
plugin_event
Commits
10572c24
Commit
10572c24
authored
Nov 21, 2016
by
LE GAC Renaud
Browse files
Update the model to take into account classes modifications.
parent
26c57e4c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
281 deletions
+91
-281
models/common_settings.py
models/common_settings.py
+40
-34
models/widgets_viewport.py
models/widgets_viewport.py
+0
-197
modules/plugin_tev/__init__.py
modules/plugin_tev/__init__.py
+2
-1
modules/plugin_tev/ui_viewport.py
modules/plugin_tev/ui_viewport.py
+49
-49
No files found.
models/common_settings.py
View file @
10572c24
...
...
@@ -12,20 +12,8 @@ from plugin_tev import (EvtModelCore,
EvtModelSelector
,
EvtUiCore
,
EvtUiReport
,
EvtUiSelector
)
#.............................................................................
#
# Plugin dbui configuration
#
plugins
=
PluginManager
()
plugins
.
dbui
.
app_css
=
"static/my.css"
plugins
.
dbui
.
app_debug
=
"static/src"
plugins
.
dbui
.
app_libmin
=
"static/track_events-min.js"
plugins
.
dbui
.
app_lg
=
"static/track_events/locale/myapp-lang-fr.js"
plugins
.
dbui
.
app_script
=
"static/app.js"
# plugins.dbui.app_script_dir = None
EvtUiSelector
,
EvtUiViewport
)
#.............................................................................
#
...
...
@@ -38,16 +26,25 @@ T.lazy = False # immediate translation
#.............................................................................
#
# C
onstant
s
# C
reate the database model
s
#
FORMATS
=
[
"csv"
,
"html"
,
"pdf"
,
"tex"
]
EvtModelCore
(
db
,
T
)
EvtModelReport
(
db
,
T
)
EvtModelSelector
(
virtdb
,
db
,
T
)
#.............................................................................
#
# Plugin dbui configuration
#
now
=
datetime
.
now
()
today
=
now
.
strftime
(
"%Y-%m-%d"
)
undef
=
T
(
dbui
.
UNDEF
)
undef_id
=
dbui
.
UNDEF_ID
year
=
now
.
year
plugins
=
PluginManager
()
plugins
.
dbui
.
app_css
=
"static/my.css"
plugins
.
dbui
.
app_debug
=
"static/src"
plugins
.
dbui
.
app_libmin
=
"static/track_events-min.js"
plugins
.
dbui
.
app_lg
=
"static/track_events/locale/myapp-lang-fr.js"
plugins
.
dbui
.
app_script
=
"static/app.js"
# plugins.dbui.app_script_dir = None
#.............................................................................
#
...
...
@@ -56,10 +53,21 @@ year = now.year
tables
=
[
"auth_group"
,
"auth_membership"
,
"auth_user"
]
tables
.
extend
(
EvtModelCore
.
tables
())
tables
.
extend
(
EvtModelReport
.
tables
())
"auth_user"
,
"domains"
,
"events"
,
"fundings"
,
"graphs"
,
# "history",
"lists"
,
"metrics1d"
,
"metrics2d"
,
"object_categories"
,
"objects"
,
"people"
,
"people_categories"
,
"projects"
,
"teams"
]
dbui
.
configure_forms
(
tables
,
plugins
=
[
"pFormToolTip"
],
width
=
350
)
...
...
@@ -70,19 +78,17 @@ dbui.configure_grids(tables, plugins=["pGridRowEditorConfirmDelete",
#.............................................................................
#
#
Creat
e the
database models
#
Tun
e the
user interface
#
EvtModelCore
.
create
(
db
,
T
)
EvtModelReport
.
create
(
db
,
T
)
EvtModelSelector
.
create
(
virtdb
,
db
,
T
)
EvtUiCore
(
db
,
T
)
EvtUiReport
(
db
,
T
)
selector_panel
=
EvtUiSelector
.
selector
(
virtdb
,
db
,
T
)
#.............................................................................
#
#
Tune the user interface
#
Configure the main viewport
#
EvtUiCore
.
tune
(
db
,
T
)
EvtUiReport
.
tune
(
db
,
T
)
selector_panel
=
EvtUiSelector
.
selector
(
virtdb
,
db
,
T
)
EvtUiViewport
(
db
,
T
,
selector_panel
)
\ No newline at end of file
models/widgets_viewport.py
deleted
100644 → 0
View file @
26c57e4c
# -*- coding: utf-8 -*-
""" widgets viewport
"""
# helper function translating a tablename into the grid configuration
to_grid
=
lambda
tablename
:
dbui
.
to_gridPanel
(
db
[
tablename
])
# short cuts
Node
=
dbui
.
Node
Panel
=
dbui
.
Panel
PanelWithUrlSelector
=
dbui
.
to_panelWithUrlSelector
# ............................................................................
#
# CAS
#
casNode
=
None
if
"auth"
in
globals
():
casNode
=
Node
(
T
(
'CAS'
))
casNode
.
add_child
(
T
(
'users'
),
to_grid
(
'auth_user'
))
casNode
.
add_child
(
T
(
'groups'
),
to_grid
(
'auth_group'
))
casNode
.
add_child
(
T
(
'relation user / groups'
),
to_grid
(
'auth_membership'
))
# ............................................................................
#
# HELP NODE
#
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'html'
,
url
=
URL
(
'plugin_dbui'
,
'about'
))
aboutLeaf
=
Panel
(
loader
=
loader
,
autoScroll
=
True
)
# loader = dict(autoLoad=True,
# renderer='html',
# scripts=True,
# url=URL('plugin_dbui', 'documentations'))
#
# docLeaf = Panel(loader=loader, plugins=['pPanelLoaderException'], autoScroll=True)
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'html'
,
url
=
URL
(
'default'
,
'documentations'
))
docLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
'pPanelLoaderException'
])
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'html'
,
scripts
=
True
,
url
=
URL
(
'plugin_dbui'
,
'versions'
))
versionLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
'pPanelLoaderException'
])
helpNode
=
Node
(
T
(
'Help'
))
helpNode
.
add_child
(
T
(
'about'
),
aboutLeaf
)
helpNode
.
add_child
(
T
(
'documentations'
),
docLeaf
)
helpNode
.
add_child
(
T
(
'versions'
),
versionLeaf
)
helpNode
.
sort_children
()
# ............................................................................
#
# CONFIGURE
#
cfgNode
=
Node
(
T
(
'Configure'
))
cfgNode
.
add_child
(
T
(
'the lists'
),
to_grid
(
'lists'
))
cfgNode
.
add_child
(
T
(
'the metrics 1d'
),
to_grid
(
'metrics1d'
))
cfgNode
.
add_child
(
T
(
'the metrics 2d'
),
to_grid
(
'metrics2d'
))
cfgNode
.
add_child
(
T
(
'the graphs'
),
to_grid
(
'graphs'
))
# ............................................................................
#
# META DATA
#
metaNode
=
Node
(
T
(
'Metadata'
))
metaNode
.
add_child
(
T
(
'domains'
),
to_grid
(
'domains'
))
metaNode
.
add_child
(
T
(
'fundings'
),
to_grid
(
'fundings'
))
metaNode
.
add_child
(
T
(
'teams'
),
to_grid
(
'teams'
))
metaNode
.
add_child
(
T
(
'projects'
),
to_grid
(
'projects'
))
metaNode
.
sort_children
()
# ............................................................................
#
# PEOPLE & OBJECT
#
objectNode
=
Node
(
T
(
'People and objects'
))
objectNode
.
add_child
(
T
(
'people'
),
to_grid
(
'people'
))
objectNode
.
add_child
(
T
(
'people_categories'
),
to_grid
(
'people_categories'
))
objectNode
.
add_child
(
T
(
'objects'
),
to_grid
(
'objects'
))
objectNode
.
add_child
(
T
(
'object_categories'
),
to_grid
(
'object_categories'
))
objectNode
.
sort_children
()
# ............................................................................
#
# EVENT
#
eventNode
=
Node
(
T
(
'Events'
))
eventNode
.
add_child
(
T
(
'definitions'
),
to_grid
(
'events'
))
eventNode
.
add_child
(
T
(
'history'
),
to_grid
(
'history'
))
# ............................................................................
#
# LIST
#
listNode
=
Node
(
T
(
'The lists'
))
for
row
in
db
(
db
.
lists
.
id
>
0
).
select
(
orderby
=
db
.
lists
.
name
):
leaf
=
selector_panel
leaf
.
baseUrl
=
URL
(
'report'
,
'grid'
)
leaf
.
baseParams
=
{
'id_lists'
:
row
.
id
}
listNode
.
add_child
(
row
.
name
,
leaf
)
# ............................................................................
#
# METRIC 1D
#
metric1dNode
=
Node
(
T
(
'The metrics 1d'
))
for
row
in
db
(
db
.
metrics1d
.
id
>
0
).
select
(
orderby
=
db
.
metrics1d
.
name
):
leaf
=
selector_panel
leaf
.
baseUrl
=
URL
(
'report'
,
'grid'
)
leaf
.
baseParams
=
{
'id_metrics1d'
:
row
.
id
}
metric1dNode
.
add_child
(
row
.
name
,
leaf
)
metric1dNode
.
sort_children
()
# ............................................................................
#
# METRIC 2D
#
metric2dNode
=
Node
(
T
(
'The metrics 2d'
))
for
row
in
db
(
db
.
metrics2d
.
id
>
0
).
select
(
orderby
=
db
.
metrics2d
.
name
):
leaf
=
selector_panel
leaf
.
baseUrl
=
URL
(
'report'
,
'grid'
)
leaf
.
baseParams
=
{
'id_metrics2d'
:
row
.
id
}
metric2dNode
.
add_child
(
row
.
name
,
leaf
)
metric2dNode
.
sort_children
()
# ............................................................................
#
# GRAPH
# Define by the 2D metrics
#
graphNode
=
Node
(
T
(
'The graphs'
))
for
row
in
db
(
db
.
graphs
.
id
>
0
).
select
(
orderby
=
db
.
graphs
.
name
):
leaf
=
selector_panel
leaf
.
baseUrl
=
URL
(
'report'
,
'graph_mpl'
)
leaf
.
baseParams
=
{
'id_graphs'
:
row
.
id
}
graphNode
.
add_child
(
row
.
name
,
leaf
)
# ............................................................................
#
# VIEWPORT
#
nodes
=
[
helpNode
,
casNode
,
cfgNode
,
metaNode
,
objectNode
,
eventNode
,
listNode
,
metric1dNode
,
metric2dNode
,
graphNode
]
viewportModifier
=
dbui
.
ViewportModifier
()
viewportModifier
.
add_node
(
*
nodes
)
viewportModifier
.
configure
(
tabTitleTpl
=
"{1}"
)
if
session
.
auth
:
viewportModifier
.
configure
(
logged
=
True
,
plugins
=
[
'pViewportLogin'
])
viewportModifier
.
default_node
(
T
(
'Events'
),
T
(
'history'
))
modules/plugin_tev/__init__.py
View file @
10572c24
...
...
@@ -8,4 +8,5 @@ from model_selector import EvtModelSelector
from
ui_core
import
EvtUiCore
from
ui_report
import
EvtUiReport
from
ui_selector
import
EvtUiSelector
\ No newline at end of file
from
ui_selector
import
EvtUiSelector
from
ui_viewport
import
EvtUiViewport
\ No newline at end of file
modules/plugin_tev/ui_viewport.py
View file @
10572c24
...
...
@@ -11,7 +11,7 @@ from gluon.html import URL
Node
=
dbui
.
Node
Panel
=
dbui
.
Panel
to_grid
=
lambda
tablename
:
dbui
.
to_gridPanel
(
db
[
tablename
])
to_grid
=
dbui
.
to_gridPanel
class
EvtUiViewport
(
object
):
...
...
@@ -44,9 +44,9 @@ class EvtUiViewport(object):
modifier
.
configure
(
tabTitleTpl
=
"{1}"
)
if
current
.
session
.
auth
:
modifier
.
configure
(
logged
=
True
,
plugins
=
[
'
pViewportLogin
'
])
modifier
.
configure
(
logged
=
True
,
plugins
=
[
"
pViewportLogin
"
])
modifier
.
default_node
(
T
(
'
Events
'
),
T
(
'
history
'
))
modifier
.
default_node
(
T
(
"
Events
"
),
T
(
"
history
"
))
@
staticmethod
def
app_node
(
db
,
T
):
...
...
@@ -64,13 +64,13 @@ class EvtUiViewport(object):
if
"auth"
in
globals
():
node
=
Node
(
T
(
'
CAS
'
))
node
=
Node
(
T
(
"
CAS
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
users
'
),
to_grid
(
'
auth_user
'
))
add_child
(
T
(
'
groups
'
),
to_grid
(
'
auth_group
'
))
add_child
(
T
(
'
relation user / groups
'
),
to_grid
(
'
auth_membership
'
))
add_child
(
T
(
"
users
"
),
to_grid
(
db
.
auth_user
))
add_child
(
T
(
"
groups
"
),
to_grid
(
db
.
auth_group
))
add_child
(
T
(
"
relation user / groups
"
),
to_grid
(
db
.
auth_membership
))
return
node
...
...
@@ -87,30 +87,30 @@ class EvtUiViewport(object):
the configuration of a tree node.
"""
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'
html
'
,
url
=
URL
(
'
plugin_dbui
'
,
'
about
'
))
renderer
=
"
html
"
,
url
=
URL
(
"
plugin_dbui
"
,
"
about
"
))
aboutLeaf
=
Panel
(
loader
=
loader
,
autoScroll
=
True
)
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'
html
'
,
url
=
URL
(
'
default
'
,
'
documentations
'
))
renderer
=
"
html
"
,
url
=
URL
(
"
default
"
,
"
documentations
"
))
docLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
'
pPanelLoaderException
'
])
docLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
"
pPanelLoaderException
"
])
loader
=
dict
(
autoLoad
=
True
,
renderer
=
'
html
'
,
renderer
=
"
html
"
,
scripts
=
True
,
url
=
URL
(
'
plugin_dbui
'
,
'
versions
'
))
url
=
URL
(
"
plugin_dbui
"
,
"
versions
"
))
versionLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
'
pPanelLoaderException
'
])
versionLeaf
=
Panel
(
loader
=
loader
,
plugins
=
[
"
pPanelLoaderException
"
])
node
=
Node
(
T
(
'
Help
'
))
node
=
Node
(
T
(
"
Help
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
about
'
),
aboutLeaf
)
add_child
(
T
(
'
documentations
'
),
docLeaf
)
add_child
(
T
(
'
versions
'
),
versionLeaf
)
add_child
(
T
(
"
about
"
),
aboutLeaf
)
add_child
(
T
(
"
documentations
"
),
docLeaf
)
add_child
(
T
(
"
versions
"
),
versionLeaf
)
node
.
sort_children
()
...
...
@@ -128,13 +128,13 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
Configure
'
))
node
=
Node
(
T
(
"
Configure
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
the lists
'
),
to_grid
(
'
lists
'
))
add_child
(
T
(
'
the metrics 1d
'
),
to_grid
(
'
metrics1d
'
))
add_child
(
T
(
'
the metrics 2d
'
),
to_grid
(
'
metrics2d
'
))
add_child
(
T
(
'
the graphs
'
),
to_grid
(
'
graphs
'
))
add_child
(
T
(
"
the lists
"
),
to_grid
(
db
.
lists
))
add_child
(
T
(
"
the metrics 1d
"
),
to_grid
(
db
.
metrics1d
))
add_child
(
T
(
"
the metrics 2d
"
),
to_grid
(
db
.
metrics2d
))
add_child
(
T
(
"
the graphs
"
),
to_grid
(
db
.
graphs
))
return
node
...
...
@@ -150,11 +150,11 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
Events
'
))
node
=
Node
(
T
(
"
Events
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
definitions
'
),
to_grid
(
'
events
'
))
add_child
(
T
(
'
history
'
),
to_grid
(
'
history
'
))
add_child
(
T
(
"
definitions
"
),
to_grid
(
db
.
events
))
add_child
(
T
(
"
history
"
),
to_grid
(
db
.
history
))
return
node
...
...
@@ -170,13 +170,13 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
Metadata
'
))
node
=
Node
(
T
(
"
Metadata
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
domains
'
),
to_grid
(
'
domains
'
))
add_child
(
T
(
'
fundings
'
),
to_grid
(
'
fundings
'
))
add_child
(
T
(
'
teams
'
),
to_grid
(
'
teams
'
))
add_child
(
T
(
'
projects
'
),
to_grid
(
'
projects
'
))
add_child
(
T
(
"
domains
"
),
to_grid
(
db
.
domains
))
add_child
(
T
(
"
fundings
"
),
to_grid
(
db
.
fundings
))
add_child
(
T
(
"
teams
"
),
to_grid
(
db
.
teams
))
add_child
(
T
(
"
projects
"
),
to_grid
(
db
.
projects
))
node
.
sort_children
()
...
...
@@ -194,13 +194,13 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
People and objects
'
))
node
=
Node
(
T
(
"
People and objects
"
))
add_child
=
node
.
add_child
add_child
(
T
(
'
people
'
),
to_grid
(
'
people
'
))
add_child
(
T
(
'
people_categories
'
),
to_grid
(
'
people_categories
'
))
add_child
(
T
(
'
objects
'
),
to_grid
(
'
objects
'
))
add_child
(
T
(
'
object_categories
'
),
to_grid
(
'
object_categories
'
))
add_child
(
T
(
"
people
"
),
to_grid
(
db
.
people
))
add_child
(
T
(
"
people_categories
"
),
to_grid
(
db
.
people_categories
))
add_child
(
T
(
"
objects
"
),
to_grid
(
db
.
objects
))
add_child
(
T
(
"
object_categories
"
),
to_grid
(
db
.
object_categories
))
node
.
sort_children
()
...
...
@@ -220,15 +220,15 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
The lists
'
))
node
=
Node
(
T
(
"
The lists
"
))
add_child
=
node
.
add_child
for
row
in
db
(
db
.
lists
.
id
>
0
).
select
(
orderby
=
db
.
lists
.
name
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
'
report
'
,
'
grid
'
)
panel
.
baseParams
=
{
'
id_lists
'
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"
report
"
,
"
grid
"
)
panel
.
baseParams
=
{
"
id_lists
"
:
row
.
id
}
add_child
(
row
.
name
,
panel
)
...
...
@@ -248,15 +248,15 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
The metrics 1d
'
))
node
=
Node
(
T
(
"
The metrics 1d
"
))
add_child
=
node
.
add_child
for
row
in
db
(
db
.
metrics1d
.
id
>
0
).
select
(
orderby
=
db
.
metrics1d
.
name
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
'
report
'
,
'
grid
'
)
panel
.
baseParams
=
{
'
id_metrics1d
'
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"
report
"
,
"
grid
"
)
panel
.
baseParams
=
{
"
id_metrics1d
"
:
row
.
id
}
add_child
(
row
.
name
,
panel
)
...
...
@@ -277,15 +277,15 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
The metrics 2d
'
))
node
=
Node
(
T
(
"
The metrics 2d
"
))
add_child
=
node
.
add_child
for
row
in
db
(
db
.
metrics2d
.
id
>
0
).
select
(
orderby
=
db
.
metrics2d
.
name
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
'
report
'
,
'
grid
'
)
panel
.
baseParams
=
{
'
id_metrics2d
'
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"
report
"
,
"
grid
"
)
panel
.
baseParams
=
{
"
id_metrics2d
"
:
row
.
id
}
node
.
add_child
(
row
.
name
,
panel
)
...
...
@@ -306,13 +306,13 @@ class EvtUiViewport(object):
dbui.Node:
the configuration of a tree node.
"""
node
=
Node
(
T
(
'
The graphs
'
))
node
=
Node
(
T
(
"
The graphs
"
))
for
row
in
db
(
db
.
graphs
.
id
>
0
).
select
(
orderby
=
db
.
graphs
.
name
):
panel
=
selector_panel
panel
.
baseUrl
=
URL
(
'
report
'
,
'
graph_mpl
'
)
panel
.
baseParams
=
{
'
id_graphs
'
:
row
.
id
}
panel
.
baseUrl
=
URL
(
"
report
"
,
"
graph_mpl
"
)
panel
.
baseParams
=
{
"
id_graphs
"
:
row
.
id
}
node
.
add_child
(
row
.
name
,
panel
)
...
...
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