def add_app(app, information):
    global apps
    install_path = woezel.get_install_path()
    try:
        title = information["name"]
    except:
        title = app
    try:
        category = information["category"]
    except:
        category = ""
    try:
        icon = information["icon"] if category == "system" else __import__(
            '%s/%s/icon' % (install_path, app)).icon

        data, num_frames = icon
        if len(data) != 8 * 8 * num_frames:
            print(
                'App icon for app "%s" is not 8*8 or has more/less frames than it says'
                % title)
            icon = icon_unknown

    except:
        icon = icon_unknown

    info = {"file": app, "title": title, "category": category, "icon": icon}
    apps.append(info)
Example #2
0
def read_metadata(app):
    try:
        install_path = woezel.get_install_path()
        info_file = "%s/%s/metadata.json" % (install_path, app)
        print("Reading " + info_file + "...")
        with open(info_file) as f:
            information = f.read()
        return ujson.loads(information)
    except BaseException as e:
        print("[ERROR] Can not read metadata for app " + app)
        sys.print_exception(e)
        information = {"name": app, "title": "---", "category": ""}
        return information
Example #3
0
def add_app(app, information):
    global apps
    install_path = woezel.get_install_path()
    try:
        title = information["name"]
    except:
        title = app
    try:
        category = information["category"]
    except:
        category = ""
    try:
        if category == "system":
            icon = {'data': information["icon"]}
        else:
            icon = {'path': '%s/%s/icon' % (install_path, app)}

    except:
        icon = {'data': icon_unknown}

    info = {"file": app, "title": title, "category": category, "icon": icon}
    apps.append(info)
import uos as os, time, machine, system
import uinterface, woezel, rgb

app = machine.nvs_getstr('launcher', 'uninstall_name')
app_file = machine.nvs_getstr('launcher', 'uninstall_file')

if (not app) or not (app_file):
    system.home()

agreed = uinterface.confirmation_dialog('Uninstall \'%s\'?' % app)
if not agreed:
    system.home()

uinterface.loading_text("Removing " + app + "...")
install_path = woezel.get_install_path()
print(app)
print(app_file)
print(install_path)
for rm_file in os.listdir("%s/%s" % (install_path, app_file)):
    os.remove("%s/%s/%s" % (install_path, app_file, rm_file))
os.rmdir("%s/%s" % (install_path, app_file))

machine.nvs_setstr('launcher', 'uninstall_name', '')
machine.nvs_setstr('launcher', 'uninstall_file', '')

rgb.clear()
uinterface.skippabletext("Uninstall completed!")
system.home()