Example #1
0
def update():
    clear()
    connect()

    with dialogs.WaitingMessage(text="Downloading full list of library files", title="TiLDA App Library") as message:
        message.text="Downloading full list of library files"
        master = http_client.get("http://api.badge.emfcamp.org/firmware/master-lib.json").raise_for_status().json()
        libs_to_update = []
        for lib, expected_hash in master.items():
            if expected_hash != filesystem.calculate_hash("lib/" + lib):
                libs_to_update.append({
                    "url": "http://api.badge.emfcamp.org/firmware/master/lib/" + lib,
                    "target": "lib/" + lib,
                    "expected_hash": expected_hash,
                    "title": lib
                })
        download_list(libs_to_update, message)

        apps = get_local_apps()
        for i, app in enumerate(apps):
            message.text = "Updating app %s" % app
            if app.fetch_api_information():
                download_app(app, message)

    dialogs.notice("Everything is up-to-date")
Example #2
0
def remove():
    clear()

    app = dialogs.prompt_option(get_local_apps(), title="TiLDA App Library", text="Please select an app to remove", select_text="Remove", none_text="Back")

    if app:
        clear()
        with dialogs.WaitingMessage(text="Removing %s\nPlease wait..." % app, title="TiLDA App Library"):
            for file in os.listdir(app.folder_path):
                os.remove(app.folder_path + "/" + file)
            os.remove(app.folder_path)
        remove()
Example #3
0
def update_options(options, category, pinned):
	options.disable_draw()
	apps = get_local_apps(category)
	out = []
	while options.count():
		options.remove_item(0)

	for app in apps:
		if app.get_attribute("built-in") == "hide":
			continue # No need to show the home app

		if app.folder_name in pinned:
			options.add_item("*%s" % app.title)
		else:
			options.add_item(app.title)
		out.append(app)

	options.selected_index(0)
	options.enable_draw()
	return out
Example #4
0
def update_options(options, category, pinned):
    options.disable_draw()
    apps = get_local_apps(category)
    out = []
    while options.count():
        options.remove_item(0)

    for app in apps:
        if app.get_attribute("built-in") == "hide":
            continue  # No need to show the home app

        if app.folder_name in pinned:
            options.add_item("*%s" % app.title)
        else:
            options.add_item(app.title)
        out.append(app)

    options.selected_index(0)
    options.enable_draw()
    return out
Example #5
0
def get_external_hook_paths():
    return [
        "%s/external" % app.folder_path for app in get_local_apps()
        if is_file("%s/external.py" % app.folder_path)
    ]
Example #6
0
def get_external_hook_paths():
	return ["%s/external" % app.folder_path for app in get_local_apps() if is_file("%s/external.py" % app.folder_path)]