wifi.wait()
        if not wifi.status():
            showMessage("Unable to connect to WiFi.")
            time.sleep(2)
            show_category(fromcat)
    showMessage("Installing " + slug + "...")
    try:
        woezel.install(slug)
        time.sleep(2)
    except woezel.LatestInstalledError:
        showMessage("Latest version is already installed.")
        time.sleep(2)
        show_category(fromcat)
    except:
        showMessage("Failed to install " + slug + "!")
        time.sleep(2)
        show_category(fromcat)
    showMessage(slug + " has been installed!")
    show_category(fromcat)


#Main application

showMessage("Loading categories...")
if not woezel.update_cache():
    # woezel.set_progress_callback(woezel_callback)
    showMessage("Failed to load repository. Returning to launcher...")
    system.launcher()

show_categories()
        data, frames = icon_no_wifi
        rgb.gif(data, (12, 0), (8, 8), frames)
        time.sleep(3)
        system.reboot()
    elif 'Done!' in text or 'Failed!' in text:
        return
    else:
        data, size, frames = animation_loading
        rgb.gif(data, (1, 1), size, frames)
        rgb.scrolltext(text, pos=(8, 0), width=(rgb.PANEL_WIDTH - 8))


woezel.set_progress_callback(woezel_callback)
# make sure we have an updated cache:
retry = 5
while (not woezel.update_cache()) and (retry > 0):
    print("Updating cache failed.")
    wifi.disconnect()
    gc.collect()
    uinterface.connect_wifi()
    retry -= 1
    if retry == 0:
        print("This is not ok, rebooting")
        system.reboot()

categories = woezel.get_categories()
active_categories = [cat for cat in categories if cat['eggs'] > 0]

if len(active_categories) == 0:
    rgb.clear()
    rgb.framerate(20)