Exemple #1
0
    def redraw(self):
        u8g2.setPowerSave(False)
        #u8g2.setFont(u8g2.u8g2_font_profont10_mr)
        u8g2.setFont(u8g2.u8g2_font_profont12_mr)
        u8g2.setDrawColor(0)
        u8g2.drawBox(0, 0, 128, 64)
        u8g2.setFontMode(True)
        u8g2.setDrawColor(1)
        u8g2.drawLine(0, 41, 128, 41)
        schedule_entry = self.schedule_entries[self.selected]
        time = schedule_entry[0]
        title = schedule_entry[1]
        speaker = schedule_entry[2]

        u8g2.drawStr(1, 10, title[0:21])
        u8g2.drawStr(1, 20, title[21:42])
        u8g2.drawStr(1, 30, title[42:63])
        u8g2.drawStr(1, 40, title[63:84])

        u8g2.setFont(u8g2.u8g2_font_profont12_mr)
        u8g2.drawStr(1, 52, speaker[0:21])
        u8g2.drawStr(1, 62, speaker[21:33])
        u8g2.drawStr(94, 62, time)

        u8g2.sendBuffer()
Exemple #2
0
    def redraw(self):
        u8g2.setFont(u8g2.u8g2_font_profont12_mr)
        u8g2.setDrawColor(0)
        u8g2.drawBox(0, 0, 128, 64)
        u8g2.setFontMode(True)
        u8g2.setDrawColor(1)
        u8g2.drawStr(1, 9, self.title)
        u8g2.drawLine(0, 10, 128, 10)

        idx = 0
        while (idx < 5):
            begin = (self.scroll_position + idx) * 21
            end = begin + 21
            u8g2.drawStr(1, 20 + (idx * 10), self.body[begin:end])
            idx = idx + 1

        u8g2.setDrawColor(0)
        u8g2.drawLine(127, 10, 127, 64)
        u8g2.setDrawColor(1)
        scroll_bar_start = 10 + round(
            self.scroll_position / float(self.lines) * 54)
        scroll_bar_end = 10 + round(
            min([1.0, ((self.scroll_position + 5) / float(self.lines))]) * 54)
        u8g2.drawLine(127, scroll_bar_start, 127, scroll_bar_end)

        u8g2.sendBuffer()
Exemple #3
0
    def redraw(self):
        u8g2.setPowerSave(False)
        u8g2.setFont(u8g2.u8g2_font_profont12_mr)
        u8g2.setDrawColor(0)
        u8g2.drawBox(0, 0, 128, 64)
        u8g2.setFontMode(True)
        u8g2.setDrawColor(1)
        u8g2.drawStr(1, 9, self.menu_name)
        u8g2.drawLine(0, 10, 128, 10)

        # loop through menu entries
        max_pos = len(self.menu_entries) - 1
        idx = 0
        while (idx < 5
               and ((self.scroll_position + idx) < len(self.menu_entries))):
            if (self.selected == (self.scroll_position + idx)):
                u8g2.drawBox(0, (idx * 10) + 11, 128, 10)
                u8g2.setDrawColor(0)

            u8g2.drawStr(5, 20 + (idx * 10),
                         self.menu_entries[self.scroll_position + idx][0])
            u8g2.setDrawColor(1)
            idx = idx + 1

        u8g2.sendBuffer()
Exemple #4
0
 def redraw(self):
     u8g2.setFont(u8g2.u8g2_font_profont12_mr)
     u8g2.setDrawColor(1)
     u8g2.drawBox(32, 16, 64, 32)
     u8g2.setDrawColor(0)
     u8g2.drawBox(33, 17, 62, 30)
     u8g2.setFontMode(True)
     u8g2.setDrawColor(1)
     u8g2.drawStr(44, 37, str(self.selected))
     u8g2.sendBuffer()
     self.set_current_value(False)
Exemple #5
0
 def redraw(self):
     try:
         f = open('/sdcard/images/rot/rot_' + str(self.selected) + '.mono',
                  'rb')
         b = f.read()
         f.close()
         u8g2.drawXBM(0, 0, 128, 64, b)
         u8g2.sendBuffer()
         gc.collect()
     except OSError:
         pass
Exemple #6
0
 def redraw(self):
     u8g2.setFont(u8g2.u8g2_font_profont12_mr)
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setDrawColor(1)
     u8g2.drawBox(50, 27, 28, 14)
     u8g2.setDrawColor(0)
     u8g2.setFontMode(True)
     if RadioStream.streaming:
         u8g2.drawStr(52, 37, "stop")
     else:
         u8g2.drawStr(52, 37, "play")
     u8g2.sendBuffer()
Exemple #7
0
 def redraw(self):
     u8g2.setFont(u8g2.u8g2_font_profont12_mr)
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setFontMode(True)
     u8g2.setDrawColor(1)
     try:
         f = open(AvatarPicker.avatars[self.selected], 'rb')
         b = f.read()
         f.close()
         u8g2.drawXBM(48, 0, 32, 32, b)
     except OSError:
         u8g2.drawStr(48, 20, "?")
     u8g2.sendBuffer()
Exemple #8
0
 def redraw(self):
     u8g2.setFont(u8g2.u8g2_font_profont12_mr)
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setFontMode(True)
     u8g2.setDrawColor(1)
     u8g2.drawStr(1, 60, BadgeSettings.settings['username'])
     try:
         f = open(BadgeSettings.settings['avatar_path'], 'rb')
         b = f.read()
         f.close()
         u8g2.drawXBM(48, 0, 32, 32, b)
     except OSError:
         u8g2.drawStr(48, 20, "?")
     u8g2.sendBuffer()
Exemple #9
0
 def redraw(self):
     u8g2.setFont(u8g2.u8g2_font_profont12_mr)
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setFontMode(True)
     u8g2.setDrawColor(1)
     u8g2.drawStr(1, 20, self.title + ":")
     u8g2.drawStr(1, 60, "Right pad to save")
     u8g2.drawLine(0, 31, 128, 31)
     render_text = self.text[self.scroll_position:]
     cur_char_x = 1 + 6 * len(render_text)
     u8g2.drawStr(1, 30, render_text)
     u8g2.drawBox(cur_char_x - 1, 20, 7, 11)
     u8g2.setDrawColor(0)
     u8g2.drawStr(cur_char_x, 30, self.current_char)
     u8g2.setDrawColor(1)
     u8g2.sendBuffer()
Exemple #10
0
 def redraw(self):
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setDrawColor(1)
     u8g2.sendBuffer()
Exemple #11
0
 def redraw(self):
     u8g2.setDrawColor(0)
     u8g2.drawBox(0, 0, 128, 64)
     u8g2.setDrawColor(1)
     u8g2.sendBuffer()
     LEDs.animation = AnimationPicker.avatars[self.selected]