예제 #1
0
 def set_power(self, status):
     if isinstance(status, bool):
         if not self.dummy:
             bl.set_power(status)
         self.dispatch('on_power_change', status)
         Logger.info(
             'BrightnessHandler: setting power to {}'.format(status))
예제 #2
0
    def handleEvents(self, event, fpsClock):
        if event.type == pygame.MOUSEBUTTONDOWN:
            # Play sound
            self.sound_beep1.play()
            self.screensaver = False
            blm.set_power(True)  # turn on screen
            self.now = dtm.datetime.now()
            self.new_plus_15 = self.now + dtm.timedelta(minutes=15)

        if event.type == pygame.MOUSEBUTTONUP:
            if (not self.layer2[0].visible):
                for sprite in self.layer1:
                    sprite.visible = False
                for sprite in self.layer2:
                    sprite.visible = True
                Sound("assets/audio/enter_authorization_code.wav").play()
            elif (self.pin_i == len(str(self.pin))):
                # Ran out of button presses
                if (self.correct == 4):
                    self.sound_granted.play()
                    from screens.main import ScreenMain
                    self.loadScreen(ScreenMain())
                else:
                    self.sound_deny2.play()
                    self.sound_denied.play()
                    self.reset()

        return False
예제 #3
0
    def on_alarm(self, alarm_id):

        print("alarm")
        # turn screen on
        try:
            bl.set_power(True)
            bl.set_power(True)
        except:
            print >> sys.stderr, "could not turn screen on"

        # play sound
        #self.sound_thread = SoundThread("sounds/alarm1.m4a")
        #self.sound_thread.start()

        try:
            # light on
            os.system("sudo ./codesend 1381717,, -l 445 -p 0")
            # hifi radio on
            os.system("sudo ./codesend 1397845,, -l 445 -p 0")

        except:
            print("Could not turn light on!")

        # open window to stop alarm or snooze
        self.snooze = SnoozeWindow(self, self.sound_thread, alarm_id)
예제 #4
0
    def handleEvents(self, event, fpsClock):
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.beep1.play()
            self.screensaver = False
            bl.set_power(True)  # turn on screen
            self.now = dt.datetime.now()
            self.new_plus_15 = self.now + dt.timedelta(minutes=15)

        if event.type == pygame.MOUSEBUTTONUP:
            return False
예제 #5
0
 def update(self, screenSurface, fpsClock):
     if pygame.time.get_ticks() - self.lastClockUpdate > 1000:
         self.stardate.setText("STAR DATE {}".format(
             datetime.now().strftime("%d%m.%y %H:%M:%S")))
         self.lastClockUpdate = pygame.time.get_ticks()
     LcarsScreen.update(self, screenSurface, fpsClock)
     # Lets have a 15 minute ScreenSaver feature. If ScreenSaver is OFF (0) and 15m past turn it ON!
     if self.screensaver == False and self.new_plus_15 < dt.datetime.now():
         self.screensaver = True
         # Blank Screen
         bl.set_power(False)
예제 #6
0
파일: pir.py 프로젝트: kfeger/WetterPi
def PIRChange(channel):
    global SwitchDisplay, DisplayOffCount

    if GPIO.input(PIRPin) == GPIO.LOW:
        SwitchDisplay = 0
        DisplayOffCount = COUNT
        #print 'Tick 1-0 um ' + datetime.datetime.now().strftime("%H:%M:%S")

    else:
        SwitchDisplay = 1
        print 'Tick 0-1 um ' + datetime.datetime.now().strftime("%H:%M:%S")
        if (screen.get_power() != True):
            screen.set_power(True)
            screen.set_brightness(255, smooth=True, duration=3)
        DisplayOffCount = COUNT
예제 #7
0
 def handleCommand(self, cmd):
     if cmd == 'playpause':
         self.kbd.emit_click(uinput.KEY_B)
     elif cmd == 'next':
         self.kbd.emit_click(uinput.KEY_N)
     elif cmd == 'previous':
         self.kbd.emit_click(uinput.KEY_V)
     elif cmd == 'phoneUp':
         self.kbd.emit_click(uinput.KEY_P)
     elif cmd == 'phoneDown':
         self.kbd.emit_click(uinput.KEY_O)
     elif cmd == 'search':
         self.kbd.emit_click(uinput.KEY_M)
     elif cmd == 'home':
         self.kbd.emit_click(uinput.KEY_H)
     elif cmd == 'brightnessUp':
         self.increaseBrightness()
     elif cmd == 'brightnessDown':
         self.decreaseBrightness()
     elif cmd == 'volumeUp':
         self.volumeUp()
     elif cmd == 'volumeDown':
         self.volumeDown()
     elif cmd == 'screenOff':
         bl.set_power(False)
     elif cmd == 'screenOn':
         bl.set_power(True)
     elif cmd == 'toggleScreen':
         if bl.get_power():
             bl.set_power(False)
         else:
             bl.set_power(True)
     elif cmd == 'toggleCamera':
         print("Camera is " +
               ("running" if self.is_cam_running else "not running"))
         if self.is_cam_running:
             print("Stop camera")
             self.stopCamera()
         else:
             print("Start camera")
             self.startCamera()
예제 #8
0
 gpsp.start()  # start it up
 while True:
     tom = bluetooth.lookup_name('94:65:2d:82:53:61', timeout=110)
     if ((tom != None) or (GPIO.input(38))):
         while (GPIO.input(38)):
             state = "Key bypass engaged "
             print(state)
             GPIO.output(RELAY1, 0)
             GPIO.output(RELAY2, 0)
             GPIO.output(RELAY3, 0)
             GPIO.output(RELAY4, 0)
             GPIO.output(RELAY5, 0)
             GPIO.output(RELAY6, 0)
             GPIO.output(RELAY7, 0)
             GPIO.output(RELAY8, 0)
             bl.set_power(True)
             time.sleep(10)
             check = "Checking " + time.strftime(
                 "%a, %d %b %Y %H:%M:%S",
                 time.localtime()) + ",  " + str(
                     gpsd.fix.latitude) + ",  " + str(
                         gpsd.fix.longitude)
             print(check)
             logging.info(check)
         else:
             if (tom != None):
                 state = "Tom's here :)"
                 print(state)
                 GPIO.output(RELAY1, 0)
                 GPIO.output(RELAY2, 0)
                 GPIO.output(RELAY3, 0)
def Change_Screen(Index, scrShow):

	Screen_Timer = TEMPO_USUARIO

	if (Index == ALUNO_1):

		lbl_dados = []
		lbl_disciplinas = []
		lbl_resultado = []
		lbl_Notas_1, lbl_Notas_2, lbl_Notas_3, lbl_Notas_4, lbl_Notas_5, lbl_Notas_6 = [],[],[],[],[],[]

		# Disciplinas do Aluno 1
		d1 = "ECA411 - Sistemas de Controle I"
		d2 = "EEE403 - Eletrônica de Potência"
		d3 = "EEN212 - Instrumentação e Automação"
		d4 = "EEN221 - Telecomunicações"
		d5 = "EEN941 - Altas Frequências I"
		d6 = "EFH104 - Gerenciamento Industrial"
		d7 = "EFH107 - Direito Empresarial"
		d8 = "EFH108 - Pilotagem - Mil. Falcon"

		r2 = "Han Solo"
		r4 = "Engenharia Eletrônica"
		r6 = "5ª"
		r8 = "Noturno"
	
		sDisciplinas = ["Disciplinas", d1, d2, d3, d4, d5, d6, d7, d8]
		sProvasCol = [p1, p2, p3, p4, p5, p6]
		sDados = [r1, r2, r3, r4, r5, r6, r7, r8, r9]

		# Para cada item contido no vetor
		for disciplina in sDisciplinas:
			i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			lbl_disciplinas.append(tk.Label(Screen, text = disciplina, font = ("Arial bold",11), fg = Br, bg = Am[Alterna_icor], width = lGde, height = 2))  # Cria um label para cada index
			lbl_disciplinas[i].grid( row = i, column = 1)   # Ordena os labels sequencialmente em linhas
		
		for i in range(len(sDisciplinas)-1):

			#i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			# Atribui valores randomicos aos labels das notas
			lbl_Notas_1.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_2.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_3.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_4.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_5.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_6.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))

			# Posiciona verticalmente os Labels das notas
			lbl_Notas_1[i].grid(row = i+1, column = 2)
			lbl_Notas_2[i].grid(row = i+1, column = 3)
			lbl_Notas_3[i].grid(row = i+1, column = 4)
			lbl_Notas_4[i].grid(row = i+1, column = 5)
			lbl_Notas_5[i].grid(row = i+1, column = 6)
			lbl_Notas_6[i].grid(row = i+1, column = 7)

		for c in sProvasCol:
			# Alternância das Cores
			if (len(sProvasCol)%2 == 0):	jAux = sProvasCol.index(c) + 1
			else:	jAux = sProvasCol.index(c)
			Alterna_jcor = jAux%2
			# Varredura em Colunas
			j = sProvasCol.index(c)
			lbl_resultado.append(tk.Label(Screen, text = c , font = ("Arial bold",11), fg = Br , bg = Am[Alterna_jcor] , width = lPeq , height = 2))   # Cria um label para cada index
			lbl_resultado[j].grid(row = 0 , column = j+2)    # Ordena os labels sequencialmente em colunas 
			
		for dado in sDados:
			k = sDados.index(dado)
			Alterna_kcor = k%2
			lbl_dados.append(tk.Label(Screen, text = dado , font = ("Arial bold",11), fg = Br , bg = Dd[Alterna_kcor] , width = lGde , height = 2))
			lbl_dados[k].grid(row = k, column = 0)

	if (Index == ALUNO_2):

		lbl_dados = []
		lbl_disciplinas = []
		lbl_resultado = []
		lbl_Notas_1, lbl_Notas_2, lbl_Notas_3, lbl_Notas_4, lbl_Notas_5, lbl_Notas_6 = [],[],[],[],[],[]
		#Disciplinas do Aluno 3
		d1 = "EEE281 - Instalações Elétricas"
		d2 = "EEE402 - Conversão de Energia"
		d3 = "EEN211 - Eletromagnestismo II"
		d4 = "EEN251 - Microcontroladores"
		d5 = "EFH113 - Emp. e Gestão"
		d6 = "ETE204 - Sistemas e Sinais"
		d7 = "ETE802 - Fen. de Transportes"
		d8 = "PAE205 - Manutenção - Mil. Falcon"

		r2 = "Chewbacca"
		r4 = "Ciclo Básico"
		r6 = "1ª"
		r8 = "Noturno"
	
		sDisciplinas = ["Disciplinas", d1, d2, d3, d4, d5, d6, d7, d8]
		sProvasCol = [p1, p2, p3, p4, p5, p6]
		sDados = [r1, r2, r3, r4, r5, r6, r7, r8, r9]

		# Para cada item contido no vetor
		for disciplina in sDisciplinas:
			i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			lbl_disciplinas.append(tk.Label(Screen, text = disciplina, font = ("Arial bold",11), fg = Br, bg = Az[Alterna_icor], width = lGde, height = 2))  # Cria um label para cada index
			lbl_disciplinas[i].grid( row = i, column = 1)   # Ordena os labels sequencialmente em linhas
		
		for i in range(len(sDisciplinas)-1):

			#i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			# Atribui valores randomicos aos labels das notas
			lbl_Notas_1.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_2.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_3.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_4.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_5.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_6.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))

			# Posiciona verticalmente os Labels das notas
			lbl_Notas_1[i].grid(row = i+1, column = 2)
			lbl_Notas_2[i].grid(row = i+1, column = 3)
			lbl_Notas_3[i].grid(row = i+1, column = 4)
			lbl_Notas_4[i].grid(row = i+1, column = 5)
			lbl_Notas_5[i].grid(row = i+1, column = 6)
			lbl_Notas_6[i].grid(row = i+1, column = 7)

		for c in sProvasCol:
			# Alternância das Cores
			if (len(sProvasCol)%2 == 0):	jAux = sProvasCol.index(c) + 1
			else:	jAux = sProvasCol.index(c)
			Alterna_jcor = jAux%2
			# Varredura em Colunas
			j = sProvasCol.index(c)
			lbl_resultado.append(tk.Label(Screen, text = c , font = ("Arial bold",11), fg = Br , bg = Az[Alterna_jcor] , width = lPeq , height = 2))   # Cria um label para cada index
			lbl_resultado[j].grid(row = 0 , column = j+2)    # Ordena os labels sequencialmente em colunas 
			
		for dado in sDados:
			k = sDados.index(dado)
			Alterna_kcor = k%2
			lbl_dados.append(tk.Label(Screen, text = dado , font = ("Arial bold",11), fg = Br , bg = Dd[Alterna_kcor] , width = lGde , height = 2))
			lbl_dados[k].grid(row = k, column = 0)

	if (Index == ALUNO_3):
		lbl_dados = []
		lbl_disciplinas = []
		lbl_resultado = []
		lbl_Notas_1, lbl_Notas_2, lbl_Notas_3, lbl_Notas_4, lbl_Notas_5, lbl_Notas_6 = [],[],[],[],[],[]

		#Disciplinas do Aluno 3
		d1 = "EFB105 - Cálculo I"
		d2 = "EFB106 - Geometria Analítica"
		d3 = "EFB205 - Física I"
		d4 = "EFB403 - Algoritmos e Programação"
		d5 = "EFB502 - Química"
		d6 = "EFB603 - Introdução à Engenharia"
		d7 = "EFB813 - Desenho"
		d8 = "EFB352 - Métodos Numéricos"
		
		r2 = "Luke Skywalker"
		r4 = "Ciclo Básico"
		r6 = "1ª"
		r8 = "Diurno"
	
		sDisciplinas = ["Disciplinas", d1, d2, d3, d4, d5, d6, d7, d8]
		sProvasCol = [p1, p2, p3, p4, p5, p6]
		sDados = [r1, r2, r3, r4, r5, r6, r7, r8, r9]

		# Para cada item contido no vetor
		for disciplina in sDisciplinas:
			i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			lbl_disciplinas.append(tk.Label(Screen, text = disciplina, font = ("Arial bold",11), fg = Br, bg = Am[Alterna_icor], width = lGde, height = 2))  # Cria um label para cada index
			lbl_disciplinas[i].grid( row = i, column = 1)   # Ordena os labels sequencialmente em linhas
		
		for i in range(len(sDisciplinas)-1):

			#i = sDisciplinas.index(disciplina)  # i <- index do vetor
			Alterna_icor = i%2                  # Alterna entre os indices pares e ímpares
			# Atribui valores randomicos aos labels das notas
			lbl_Notas_1.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_2.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_3.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_4.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_5.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
			lbl_Notas_6.append(tk.Label(Screen, text = random.choice(vNotas), font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))

			# Posiciona verticalmente os Labels das notas
			lbl_Notas_1[i].grid(row = i+1, column = 2)
			lbl_Notas_2[i].grid(row = i+1, column = 3)
			lbl_Notas_3[i].grid(row = i+1, column = 4)
			lbl_Notas_4[i].grid(row = i+1, column = 5)
			lbl_Notas_5[i].grid(row = i+1, column = 6)
			lbl_Notas_6[i].grid(row = i+1, column = 7)

		for c in sProvasCol:
			# Alternância das Cores
			if (len(sProvasCol)%2 == 0):	jAux = sProvasCol.index(c) + 1
			else:	jAux = sProvasCol.index(c)
			Alterna_jcor = jAux%2
			# Varredura em Colunas
			j = sProvasCol.index(c)
			lbl_resultado.append(tk.Label(Screen, text = c , font = ("Arial bold",11), fg = Br , bg = Am[Alterna_jcor] , width = lPeq , height = 2))   # Cria um label para cada index
			lbl_resultado[j].grid(row = 0 , column = j+2)    # Ordena os labels sequencialmente em colunas 
			
		for dado in sDados:
			k = sDados.index(dado)
			Alterna_kcor = k%2
			lbl_dados.append(tk.Label(Screen, text = dado , font = ("Arial bold",11), fg = Br , bg = Dd[Alterna_kcor] , width = lGde , height = 2))
			lbl_dados[k].grid(row = k, column = 0)
		
	while scrShow:

		if (Screen_Timer != 0):	
			print(Screen_Timer)
			bl.set_power(True)
			Screen_Timer -= 1
		else:
			scrShow = False
			bl.set_power(False)
			Main_Screen()

		lbl_Restante = tk.Label(Screen, text = "Tempo Restante para Consulta:" , font = ("Arial bold",11), width = lGde-3 , height = 1)
		lbl_Tempo = tk.Label(Screen, text = str(int(Screen_Timer)) + "  Segundos", font = ("Arial bold",11), width = lGde-3 , height = 1)
		lbl_Restante.grid(row = 12, column = 1)
		lbl_Tempo.grid(row = 13, column = 1)
		print(Screen_Timer)
		time.sleep(1)
		Screen.update()
def Main_Screen():
	lbl_dados = []
	lbl_disciplinas = []
	lbl_resultado = []
	lbl_Notas_1, lbl_Notas_2, lbl_Notas_3, lbl_Notas_4, lbl_Notas_5, lbl_Notas_6 = [],[],[],[],[],[]

	# Disciplinas do Aluno 1
	d1 = "****"

	r2 = "*** Nome_Aluno ***"
	r4 = "*** Curso_Aluno ***"
	r6 = "*** Ano_Aluno ***"
	r8 = "*** Período_Aluno ***"
	
	sDisciplinas = ["*** Disciplinas ***", d1, d1, d1, d1, d1, d1, d1, d1]
	sProvasCol = [p1, p2, p3, p4, p5, p6]
	sDados = [r1, r2, r3, r4, r5, r6, r7, r8, r9]

	# Para cada item contido no vetor
	for i in range(len(sDisciplinas)):

		Alterna_icor = i%2	# Alterna entre os indices pares e ímpares
		if (i != 0):
			lbl_disciplinas.append(tk.Label(Screen, text = "", font = ("Arial bold",11), fg = Br, bg = Vm[Alterna_icor], width = lGde, height = 2))  # Cria um label para cada index
			lbl_disciplinas[i].grid( row = i, column = 1)   # Ordena os labels sequencialmente em linhas
		else:
			lbl_disciplinas.append(tk.Label(Screen, text = "*** Disciplinas ***", font = ("Arial bold",11), fg = Br, bg = Vm[Alterna_icor], width = lGde, height = 2))  # Cria um label para cada index
			lbl_disciplinas[0].grid( row = 0, column = 1)   # Ordena os labels sequencialmente em linhas

	for i in range(len(sDisciplinas)-1):
		Alterna_icor = i%2
		# Atribui valores randomicos aos labels das notas
		lbl_Notas_1.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
		lbl_Notas_2.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
		lbl_Notas_3.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
		lbl_Notas_4.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
		lbl_Notas_5.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))
		lbl_Notas_6.append(tk.Label(Screen, text = "####", font = ("Arial bold",11), fg = Pt, bg = Cz[Alterna_icor], width = lPeq, height = 2))

		# Posiciona verticalmente os Labels das notas
		lbl_Notas_1[i].grid(row = i+1, column = 2)
		lbl_Notas_2[i].grid(row = i+1, column = 3)
		lbl_Notas_3[i].grid(row = i+1, column = 4)
		lbl_Notas_4[i].grid(row = i+1, column = 5)
		lbl_Notas_5[i].grid(row = i+1, column = 6)
		lbl_Notas_6[i].grid(row = i+1, column = 7)

	for c in sProvasCol:
		# Alternância das Cores
		if (len(sProvasCol)%2 == 0):	jAux = sProvasCol.index(c) + 1
		else:	jAux = sProvasCol.index(c)
		Alterna_jcor = jAux%2
		# Varredura em Colunas
		j = sProvasCol.index(c)
		lbl_resultado.append(tk.Label(Screen, text = c , font = ("Arial bold",11), fg = Br , bg = Vm[Alterna_jcor] , width = lPeq , height = 2))   # Cria um label para cada index
		lbl_resultado[j].grid(row = 0 , column = j+2)    # Ordena os labels sequencialmente em colunas 
			
	for dado in sDados:
		k = sDados.index(dado)
		Alterna_kcor = k%2
		lbl_dados.append(tk.Label(Screen, text = dado , font = ("Arial bold",11), fg = Br , bg = Dd[Alterna_kcor] , width = lGde , height = 2))
		lbl_dados[k].grid(row = k, column = 0)

	toggleButton1 = tk.Button(Screen, text="Tela 1", font = ("Arial bold",11), width = lGde-1, height = 1, command = Button_1)
	toggleButton2 = tk.Button(Screen, text="Tela 2", font = ("Arial bold",11), width = lGde-1, height = 1, command = Button_2)
	toggleButton3 = tk.Button(Screen, text="Tela 3", font = ("Arial bold",11), width = lGde-1, height = 1, command = Button_3)

	toggleButton1.grid(row = 12, column = 0)
	toggleButton2.grid(row = 13, column = 0)
	toggleButton3.grid(row = 14, column = 0)

	quitButton = tk.Button(Screen, text = "Quit", font = ("Arial bold",11), width = lPeq-3, height = 1, command = Quit)
	quitButton.grid(row = 13, column = 2)

	while init_Screen:
		if (GPIO.input(6) == True):
		    bl.set_power(True)
		    print("Tem")

		if (GPIO.input(6) == False):
		    bl.set_power(False)

		readData("Data read from serial")
		time.sleep(1)
		Screen.update()
예제 #11
0
 def update(self, screenSurface, fpsClock):
     # Lets have a 15 minute ScreenSaver feature. If ScreenSaver is OFF (0) and 15m past turn it ON!
     if self.screensaver == False and self.new_plus_15 < dtm.datetime.now():
         self.screensaver = True
         # Blank Screen
         blm.set_power(False)
def Main_Screen():
    lbl_dados = []
    lbl_disciplinas = []
    lbl_resultado = []
    lbl_Notas_1, lbl_Notas_2, lbl_Notas_3, lbl_Notas_4, lbl_Notas_5, lbl_Notas_6 = [],[],[],[],[],[]

    # Disciplinas do Aluno 1
    d1 = "****"

    r2 = "*** Nome_Aluno ***"
    r4 = "*** Curso_Aluno ***"
    r6 = "*** Ano_Aluno ***"
    r8 = "*** Período_Aluno ***"

    sDisciplinas = ["*** Disciplinas ***", d1, d1, d1, d1, d1, d1, d1, d1]
    sProvasCol = [p1, p2, p3, p4, p5, p6]
    sDados = [r1, r2, r3, r4, r5, r6, r7, r8, r9]

    # Para cada item contido no vetor
    for i in range(len(sDisciplinas)):

        Alterna_icor = i % 2  # Alterna entre os indices pares e ímpares
        if (i != 0):
            lbl_disciplinas.append(
                tk.Label(Screen,
                         text="",
                         font=(Arialb, Font_Size),
                         fg=Br,
                         bg=Vm[Alterna_icor],
                         width=lGde,
                         height=2))  # Cria um label para cada index
            lbl_disciplinas[i].grid(
                row=i, column=1)  # Ordena os labels sequencialmente em linhas
        else:
            lbl_disciplinas.append(
                tk.Label(Screen,
                         text="*** Disciplinas ***",
                         font=(Arialb, Font_Size),
                         fg=Br,
                         bg=Vm[Alterna_icor],
                         width=lGde,
                         height=2))  # Cria um label para cada index
            lbl_disciplinas[0].grid(
                row=0, column=1)  # Ordena os labels sequencialmente em linhas

    for i in range(len(sDisciplinas) - 1):
        Alterna_icor = i % 2
        # Atribui valores randomicos aos labels das notas
        lbl_Notas_1.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))
        lbl_Notas_2.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))
        lbl_Notas_3.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))
        lbl_Notas_4.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))
        lbl_Notas_5.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))
        lbl_Notas_6.append(
            tk.Label(Screen,
                     text="####",
                     font=(Arialb, Font_Size),
                     fg=Pt,
                     bg=Cz[Alterna_icor],
                     width=lPeq,
                     height=2))

        # Posiciona verticalmente os Labels das notas
        lbl_Notas_1[i].grid(row=i + 1, column=2)
        lbl_Notas_2[i].grid(row=i + 1, column=3)
        lbl_Notas_3[i].grid(row=i + 1, column=4)
        lbl_Notas_4[i].grid(row=i + 1, column=5)
        lbl_Notas_5[i].grid(row=i + 1, column=6)
        lbl_Notas_6[i].grid(row=i + 1, column=7)

    for c in sProvasCol:
        # Alternância das Cores
        if (len(sProvasCol) % 2 == 0): jAux = sProvasCol.index(c) + 1
        else: jAux = sProvasCol.index(c)
        Alterna_jcor = jAux % 2
        # Varredura em Colunas
        j = sProvasCol.index(c)
        lbl_resultado.append(
            tk.Label(Screen,
                     text=c,
                     font=(Arialb, Font_Size),
                     fg=Br,
                     bg=Vm[Alterna_jcor],
                     width=lPeq,
                     height=2))  # Cria um label para cada index
        lbl_resultado[j].grid(row=0, column=j +
                              2)  # Ordena os labels sequencialmente em colunas

    for dado in sDados:
        k = sDados.index(dado)
        Alterna_kcor = k % 2
        lbl_dados.append(
            tk.Label(Screen,
                     text=dado,
                     font=(Arialb, Font_Size),
                     fg=Br,
                     bg=Dd[Alterna_kcor],
                     width=lGde,
                     height=2))
        lbl_dados[k].grid(row=k, column=0)

    ID_Aluno = tk.StringVar()

    #Botões para teste de navegação entre usuários
    toggleButton1 = tk.Button(Screen,
                              text="Tela 1",
                              font=(Arialb, Font_Size),
                              width=lGde - 4,
                              height=1,
                              command=Button_1)
    toggleButton2 = tk.Button(Screen,
                              text="Tela 2",
                              font=(Arialb, Font_Size),
                              width=lGde - 4,
                              height=1,
                              command=Button_2)
    toggleButton3 = tk.Button(Screen,
                              text="Tela 3",
                              font=(Arialb, Font_Size),
                              width=lGde - 4,
                              height=1,
                              command=Button_3)
    #Campo de entrada do ID
    DataEntry = tk.Entry(Screen, textvariable=ID_Aluno)

    #Botão do campo de entrada - TESTE...
    #EntryButton =  tk.Button(Screen, text="OK", font = ("Arial bold",11), width = lPeq, height = 1, command = Button_4)

    #Posicionamento dos botões no grid
    toggleButton1.grid(row=12, column=0)
    toggleButton2.grid(row=13, column=0)
    toggleButton3.grid(row=14, column=0)
    DataEntry.grid(row=14, column=1)
    #EntryButton.grid(row = 14, column = 2)

    #Botão de Logoff - TESTE...
    #logoffButton = tk.Button(Screen, text = "Logoff", font = (Arialb,11), width = lPeq-3, height = 1, command = Logoff)
    #logoffButton.grid(row = 13, column = 2)

    #Inicialização da porta serial
    ser = serial.Serial(port='/dev/ttyAMA0',
                        baudrate=9600,
                        parity=serial.PARITY_NONE,
                        stopbits=serial.STOPBITS_ONE,
                        bytesize=serial.EIGHTBITS,
                        timeout=0)
    ser.read()

    #Loop para Backlight e verificação do usuário
    while init_Screen:

        #Controle de Backlight
        if (GPIO.input(6) == True):
            bl.set_power(True)
            print("Tem")

        if (GPIO.input(6) == False):
            bl.set_power(False)

        verifica_ID = ID_Aluno.get()
        #verifica_ID = ser.read()
        print(verifica_ID)

        #Login Aluno Han Solo
        if (verifica_ID == "Solo"):
            Button_1()

    #Login Aluno Chewbacca
        if (verifica_ID == "Chewie"):
            Button_2()

    #Login Aluno Luke Skywalker
        if (verifica_ID == "Skywalker"):
            Button_3()

        time.sleep(0.5)
        Screen.update()
예제 #13
0
 def onScreenOff(self):
     try:
         bl.set_power(not bl.get_power())
     except:
         print("could not change screen")
예제 #14
0
 def set_screen_on(self, on):
     bl.set_power(on)
예제 #15
0
파일: pir.py 프로젝트: kfeger/WetterPi
        SwitchDisplay = 0
        DisplayOffCount = COUNT
        #print 'Tick 1-0 um ' + datetime.datetime.now().strftime("%H:%M:%S")

    else:
        SwitchDisplay = 1
        print 'Tick 0-1 um ' + datetime.datetime.now().strftime("%H:%M:%S")
        if (screen.get_power() != True):
            screen.set_power(True)
            screen.set_brightness(255, smooth=True, duration=3)
        DisplayOffCount = COUNT


GPIO.setup(PIRPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(PIRPin, GPIO.BOTH, callback=PIRChange, bouncetime=50)
screen.set_power(True)
screen.set_brightness(255)

#print 'Dim nach %d Sekunden, Aus nach %d Sekunden' % (COUNT/3, COUNT)

while 1:
    sleep(1)
    if (DisplayOffCount > 0):
        DisplayOffCount = DisplayOffCount - 1

    if (SwitchDisplay == 0):
        if (DisplayOffCount == 0):
            screen.set_power(False)
        elif (DisplayOffCount == COUNT / 3):
            screen.set_brightness(32, smooth=True, duration=3)
    else: