3. Modular page view

3.1. Page structure overview

3.2. Creating pages

Modular page views are created by subclassing the ModularPageView class:

class HomeView(ModularPageView):
 name = "HomeView"
 label = "Home View"
 injectVariables = ['ModelCommunicator', 'variables']
 modules = [AreaCalculator, UnitConverterModule, Company]

A modular page consists of modules, which can be activated by the user by clicking on the corresponding pill in the sidebar in the left of the page.


A modular page example

3.3. Modules

Page modules may be one of the following types:

3.3.1. NumericalModel


An active NumericalModel module

3.3.2. HtmlModule

class smo.web.modules.HtmlModule[source]

Page module consisting of blocks of HTML and JavaScript code


An active HtmlModule module

3.3.3. RestModule

class smo.web.modules.RestModule[source]

Page module generated from a restructured text document


An active RestModule module

3.4. Blocks

3.4.1. ModelView


3.4.2. HtmlBlock

class smo.web.blocks.HtmlBlock(srcType=None, src=None)[source]

A block of HTML code

  • srcType (str) – ‘string’ or ‘file’
  • src (str) – the string of code or file path

3.4.3. JsBlock

class smo.web.blocks.JsBlock(srcType=None, src=None)[source]

A block of JavaScript code

  • srcType (str) – ‘string’ or ‘file’
  • src (str) – the string of code or file path