Exemple #1
0
    def next_level(self):
        self.level_n += 1
        self.enemy_planes.clear()
        self.planes_spawned.clear()
        if self.level_n == 0:
            # First level
            pass
        elif self.level_n >= len(levels):
            for n in range(50):
                ugfx.clear(ugfx.BLACK)
                message("You've won the game! :)")
                ugfx.flush()
                buzzer(8000, 0.1)
                buzzer(4000, 0.1)
                time.sleep(0.1)
            self.is_running = False
            return
        else:
            for n in range(5):
                ugfx.clear(ugfx.BLACK)
                message("You've cleared level %s/%s" % (
                    self.level_n,
                    len(levels),
                ))
                ugfx.flush()
                buzzer(5000, 0.1)
                time.sleep(0.1)

        self.level = levels[self.level_n]
def connectClick(pushed):
    if pushed:
        selected = options.selected_text().encode()
        print('selected')
        options.destroy()

        ssidType = scanResults[ssidList.index(selected)][4]
        print(ssidType)
        print(ssidList.index(selected))
        ugfx.clear(ugfx.WHITE)
        ugfx.string(100, 50, selected, 'Roboto_Regular18', ugfx.BLACK)
        ugfx.flush()
        if ssidType == 5:
            clearGhosting()
            ugfx.clear(ugfx.WHITE)
            ugfx.string(20, 50, 'WPA Enterprise unsupported...',
                        'Roboto_Regular18', ugfx.BLACK)
            ugfx.set_lut(ugfx.LUT_FULL)
            ugfx.flush()
            badge.eink_busy_wait()
            system.reboot()

        badge.nvs_set_str("system", "wifi.ssid", selected)

        if ssidType == 0:
            badge.nvs_set_str("system", "wifi.password", '')
            system.reboot()
        else:
            clearGhosting()
            dialogs.prompt_text("WiFi password", cb=passInputDone)
Exemple #3
0
def clearscreen():
    # clear the screen 3 times
    for x in range(0, 3):
        ugfx.clear(ugfx.WHITE)
        ugfx.flush()
        ugfx.clear(ugfx.BLACK)
        ugfx.flush()
Exemple #4
0
def cuss():
    ##    t = easyrtc.string()
    ugfx.clear(ugfx.WHITE)
    one = str(random.choice(first))
    two = str(random.choice(second))
    three = str(random.choice(third))

    len1 = ugfx.get_string_width(one, "Roboto_BlackItalic24")
    len2 = ugfx.get_string_width(two, "PermanentMarker36")
    len3 = ugfx.get_string_width(three, "Roboto_BlackItalic24")

    ugfx.string_box(90, 0, len1, 24, one, "Roboto_BlackItalic24", ugfx.BLACK,
                    ugfx.justifyCenter)
    ugfx.string_box(40, 25, len2, 36, two, "PermanentMarker36", ugfx.BLACK,
                    ugfx.justifyCenter)
    ugfx.string_box(90, 63, len3, 34, three, "Roboto_BlackItalic24",
                    ugfx.BLACK, ugfx.justifyCenter)

    ###ugfx.string(x, y, string, font, colour)
    #ugfx.string(20, 5, str(random.choice(first)), "Roboto_BlackItalic24", ugfx.BLACK, ugfx.justifyCenter)
    #ugfx.string(30, 20, str(random.choice(second)), "PermanentMarker36", ugfx.BLACK)
    #len = ugfx.get_string_width(str(random.choice(second)),"PermanentMarker36")
    #ugfx.line(25, 57, 64 + len, 57, ugfx.BLACK)
    #ugfx.line(140 + len, 52, 140 + len, 70, ugfx.BLACK)
    #ugfx.string(120, 60, str(random.choice(third)), "Roboto_BlackItalic24", ugfx.BLACK)
    #ugfx.string(30, 95, " it's ", "PermanentMarker22", ugfx.BLACK)
    ##    ugfx.string(140, 95, t, "PermanentMarker36", ugfx.BLACK)

    ugfx.flush()
    time.sleep(3)
Exemple #5
0
def render():
    ugfx.clear(ugfx.WHITE)
    lenny.render_creation(
        lambda w, h: (lenny.BADGE_EINK_WIDTH // 2 - w // 2, lenny.
                      BADGE_EINK_HEIGHT // 2 - h // 2), lenny.creation,
        cursor_position)
    ugfx.flush()
Exemple #6
0
def get_tweets(pushed):
    if (pushed):
        print("Downloading JSON...")
        gc.collect()
        try:
            data = requests.get("https://example/twitter.php")
        except:
            print("Could not download JSON!")
            sleep(1)
            return
        try:
            global tweets
            tweets = data.json()
        except:
            data.close()
            print("Could not decode JSON!")
            sleep(1)
            return
        data.close()

    print("Rendering list...")
    ugfx.clear(ugfx.WHITE)
    ugfx.flush()

    #get 1 tweet only, but possible to convert to scroll/something
    x = 1
    tweet_text = str(tweets['statuses'][x]['text'])
    ugfx.string(45, 85, tweet_text, "Roboto_Black22", ugfx.BLACK)
    ugfx.flush()
Exemple #7
0
def start():
	ugfx.set_lut(ugfx.LUT_FASTER)
	ugfx.clear(ugfx.WHITE)
	x0 = int(display.width()/2)
	display.drawText(x0+10, 0, "Recovery mode!", 0x000000, "roboto_regular12")

	global options
	global install_path
	options = None
	install_path = None

	ugfx.input_attach(ugfx.BTN_A, input_a)
	ugfx.input_attach(ugfx.BTN_B, input_b)
	ugfx.input_attach(ugfx.BTN_SELECT, input_select)
	ugfx.input_attach(ugfx.JOY_UP, input_other)
	ugfx.input_attach(ugfx.JOY_DOWN, input_other)
	ugfx.input_attach(ugfx.JOY_LEFT, input_other)
	ugfx.input_attach(ugfx.JOY_RIGHT, input_other)
	ugfx.input_attach(ugfx.BTN_START, input_other)

	populate_apps()
	populate_category()
	populate_options()

	# do a greyscale flush on start
	ugfx.flush(ugfx.GREYSCALE)
Exemple #8
0
def pixelflood_handler(client_sock):
    while True:
        line = client_sock.readline().decode('ascii')
        if line == '' or line == '\r\n':
            break
        
        line_parts = line.split(' ')
        if len(line_parts) != 4  or line_parts[0] != 'PX':
            break
        
        try:
            int(line_parts[1])
            int(line_parts[2])
            int(line_parts[3], 16)
        except ValueError:
            break
        
        x, y = int(line_parts[1]), int(line_parts[2])
        col  = ugfx.BLACK if int(line_parts[3], 16) < 0x800000 else ugfx.WHITE
        
        if x in range (0, 296) and y in range(0, 128):
            ugfx.pixel(x, y, col)
            ugfx.flush()

    client_sock.close()
def re_draw():
    global scroll, max_scroll
    print("redraw:"+str(scroll))
    ugfx.clear(ugfx.WHITE)
    y=0
    ugfx.string(0, y, "SSID", "pixelade13", ugfx.BLACK)
    ugfx.string(110, y, "Enc", "pixelade13", ugfx.BLACK)
    ugfx.string(150, y, "Ch", "pixelade13", ugfx.BLACK)
    ugfx.string(175, y, "dB", "pixelade13", ugfx.BLACK)
    ugfx.string(210, y, "BSSID", "pixelade13", ugfx.BLACK)
    ugfx.string(270, y, '{:d}/{:d}'.format(scroll, max_scroll), "pixelade13", ugfx.BLACK)
    ugfx.line(0, 12, 296, 12, ugfx.BLACK)
    y+=15
    for net in scanResults[scroll:]:
        # (ssid, bssid, channel, RSSI, authmode, hidden)
        # (b'SHA2017-legacy', b"\xa8\xbd'z\xd1\xc0", 1, -55, 5, False)
        print(net)
        bssid = ubinascii.hexlify(net[1]).upper()
        ssid = net[0]
        if net[5] == True:
            ssid = "<hidden>"
        ugfx.string(0, y, '{:40}'.format(ssid), "pixelade13", ugfx.BLACK)
        ugfx.string(110, y, '{}'.format(encription.get(net[4],"?")), "pixelade13", ugfx.BLACK)
        ugfx.string(150, y, '{:2d}'.format(net[2]), "pixelade13", ugfx.BLACK)
        ugfx.string(175, y, '{:3d}'.format(net[3]), "pixelade13", ugfx.BLACK)
        ugfx.string(210, y, '{:2}:{:2}:{:2}:{:2}:{:2}:{:2}'.format(bssid[0:2],bssid[2:4],bssid[4:6],bssid[6:8],bssid[8:10],bssid[10:12]), "pixelade13", ugfx.BLACK)
        y += 14
    ugfx.flush()
def passInputDone(passIn):
    badge.nvs_set_str("system", "wifi.password", passIn)
    ugfx.clear(ugfx.WHITE)
    ugfx.string(100, 50, 'Restarting!', 'Roboto_Regular18', ugfx.BLACK)
    ugfx.flush()
    badge.eink_busy_wait()
    system.reboot()
Exemple #11
0
def move_view(button_direction, pressed):
    global view, article_length, start, max_onscreen, f, eof
    if pressed:
        if button_direction == "down":
            start_position = view[0] + 1
            action = "next"
        elif button_direction == "up":
            start_position = view[0] - 1
            action = "next"
        elif button_direction == "right":
            start_position = view[1]
            action = "next"
        elif button_direction == "left":
            start_position = view[0]
            action = "prev"
        else:
            raise ValueError("this direction doesn't exist")
        if start_position <= 0:
            start_position = 0
            action = "next"
        elif start_position >= article_length:
            start_position = article_length
            action = "prev"
        if start_position + max_onscreen >= article_length:
            if f:
                ugfx.fill_circle(291, 5, 10, ugfx.BLACK)
                ugfx.flush()
                if not eof:
                    if not read_data():
                        eof = True
                        print('EOF')
            else:
                print('File not yet read!')
        print("scroll: " + str(start_position) + " " + str(article_length))
        view = create_view(start_position, action)
Exemple #12
0
 def toggle_focus(pressed):
     if pressed:
         if focus == 0:
             edit.set_focus()
             kb.enabled(1)
             ugfx.input_attach(
                 version.btn_cancel, lambda pressed: vkey_backspace()
                 if pressed else 0)
             ugfx.input_attach(
                 version.btn_ok, lambda pressed: 0
                 if pressed else ugfx.flush())
             focus = 1
         elif focus == 1 or not button_no:
             button_yes.set_focus()
             kb.enabled(0)
             ugfx.input_attach(version.btn_ok,
                               asyncSuccess if cb else syncSuccess)
             ugfx.input_attach(version.btn_cancel,
                               asyncCancel if cb else syncCancel)
             focus = (2 if button_no else 0)
         else:
             button_no.set_focus()
             kb.enabled(0)
             ugfx.input_attach(version.btn_ok,
                               asyncCancel if cb else syncCancel)
             ugfx.input_attach(version.btn_cancel,
                               asyncCancel if cb else syncCancel)
             focus = 0
         ugfx.flush()
 def run_step(self, step_size):
     self.increment()
     if (self.snake.started == True
             and self.snake.should_render(self.steps)):
         self.snake.move(step_size)
         self.do_game()
         ugfx.flush()
Exemple #14
0
def clear_ghosting():
    ugfx.clear(ugfx.BLACK)
    ugfx.flush()
    badge.eink_busy_wait()
    ugfx.clear(ugfx.WHITE)
    ugfx.flush()
    badge.eink_busy_wait()
def start():
	ugfx.input_init()
	ugfx.set_lut(ugfx.LUT_FASTER)
	ugfx.clear(ugfx.WHITE)

	# Instructions
	if orientation.isLandscape():
		if display.width() > 128:
			x0 = int(display.width()/2)
			currentY = 20
			
			display.drawText(x0+((display.width()-x0)//2)-(display.getTextWidth("BADGE.TEAM", "fairlight12")//2), currentY, "BADGE.TEAM\n", 0x000000, "fairlight12")
			currentY += display.getTextHeight("BADGE.TEAM", "fairlight12")
			
			display.drawText(x0+int((display.width()-x0)/2)-int(display.getTextWidth("ESP32 platform", "roboto_regular12")/2), currentY, "ESP32 platform\n", 0x000000, "roboto_regular12")
			display.drawLine(x0,0,x0,display.height()-1,0x000000)
			pixHeight = display.getTextHeight(" ", "roboto_regular12")
			currentY = pixHeight*5
			
			lineY = display.height()-pixHeight*6-pixHeight//2
			display.drawLine(x0, lineY, display.width()-1, lineY, 0x000000)
			
			display.drawText(x0+5, display.height()-pixHeight*6, "A: Run\n", 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight*5, "START: Return to home\n", 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight*4, "SELECT: Uninstall app\n", 0x000000, "roboto_regular12")
			
			lineY = display.height()-pixHeight*2-pixHeight//2
			display.drawLine(x0, lineY, display.width()-1, lineY, 0x000000)
			display.drawText(x0+5, display.height()-pixHeight*2, consts.INFO_FIRMWARE_NAME, 0x000000, "roboto_regular12")
			display.drawText(x0+5, display.height()-pixHeight, "Build "+str(consts.INFO_FIRMWARE_BUILD), 0x000000, "roboto_regular12")
	else:
		pixHeight = display.getTextHeight(" ", "roboto_regular12")
		display.drawLine(0, display.height()-18*4, display.width(), display.height()-18*4, ugfx.BLACK)
		display.drawText(0, display.height()-pixHeight*6, "A: Run\n", 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight*5, "START: Home\n", 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight*4, "SELECT: Uninstall\n", 0x000000, "roboto_regular12")
		
		lineY = display.height()-pixHeight*2-pixHeight//2
		display.drawLine(0, lineY, display.width()-1, lineY, 0x000000)
		display.drawText(0, display.height()-pixHeight*2, consts.INFO_FIRMWARE_NAME, 0x000000, "roboto_regular12")
		display.drawText(0, display.height()-pixHeight, "Build "+str(consts.INFO_FIRMWARE_BUILD), 0x000000, "roboto_regular12")

	global options
	global install_path
	options = None
	install_path = None

	ugfx.input_attach(ugfx.BTN_OK,    input_a)
	ugfx.input_attach(ugfx.BTN_BACK,  input_b)
	ugfx.input_attach(ugfx.JOY_UP,    input_other)
	ugfx.input_attach(ugfx.JOY_DOWN,  input_other)
	ugfx.input_attach(ugfx.JOY_RIGHT, input_a)
	ugfx.input_attach(ugfx.JOY_LEFT, input_select)

	populate_apps()
	populate_category()
	populate_options()

	# do a greyscale flush on start
	ugfx.flush(ugfx.GREYSCALE)
def FailGame(this_game):
    ugfx.clear(ugfx.WHITE)
    ugfx.string(20, 50, "Game Over - Score: {}".format(this_game.snake.score),
                "PermanentMarker22", ugfx.BLACK)
    ugfx.flush()
    time.sleep(5)
    sys.exit(0)
Exemple #17
0
def start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.WHITE)
    
    badge.backlight(255)

    global options
    global install_path
    options = None
    install_path = None

    ugfx.input_attach(ugfx.BTN_START, input_run)
    ugfx.input_attach(ugfx.BTN_B, input_home)
    ugfx.input_attach(ugfx.JOY_UP, input_other)
    ugfx.input_attach(ugfx.JOY_DOWN, input_other)
    ugfx.input_attach(ugfx.JOY_LEFT, input_uninstall)
    ugfx.input_attach(ugfx.JOY_RIGHT, input_other)

    populate_apps()
    populate_category()
    populate_options()

    # do a greyscale flush on start
    ugfx.flush(ugfx.GREYSCALE)
Exemple #18
0
def show_shift_detail():
    global shifts
    global shift_list
    shift_list.visible(False)
    ugfx.clear(ugfx.WHITE)
    ugfx.flush()
    i = shift_list.selected_index()
    title = shifts[i]["name"]
    title_height = 20 if ugfx.get_string_width(
        title, "PermanentMarker22") <= ugfx.width() else 60
    title = ugfx.string_box(0, 0, ugfx.width(), title_height, title,
                            "PermanentMarker22", ugfx.BLACK,
                            ugfx.justifyCenter)
    location = ugfx.string(0, title_height + 5,
                           "Location: " + shifts[i]["Name"],
                           "Roboto_Regular18", ugfx.BLACK)
    description = ugfx.string_box(0, title_height + 25, ugfx.width(), 40,
                                  "Description: " + shifts[i]["title"],
                                  "Roboto_Regular12", ugfx.BLACK,
                                  ugfx.justifyLeft)
    time = ugfx.string(
        0,
        ugfx.height() - 20, "Time: " + generate_timedelta_text(
            int(shifts[i]["start"]), int(shifts[i]["end"])),
        "Roboto_Regular18", ugfx.BLACK)
    ugfx.flush()
    ugfx.input_attach(ugfx.BTN_B, lambda pressed: show_shift_list()
                      if pressed else None)
Exemple #19
0
def cuss():
    ugfx.clear(ugfx.WHITE)
    #ugfx.string(0,0,"Hey, look at my c*ock!","PermanentMarker24",ugfx.BLACK)
    ##    t = easyrtc.string()
    #    n1 = random.getrandbits(2)
    #    n2 = random.getrandbits(2)
    #    n3 = random.getrandbits(2)
    #herp = len(first)
    herp = str(random.choice(first))

    #    ugfx.string(50, 10, str(first[n1]), "PermanentMarker24", ugfx.BLACK)
    #    ugfx.string(70, 35, str(second[n1]), "PermanentMarker24", ugfx.BLACK)
    #    ugfx.string(90, 60, str(third[n1]), "PermanentMarker24", ugfx.BLACK)
    ugfx.string(30, 5, str(random.choice(first)), "PermanentMarker36",
                ugfx.BLACK)
    ugfx.string(50, 30, str(random.choice(second)), "PermanentMarker36",
                ugfx.BLACK)
    ugfx.string(100, 55, str(random.choice(third)), "PermanentMarker36",
                ugfx.BLACK)
    #    ugfx.string(110, 85, str(herp), "PermanentMarker24", ugfx.BLACK)
    ugfx.string(110, 85, " it's ", "PermanentMarker24", ugfx.BLACK)
    ugfx.string(130, 50, t, "PermanentMarker36", ugfx.BLACK)

    ugfx.flush()
    time.sleep(3)
    cuss()
Exemple #20
0
def msg_nosplit(message, title='Loading...', reset=False):
    global NUM_LINES
    """Show a terminal style loading screen with title

	title can be optionaly set when resetting or first call
	"""
    global messageHistory

    try:
        messageHistory
        if reset:
            raise exception
    except:
        ugfx.clear(ugfx.WHITE)
        ugfx.string(0, 0, title, version.font_header, ugfx.BLACK)
        messageHistory = []

    if len(messageHistory) < NUM_LINES:
        ugfx.string(0, 19 + (len(messageHistory) * 13), message,
                    version.font_default, ugfx.BLACK)
        messageHistory.append(message)
    else:
        messageHistory.pop(0)
        messageHistory.append(message)
        ugfx.area(0, 15, ugfx.width(), ugfx.height() - 15, ugfx.WHITE)
        for i, message in enumerate(messageHistory):
            ugfx.string(0, 19 + (i * 13), message, version.font_default,
                        ugfx.BLACK)

    ugfx.flush(ugfx.LUT_FASTER)
Exemple #21
0
def show_categories(pressed=True):
	if not pressed:
		return
	ugfx.clear(ugfx.WHITE)
	#Hide category list
	category_list.visible(False)
	category_list.enabled(False)
	#Show categories list
	categories_list.visible(True)
	categories_list.enabled(True)
	#Input handling
	ugfx.input_attach(ugfx.BTN_START, btn_exit)
	ugfx.input_attach(ugfx.BTN_SELECT, btn_update)
	ugfx.input_attach(ugfx.BTN_A, show_category)
	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)
	#Hint
	easydraw.disp_string_right_bottom(0, "START: Exit app")
	easydraw.disp_string_right_bottom(1, "A: Open category")
	easydraw.disp_string_right_bottom(2, "SELECT: Update repo")
	#Flush screen
	ugfx.flush()
Exemple #22
0
def draw(mode, goingToSleep=False):
    if mode:
        # We flush the buffer and wait
        ugfx.flush(ugfx.LUT_FULL)
        badge.eink_busy_wait()
    else:
        # We prepare the screen refresh
        ugfx.clear(ugfx.WHITE)
        if goingToSleep:
            info1 = 'Sleeping...'
            info2 = 'Press any key to wake up'
        else:
            info1 = 'Press start to open the launcher'
            if otac.available(False):
                info2 = 'Press select to start OTA update'
            else:
                info2 = ''
        l = ugfx.get_string_width(info1,"Roboto_Regular12")
        ugfx.string(296-l, 0, info1, "Roboto_Regular12",ugfx.BLACK)
        l = ugfx.get_string_width(info2,"Roboto_Regular12")
        ugfx.string(296-l, 12, info2, "Roboto_Regular12",ugfx.BLACK)
        
        easydraw.nickname()
        
        vUsb = badge.usb_volt_sense()
        vBatt = badge.battery_volt_sense()
        vBatt += vDrop
        charging = badge.battery_charge_status()

        easydraw.battery(vUsb, vBatt, charging)
        
        if vBatt>500:
            ugfx.string(52, 0, str(round(vBatt/1000, 1)) + 'v','Roboto_Regular12',ugfx.BLACK)
Exemple #23
0
def loop():
    sta_if = network.WLAN(network.STA_IF)
    sta_if.active(True)  # Activate standalone interface
    sta_if.scan()  # Scan for available access points
    sta_if.connect("SHA2017-insecure"
                   )  # Connect to the public SHA2017 AP without a password
    sta_if.isconnected()  # Check for successful connection
    sta_if.ifconfig()  # Print connection information

    r = urequests.get(
        'https://br-gpsgadget-new.azurewebsites.net/data/raintext/?lat=52.28&lon=5.52'
    )
    lines = r.text.splitlines()
    raindata = [int(lines[i].split('|')[0]) for i in range(len(lines))]
    if sum(raindata) > 0:
        # Plot graph
        ugfx.clear(ugfx.WHITE)
        for i in range(len(raindata)):
            ugfx.area(12 * i, 127 - (raindata[i] // 2), 11, 127, ugfx.BLACK)
        ugfx.flush()

        badge.leds_init()
        badge.leds_send_data(bytes([0, 0, raindata[0] // 2, 0] * 6),
                             24)  # all blue with intensity of current rain
        badge.vibrator_init()
        badge.vibrator_activate(9)
        time.sleep(2)
        badge.leds_disable()
    return 15 * 60 * 1000
Exemple #24
0
def start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.WHITE)

    # Instructions
    if orientation.isLandscape():
        ugfx.line(148, 78, 296, 78, ugfx.BLACK)
        ugfx.string_box(148, 78, 148, 18, " A: Run", "Roboto_Regular12",
                        ugfx.BLACK, ugfx.justifyLeft)
        ugfx.string_box(148, 78, 148, 18, " B: Return to home",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyRight)
        ugfx.string_box(148, 92, 148, 18, " SELECT: Uninstall",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
        ugfx.line(148, 110, 296, 110, ugfx.BLACK)
        ugfx.string_box(148, 110, 148, 18, " " + version.name,
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
    else:
        ugfx.line(0,
                  ugfx.height() - 18 * 4, ugfx.width(),
                  ugfx.height() - 18 * 4, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 4, ugfx.width(), 18, " A: Run",
                        "Roboto_Regular12", ugfx.BLACK, ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 3, ugfx.width(), 18,
                        " B: Return to home", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 2, ugfx.width(), 18,
                        " SELECT: Uninstall", "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)
        ugfx.line(0,
                  ugfx.height() - 18 * 1, ugfx.width(),
                  ugfx.height() - 18 * 1, ugfx.BLACK)
        ugfx.string_box(0,
                        ugfx.height() - 18 * 1, ugfx.width(), 18,
                        " " + version.name, "Roboto_Regular12", ugfx.BLACK,
                        ugfx.justifyLeft)

    global options
    global install_path
    options = None
    install_path = None

    ugfx.input_attach(ugfx.BTN_A, input_a)
    ugfx.input_attach(ugfx.BTN_B, input_b)
    ugfx.input_attach(ugfx.BTN_SELECT, input_select)
    ugfx.input_attach(ugfx.JOY_UP, input_other)
    ugfx.input_attach(ugfx.JOY_DOWN, input_other)
    ugfx.input_attach(ugfx.JOY_LEFT, input_other)
    ugfx.input_attach(ugfx.JOY_RIGHT, input_other)
    ugfx.input_attach(ugfx.BTN_START, input_other)

    populate_apps()
    populate_category()
    populate_options()

    # do a greyscale flush on start
    ugfx.flush(ugfx.GREYSCALE)
def msg(message, title='Still Loading Anyway...', reset=False):
    """Show a terminal style loading screen with title

    title can be optionaly set when resetting or first call
    """
    global messageHistory

    try:
        messageHistory
        if reset:
            raise exception
    except:
        ugfx.clear(ugfx.WHITE)
        ugfx.string(0, 0, title, "PermanentMarker22", ugfx.BLACK)
        messageHistory = []

    if len(messageHistory) < 6:
        ugfx.string(0, 30 + (len(messageHistory) * 15), message,
                    "Roboto_Regular12", ugfx.BLACK)
        messageHistory.append(message)
    else:
        messageHistory.pop(0)
        messageHistory.append(message)
        ugfx.area(0, 30, 296, 98, ugfx.WHITE)
        for i, message in enumerate(messageHistory):
            ugfx.string(0, 30 + (i * 15), message, "Roboto_Regular12",
                        ugfx.BLACK)

    ugfx.flush(ugfx.LUT_FASTER)
Exemple #26
0
def display_next(tweets,pressed):
    if (pressed):
        ugfx.clear(ugfx.WHITE)
        tweet_text = str(tweets[x])
        ugfx.string(45,85,tweet_text,"Roboto_Black22",ugfx.BLACK)
        ugfx.flush()
        x=x+1
Exemple #27
0
def reset_game():
    global round, bullet
    ugfx.clear(ugfx.WHITE)
    ugfx.flush()
    round = 0
    bullet = random.randint(1, 6)
    bullet = random.randint(1, 6)
    print_start()
def show_description(active):
    if active:
        easydraw.msg(packages[options.selected_index()]["description"],
                     "Details", True)
    else:
        options.visible(0)
        options.visible(1)
    ugfx.flush()
Exemple #29
0
def program_main():
    print("--- SPONSORS APP ---")
    ugfx.init()
    ugfx.set_lut(ugfx.LUT_FULL)
    ugfx.clear(ugfx.BLACK)
    ugfx.flush()
    show_sponsors()
    appglue.start_app("")  # Return home
Exemple #30
0
def wait_sauna():
    clear(ugfx.BLACK)
    ugfx.string(50, 25, "STILL", "Roboto_BlackItalic24", ugfx.WHITE)
    ugfx.string(30, 50, "Connecting to sauna", "PermanentMarker22", ugfx.WHITE)
    len = ugfx.get_string_width("Connecting to sauna", "PermanentMarker22")
    ugfx.line(30, 72, 30 + 14 + len, 72, ugfx.WHITE)
    ugfx.string(140, 75, "Anyway", "Roboto_BlackItalic24", ugfx.WHITE)
    ugfx.flush()