# -*- coding: utf-8 -*- """ Common settings Model instantiate the database table as well as the UI configuration. It is tune to only satisfy the need of the controller, function pair. Note: The model expose to controllers several global variables: * auth * directSvc """ from plugin_dbui import (configure_forms, configure_grids, Dbui) from plugin_event import (Core, CoreUi, Event, Report, ReportUi, Selector, ViewportUi) ctrl = request.controller fnct = request.function # ............................................................................ # # Language # T.set_current_languages("en", "en-gb", "en-us") # mother tongue T.force("fr-fr") # user language T.lazy = True # lazy translation # ............................................................................ # # Plugin dbui configuration # is_dbui = (ctrl == "plugin_dbui") and \ fnct in ("debug", "documentations", "dbui_conf", "index") if is_dbui: Dbui.define_paths( app_about="static/plugin_event/ABOUT.html", app_css=None, app_changelog="static/plugin_event/CHANGELOG", app_db_schema="static/plugin_event/docs/database.png", app_debug=None, app_html_api="static/plugin_event/docs/api/index.html", app_html_jsduck="static/plugin_event/docs/jsduck/index.html", app_html_user="static/plugin_event/docs/user/index.html", app_lg=None, app_license="static/plugin_event/LICENSE", app_libmin="static/plugin_event/event-min.js", app_pdf_api="static/plugin_event/docs/pdf/event_api.pdf", app_pdf_user="static/plugin_event/docs/pdf/event_user.pdf", app_script="static/app.js") Event.define_paths("fr") # ............................................................................ # # Create the database models # is_db = (ctrl == "plugin_dbui" and fnct in ("call", "csv", "dbui_conf")) \ or (ctrl == "plugin_event") if is_db: # register source for the reporting Event.register_sources() Core.define_tables(db, T) Report.define_tables(db, T) Selector.define_tables(virtdb, db, T) # ............................................................................ # # Configure the user interface # if ctrl == "plugin_dbui" and fnct in ("call", "dbui_conf"): Dbui.initialise_ui() directSvc = Dbui.start_directSvc() # common configuration for forms and grids tables = ["auth_group", "auth_membership", "auth_user", "domains", "events", "fundings", "lists2", "metrics2d2", "object_categories", "objects", "people", "people_categories", "projects", "teams"] configure_forms(tables, plugins=["pFormToolTip"], width=350) configure_grids( tables, plugins=["pGridRowEditorConfirmDelete", "pGridRowEditorContextMenu", "pGridRowEditorDblClick", "pGridToolbar"]) # tune the user interface CoreUi.define(db, T) ReportUi.define(db, T) # configure the main viewport if fnct == "dbui_conf": ViewportUi.define(db, T, virtdb)