visualizarOrdemGerente.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. from tkinter import *
  2. import tkinter as tk
  3. from tkinter import ttk
  4. from tkinter import messagebox
  5. from tkinter.font import BOLD
  6. class GerenciarOrdens():
  7. def __init__(self):
  8. self.janela = Tk()
  9. self.janela.title('Gerenciar Ordens de Serviço')
  10. self.janela.geometry('1600x900')
  11. self.janela.minsize(1600, 900)
  12. self.janela.maxsize(1600, 900)
  13. self.janela.config(bg="#484848")
  14. self.janela.state("zoomed")
  15. self.janela.iconbitmap('automotivo.ico')
  16. # ============= SEÇÕES ================ #
  17. self.containerInicial = Label(self.janela, bg="#484848", fg="white", text='Ordens de Serviço', font=(
  18. "Roboto", 25, BOLD))
  19. self.container = LabelFrame(self.janela, bg="#484848", fg="#e1e3db")
  20. self.rodape = Frame(self.janela, bg="#484848")
  21. self.containerInicial.pack(fill='x', expand='no', pady=40)
  22. self.container.pack(fill='x', expand='yes', ipadx=30, padx=30)
  23. self.rodape.pack(fill='both', expand='no', padx=20)
  24. # ------------------- TREEVIEW ------------------ #
  25. self.style = ttk.Style(master=self.janela)
  26. self.style.theme_use("clam")
  27. self.style.configure("mystyle.Treeview", font=("Roboto", 14))
  28. self.style.configure("mystyle.Treeview.Heading", font=("Roboto", 16))
  29. self.style.configure("Treeview", background="silver",
  30. rowheight=25, fieldbackground="#E0FFFF",)
  31. self.style.configure("Heading", background="#4682B4", foreground="white")
  32. self.cabecalho = ('#', 'cliente', 'cpfCliente', 'mecanico', 'cpfMecanico',
  33. 'servico', 'valor')
  34. self.trv = ttk.Treeview(
  35. self.container, selectmode='browse', columns=self.cabecalho, show='headings')
  36. self.trv.column('#', width=30)
  37. self.trv.column('cliente', anchor='center', width=300)
  38. self.trv.column('cpfCliente', anchor='center', width=200)
  39. self.trv.column('mecanico', anchor='center', width=300)
  40. self.trv.column('cpfMecanico', anchor='center', width=200)
  41. self.trv.column('servico', anchor='center', width=200)
  42. self.trv.column('valor', anchor='center', width=200)
  43. self.trv.heading('#', text='#')
  44. self.trv.heading('cliente', text='Nome do Cliente')
  45. self.trv.heading('cpfCliente', text='CPF do Cliente')
  46. self.trv.heading('mecanico', text='Nome do Mecânico')
  47. self.trv.heading('cpfMecanico', text='CPF do Mecânico')
  48. self.trv.heading('servico', text='Serviço')
  49. self.trv.heading('valor', text='Valor')
  50. self.trv.bind('<Double 1>', self.pegar_linha)
  51. self.trv.pack(pady=20)
  52. self.popular()
  53. # ========= SEÇÃO RODAPÉ ======= #
  54. # ---------- BOTÃO ----------- #
  55. self.finalizarBtn = Button(self.container, text='Finalizar Ordem', font=("Roboto", 14, BOLD), width='20', height=2,
  56. command=self.finalizar, bg="#566981", fg="#e1e3db", relief=RAISED)
  57. self.finalizarBtn.pack(side='left', pady=20, padx=165)
  58. self.finalizarBtn.bind("<Enter>", self.hoverIn1)
  59. self.finalizarBtn.bind("<Leave>", self.hoverOut)
  60. self.ativasBtn = Button(self.container, text='Ordens ativas', font=("Roboto", 14, BOLD), width='20', height=2,
  61. command=self.ver_ativas, bg="#566981", fg="#e1e3db", relief=RAISED)
  62. self.ativasBtn.pack(side='left', pady=20, padx=100)
  63. self.ativasBtn.bind("<Enter>", self.hoverIn1)
  64. self.ativasBtn.bind("<Leave>", self.hoverOut)
  65. self.finalizadasBtn = Button(self.container, text='Ordens finalizadas', font=("Roboto", 14, BOLD), width='20', height=2,
  66. command=self.ver_finalizadas, bg="#566981", fg="#e1e3db", relief=RAISED)
  67. self.finalizadasBtn.pack(side='left', pady=20, padx=150)
  68. self.finalizadasBtn.bind("<Enter>", self.hoverIn1)
  69. self.finalizadasBtn.bind("<Leave>", self.hoverOut)
  70. self.voltarBtn = Button(self.rodape, text='Voltar', font=("Roboto", 14, BOLD), width='20', height=2,
  71. command=self.voltar_tela, bg="#cc0000", fg="#e1e3db", relief=RAISED)
  72. self.voltarBtn.pack(side='right', pady=40)
  73. self.voltarBtn.bind("<Enter>", self.hoverIn3)
  74. self.voltarBtn.bind("<Leave>", self.hoverOut2)
  75. mainloop()
  76. # ============= FUNÇÕES ============== #
  77. def pegar_linha(self, identificador):
  78. return
  79. def popular(self):
  80. # self.trv.delete(*self.trv.get_children())
  81. # staff = TabFunc()
  82. # for i in staff.populate():
  83. # self.trv.insert('', 'end', values=i)
  84. return
  85. def finalizar(self):
  86. return
  87. def ver_finalizadas(self):
  88. return
  89. def ver_ativas(self):
  90. return
  91. def voltar_tela(self):
  92. self.janela.destroy()
  93. return
  94. def hoverIn1(self, event): # verde
  95. event.widget.config(bg="#3CB371", fg="white", relief=GROOVE)
  96. def hoverIn3(self, event): # vermelho
  97. event.widget.config(bg="#8B0000", fg="white", relief=GROOVE)
  98. def hoverOut(self, event):
  99. event.widget.config(bg="#566981", fg="#e1e3db", relief=RAISED)
  100. def hoverOut2(self, event):
  101. event.widget.config(bg="#cc0000", fg="#e1e3db", relief=RAISED)
  102. minhaTela = GerenciarOrdens()