Commit e9365b1e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Merge branch 'master' into 'production'

Release 0.6.0

* Require `plugin_dbui` 0.9.0 or higher.
* Change the javaScript namespaces to `Dbui` and `TrackEVents`.
* Update the database schema by adding the table `domains`.
* Add the modules `matplotlib_tools`.
* Add the script `lbfr_report.py`.


See merge request !18
parents 86bce434 7fb84320
0.5.6
\ No newline at end of file
0.6.0
\ No newline at end of file
......@@ -76,12 +76,12 @@ def graph_mpl():
def grid():
"""Render the report through the C{App.grid.Panel}.
"""Render the report through the C{Dbui.grid.Panel}.
The report can be a list, a metrics 1d or 2d.
The controller extracts the configuration of the report form the database.
It builds the DataFrame, extracts the the configuration
for the C{Ext.data.Store} as well as the C{App.grid.Panel}.
for the C{Ext.data.Store} as well as the C{Dbui.grid.Panel}.
The former contains the data displayed in the grid.
The report identifier is defined in the viewport
......@@ -117,7 +117,7 @@ def grid():
except (IndexError, ReportException, TypeError, ValueError) as e:
return INLINE_ALERT % ("JSON Error...", e)
# extract the configurations for the Ext.data.Store and App.grid.Panel.
# extract the configurations for the Ext.data.Store and Dbui.grid.Panel.
store = report.to_store()
grid = report.to_grid()
......
docs/db_schema/database.png

130 KB | W: | H:

docs/db_schema/database.png

127 KB | W: | H:

docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
  • 2-up
  • Swipe
  • Onion skin
<?xml version="1.0" encoding="utf-8" ?><sql><datatypes db="web2py">
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, https://github.com/ondras/wwwsqldesigner/ -->
<!-- Active URL: file:///home/legac/mywap/wwwsqldesigner/index.html -->
<sql>
<datatypes db="web2py">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="1" sql="integer" re="INTEGER" quote=""/>
<type label="Double precision" length="1" sql="double" re="DOUBLE" quote=""/>
......@@ -22,4 +26,320 @@
<type label="Upload" length="0" sql="upload" quote="'"/>
<type label="Password" length="0" sql="password" quote="'"/>
</group>
</datatypes><table x="303" y="21" name="people"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="first_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="last_name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="initials" null="0" autoincrement="0"><datatype>string</datatype></row><row name="birth_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="note" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="302" y="174" name="teams"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="team" null="0" autoincrement="0"><datatype>string</datatype></row><row name="domain" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="303" y="285" name="projects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="project" null="0" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="618" y="19" name="people_categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="category" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="452" y="71" name="history"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="id_people" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people" row="id" /></row><row name="id_teams" null="0" autoincrement="0"><datatype>integer</datatype><relation table="teams" row="id" /></row><row name="id_projects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="projects" row="id" /></row><row name="id_people_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="people_categories" row="id" /></row><row name="id_fundings" null="0" autoincrement="0"><datatype>integer</datatype><relation table="fundings" row="id" /></row><row name="id_objects" null="0" autoincrement="0"><datatype>integer</datatype><relation table="objects" row="id" /></row><row name="id_object_categories" null="0" autoincrement="0"><datatype>integer</datatype><relation table="object_categories" row="id" /></row><row name="id_events" null="0" autoincrement="0"><datatype>integer</datatype><relation table="events" row="id" /></row><row name="start_date" null="0" autoincrement="0"><datatype>date</datatype></row><row name="end_date" null="1" autoincrement="0"><datatype>date</datatype></row><row name="percentage" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>string</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="633" y="149" name="fundings"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="agency" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="638" y="266" name="events"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="event" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definitiion" null="1" autoincrement="0"><datatype>text</datatype></row><row name="data" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="827" y="22" name="lists"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="group_field" null="1" autoincrement="0"><datatype>string</datatype></row><row name="sorters" null="1" autoincrement="0"><datatype>integer</datatype></row><row name="columns" null="0" autoincrement="0"><datatype>text</datatype></row><row name="features" null="1" autoincrement="0"><datatype>text</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="934" y="193" name="metrics2d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="group_field_x" null="0" autoincrement="0"><datatype>string</datatype></row><row name="group_field_y" null="0" autoincrement="0"><datatype>string</datatype></row><row name="metric_field_z" null="0" autoincrement="0"><datatype>string</datatype></row><row name="aggregate_z" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="1065" y="22" name="graphs"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="report_type" null="0" autoincrement="0"><datatype>string</datatype></row><row name="report_name" null="1" autoincrement="0"><datatype>string</datatype></row><row name="plot" null="0" autoincrement="0"><datatype>text</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="929" y="19" name="metrics1d"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="name" null="0" autoincrement="0"><datatype>string</datatype></row><row name="title" null="1" autoincrement="0"><datatype>string</datatype></row><row name="conditions" null="1" autoincrement="0"><datatype>text</datatype></row><row name="group_field" null="1" autoincrement="0"><datatype>string</datatype></row><row name="columns" null="0" autoincrement="0"><datatype>text</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="616" y="391" name="object_categories"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="code" null="0" autoincrement="0"><datatype>string</datatype></row><row name="category" null="0" autoincrement="0"><datatype>string</datatype></row><row name="definition" null="1" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table><table x="324" y="372" name="objects"><row name="id" null="0" autoincrement="1"><datatype>integer</datatype></row><row name="reference" null="1" autoincrement="0"><datatype>string</datatype></row><row name="serial_number" null="0" autoincrement="0"><datatype>string</datatype></row><row name="batch_number" null="0" autoincrement="0"><datatype>string</datatype></row><row name="note" null="0" autoincrement="0"><datatype>text</datatype></row><key type="PRIMARY" name=""><part>id</part></key></table></sql>
\ No newline at end of file
</datatypes><table x="303" y="21" name="people">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="first_name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="last_name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="initials" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="birth_date" null="1" autoincrement="0">
<datatype>date</datatype>
<default>NULL</default></row>
<row name="note" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="302" y="183" name="teams">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="team" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="303" y="285" name="projects">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="project" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="618" y="19" name="people_categories">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="code" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="category" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="447" y="100" name="history">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="id_people" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="people" row="id" />
</row>
<row name="id_domains" null="1" autoincrement="0">
<datatype>integer</datatype>
<default>NULL</default><relation table="domains" row="id" />
</row>
<row name="id_teams" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="teams" row="id" />
</row>
<row name="id_projects" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="projects" row="id" />
</row>
<row name="id_people_categories" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="people_categories" row="id" />
</row>
<row name="id_fundings" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="fundings" row="id" />
</row>
<row name="id_objects" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="objects" row="id" />
</row>
<row name="id_object_categories" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="object_categories" row="id" />
</row>
<row name="id_events" null="0" autoincrement="0">
<datatype>integer</datatype>
<relation table="events" row="id" />
</row>
<row name="start_date" null="0" autoincrement="0">
<datatype>date</datatype>
</row>
<row name="end_date" null="1" autoincrement="0">
<datatype>date</datatype>
<default>NULL</default></row>
<row name="percentage" null="1" autoincrement="0">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="note" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="data" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="633" y="149" name="fundings">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="agency" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="611" y="393" name="events">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="event" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="definitiion" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="data" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="827" y="22" name="lists">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="title" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="conditions" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="group_field" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="sorters" null="1" autoincrement="0">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="columns" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="features" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="934" y="193" name="metrics2d">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="title" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="conditions" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="group_field_x" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="group_field_y" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="metric_field_z" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="aggregate_z" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="1065" y="22" name="graphs">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="title" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="report_type" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="report_name" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="plot" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="929" y="19" name="metrics1d">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="name" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="title" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="conditions" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<row name="group_field" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="columns" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="626" y="258" name="object_categories">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="code" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="category" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="definition" null="1" autoincrement="0">
<datatype>text</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="309" y="365" name="objects">
<row name="id" null="0" autoincrement="1">
<datatype>integer</datatype>
</row>
<row name="reference" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<row name="serial_number" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="batch_number" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="note" null="0" autoincrement="0">
<datatype>text</datatype>
</row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
<table x="466" y="18" name="domains">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="domain" null="0" autoincrement="0">
<datatype>string</datatype>
<default>'NULL'</default></row>
<key type="PRIMARY" name="">
<part>id</part>
</key>
</table>
</sql>
......@@ -94,6 +94,7 @@
'Documentations': 'Documentations',
'Domain': 'Domaine',
'Domaine': 'Domaine',
'domains': 'domaines',
'Duration': 'Durée',
'E-mail': 'E-mail',
'end': 'fin',
......
......@@ -51,6 +51,7 @@ year = now.year
tables = ['auth_group',
'auth_membership',
'auth_user',
'domains',
'events',
'fundings',
'graphs',
......
# -*- coding: utf-8 -*-
""" domains
"""
db.define_table("domains",
Field("domain", "string", length=255, notnull=True, unique=True),
migrate="domains.table")
db.domains._before_delete.append(INHIBIT_CASCADE_DELETE)
db.domains._before_delete.append(dbui.INHIBIT_DELETE_UNDEF)
db.domains._before_update.append(dbui.INHIBIT_UPDATE_UNDEF)
......@@ -4,7 +4,6 @@
"""
db.define_table("teams",
Field("team", "string", length=255, notnull=True, unique=True),
Field("domain", "string", length=255),
migrate="teams.table")
db.teams._before_delete.append(INHIBIT_CASCADE_DELETE)
......
......@@ -4,6 +4,7 @@
"""
db.define_table("history",
Field("id_events", "reference events", default=undef_id, label='Event'),
Field("id_domains", "reference domains", default=undef_id, label='Domain'),
Field("id_teams", "reference teams", default=undef_id, label='Team'),
Field("id_projects", "reference projects", default=undef_id, label='Project'),
Field("id_fundings", "reference fundings", default=undef_id, label='Funding'),
......
# -*- coding: utf-8 -*-
""" teams
"""
#-------------------------------------------------------------------------------
#
# FIELDS CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# FORM CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('domains')
storeModifier.orderby(db.domains.domain)
\ No newline at end of file
......@@ -28,7 +28,8 @@ fieldsModifier.configure_field('note', height=150)
#
#-------------------------------------------------------------------------------
formModifier = dbui.FormModifier('history')
formModifier.merge_fields('id_teams',
formModifier.merge_fields('id_domains',
'id_teams',
'id_projects',
'id_fundings',
title=T('Metadata'))
......@@ -63,12 +64,14 @@ gridModifier = dbui.GridModifier('history')
gridModifier.configure(plugins=['pGridPaging'])
gridModifier.hide_columns('data',
'id_domains',
'id_object_categories',
'id_people_categories',
'note',
'percentage')
gridModifier.append_filter(('id_events', '==', T('is equal to')))
gridModifier.append_filter(('id_domains', '==', T('is equal to')))
gridModifier.append_filter(('id_teams', '==', T('is equal to')))
gridModifier.append_filter(('id_projects', '==', T('is equal to')))
gridModifier.append_filter(('id_fundings', '==', T('is equal to')))
......
......@@ -4,6 +4,10 @@
Insert defaults values in the tables
"""
if not db(db.domains.id).count():
db.domains.insert(id=undef_id,
domain=undef)
if not db(db.events.id).count():
db.events.insert(id=undef_id,
event=undef,
......
......@@ -7,6 +7,7 @@ tp_data = T("The field history.data contains the given value.")
virtdb.define_table('selector',
Field('year_start', 'integer', default=year),
Field('year_end', 'integer'),
Field('id_domains', 'reference domains', label=T('Domain')),
Field('id_teams', 'reference teams', label=T('Team')),
Field('id_projects', 'reference projects', label=T('Project')),
Field('id_fundings', 'reference fundings', label=T('Funding')),
......@@ -28,6 +29,7 @@ IS_IN_DB(db, 'alias_people_categories.category')
virtdb.selector.id_people_code.requires = \
IS_IN_DB(db, 'people_categories.code')
virtdb.selector.id_domains.requires = IS_IN_DB(db, 'domains.domain')
virtdb.selector.id_fundings.requires = IS_IN_DB(db, 'fundings.agency')
virtdb.selector.id_projects.requires = IS_IN_DB(db, 'projects.project')
virtdb.selector.id_teams.requires = IS_IN_DB(db, 'teams.team')
......@@ -46,6 +48,7 @@ mytype = 'xcomboboxuserreset'
text = T('select...')
fieldsModifier.configure_field('id_categories', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_domains', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_fundings', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_object_categories', emptyText=text, xtype=mytype)
fieldsModifier.configure_field('id_object_code', emptyText=text, xtype=mytype)
......
......@@ -78,6 +78,7 @@ cfgNode.add_child(T('the graphs'), to_grid('graphs'))
#
#-------------------------------------------------------------------------------
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'))
......
# -*- coding: utf-8 -*-
"""a collections of functions to be used in _before_delete, before_insert
and _before_update callbacks.
......
# -*- coding: utf-8 -*-
"""matplotlib_tools module
"""
import matplotlib as mpl
import os
from datetime import datetime
from gluon import current
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.ticker import IndexLocator
NOW = datetime.now()
def create_pdf(base):
"""Generate the pdf file. It name depends on the user criteria and on
the arguments.
Args:
base (str): the filename is base.pdf
Returns:
matplotlib.backends.backend_pdf.PdfPages
"""
request = current.request
fn = "%s.pdf" % base
fn = os.path.join("applications", request.application, "scripts", fn)
return PdfPages(fn)
def header_footer(fig, title, timestamp=False):
"""write the header_footer and the footer.
Args:
ax (matplotlib.Figure):
title (str):
timestamp (bool):
"""
fig.text(0.05, 0.9, title, fontsize=14)
if timestamp:
msg = NOW.strftime("%b %d, %Y %H:%M\nday %j -- week %W")
fig.text(0.94, 0.89, msg, fontsize=8, horizontalalignment='right')
fig.text(0.94, 0.04, fig.number, fontsize=10, horizontalalignment='right')
def plot_references(ax, lines, values, xpos, stacked=False):
"""Plot reference markers.
Args:
ax (matplotlib.Axes):
lines (list):
values (list): reference value per line
xpos (float):
stacked (bool)
"""
legend = ax.get_legend()
texts = [el.get_text() for el in legend.get_texts()]
value = 0.
mycolor = "black"
for line in lines:
i = texts.index(line)