diff --git a/assets/icons/delete.png b/assets/icons/delete.png new file mode 100644 index 0000000..b44ec05 Binary files /dev/null and b/assets/icons/delete.png differ diff --git a/assets/icons/editar.webp b/assets/icons/editar.webp new file mode 100644 index 0000000..c3798d6 Binary files /dev/null and b/assets/icons/editar.webp differ diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 0000000..08196c6 Binary files /dev/null and b/assets/images/logo.png differ diff --git a/main.py b/main.py index d9ba1bf..f306586 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ -# from visao.interface_texto import InterfaceTexto -from visao.interface_gui import InterfaceGUI +from visao.cli import InterfaceTexto +from visao.tela_principal import TelaPrincipal if __name__ == "__main__": - app = InterfaceGUI() + app = TelaPrincipal() app.mainloop() diff --git a/visao/interface_texto.py b/visao/cli.py similarity index 100% rename from visao/interface_texto.py rename to visao/cli.py diff --git a/visao/frames/frame_inicio.py b/visao/frames/frame_inicio.py new file mode 100644 index 0000000..2446b57 --- /dev/null +++ b/visao/frames/frame_inicio.py @@ -0,0 +1,29 @@ +import tkinter as tk + +class FrameInicio(tk.Frame): + def __init__(self, master=None): + super().__init__(master, bg="#1e1e1e") + + self.caixas_info = [ + {"titulo": "Pessoas", "quantidade": 0, "cor": "#ff9966"}, + {"titulo": "Pets", "quantidade": 0, "cor": "#66c2ff"}, + {"titulo": "Adoções", "quantidade": 0, "cor": "#99e699"}, + ] + + self._criar_layout() + + def _criar_layout(self): + container = tk.Frame(self, bg="#1e1e1e") + container.pack(pady=40, padx=50, fill="x") + + for caixa in self.caixas_info: + frame = tk.Frame(container, bg=caixa["cor"], width=200, height=120) + frame.pack(side="left", expand=True, padx=10, pady=10, fill="both") + + titulo = tk.Label(frame, text=caixa["titulo"], font=("Arial", 16, "bold"), bg=caixa["cor"], fg="white") + titulo.pack(pady=(20, 5)) + + valor = tk.Label(frame, text=str(caixa["quantidade"]), font=("Arial", 24), bg=caixa["cor"], fg="white") + valor.pack() + + \ No newline at end of file diff --git a/visao/frames/frame_pessoa.py b/visao/frames/frame_pessoa.py new file mode 100644 index 0000000..43f65d3 --- /dev/null +++ b/visao/frames/frame_pessoa.py @@ -0,0 +1,18 @@ +import tkinter as tk + +class FramePessoas(tk.Frame): + def __init__(self, master=None, bd=None): + super().__init__(master, bg="#1e1e1e") + self.bd = bd + self._criar_layout() + + def _criar_layout(self): + # Título da seção + titulo_label = tk.Label( + self, + text="GERENCIAR PESSOAS", + font=("Arial", 24, "bold"), + bg="#1e1e1e", + fg="white" + ) + titulo_label.pack(pady=20) \ No newline at end of file diff --git a/visao/interface_gui.py b/visao/interface_gui.py deleted file mode 100644 index 089455e..0000000 --- a/visao/interface_gui.py +++ /dev/null @@ -1,158 +0,0 @@ -import tkinter as tk -from tkinter import font as tkfont -from tkinter import messagebox # Usado para os botões de exemplo - -class InterfaceGUI(tk.Tk): - """Classe principal que gerencia a janela e os frames (painéis).""" - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.title("Sistema de Adoção de Pets") - # Um pouco maior para acomodar melhor o design - self.geometry("1024x600") - self.minsize(900, 550) # Define um tamanho mínimo - self.configure(bg="#1e1e1e") - - # Define fontes para serem usadas na aplicação - self.title_font = tkfont.Font(family='Helvetica', size=16, weight="bold") - self.label_font = tkfont.Font(family='Helvetica', size=10) - self.button_font = tkfont.Font(family='Helvetica', size=20, weight="bold") - self.widget_title_font = tkfont.Font(family='Helvetica', size=12, weight="bold") - - # Container principal que usa todo o espaço - container = tk.Frame(self, bg="#1e1e1e") - container.pack(side="top", fill="both", expand=True) - container.grid_rowconfigure(0, weight=1) - container.grid_columnconfigure(0, weight=1) - - self.frames = {} - # Adicione futuras classes de painel aqui - for F in (HomePage,): - page_name = F.__name__ - frame = F(parent=container, controller=self) - self.frames[page_name] = frame - frame.grid(row=0, column=0, sticky="nsew") - - self.show_frame("HomePage") - - def show_frame(self, page_name): - """Mostra um frame para a página requisitada.""" - frame = self.frames[page_name] - frame.tkraise() - -class ActionCard(tk.Frame): - """Um widget 'Card' reutilizável para as ações principais.""" - def __init__(self, parent, controller, title, description, command): - super().__init__(parent, bg="#2d2d2d", relief="raised", borderwidth=1) - - # Adiciona um padding interno ao card - self.grid_propagate(False) # Impede que os widgets filhos redimensionem o card - self.config(width=250, height=180) # Tamanho fixo para o card - - title_label = tk.Label( - self, - text=title, - font=controller.widget_title_font, - fg="white", - bg="#2d2d2d" - ) - title_label.pack(pady=(15, 5)) - - desc_label = tk.Label( - self, - text=description, - font=controller.label_font, - fg="#cccccc", # Um cinza mais claro - bg="#2d2d2d" - ) - desc_label.pack(pady=5) - - # Botão de ação estilizado como um ícone - action_button = tk.Button( - self, - text="➕", # Um ícone de 'mais' simples. Você pode usar uma imagem aqui. - font=controller.button_font, - fg="white", - bg="#4a4a4a", - activebackground="#6a6a6a", - activeforeground="white", - relief="flat", - width=3, - command=command - ) - action_button.pack(side="bottom", pady=15) - -class HomePage(tk.Frame): - """Painel da tela inicial (Home), agora com o layout de cards.""" - def __init__(self, parent, controller): - super().__init__(parent, bg="#1e1e1e") - self.controller = controller - - # Configura o grid principal da HomePage para ter 2 colunas e 2 linhas - self.grid_columnconfigure(0, weight=2) # Coluna da esquerda (cards) - self.grid_columnconfigure(1, weight=1) # Coluna da direita (configurações) - self.grid_rowconfigure(0, weight=0) # Linha para o header (não expande) - self.grid_rowconfigure(1, weight=1) # Linha para o conteúdo principal (expande) - - # --- Header com ícone e título --- - header_frame = tk.Frame(self, bg="#1e1e1e") - # Coloca o header na primeira linha, ocupando as duas colunas - header_frame.grid(row=0, column=0, columnspan=2, sticky="ew", padx=20, pady=(20, 0)) - - home_icon = tk.Label( - header_frame, - text="🏠", # Ícone de casa - font=controller.title_font, - fg="white", - bg="#1e1e1e" - ) - home_icon.pack(side="left", anchor="w") - - home_label = tk.Label( - header_frame, - text="Home", - font=controller.title_font, - fg="white", - bg="#1e1e1e" - ) - home_label.pack(side="left", padx=10, anchor="w") - - # --- Frame da Esquerda para os ActionCards --- - left_frame = tk.Frame(self, bg="#1e1e1e") - left_frame.grid(row=1, column=0, sticky="nsew", padx=20, pady=20) - - # Configura um grid dentro do frame da esquerda para os cards - left_frame.grid_columnconfigure((0, 1), weight=1) - left_frame.grid_rowconfigure((0, 1), weight=1) - - # --- Frame da Direita para Controles e Botão --- - right_frame = tk.Frame(self, bg="#1e1e1e") - right_frame.grid(row=1, column=1, sticky="nsew", padx=20, pady=20) - right_frame.grid_columnconfigure(0, weight=1) - # As rows do frame da direita não precisam expandir, então não configuramos rowconfigure - - # --- Criando e posicionando os CARDS --- - # Exemplo de comandos. Troque isso pelas suas funções reais. - cmd_pets = lambda: messagebox.showinfo("Ação", "Abrir gerenciamento de Pets") - cmd_pessoas = lambda: messagebox.showinfo("Ação", "Abrir gerenciamento de Pessoas") - cmd_adocoes = lambda: messagebox.showinfo("Ação", "Abrir tela para nova adoção") - cmd_historico = lambda: messagebox.showinfo("Ação", "Abrir histórico de adoções") - - card1 = ActionCard(left_frame, controller, "Gerenciar Pets", "Adicionar, editar e remover pets", cmd_pets) - card1.grid(row=0, column=0, padx=10, pady=10, sticky="nsew") - - card2 = ActionCard(left_frame, controller, "Gerenciar Pessoas", "Cadastrar adotantes e doadores", cmd_pessoas) - card2.grid(row=0, column=1, padx=10, pady=10, sticky="nsew") - - card3 = ActionCard(left_frame, controller, "Realizar Adoção", "Iniciar um novo processo de adoção", cmd_adocoes) - card3.grid(row=1, column=0, padx=10, pady=10, sticky="nsew") - - card4 = ActionCard(left_frame, controller, "Histórico", "Consultar adoções realizadas", cmd_historico) - card4.grid(row=1, column=1, padx=10, pady=10, sticky="nsew") - - # --- Criando os widgets no FRAME DA DIREITA --- - - -if __name__ == "__main__": - app = InterfaceGUI() - app.mainloop() \ No newline at end of file diff --git a/visao/tela_principal.py b/visao/tela_principal.py new file mode 100644 index 0000000..4a77a89 --- /dev/null +++ b/visao/tela_principal.py @@ -0,0 +1,108 @@ +import tkinter as tk +from datetime import datetime +from tkinter import font as tkfont +from tkinter import messagebox +from PIL import Image, ImageTk +from persistencia.banco_dados import BancoDeDados +from modelo.pessoa import Pessoa +import os + +class TelaPrincipal(tk.Tk): + def __init__(self): + super().__init__() + + self.title("Sistema PETS") + self.geometry("900x600") + self.resizable(False, False) + self.configure(bg="#1e1e1e") + + self.bd = BancoDeDados() + if not self.bd.pessoas.listar_todos(): # Adiciona apenas se estiver vazio + self.bd.pessoas.inserir(Pessoa(1, "Ana Silva")) + self.bd.pessoas.inserir(Pessoa(2, "Bruno Costa")) + self.bd.pessoas.inserir(Pessoa(3, "Carlos Dias")) + self.bd.pessoas.inserir(Pessoa(4, "Daniel Santos")) + + + self.header = tk.Frame(self, bg="#2c2c2c", height=80) + self.header.pack(side="top", fill="x") + self.header.pack_propagate(False) + + script_dir = os.path.dirname(__file__) + logo_path = os.path.join(script_dir, "..", "assets", "images", "logo.png") + + logo_pil = Image.open(logo_path) + logo_pil = logo_pil.resize((120, 80), Image.Resampling.LANCZOS) + self.logo_image = ImageTk.PhotoImage(logo_pil) + + # O Label agora usa a imagem em vez de texto + self.logo_label = tk.Label(self.header, image=self.logo_image, bg="#2c2c2c") + self.logo_label.pack(side="left", padx=(10, 5)) + # ----------------------------- + + self.relogio_label = tk.Label(self.header, font=("Arial", 12), bg="#2c2c2c", fg="white") + self.relogio_label.pack(side="right", padx=10) + + self.atualizar_relogio() + + self.menu_lateral = tk.Frame(self, bg="#2c2c2c", width=200) + self.menu_lateral.pack(side="left", fill="y") + self.menu_lateral.pack_propagate(False) + + self.area_conteudo = tk.Frame(self, bg="#ccbcbc") + self.area_conteudo.pack(side="right", expand=True, fill="both") + + botoes = [ + ("Início", self.mostrar_inicio), + ("Pessoas", self.mostrar_pessoas), + ("Pets", self.mostrar_inicio), + ("Sair", self.sair), + ] + + for texto, comando in botoes: + btn = tk.Button( + self.menu_lateral, + text=texto, + command=comando, + bg="#2c2c2c", + fg="white", + activebackground="#3c3c3c", + activeforeground="white", + relief="flat", + borderwidth=0, + highlightthickness=0, + anchor="w", + padx=10, + ) + btn.pack(fill="x", pady=2, padx=5) + + self.mostrar_inicio() + + def atualizar_relogio(self): + agora = datetime.now().strftime("%d-%m-%Y %H:%M:%S") + self.relogio_label.config(text=agora) + self.after(1000, self.atualizar_relogio) + + def mostrar_inicio(self): + from visao.frames.frame_inicio import FrameInicio + self.limpar_conteudo() + frame = FrameInicio(self.area_conteudo) + frame.pack(expand=True, fill="both") + + def mostrar_pessoas(self): + from visao.frames.frame_pessoa import FramePessoas + self.limpar_conteudo() + frame = FramePessoas(self.area_conteudo, self.bd) + frame.pack(expand=True, fill="both") + + def limpar_conteudo(self): + for widget in self.area_conteudo.winfo_children(): + widget.destroy() + + def sair(self): + if messagebox.askyesno("Sair", "Tem certeza que deseja sair?"): + self.destroy() + +if __name__ == "__main__": + app = TelaPrincipal() + app.mainloop() \ No newline at end of file