Skip to content

Commit

Permalink
Finish project
Browse files Browse the repository at this point in the history
  • Loading branch information
Veras-D committed Jan 1, 2024
1 parent a14df7a commit eacb6e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
14 changes: 11 additions & 3 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def changeTheme():
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, bg_color=color_bg, corner_radius=20)
instagram_link.place(x=20, y=root.winfo_height() - 80)
instagram_link.place(x=20, y=root.winfo_height() - 84)
github_link.place(x=20, y=root.winfo_height() - 50)
open_new_page()
else:
Expand All @@ -36,7 +36,7 @@ def changeTheme():
fg_color=text_radius_color, corner_radius=20)
github_link = ctk.CTkLabel(root, text="GitHub", text_color=color_text, cursor="hand2",
fg_color=text_radius_color, corner_radius=20)
instagram_link.place(x=20, y=root.winfo_height() - 80)
instagram_link.place(x=20, y=root.winfo_height() - 84)
github_link.place(x=20, y=root.winfo_height() - 50)
open_new_page()

Expand Down Expand Up @@ -119,6 +119,10 @@ def open_new_page():
wraplength=400, bg_color=color_bg, compound="left")
main_label9.place(x=10, y=220)

main_label10 = ctk.CTkLabel(configures_tab, text=f"Aberto: {Arduino(selected_port.get()).is_open}",
wraplength=400, bg_color=color_bg, compound="left")
main_label10.place(x=10, y=245)

about_label = ctk.CTkLabel(about_tab,
text="PyHolofotes é um programa Python para controlar um sistema Arduino RELE, "
"injetando pulsos em superfícies para análises térmicas de defeitos não "
Expand All @@ -135,7 +139,7 @@ def open_new_page():
instagram_link.bind("<Button-1>", lambda e: callback("https://www.instagram.com/veras_programmer"))
github_link.bind("<Button-1>", lambda e: callback("https://www.github.com/Veras-D"))

instagram_link.place(x=20, y=root.winfo_height()-80)
instagram_link.place(x=20, y=root.winfo_height()-84)
github_link.place(x=20, y=root.winfo_height()-50)

else:
Expand Down Expand Up @@ -167,6 +171,7 @@ def pulso_unico():
def led_pulse():
if tempo1_entry.get().strip() != "":
led(porta=selected_port.get(), opc=1, tempo1=float(tempo1_entry.get()))
tempo1_entry.delete(0, END)
open_new_page()
else:
port_error = ctk.CTkToplevel(root)
Expand Down Expand Up @@ -210,6 +215,9 @@ def led_pulse():
if tempo1_entry.get().strip() != "" and tempo2_entry.get().strip() != "" and num_pulse_entry.get().strip() != "":
led(porta=selected_port.get(), opc=2, tempo1=float(tempo1_entry.get()),
tempo2=float(tempo2_entry.get()), num_pulse=int(num_pulse_entry.get()))
tempo1_entry.delete(0, END)
tempo2_entry.delete(0, END)
num_pulse_entry.delete(0, END)
open_new_page()
else:
port_error = ctk.CTkToplevel(root)
Expand Down
9 changes: 1 addition & 8 deletions scripts/utilities.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from serial import *
import serial.tools.list_ports
import customtkinter as ctk
import webbrowser
# import base64


arduino = None
Expand All @@ -21,11 +19,6 @@ def callback(url):
webbrowser.open_new_tab(url)


# def get_base64_encoded_image(image_path):
# with open(image_path, "rb") as img_file:
# return base64.b64encode(img_file.read()).decode('utf-8')


def find_arduino():
arduino_ports = serial.tools.list_ports.comports()
ports = ["Selecione a porta"]
Expand All @@ -40,7 +33,7 @@ def arduino_conected(portas):
arduino = serial.Serial(portas, 115200, timeout=1)
print("Arduino está conectado.")
except serial.SerialException:
print("Não foi possível conectar ao Arduino. Verifique a conexão e tente novamente.") # Fazer esses textos aparecerem no programa
print("Não foi possível conectar ao Arduino. Verifique a conexão e tente novamente.")
pass


Expand Down

0 comments on commit eacb6e4

Please sign in to comment.