Пример #1
0
def blink_events():
    for event in g_calendar.events:
        blink_color = g_calendar.color_ids[
            event["colorId"]] if "colorId" in event else 0xffffff

        event_date = dateutil.parser.parse(
            event['start']['dateTime'] if 'dateTime' in
            event['start'] else event['start']['date'])

        event_date = event_date.replace(tzinfo=None)
        delta = event_date - datetime.datetime.now()

        if delta < datetime.timedelta(hours=10):
            display.clear()
            time.sleep(0.5)
            display.set_display(int(delta.seconds / 3600), True, blink_color)
            time.sleep(0.5)
            display.set_display(16, False, blink_color)
            time.sleep(0.5)
            display.clear()
        else:
            display.set_display_manual({0: blink_color})
            time.sleep(0.5)
            display.set_display_manual({0: 0})
        time.sleep(0.5)
Пример #2
0
def infinity():
    sequence = [1, 2, 6, 5, 4, 3, 6, 7]
    current_color = 0
    for loops in range(8):
        for i in sequence:
            display.clear()
            display.set_display_manual({i: colors[current_color % 7]})
            current_color += 1
            time.sleep(0.08)
Пример #3
0
    def receive_data(self):
        while self.connected:
            data = ""
            try:
                data = self.conn.recv(512)
            except:
                self.kill(False)

            if data != "":
                display.clear()
                display.set_display_manual({0: (ord(data[0]) << 16) | (ord(data[1]) << 8) | ord(data[2])})
            else:
                self.kill(False)
Пример #4
0
    def receive_data(self):
        while self.connected:
            data = ''
            try:
                data = self.conn.recv(512)
            except:
                self.kill(False)

            if data != '':
                display.clear()
                display.set_display_manual({
                    0:
                    (ord(data[0]) << 16) | (ord(data[1]) << 8) | ord(data[2])
                })
            else:
                self.kill(False)
Пример #5
0
def blink_events():
    dp_off_color = display.current_color if display.decimal_on else 0
    for event in g_calendar.events:
        if "colorId" in event:
            display.set_display_manual({0: g_calendar.color_ids[event["colorId"]]})
        else:
            display.set_display_manual({0: 0xffffff})

        time.sleep(0.5)
        display.set_display_manual({0: 0})
        time.sleep(0.5)

    display.set_display_manual({0: dp_off_color})
Пример #6
0
def blink_events():
    for event in g_calendar.events:
        blink_color = g_calendar.color_ids[event["colorId"]] if "colorId" in event else 0xFFFFFF

        event_date = dateutil.parser.parse(
            event["start"]["dateTime"] if "dateTime" in event["start"] else event["start"]["date"]
        )

        event_date = event_date.replace(tzinfo=None)
        delta = event_date - datetime.datetime.now()

        if delta < datetime.timedelta(hours=10):
            display.clear()
            time.sleep(0.5)
            display.set_display(int(delta.seconds / 3600), True, blink_color)
            time.sleep(0.5)
            display.set_display(16, False, blink_color)
            time.sleep(0.5)
            display.clear()
        else:
            display.set_display_manual({0: blink_color})
            time.sleep(0.5)
            display.set_display_manual({0: 0})
        time.sleep(0.5)
Пример #7
0
def attention_dp():
    for i in range(24):
        display.set_display_manual({0: colors[i % 6]})
        time.sleep(2.0 / 24.0)
    display.set_display_manual({0: 0})
    time.sleep(1)
Пример #8
0
def attention_dp():
    for i in range(24):
        display.set_display_manual({0: colors[i % 6]})
        time.sleep(2.0 / 24.0)
    display.set_display_manual({0: 0})
    time.sleep(1)
Пример #9
0
def decode_data(data):
    data_dict = {}
    for i in range(8):
        data_dict[i] = (ord(data[(i*3)]) << 16) | (ord(data[(i*3)+1]) << 8) | ord(data[(i*3)+2])
    display.set_display_manual(data_dict)