Overview

Basics of a form

An application is defined as a namespace containing several main functions with predefined names (starting with gui) and syntax. These are described in the table below. For MATLAB the namespace must be a package. For Python it must be a module. Simian GUI must be able to find the namespace on the path.

Simian GUI will try to execute the gui functions during initialization and when handling events. The form code can be in other files and functions, as long as the gui functions call these other functions in turn. When the functions are not found or cannot be executed for any other reason, the form will not function correctly.

gui functions

FunctionMandatoryDescriptionSyntax
guiInitForm initialization code. See Form definition.payload = guiInit(metadata)
guiEventEvent handling code. See Handling events.payload = guiEvent(metadata, payload)
guiDownloadDownload content from the form. This is triggered instead of guiEvent when the downloadStart event is triggered. For more info, see the guiDownload section.payload = guiDownload(metadata, payload)
guiUploadUpload content to the form. This is triggered instead of guiEvent when a button is clicked that had the setUpload method called on it during form initialization. For more info, see the guiUpload section.payload = guiUpload(metadata, payload)
guiCloseDefine what should happen when the application is closed. For example, data may need to be saved or the workspace might need to be cleaned up. In addition to what is executed in your custom function, the cache is cleared.guiClose(metadata)

Running locally

The functions must be in a package (or module) to prevent shadowing these functions implemented for other potential applications created with Simian GUI. Once these functions have been created and the code and Simian are on the path, the form can be initialized locally by using:

simian.local_v2_0_0.Uiformio("my.namespace")
import simian.local
simian.local.Uiformio("my.namespace")

where "my.namespace" is the unique namespace of your form.

The following extra options can be specified:

  • MATLAB:
    • Uiformio(_, "FigureHandle", figHandle) Specifies a custom parent figure.
    • Uiformio(_, "FigureProps", props) Specifies additional options (cell array) to use for the uihtml component.
    • Uiformio(_, "Fullscreen", fullscreen) Sets the figure full screen on start when true.
    • Uiformio(_, "Maximized", maximized) Maximizes the figure on start when true.
    • Uiformio(_, "Size", size) Sets the initial size [width, height] of the figure.
    • Uiformio(_, "WindowTitle", title) Specifies a title for the figure.
  • Python:
    • Uiformio(_, debug=debug) Sets the application debug flag.
    • Uiformio(_, fullscreen=fullscreen) Sets the window full screen on start when true.
    • Uiformio(_, size=size) Sets the initial window size [width, height].
    • Uiformio(_, window_title=window_title) Specifies a title for the application window.

For deploying the form on a server please refer to the deployment chapter.