Commit 313f2beb authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Rename classes and methods related to model and ui.

parent 5211c078
......@@ -10,6 +10,6 @@ A collection of classes to define the model for the database.
:toctree: generated/
Event
EvtModelCore
EvtModelReport
EvtModelSelector
\ No newline at end of file
Core
Report
Selector
\ No newline at end of file
UI
--
User Interface
--------------
A collection of classes to tune the user interface.
......@@ -9,7 +9,7 @@ A collection of classes to tune the user interface.
.. autosummary::
:toctree: generated/
EvtUiCore
EvtUiReport
EvtUiSelector
EvtUiViewport
\ No newline at end of file
CoreUi
ReportUi
SelectorUi
ViewportUi
\ No newline at end of file
......@@ -252,6 +252,7 @@
'Name of the object.': 'Name of the object.',
'Niveau': 'Niveau',
'Nom de famille': 'Nom de famille',
'not install': 'pas installé',
'Note': 'Note',
'Notified': 'Notifié',
'Object': 'Objet',
......
......@@ -35,7 +35,7 @@ is_dbui = (ctrl == "plugin_dbui") and \
fnct in ("debug", "documentations", "dbui_conf", "index")
if is_dbui:
dbui.Dbui.initialise_paths(
dbui.Dbui.define_paths(
app_about="static/plugin_event/ABOUT.html",
app_css="static/plugin_event/resources/css/event.css",
app_changelog="static/plugin_event/CHANGELOG",
......@@ -51,7 +51,7 @@ if is_dbui:
app_pdf_user="static/plugin_event/docs/pdf/event_user.pdf",
app_script="static/app.js")
event.Event.initialise_paths("fr")
event.Event.define_paths("fr")
#.............................................................................
#
......@@ -62,9 +62,9 @@ is_db = (ctrl == "plugin_dbui" and fnct in ("call", "csv", "dbui_conf")) or \
(ctrl == "plugin_event")
if is_db:
event.EvtModelCore(db, T)
event.EvtModelReport(db, T)
event.EvtModelSelector(virtdb, db, T)
event.Core.define_tables(db, T)
event.Report.define_tables(db, T)
event.Selector.define_tables(virtdb, db, T)
#.............................................................................
#
......@@ -103,11 +103,11 @@ if ctrl == "plugin_dbui" and fnct in ("call", "dbui_conf"):
"pGridToolbar"])
# tune the user interface
event.EvtUiCore(db, T)
event.EvtUiReport(db, T)
event.CoreUi.define(db, T)
event.ReportUi.define(db, T)
selector_panel = event.EvtUiSelector.selector(virtdb, db, T)
selector_panel = event.SelectorUi.selector(virtdb, db, T)
# configure the main viewport
if fnct == "dbui_conf":
event.EvtUiViewport(db, T, selector_panel)
event.ViewportUi.define(db, T, selector_panel)
......@@ -13,9 +13,9 @@ from matplotlib_tools import (create_pdf,
ticks_and_labels,
xticks_and_labels)
from model_core import EvtModelCore
from model_report import EvtModelReport
from model_selector import EvtModelSelector
from model_core import Core
from model_report import Report
from model_selector import Selector
from report_objects import (do_title,
get_value,
......@@ -31,7 +31,7 @@ from selector import (EvtSelector,
SelectorActiveItems,
SelectorActiveItemsException)
from ui_core import EvtUiCore
from ui_report import EvtUiReport
from ui_selector import EvtUiSelector
from ui_viewport import EvtUiViewport
\ No newline at end of file
from ui_core import CoreUi
from ui_report import ReportUi
from ui_selector import SelectorUi
from ui_viewport import ViewportUi
......@@ -14,8 +14,8 @@ class Event(object):
"""
@staticmethod
def initialise_paths(lg="en"):
"""Add paths for the plugin_event.
def define_paths(lg="en"):
"""Define paths for the plugin_event.
Args:
lg (str): the language. Possible values are ``en`` or ``fr``.
......@@ -32,4 +32,3 @@ class Event(object):
"debug": "static/plugin_event/event-debug.js",
"lg": "static/plugin_event/locale/event-lang-%s.js" % lg,
"libmin": "static/plugin_event/event-min.js"}
......@@ -13,35 +13,11 @@ from gluon.validators import IS_IN_DB
from pydal import Field
class EvtModelCore(object):
class Core(object):
"""Create the history table and its foreign tables, including
alias table for object and people categories.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
def __init__(self, db, T):
# foreign tables
EvtModelCore.domains(db, T)
EvtModelCore.events(db, T)
EvtModelCore.fundings(db, T)
EvtModelCore.object_categories(db, T)
EvtModelCore.objects(db, T)
EvtModelCore.people_categories(db, T)
EvtModelCore.people(db, T)
EvtModelCore.projects(db, T)
EvtModelCore.teams(db, T)
# the main table
EvtModelCore.history(db, T)
# alias
db.object_categories.with_alias("alias_object_categories")
db.people_categories.with_alias("alias_people_categories")
@staticmethod
def _protect(table):
"""protect the content of the table.
......@@ -57,6 +33,33 @@ class EvtModelCore(object):
table._before_delete.append(dbui.INHIBIT_DELETE_UNDEF)
table._before_update.append(dbui.INHIBIT_UPDATE_UNDEF)
@staticmethod
def define_tables(db, T):
"""define the core tables
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
# foreign tables
Core.domains(db, T)
Core.events(db, T)
Core.fundings(db, T)
Core.object_categories(db, T)
Core.objects(db, T)
Core.people_categories(db, T)
Core.people(db, T)
Core.projects(db, T)
Core.teams(db, T)
# the main table
Core.history(db, T)
# alias
db.object_categories.with_alias("alias_object_categories")
db.people_categories.with_alias("alias_people_categories")
@staticmethod
def domains(db, T):
"""domains table
......@@ -74,7 +77,7 @@ class EvtModelCore(object):
Field("domain", "string", length=255, notnull=True, unique=True),
migrate="domains.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -97,7 +100,7 @@ class EvtModelCore(object):
Field("data", "json", label="Model"),
migrate="events.table")
EvtModelCore._protect(table)
Core._protect(table)
# NOTE: we have to remove the json validator to work !!
table.data.requires = None
......@@ -122,7 +125,7 @@ class EvtModelCore(object):
Field("definition", "text"),
migrate="fundings.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -223,7 +226,7 @@ class EvtModelCore(object):
Field("definition", "text"),
migrate="object_categories.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -247,7 +250,7 @@ class EvtModelCore(object):
Field("note", "text"),
migrate="objects.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -277,7 +280,7 @@ class EvtModelCore(object):
Field("definition", "text"),
migrate="people_categories.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -302,7 +305,7 @@ class EvtModelCore(object):
Field("note", "text"),
migrate="people.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -323,7 +326,7 @@ class EvtModelCore(object):
Field("project", "string", length=255, notnull=True, unique=True),
migrate="projects.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -364,6 +367,6 @@ class EvtModelCore(object):
Field("team", "string", length=255, notnull=True, unique=True),
migrate="teams.table")
EvtModelCore._protect(table)
Core._protect(table)
return table
......@@ -77,21 +77,25 @@ TP_SORTERS = \
"or 'year'. Descending order is obtained by using the '~field' construct."
class EvtModelReport(object):
class Report(object):
"""Create the tables for the reporting: lists, metrics1d, metrics2d,
and graphs.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
def __init__(self, db, T):
@staticmethod
def define_tables(db, T):
"""Define tables for the reporting.
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
EvtModelReport.graphs(db, T)
EvtModelReport.lists(db, T)
EvtModelReport.metrics1d(db, T)
EvtModelReport.metrics2d(db, T)
Report.graphs(db, T)
Report.lists(db, T)
Report.metrics1d(db, T)
Report.metrics2d(db, T)
@staticmethod
def graphs(db, T):
......
......@@ -10,18 +10,19 @@ from pydal import Field
TP_DATA = "The field history.data contains the given value."
class EvtModelSelector(object):
"""Create the table defining the selector.
class Selector(object):
Args:
virtdb (pyDAL.DAL): connection to the virtual database
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
@staticmethod
def define_tables(virtdb, db, T):
"""Define the table use for the selector.
"""
def __init__(self, virtdb, db, T):
Args:
virtdb (pyDAL.DAL): connection to the virtual database
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
EvtModelSelector.selector(virtdb, db, T)
"""
Selector.selector(virtdb, db, T)
@staticmethod
def selector(virtdb, db, T):
......@@ -84,4 +85,3 @@ class EvtModelSelector(object):
table.id_teams.requires = IS_IN_DB(db, "teams.team")
return table
......@@ -12,26 +12,27 @@ gridModifier = dbui.GridModifier
storeModifier = dbui.StoreModifier
class EvtUiCore(object):
"""Tune the user interface for the history table and its foreign tables,
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
def __init__(self, db, T):
EvtUiCore.domains(db, T)
EvtUiCore.events(db, T)
EvtUiCore.fundings(db, T)
EvtUiCore.history(db, T)
EvtUiCore.object_categories(db, T)
EvtUiCore.objects(db, T)
EvtUiCore.people_categories(db, T)
EvtUiCore.people(db, T)
EvtUiCore.projects(db, T)
EvtUiCore.teams(db, T)
class CoreUi(object):
@staticmethod
def define(db, T):
"""Tune the user interface for the history table and its foreign tables,
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
"""
CoreUi.domains(db, T)
CoreUi.events(db, T)
CoreUi.fundings(db, T)
CoreUi.history(db, T)
CoreUi.object_categories(db, T)
CoreUi.objects(db, T)
CoreUi.people_categories(db, T)
CoreUi.people(db, T)
CoreUi.projects(db, T)
CoreUi.teams(db, T)
@staticmethod
def domains(db, T):
......
......@@ -11,21 +11,22 @@ gridModifier = dbui.GridModifier
storeModifier = dbui.StoreModifier
class EvtUiReport(object):
"""Tune the user interface for the report tables: lists, metrics1d,
metrics2d and graphs.
class ReportUi(object):
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
@staticmethod
def define(db, T):
"""Tune the user interface for the report tables: lists, metrics1d,
metrics2d and graphs.
"""
def __init__(self, db, T):
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
EvtUiReport.graphs(db, T)
EvtUiReport.lists(db, T)
EvtUiReport.metrics1d(db, T)
EvtUiReport.metrics2d(db, T)
"""
ReportUi.graphs(db, T)
ReportUi.lists(db, T)
ReportUi.metrics1d(db, T)
ReportUi.metrics2d(db, T)
@staticmethod
def graphs(db, T):
......
......@@ -13,18 +13,19 @@ gridModifier = dbui.GridModifier
storeModifier = dbui.StoreModifier
class EvtUiSelector(object):
"""Tune the user interface for the selector.
class SelectorUi(object):
Args:
virtdb (pyDAL.DAL): connection to the virtual database
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
@staticmethod
def define(virtdb, db, T):
"""Tune the user interface for the selector.
"""
def __init__(self, virtdb, db, T):
Args:
virtdb (pyDAL.DAL): connection to the virtual database
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
EvtUiSelector.selector(virtdb, db, T)
"""
SelectorUi.selector(virtdb, db, T)
@staticmethod
def selector(virtdb, db, T):
......
......@@ -14,29 +14,30 @@ Panel = dbui.Panel
to_grid = dbui.to_gridPanel
class EvtUiViewport(object):
"""Configure the viewport.
class ViewportUi(object):
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
selector_panel (gluon.storage.Storage):
configuration of the selector panel.
@staticmethod
def define(db, T, selector_panel):
"""Configure the viewport.
"""
def __init__(self, db, T, selector_panel):
Args:
db (pyDAL.DAL): database connection
T (gluon.languages.translator): language translator
selector_panel (gluon.storage.Storage):
configuration of the selector panel.
"""
nodes = [
EvtUiViewport.help_node(db, T),
EvtUiViewport.app_node(db, T),
EvtUiViewport.configure_node(db, T),
EvtUiViewport.meta_node(db, T),
EvtUiViewport.object_node(db, T),
EvtUiViewport.event_node(db, T),
EvtUiViewport.list_node(db, T, selector_panel),
EvtUiViewport.metric1d_node(db, T, selector_panel),
EvtUiViewport.metric2d_node(db, T, selector_panel),
EvtUiViewport.graph_node(db, T, selector_panel)]
ViewportUi.help_node(db, T),
ViewportUi.app_node(db, T),
ViewportUi.configure_node(db, T),
ViewportUi.meta_node(db, T),
ViewportUi.object_node(db, T),
ViewportUi.event_node(db, T),
ViewportUi.list_node(db, T, selector_panel),
ViewportUi.metric1d_node(db, T, selector_panel),
ViewportUi.metric2d_node(db, T, selector_panel),
ViewportUi.graph_node(db, T, selector_panel)]
modifier = dbui.ViewportModifier()
modifier.add_node(*nodes)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment