Exemplo n.º 1
0
def install_app(i):
	system.serialWarning()
	global category
	slug = category[i]["slug"]
	category = None
	gc.collect()
	if not wifi.status():
		wifi.connect()
		wifi.wait()
		if not wifi.status():
			showMessage("Unable to connect to WiFi.")
			time.sleep(2)
			return
	showMessage("Installing "+slug+"...")
	try:
		woezel.install(slug)
	except woezel.LatestInstalledError:
		showMessage("Latest version is already installed.")
		time.sleep(2)
		return
	except:
		showMessage("Failed to install "+slug+"!")
		time.sleep(2)
		return
	showMessage(slug+" has been installed!")
	return
Exemplo n.º 2
0
def show_category(i):
    system.serialWarning()
    global category
    slug = categories[i]["slug"]
    name = categories[i]["name"]
    showMessage("Loading " + slug + "...")
    try:
        try:
            category = woezel.get_category(slug)
        except:
            showMessage("Failed to open category " + slug + "!", True)
            time.sleep(1)
            show_categories()
        gc.collect()
        opt = []
        for package in category:
            opt.append("%s rev. %s" % (package["name"], package["revision"]))
        opt.append("< Back to categories")
        sel = term.menu("Installer - " + name, opt)
        if sel == len(category):
            show_categories()
        install_app(sel, i)
    except BaseException as e:
        sys.print_exception(e)
        showMessage(e, True)
        time.sleep(1)
        show_categories()
Exemplo n.º 3
0
def show_category(i = None):
	system.serialWarning()
	global category
	if i != None:
		slug = repo.categories[i]["slug"]
		name = repo.categories[i]["name"]
		showMessage("Loading "+slug+"...")
		try:
			category = repo.getCategory(slug)
		except:
			showMessage("Failed to open category "+slug+"!", True)
			time.sleep(1)
			return
		gc.collect()
	else:
		if category == None:
			print("Internal error.")
			return
	try:
		opt = []
		for package in category:
			opt.append("%s rev. %s" % (package["name"], package["revision"]))
		opt.append("< Back to categories")
		while True:
			sel = term.menu("Installer - "+name, opt)
			if sel == len(category):
				return
			install_app(sel)
	except BaseException as e:
		sys.print_exception(e)
		showMessage(e, True)
		time.sleep(1)
		return
def install_app(i,fromcat):
	system.serialWarning()
	global category
	slug = category[i]["slug"]
	category = None
	showMessage("Installing "+slug+"...")
	uinstaller.install(slug)
Exemplo n.º 5
0
def show_category(slug, name):
	system.serialWarning()
	showMessage("Loading "+slug+"...")
	try:
		category = repo.getCategory(slug)
	except BaseException as e:
		showMessage("Failed to open category "+slug+"!", True)
		sys.print_exception(e)
		time.sleep(1)
		return
	gc.collect()
	try:
		opt = []
		for package in category:
			opt.append("%s rev. %s" % (package["name"], package["revision"]))
		opt.append("< Back to categories")
		sel = term.menu("Installer - "+name, opt)
		if sel == len(opt)-1:
			return
		slug  = category[sel]["slug"]
		category = None
		gc.collect()
		install_app(slug)
	except BaseException as e:
		sys.print_exception(e)
		showMessage(e, True)
		time.sleep(1)
		return
Exemplo n.º 6
0
def show_categories():
    system.serialWarning()
    opt = []
    for category in categories:
        opt.append(category["name"])
    opt.append("< Back to launcher")
    sel = term.menu("Installer - Categories", opt)
    if sel == len(categories):
        system.launcher(True)
    show_category(sel)
Exemplo n.º 7
0
def show_categories():
	system.serialWarning()
	while True:
		opt = []
		for category in repo.categories:
			opt.append(category["name"])
		opt.append("< Back to launcher")
		sel = term.menu("Installer - Categories", opt)
		if sel == len(repo.categories):
			system.launcher(True)
		opt = []
		gc.collect()
		show_category(repo.categories[sel]["slug"], repo.categories[sel]["name"])
def install_app(i, fromcat):
    system.serialWarning()
    global category
    slug = category[i]["slug"]
    category = None
    gc.collect()
    if not wifi.status():
        wifi.connect()
        wifi.wait()
        if not wifi.status():
            showMessage("Unable to connect to WiFi.")
            time.sleep(2)
            show_category(fromcat)
    showMessage("Installing " + slug + "...")
    uinstaller.install(slug)
import term, orientation, system, time, uos, json, machine

system.serialWarning()
term.header(True, "Services")
print("Loading...")
apps = uos.listdir('/lib')
services = []
for app in apps:
    if "ledsrv.py" in uos.listdir('/lib/' + app):
        services.append(app)

current = machine.nvs_getstr('splash', 'ledApp')

while True:
    options = []
    for service in services:
        title = service
        if service == current:
            title += " [Enabled]"
        options.append(title)
    options.append(" None (disable LED services)")
    options.append("< Exit")

    selected = term.menu("Services", options, 0, "")
    if selected > len(services):
        system.home(True)
    if selected == len(services):
        current = None
        try:
            machine.nvs_erase('splash', 'ledApp')
        except: