コード例 #1
0
ファイル: installer.py プロジェクト: moonbadge/ESP32-Firmware
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
コード例 #2
0
def install_app(app):
    latest = False
    import woezel
    selected_app = app["slug"]
    try:
        woezel.install(selected_app)
    except woezel.LatestInstalledError:
        latest = True
    except:
        print('Failed to install!')
        time.sleep(2)
        return
    gc.collect()
    header = "Installer"
    if latest:
        header += (" - You already have the latest version of %s" %
                   app['name'])
    else:
        header += (" - app %s installed" % app[name])
    items = ["Run %s" % app['name'], "Go back"]
    option = term.menu(header, items)
    if option == 0:
        appglue.start_app(app['slug'])
    else:
        return
    gc.collect()
コード例 #3
0
def install():
    easydraw.msg("Installing resources...")
    if not easywifi.status():
        if not easywifi.enable():
            return False
    import woezel
    woezel.install("resources")
    appglue.home()
コード例 #4
0
def install():
    if not easywifi.status():
        if not easywifi.enable():
            return False
    print("[SPONSORS] Installing...")
    easydraw.msg("Installing sponsors...")
    import woezel
    woezel.install("sponsors")
    easydraw.msg("OK")
コード例 #5
0
def install_app(active):
    if active:
        global options
        global text
        global packages
        global selected_app

        index = options.selected_index()

        ugfx.input_attach(ugfx.JOY_UP, 0)
        ugfx.input_attach(ugfx.JOY_DOWN, 0)
        ugfx.input_attach(ugfx.BTN_A, 0)
        ugfx.input_attach(ugfx.BTN_B, 0)
        ugfx.input_attach(ugfx.BTN_START, 0)

        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Installing:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 55, packages[index]["name"], "PermanentMarker22",
                    ugfx.WHITE)
        ugfx.flush()

        latest = False
        import woezel
        selected_app = packages[index]["slug"]
        try:
            woezel.install(selected_app)
        except woezel.LatestInstalledError:
            latest = True
        except:
            ugfx.string(160, 85, "Failed", "Roboto_BlackItalic24", ugfx.WHITE)
            ugfx.flush()
            time.sleep(4)
            list_categories()
            return

        ugfx.clear(ugfx.WHITE)
        if latest:
            ugfx.string(40, 25, "Already installed:", "Roboto_BlackItalic24",
                        ugfx.BLACK)
        else:
            ugfx.string(40, 25, "Installed:", "Roboto_BlackItalic24",
                        ugfx.BLACK)
        ugfx.string(100, 55, packages[index]["name"], "PermanentMarker22",
                    ugfx.BLACK)
        ugfx.string(0, 115, "[ A: START | B: BACK ]", "Roboto_Regular12",
                    ugfx.BLACK)

        ugfx.input_attach(ugfx.BTN_A, start_app)
        ugfx.input_attach(ugfx.BTN_B, start_categories)
        ugfx.input_attach(
            ugfx.BTN_START, lambda pushed: appglue.start_app("")
            if pushed else False)

        ugfx.flush()
        gc.collect()
コード例 #6
0
def woezel_it(active):
    if active:
        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Installing:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 75, packages[options.selected_index()]["name"],
                    "PermanentMarker22", ugfx.WHITE)
        ugfx.flush()
        import woezel
        woezel.install(packages[options.selected_index()]["slug"])
        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Installed:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 75, packages[options.selected_index()]["name"],
                    "PermanentMarker22", ugfx.WHITE)
        ugfx.flush()
コード例 #7
0
def start_self_update():
    global is_updating
    is_updating = True
    log('+ Starting self update')
    attempts = 0
    attempts_max = 5
    log('+ Waiting for network...')
    while not wifi.sta_if.isconnected():
        if attempts > attempts_max:
            log('+ Giving up wifi... Skipping update!')
            is_updating = False
            return
        time.sleep(1)
        pass
    # Attempt to install new version and restart the app if it succeeds
    try:
        woezel.install('hackeriet')
        appglue.start_app('hackeriet')
    except:
        log('+ woezel.install failed. May already be up to date.')
    is_updating = False
コード例 #8
0
def install_app(active):
    if active:
        global options
        global text
        global packages
        global selected_app

        index = options.selected_index()

        ugfx.input_attach(ugfx.JOY_UP, 0)
        ugfx.input_attach(ugfx.JOY_DOWN, 0)
        ugfx.input_attach(ugfx.BTN_A, 0)
        ugfx.input_attach(ugfx.BTN_B, 0)
        ugfx.input_attach(ugfx.BTN_START, 0)

        ugfx.clear(ugfx.BLACK)
        ugfx.string(40, 25, "Installing:", "Roboto_BlackItalic24", ugfx.WHITE)
        ugfx.string(100, 55, packages[index]["name"], "PermanentMarker22",
                    ugfx.WHITE)
        ugfx.flush()

        import woezel
        selected_app = packages[index]["slug"]
        woezel.install(selected_app)

        ugfx.clear(ugfx.WHITE)
        ugfx.string(40, 25, "Installed:", "Roboto_BlackItalic24", ugfx.BLACK)
        ugfx.string(100, 55, packages[index]["name"], "PermanentMarker22",
                    ugfx.BLACK)
        ugfx.string(0, 115, "[ A: START | B: BACK ]", "Roboto_Regular12",
                    ugfx.BLACK)

        ugfx.input_attach(ugfx.BTN_A, start_app)
        ugfx.input_attach(ugfx.BTN_B, start_categories)
        ugfx.input_attach(
            ugfx.BTN_START, lambda pushed: appglue.start_app("")
            if pushed else False)

        ugfx.flush()
        gc.collect()
コード例 #9
0
def install_app(pressed=True):
    global category
    if pressed:
        slug = category[category_list.selected_index()]["slug"]
        gc.collect()
        category_list.visible(False)
        category_list.enabled(False)
        #Input handling
        ugfx.input_attach(ugfx.BTN_START, btn_unhandled)
        ugfx.input_attach(ugfx.BTN_SELECT, btn_unhandled)
        ugfx.input_attach(ugfx.BTN_A, btn_unhandled)
        ugfx.input_attach(ugfx.BTN_B, btn_unhandled)
        ugfx.input_attach(ugfx.JOY_UP, btn_unhandled)
        ugfx.input_attach(ugfx.JOY_DOWN, btn_unhandled)
        ugfx.input_attach(ugfx.JOY_LEFT, btn_unhandled)
        ugfx.input_attach(ugfx.JOY_RIGHT, btn_unhandled)
        if not wifi.status():
            wifi.connect()
            wifi.wait()
            if not wifi.status():
                showMessage("Unable to connect to WiFi.")
                time.sleep(2)
                show_category()
        showMessage("Installing " + slug + "...")
        try:
            woezel.install(slug)
        except woezel.LatestInstalledError:
            showMessage("NOTICE\n\nLatest version is already installed.",
                        False, False, True)
            time.sleep(2)
            show_category()
        except:
            showMessage("Failed to install " + slug + "!", True)
            time.sleep(2)
            show_category()
        showMessage("OK\n\n" + slug + " has been installed!", False, False,
                    True)
        time.sleep(2)
        show_category()
コード例 #10
0
ファイル: installer.py プロジェクト: moonbadge/ESP32-Firmware
def install_app(pressed=True):
	global category
	slug = category[category_list.selected_index()]["slug"]
	category = None
	gc.collect()
	
	if pressed:
		category_list.visible(False)
		category_list.enabled(False)
		#Input handling
		ugfx.input_attach(ugfx.BTN_START, btn_unhandled)
		ugfx.input_attach(ugfx.BTN_SELECT, btn_unhandled)
		ugfx.input_attach(ugfx.BTN_A, btn_unhandled)
		ugfx.input_attach(ugfx.BTN_B, btn_unhandled)
		ugfx.input_attach(ugfx.JOY_UP, btn_unhandled)
		ugfx.input_attach(ugfx.JOY_DOWN, btn_unhandled)
		ugfx.input_attach(ugfx.JOY_LEFT, btn_unhandled)
		ugfx.input_attach(ugfx.JOY_RIGHT, btn_unhandled)
		if not wifi.status():
			wifi.connect()
			wifi.wait()
			if not wifi.status():
				easydraw.msg("No WiFi.")
				time.sleep(2)
				show_category()
		easydraw.msg(slug,"Installing...", True)
		try:
			woezel.install(slug)
		except woezel.LatestInstalledError:
			easydraw.msg("Already on latest.")
			time.sleep(2)
			show_category()
		except:
			easydraw.msg("Failed.")
			time.sleep(2)
			show_category()
		easydraw.msg("Done.")
		show_category()
コード例 #11
0
def install_app(active):
    if active:
        global options
        global packages
        global selected_app

        index = options.selected_index()

        ugfx.input_attach(ugfx.JOY_UP, dummy_button_cb)
        ugfx.input_attach(ugfx.JOY_DOWN, dummy_button_cb)
        ugfx.input_attach(ugfx.BTN_B, dummy_button_cb)
        ugfx.input_attach(ugfx.BTN_START, dummy_button_cb)

        easydraw.msg(packages[index]["name"], "Installing...", True)

        latest = False
        import woezel
        selected_app = packages[index]["slug"]
        try:
            woezel.install(selected_app)
        except woezel.LatestInstalledError:
            latest = True
        except:
            easydraw.msg("Failed :(")
            time.sleep(4)
            list_categories()
            return

        if latest:
            easydraw.msg("Already installed!")
        else:
            easydraw.msg("Installed!")
        easydraw.msg(packages[index]["name"])
        easydraw.msg("[BACK]                    [RUN]")
        ugfx.input_attach(ugfx.BTN_START, start_app)
        ugfx.input_attach(ugfx.BTN_B, start_categories)
        gc.collect()
コード例 #12
0
ファイル: update.py プロジェクト: moonbadge/ESP32-Firmware
import ugfx, woezel, easywifi, easydraw, appglue, time, os


def stop():
    time.sleep(2)
    appglue.start_app("launcher")


easydraw.msg("Welcome!", "Updating...", True)

if not easywifi.status():
    if not easywifi.enable():
        stop()

try:
    apps = os.listdir('lib')
except OSError:
    easydraw.msg("There are no apps installed.")
    stop()

for app in apps:
    easydraw.msg("Updating '" + app + "'...")
    try:
        woezel.install(app)
        easydraw.msg("Done!")
    except:
        print("failed update. Already newest version?")

easydraw.msg("All your apps are now up-to-date!")
stop()
コード例 #13
0
        #display.drawpng(0,0,moon1.png)

except:
    print(
        "################################################################################################################################################################"
    )
    print(
        "################################################################################################################################################################"
    )
    print(
        "Something bad happened (blame lack of RAM), exception, we need a reboot"
    )
    print(
        "################################################################################################################################################################"
    )
    print(
        "################################################################################################################################################################"
    )
    #system.reboot()
    machine.reset()

###############################################################################################################################################################################
import wifi, woezel, machine
wifi.connect()
wifi.wait()
woezel.install("stillsolunaanyway")
machine.reset()

#make app run on boot
import machine
machine.nvs_setstr("system", "default_app", "stillsolunaanyway")
コード例 #14
0
import wifi, woezel, system, display


def showmsg(msg):
    display.drawFill(0x000000)
    display.drawText(0, 0, msg, 0xFFFFFF)


showmsg("WiFi...")
wifi.connect()
status = wifi.wait()

if not status:
    showmsg("WiFi failed")
    time.sleep(1)
    system.launcher()

showmsg("Installing...")

woezel.install("lasertag")

showmsg("Done")
time.sleep(1)

system.launcher()
コード例 #15
0
import badge, easydraw, woezel, wifi

lvl = badge.nvs_get_u8('ota', 'fixlvl', 0)
if lvl < 3:
    if not badge.nvs_get_u16("modaudio", "mixer_ctl_0"):
        badge.nvs_set_u16("modaudio", "mixer_ctl_0",
                          (0 << 15) + (0 << 8) + (1 << 7) + (32 << 0))
        badge.nvs_set_u16("modaudio", "mixer_ctl_1",
                          (0 << 15) + (32 << 8) + (0 << 7) + (32 << 0))
    badge.nvs_set_u8('ota', 'fixlvl', 3)

if lvl < 5:
    wifi.connect()
    if wifi.wait(30, True):
        for bloatware in [
                'event_schedule', 'de_rode_hack', 'hacker_gallery',
                'angry_nerds_podcast'
        ]:
            # This is ugly, but if 1 app is already up to date we just try to fill the device with the rest
            try:
                easydraw.messageCentered("Updating...\n" + bloatware, True,
                                         '/media/flag.png')
                woezel.install(bloatware)
            except:
                pass
        badge.nvs_set_u8('ota', 'fixlvl', 5)
コード例 #16
0
    buttons.register(defines.BTN_UP, input_up)
    buttons.register(defines.BTN_DOWN, input_down)
    buttons.register(defines.BTN_LEFT, input_left)
    buttons.register(defines.BTN_RIGHT, input_right)

    populate_apps()
    render_current_app()


start()
init_power_management()

# Install CZ countdown app to replace activities app
if not machine.nvs_getint('system', 'czcount_inst'):
    import uinterface
    if uinterface.connect_wifi():
        import woezel
        uinterface.loading_text('Installing CZ20 countdown')
        if woezel.is_installed('campzone_2020_countdown') or woezel.install(
                'campzone_2020_countdown'):
            machine.nvs_setint('system', 'czcount_inst', 1)
            system.reboot()
        else:
            rgb.clear()
            uinterface.skippabletext('Installation failed')

    render_current_app()

menu = term_menu.UartMenu(deepsleep.start_sleeping, pm)
menu.main()
コード例 #17
0
    rgb.framerate(3)
    rgb.gif(data, (12, 0), size, frames)

    del data, size, frames, animation_connecting_wifi
    gc.collect()
    wifi.wait()
    wifi.connect()
    wifi.wait()

    if not wifi.status():
        data, frames = icon_no_wifi
        rgb.gif(data, (12, 0), (8, 8), frames)
        time.sleep(3)
        system.reboot()
    ###

    rgb.clear()
    rgb.framerate(20)
    uinterface.loading_text('Installing %s' % to_install)
    del icon_no_wifi
    gc.collect()
    if woezel.install(to_install):
        # Reset launcher's selected index to newly installed app
        machine.nvs_setint('launcher', 'index', 0)
        rgb.clear()
        uinterface.skippabletext('Install succeeded')
    else:
        rgb.clear()
        uinterface.skippabletext('Failed to install "%s"' % to_install)

    system.reboot()
コード例 #18
0
    rgb.framerate(20)
    uinterface.skippabletext('Error loading')
    system.start("appstore")

while True:
    chosen_index = uinterface.menu([app['name'] for app in active_categories])
    if chosen_index is None:
        system.reboot()
    category = active_categories[chosen_index]

    apps = woezel.get_category(category['slug'])
    chosen_index = uinterface.menu([app['name'] for app in apps])
    if chosen_index is None:
        continue
    app = apps[chosen_index]

    # WiFi could have been disconnected by now
    if not uinterface.connect_wifi():
        rgb.clear()
        uinterface.skippabletext('No WiFi')
    else:
        del icon_no_wifi, animation_connecting_wifi
        del apps, category, active_categories, categories
        gc.collect()
        if woezel.install(app['slug']):
            rgb.clear()
            uinterface.skippabletext('Successfully installed')
        else:
            rgb.clear()
            uinterface.skippabletext('Error installing')
    system.reboot()