Skeleton appΒΆ

This is an example application. It shows basics of initializing your application, some conventions you need to follow and basics of working with UI elements.

menu_name = "Skeleton app" #App name as seen in main menu while using the system

from subprocess import call
from time import sleep

from ui import Menu, Printer

def call_internal():
    Printer(["Calling internal", "command"], i, o, 1)

def call_external():
    Printer(["Calling external", "command"], i, o, 1)
    call(['echo', 'Success'])

#Callback global for pyLCI. It gets called when application is activated in the main menu
callback = None

#Some globals for us
i = None #Input device
o = None #Output device

def init_app(input, output):
    global callback, i, o
    i = input; o = output #Getting references to output and input device objects and saving them as globals
    main_menu_contents = [
    ["Internal command", call_internal],
    ["External command", call_external],
    ["Exit", 'exit']]
    main_menu = Menu(main_menu_contents, i, o, "Skeleton app menu")
    callback = main_menu.activate