Beispiel #1
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)
Beispiel #2
0
def display_logo():
    ugfx.clear(ugfx.BLACK)
    ugfx.string(280, 228, 'v{}'.format(get_version()),
            'IBMPlexSans_Regular12', ugfx.WHITE)
    ugfx.display_image(40, 70, bytearray(open('ibm_logo.gif', 'rb').read()), 2, 300)
    ugfx.string_box(0, 140, ugfx.width(), 50, 'Developer Day 2018',
            'IBMPlexSans_Regular22', ugfx.HTML2COLOR(0x01d7dd), ugfx.justifyCenter)
    gc.collect()
def list_categories():
    global options
    global text
    global categories

    try:
        categories
    except:
        ugfx.input_init()
        draw_msg('Getting categories')
        try:
            f = urequests.get("https://badge.team/eggs/categories/json",
                              timeout=30)
            categories = f.json()
        except:
            draw_msg('Failed!')
            draw_msg('Returning to launcher :(')
            appglue.start_app('launcher', False)

            f.close()
        draw_msg('Done!')
        options = ugfx.List(0, 0, int(ugfx.width() / 2), ugfx.height())
        text = ugfx.Textbox(int(ugfx.width() / 2), 0, int(ugfx.width() / 2),
                            ugfx.height())

    ugfx.input_attach(ugfx.JOY_UP, lambda pushed: ugfx.flush()
                      if pushed else False)
    ugfx.input_attach(ugfx.JOY_DOWN, lambda pushed: ugfx.flush()
                      if pushed else False)
    ugfx.input_attach(ugfx.BTN_A, select_category)
    ugfx.input_attach(
        ugfx.BTN_B, lambda pushed: appglue.start_app("launcher", False)
        if pushed else False)
    ugfx.input_attach(
        ugfx.BTN_START, lambda pushed: appglue.start_app("")
        if pushed else False)

    ugfx.clear(ugfx.WHITE)
    ugfx.flush()

    while options.count() > 0:
        options.remove_item(0)
    for category in categories:
        options.add_item("%s (%d) >" % (category["name"], category["eggs"]))
    options.selected_index(0)

    text.text("Install or update eggs from the hatchery here\n\n\n\n")
    ugfx.string_box(148, 0, 148, 26, "Hatchery", "Roboto_BlackItalic24",
                    ugfx.BLACK, ugfx.justifyCenter)
    ugfx.line(148, 78, 296, 78, ugfx.BLACK)
    ugfx.string_box(148, 78, 148, 18, " A: Open category", "Roboto_Regular12",
                    ugfx.BLACK, ugfx.justifyLeft)
    ugfx.string_box(148, 92, 148, 18, " B: Return to home", "Roboto_Regular12",
                    ugfx.BLACK, ugfx.justifyLeft)
    ugfx.line(148, 110, 296, 110, ugfx.BLACK)
    ugfx.string_box(148, 110, 148, 18, " badge.team", "Roboto_Regular12",
                    ugfx.BLACK, ugfx.justifyLeft)
    ugfx.flush(ugfx.LUT_FULL)
    gc.collect()
Beispiel #4
0
def draw(y, sleep=2):
    global message
    enabled = badge.nvs_get_u8("sweary","enable", 0)
    if enabled and seeded and sleep:
        nick = badge.nvs_get_str("owner", "name", 'Offensive Owner')

	ugfx.clear(ugfx.BLACK)
	ugfx.flush()
	ugfx.clear(ugfx.WHITE)
	ugfx.flush()

	ugfx.string_box(0,10,296,26, nick + " says:", "Roboto_BlackItalic24", ugfx.BLACK, ugfx.justifyLeft)
	ugfx.string_box(0,45,296,38, message, "PermanentMarker36", ugfx.BLACK, ugfx.justifyCenter)

	return [interval, 0]

    return [9999999999, 0]
Beispiel #5
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)
Beispiel #6
0
ugfx.flush()
ugfx.clear(ugfx.WHITE)
ugfx.flush()

name = badge.nvs_get_str("owner", "name", "")
nick = dialogs.prompt_text("Please enter name", name)
if nick:
    badge.nvs_set_str("owner", "name", nick)

#Nice clean screen
ugfx.clear(ugfx.BLACK)
ugfx.flush()
ugfx.clear(ugfx.WHITE)
ugfx.flush()

ugfx.string_box(0, 10, 296, 26, "STILL", "Roboto_BlackItalic24", ugfx.BLACK,
                ugfx.justifyCenter)
ugfx.string_box(0, 45, 296, 38, nick, "PermanentMarker36", ugfx.BLACK,
                ugfx.justifyCenter)
ugfx.string_box(0, 94, 296, 26, "Anyway", "Roboto_BlackItalic24", ugfx.BLACK,
                ugfx.justifyCenter)

#the line under the text
str_len = ugfx.get_string_width(nick, "PermanentMarker36")
line_begin = int((296 - str_len) / 2)
line_end = str_len + line_begin
ugfx.line(line_begin, 83, line_end, 83, ugfx.BLACK)

#the cursor past the text
cursor_pos = line_end + 5
ugfx.line(cursor_pos, 46, cursor_pos, 81, ugfx.BLACK)
def start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.WHITE)

    # Instructions
    if orientation.isLandscape():
        x0 = int(display.width() / 2)
        display.font("fairlight8")
        currentY = 20
        display.cursor(
            x0 + int((display.width() - x0) / 2) -
            int(display.get_string_width("BADGE.TEAM") / 2), currentY)
        display.print("BADGE.TEAM\n")
        display.font("pixelade9")
        (_, currentY) = display.cursor()
        display.cursor(
            x0 + int((display.width() - x0) / 2) -
            int(display.get_string_width("ESP32 platform") / 2), currentY)
        display.print("ESP32 platform\n")
        display.line(x0, 0, x0, display.height() - 1, 0x000000)
        display.textColor(0x000000)
        display.font("pixelade9")
        currentY = display.get_string_height(" ") * 5 - 5
        display.line(x0, currentY, display.width() - 1, currentY, 0x000000)
        display.cursor(x0 + 5, currentY + 5)
        display.print("A: Run\n")
        display.print("B: Return to home\n")
        display.print("SELECT: Uninstall app\n")
        (_, currentY) = display.cursor()
        display.line(x0, currentY, display.width() - 1, currentY, 0x000000)
        _ = display.cursor(x0 + 5, currentY + 5)
        display.print(consts.INFO_FIRMWARE_NAME)
    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,
                        " " + consts.INFO_FIRMWARE_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)
Beispiel #8
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 start():
    ugfx.input_init()
    ugfx.set_lut(ugfx.LUT_FASTER)
    ugfx.clear(ugfx.BLACK)
    ugfx.flush()
    ugfx.clear(ugfx.WHITE)
    ugfx.flush()

    ugfx.string_box(148, 0, 148, 26, "STILL", "Roboto_BlackItalic24",
                    ugfx.BLACK, ugfx.justifyCenter)
    ugfx.string_box(148, 23, 148, 23, "Hacking", "PermanentMarker22",
                    ugfx.BLACK, ugfx.justifyCenter)
    ugfx.string_box(148, 48, 148, 26, "Anyway", "Roboto_BlackItalic24",
                    ugfx.BLACK, ugfx.justifyCenter)

    #the line under the text
    str_len = ugfx.get_string_width("Hacking", "PermanentMarker22")
    line_begin = 148 + int((148 - str_len) / 2)
    line_end = str_len + line_begin
    ugfx.line(line_begin, 46, line_end, 46, ugfx.BLACK)

    #the cursor past the text
    cursor_pos = line_end + 5
    ugfx.line(cursor_pos, 22, cursor_pos, 44, ugfx.BLACK)

    # Instructions
    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)

    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()

    ugfx.flush(ugfx.LUT_FULL)
def nickname(y=25, font="PermanentMarker36", color=ugfx.BLACK):
    nick = badge.nvs_get_str("owner", "name", 'Henk de Vries')
    ugfx.string_box(0, y, 296, 38, nick, font, color, ugfx.justifyCenter)
Beispiel #11
0
def nickname(y=0, font=version.font_nickname_large, color=ugfx.BLACK):
    nick = badge.nvs_get_str("owner", "name", 'WELCOME TO DISOBEY')
    lines = lineSplit(nick, ugfx.width(), font)
    for i in range(len(lines)):
        ugfx.string_box(0, y + 15 * i, ugfx.width(), 15, lines[i], font, color,
                        ugfx.justifyCenter)
Beispiel #12
0
import easywifi
import time
import machine
import gc
import time
from umqtt.simple import MQTTClient

state="CLOSED"
oldstate=state
oldtest=-1
pin=machine.Pin(33,machine.Pin.IN,machine.Pin.PULL_UP)

def test():
    return pin.value()

X=MQTTClient("openlabs42","clamans.mobach.de")
while True:
    thetest = test()
    if oldtest != thetest:
        easywifi.enable()
        X.connect()
        oldtest = thetest
        state = "CLOSED" if thetest == 1 else "OPEN"
        X.publish("openlabs/state/state",state,1)
        ugfx.clear(ugfx.WHITE if state=="OPEN" else ugfx.BLACK)
        ugfx.string_box(0,45,296,38, state, "PermanentMarker36", ugfx.BLACK if state=="OPEN" else ugfx.WHITE, ugfx.justifyCenter)
        ugfx.flush(ugfx.LUT_FULL)
        X.disconnect()
        easywifi.disable()
    time.sleep(1)
Beispiel #13
0
    def run(self):

        # Show window
        self.indicator.show()
        self.container.show()

        # Title
        # self.indicator.area(0, 0, self.indicator.width(), self.indicator.height(), ugfx.BLACK)
        # ugfx.string_box(0, 0, self.indicator.width(), self.indicator.height(), 'AQI Gas Monitor', 'IBMPlexMono_Bold24', ugfx.WHITE, ugfx.justifyCenter)
        self.showTitleText('AQ Gas Monitor')

        time.sleep(1)
        self.showTitleText('Intializing...')

        stime = time.ticks_ms()

        idx = 0
        sleep_time = 8000
        isStable = False
        begin_time = time.ticks_ms()
        while True:

            VoRaw = self.gas_sensor.read()

            # Exponential Moving Average
            # https://www.investopedia.com/terms/e/ema.asp
            # EMA(t) = Value(t)*k + EMA(y) * (1-k)
            # k = 2 / (N+1)
            # k = 0.005 where N = 399
            self.Vos = VoRaw * 0.005 + self.Vos * 0.995

            # TODO: Convert to Gas Density in units of ug/m3.
            gasDensity = 0

            elapsed = (time.ticks_ms() - stime)

            stime = time.ticks_ms()
            if elapsed > 10:
                sleep_time -= 100
            elif elapsed < 10:
                sleep_time += 100

            time.sleep_us(sleep_time)

            # Next
            idx += 1

            # Not stable before 10 secs
            if not isStable:
                if (time.ticks_ms() - begin_time) < self.STABILIZATION_TIME:
                    # Wait...
                    if idx % 6 == 0:
                        # self.showTitleText('Intializing...')
                        x = 240
                        self.indicator.area(x, 0,
                                            self.indicator.width() - x,
                                            self.indicator.height(),
                                            ugfx.BLACK)
                    else:
                        # self.showTitleText('Intializing...')
                        ugfx.string_box(0, 0, self.indicator.width(),
                                        self.indicator.height(),
                                        'Intializing...', 'IBMPlexMono_Bold24',
                                        ugfx.WHITE, ugfx.justifyCenter)

                    sys.stdout.write(".")
                    if idx % 80 == 0:
                        print('')
                    continue
                print('')
                isStable = True

            if idx % 100 == 0:
                idx = 0
                self.refresh_screen(int(self.Vos), self.threshold, gasDensity)
                if self.Vos > self.threshold:
                    self.buzzer.beep(int(self.Vos))
                    pass
                else:
                    self.buzzer.mute()
                    pass
Beispiel #14
0
 def showTitleText(self, text):
     self.indicator.area(0, 0, self.indicator.width(),
                         self.indicator.height(), ugfx.BLACK)
     ugfx.string_box(0, 0, self.indicator.width(), self.indicator.height(),
                     text, 'IBMPlexMono_Bold24', ugfx.WHITE,
                     ugfx.justifyCenter)
Beispiel #15
0
    def run(self):

        # Show window
        self.indicator.show()
        self.container.show()

        # Title
        # self.indicator.area(0, 0, self.indicator.width(), self.indicator.height(), ugfx.BLACK)
        # ugfx.string_box(0, 0, self.indicator.width(), self.indicator.height(), 'AQI Dust Monitor', 'IBMPlexMono_Bold24', ugfx.WHITE, ugfx.justifyCenter)
        self.showTitleText('AQI Dust Monitor')

        if not self.IS_GRAPH_MODE:
            self.draw_legend()

        # IoTF
        try:
            self.iotf = IoTFoundation()
            self.showTitleText('Device ID {}'.format(self.iotf.deviceId))
        except Exception as e:
            print(e)
            self.showTitleText('Network Failed')
            self.iotf = None

        time.sleep(1)
        self.showTitleText('Intializing...')

        stime = time.ticks_ms()

        idx = 0
        sleep_time = 8000
        isStable = False
        begin_time = time.ticks_ms()
        while True:

            Vo = self.dust_sensor.readVo(self.SAMPLING_TIME, 40)
            # VoRaw = self.dust_sensor.readVoRaw(self.SAMPLING_TIME, 0)

            # Exponential Moving Average
            # https://www.investopedia.com/terms/e/ema.asp
            # EMA(t) = Value(t)*k + EMA(y) * (1-k)
            # k = 2 / (N+1)
            # k = 0.005 where N = 399
            self.Vos = Vo * 0.005 + self.Vos * 0.995

            dV = self.Vos - self.Voc
            if dV < 0:
                dV = 0
                if isStable:
                    self.Voc = self.Vos

            # Convert to Dust Density in units of ug/m3.
            dustDensity = dV / self.K * 100.0

            elapsed = (time.ticks_ms() - stime)
            #print('{}, {}, {}'.format(VoRaw, int(self.VosRaw), elapsed))

            stime = time.ticks_ms()
            if elapsed > 10:
                sleep_time -= 100
            elif elapsed < 10:
                sleep_time += 100

            time.sleep_us(sleep_time)

            # IoT
            if self.iotf != None:
                self.iotf.process()

            # Next
            idx += 1

            # Not stable before 10 secs
            if not isStable:
                if (time.ticks_ms() - begin_time) < self.STABILIZATION_TIME:
                    # Wait...
                    if idx % 6 == 0:
                        # self.showTitleText('Intializing...')
                        x = 240
                        self.indicator.area(x, 0,
                                            self.indicator.width() - x,
                                            self.indicator.height(),
                                            ugfx.BLACK)
                    else:
                        # self.showTitleText('Intializing...')
                        ugfx.string_box(0, 0, self.indicator.width(),
                                        self.indicator.height(),
                                        'Intializing...', 'IBMPlexMono_Bold24',
                                        ugfx.WHITE, ugfx.justifyCenter)

                    sys.stdout.write(".")
                    if idx % 80 == 0:
                        print('')
                    continue
                print('')
                isStable = True

            if idx % 100 == 0:
                idx = 0
                self.refresh_screen(self.Vos, self.Voc, dustDensity)
Beispiel #16
0
iconSize = 48


def drawCursor(i):
    ugfx.box(applistOffset[0] + i * (10 + iconSize) - 3, applistOffset[1] - 17,
             iconSize + 6, iconSize + 20, 0)


def drawBattery(percent):
    bw = int(20 * (percent / 100))
    ugfx.area(w - 22, 1, bw, 10, 0)


# statusbar
ugfx.string(1, 0, "Sun, 18.06.2017", font, 0)
ugfx.string_box(0, 0, w, 13, "doebi", font, 0, ugfx.justifyCenter)
ugfx.line(0, 12, w, 12, 0)
ugfx.box(w - 22, 1, 20, 10, 0)
drawBattery(50)

# applist
apps = ["nametag", "weather", "fahrplan", "foo", "bar"]
for i, app in enumerate(apps):
    ugfx.string_box(applistOffset[0] + i * (10 + iconSize),
                    applistOffset[1] - 17, iconSize, 14, app, font, 0,
                    ugfx.justifyCenter)
    ugfx.box(applistOffset[0] + i * (10 + iconSize), applistOffset[1],
             iconSize, iconSize, 0)

drawCursor(2)