Skip to content

Documentation

tenJirka edited this page Aug 21, 2023 · 3 revisions

Few words at beginning

There is whole documentation on this library, if you can't find anything here, try look to the code, it should be well commented (I hope).

Scene

Object representing some scene that will be displayed.

Parameters

Optional

  • noClear: true/false viz NoClear object
  • timeOut: timeout in secs viz [TimeOut object
  • simplePath: when Simple is not installed in /opt/bin/simple, another way could be specified here
  • encoding: encoding of output

Methods:

.add()

  • takes object from "List of objects that can be added to Scene" or list of these objects and add it to the scene

.display()

  • display object from scene and waits for input, if timeOut is not specified.
  • result of SAS (program input) stores to .input as list of id and textinput (if any was given): ['id', 'textinput'] or ['id', None]

.remove(id: str):

  • search objects from scene by id and when find match, deletes it from there.

List of objects that can be added to Scene

Label

Good for short texts like headlights etc.

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height

Optional:

  • text - text that will be displayed
  • id - id of this object
  • fontSize - font size (when specified, FontSize object will be added before this)
  • justify - text alignment - possible inputs are "left", "center" or "right" (when specified, Justify object will be added before this)

Paragraph

Good for longer and multi line texts.

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height

Optional:

  • text - text that will be displayed
  • id - id of this object
  • fontSize - font size (when specified, FontSize object will be added before this)
  • justify - text alignment - possible inputs are "left", "center" or "right" (when specified, Justify object will be added before this)

Button

Button

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height

Optional:

  • text - text that will be displayed
  • id - id of this object
  • fontSize - font size (when specified, FontSize object will be added before this)
  • justify - text alignment - possible inputs are "left", "center" or "right" (when specified, Justify object will be added before this)

TextInput

Text field that can be edited by onscreen keyboard. Good for shorter text on one line.

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height

Optional:

  • text - text that will be displayed
  • id - id of this object
  • fontSize - font size (when specified, FontSize object will be added before this)
  • justify - text alignment - possible inputs are "left", "center" or "right" (when specified, Justify object will be added before this)

TextArea

Text field that can be edited by onscreen keyboard. Good for longer text on multiple lines.

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height

Optional:

  • text - text that will be displayed
  • id - id of this object
  • fontSize - font size (when specified, FontSize object will be added before this)
  • justify - text alignment - possible inputs are "left", "center" or "right" (when specified, Justify object will be added before this)

Image

Image that will be displayed

Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height
  • path: Full path to image that should be displayed
  • id: id of this object

Range

Horizontal slider, by which number from range can be chosen.

###Parameters:

Compulsory

  • x: x coordinate
  • y: y coordinate
  • w: weight
  • h: height
  • min: Minimum value that will be on slider
  • max: Maximum value that will be on slider
  • value: Current/initial value that will be chosen on slider

FontSize

Specifies font size for next objects. It is valid until next occurrence of this object.

Parameters:

Compulsory

  • size: Font size

Justify

Specifies text alignment for next objects. It is valid until next occurrence of this object.

Parameters:

Compulsory

  • justify: possible inputs are "left", "right" and "center"

Timeout

Specifies timeout that SAS will wait until it exits. Its only way to exit without any input.

Parameters:

Compulsory

  • timeout: timeout in secs

NoClear

When used, SAS will not clear the display before render.

Parameters:

  • None