Esempio n. 1
0
File: gui.py Progetto: uniite/imd
def calibrate ():
	i = 1
	while i > -1:
		oled.clear()
		oled.flush()
		oled.textbox(x = 65, y = 50, text = "Calibrating in %s" % i, align = 2)
		oled.flush()
		oled.redraw()
		oled.flush()
		sleep(1)
		i -= 1
	tty.write("c")
	sleep(.4)
Esempio n. 2
0
File: gui.py Progetto: uniite/imd
def imd_playback ():
	global mode
	mode = "play"
	song = menu.imd_db.record(cursong)
	oled.clear()
	oled.flush()
	n = isnum
	bc = border_color
	y = offset
	for i in range(0, 12):
		oled.fill(0, y + i, 129, y + i+1, [bc.r - (n(bc.r) * i), bc.g - (n(bc.g) * i), bc.b - (n(bc.b) * i)])
		oled.flush()
	oled.textbox(x = 65, y = 4, text = "Now Playing", color = black, align = 2)
	oled.flush()
	tcolor = blue
	oled.textbox(x = 65, y = 35, text = song.title, color = tcolor, mode = 1, align = 2)
	oled.flush()
	oled.textbox(x = 65, y = 50, text = song.artist, color = tcolor, mode = 1, align = 2)
	oled.flush()
	oled.textbox(x = 65, y = 65, text = song.album, color = tcolor, mode = 1, align = 2)
	oled.flush()
	oled.redraw()
	oled.flush()
	timer().start()
	return song
Esempio n. 3
0
File: gui.py Progetto: uniite/imd
	def run (self):
		sleep(.5)
		while 1:
			if mode == "play":
				times = audeng.getpos()
				#print times
				sleep(.8)
				if times:
					percent_elapsed = times[0] * 1.0 / times[1]
					oled.fill(15, 80, 114, 90, blue)
					oled.flush()
					oled.fill(16, 81, 113, 89, black)
					oled.flush()
					
					y = 82
					h = highlight_color
					n = isnum
					#print "bar pos: %s" % (17 + int(95 * percent_elapsed))
					for i in range(0, 6):
						oled.fill(17, y + i, 17 + int(95 * percent_elapsed), y + i+1, [h.r - (n(h.r) * i), h.g - (n(h.g) * i), h.b - (n(h.b) * i)])
						oled.flush()
					i2 = 0
					
					secs = (times[0] % 600) / 10
					min = (times[0] - secs * 10) / 600
					oled.fill(17, 93, 114, 100, black)
					oled.flush()
					oled.textbox(x=17, y=93, text="%s:%s%s" % (min, ("0", "")[secs > 9], secs), color = blue)
					oled.flush()
					time_rem = times[1] - times[0]
					secs_rem = (time_rem % 600) / 10
					min_rem = (time_rem - secs_rem * 10) / 600
					oled.textbox(x=114, y=93, text="-%s:%s%s" % (min_rem, ("0", "")[secs_rem > 9], secs_rem), color = blue, align = 1)
					oled.flush()
					oled.redraw()
					oled.flush()
					if times[0] >= times[1]:
						play_next()
						return
			else:
				return
Esempio n. 4
0
File: gui.py Progetto: uniite/imd
def menu_draw ():
	# Clear the frame buffer first
	oled.clear()
	oled.flush()
	# Draw blue bars at top and bottom of screen
	n = isnum
	bc = border_color
	y = offset
	for i in range(0, 12):
		oled.fill(0, y + i, 129, y + i+1, [bc.r - (n(bc.r) * i), bc.g - (n(bc.g) * i), bc.b - (n(bc.b) * i)])
		oled.flush()
	y = 116 + offset
	for i in range(0, 12):
		oled.fill(0, y + i, 129, y + i+1, [bc.r - (n(bc.r) * i), bc.g - (n(bc.g) * i), bc.b - (n(bc.b) * i)])
		oled.flush()
	# Show title of menu on the top blue bar that was just drawn
	oled.textbox(x=65, y=4, text=curmenu.name, color=[0, 0, 0], align=2)
	oled.flush()
	# Show current item index and total on bottom blue bar
	oled.textbox(x=65, y=119, text="%s/%s" % (curmenu.index + 1, curmenu.len), color=[0, 0, 0], align=2)
	oled.flush()
	# Redraw the counter (bottom blue bar)
	oled.redraw(116 + offset)
	for y in range(menu_start, curmenu.end, row_height):
		if y == curmenu.cursor:
			# Fill the row of the center menu item because for the selection cursor, iPod-ish style :)
			h = highlight_color
			for i in range(0, 6):
				oled.fill(0, y + i, 129, y + i+1, [h.r - (n(h.r) * i), h.g - (n(h.g) * i), h.b - (n(h.b) * i)])
				oled.flush()
			i2 = 0
			for i in range(6, 11):
				oled.fill(0, y + i, 129, y + i+1, [h.r - (10 * n(h.r)) + i2, h.g - (10 * n(h.r)) + i2, h.b - (10 * n(h.r)) + i2])
				oled.flush()
				i2 += 1
			# Also invert selected item's text color
			oled.textbox (x = 1, y = y + 2, text = curmenu.items[curmenu.top + ((y - menu_start) / row_height)][0], color=texth_color, mode=2)
		else:
			# Plain menu items (but they might get selected later!)
			oled.textbox (x = 1, y = y + 2, text = curmenu.items[curmenu.top + ((y - menu_start) / row_height)][0], color=text_color, mode=2)
		oled.flush()