def inicializar_devs(self): def criar_label(master, texto): label = TKUtils.obter_label() label.defs.cnf['text'] = texto label.defs.cnf['width'] = 200 label.defs.mcnf['fz'] = 18 label.iniciar(master=master) devs = TKUtils.obter_container(instanciar=True) devs.defs.pack['pady'] = 6 devs.iniciar(master=self) label = TKUtils.obter_label() label.defs.cnf['text'] = 'Desenvolvedores' label.defs.mcnf['fz'] = 24 label.defs.pack['padx'] = 20 label.defs.pack['side'] = 'left' label.iniciar(master=devs) membros = TKUtils.obter_container(instanciar=True) membros.defs.cnf['bd'] = 4 membros.defs.cnf['bg'] = 'grey' membros.defs.pack['side'] = 'right' membros.iniciar(master=devs) criar_label(membros, 'Paulo Ricardo: github.com/paulloclara') criar_label(membros, 'Josivan Cardoso: github.com/josivancs') criar_label(membros, 'Weslley Isidorio: github.com/weslleyisidorio')
def __init__(self): super().__init__(campos=3) self.defs.cnf['title'] = 'Cadastrar Evento' self.subelemento.titulo = Atributo() self.subelemento.titulo.label = TKUtils.obter_label() self.subelemento.titulo.input = TKUtils.obter_input()
def __init__(self, campos: int = 2) -> None: super().__init__() self.defs.qtd_campos = campos self.defs.cnf['geometry'] = f'420x{180 + campos * 30}' self.subelemento.cancelar = TKUtils.obter_botao() self.subelemento.confirmar = TKUtils.obter_botao()
def __init__(self, campos=2): super().__init__(campos) self.subelemento.data = Atributo() self.subelemento.data.label = TKUtils.obter_label() self.subelemento.data.input = TKUtils.obter_input() self.subelemento.duracao = Atributo() self.subelemento.duracao.label = TKUtils.obter_label() self.subelemento.duracao.input = TKUtils.obter_input()
def __init__(self): super().__init__() self.defs.cnf['bd'] = 10 self.defs.pack['expand'] = True self.defs.pack['side'] = 'bottom' self.subelemento.evento = TKUtils.obter_botao() self.subelemento.tarefa = TKUtils.obter_botao() self.subelemento.apresentacao = TKUtils.obter_botao()
def __init__(self): super().__init__() self.defs.pack['pady'] = 6 self.defs.pack['side'] = 'top' self.elemento_ativo = '' self.subelemento.evento = TKUtils.obter_botao() self.subelemento.tarefa = TKUtils.obter_botao() self.subelemento.apresentacao = TKUtils.obter_botao()
def create_activity_label(self, activity): # Container cnf, pack = {}, {} cnf['bd'] = 1 cnf['bg'] = 'grey' label_container =\ TKUtils.get_container(master=self.viewport, cnf=cnf, pack=pack) # Label cnf, pack = {}, {} cnf['text'] = activity['title'] cnf['bg'] = 'blue' cnf['fg'] = 'white' cnf['width'] = 93 cnf['height'] = 2 pack['side'] = 'left' label_container.label =\ TKUtils.get_label(master=label_container, cnf=cnf, pack=pack) # Raffle Button cnf, pack, defs = {}, {}, {} defs['type'] = 'activity' defs['value'] = activity cnf['text'] = 'O' cnf['bg'] = 'orange' cnf['width'] = 2 cnf['command'] = lambda evt=None: self.commands['raffle'](defs=defs) pack['side'] = 'left' label_container.button =\ TKUtils.get_button(master=label_container, cnf=cnf, pack=pack) # Remove Button cnf, pack = {}, {} cnf['text'] = 'X' cnf['bg'] = 'red' cnf['width'] = 2 cnf['command'] =\ lambda evt=None: self.commands['remove'](activity['activity_id']) pack['side'] = 'right' label_container.button =\ TKUtils.get_button(master=label_container, cnf=cnf, pack=pack) self.label_list.append(label_container)
def __init__(self): super().__init__() self.defs.pack['side'] = 'top' self.subelemento.home = TKUtils.obter_botao() self.subelemento.aluno = TKUtils.obter_botao() self.subelemento.grupo = TKUtils.obter_botao() self.subelemento.sobre = TKUtils.obter_botao() self.subelemento.atividade = TKUtils.obter_botao() self.elemento_ativo = ''
def __init__(self): super().__init__() self.defs.cnf['title'] = 'Gerar Grupos' self.subelemento.nome = Atributo() self.subelemento.nome.label = TKUtils.obter_label() self.subelemento.nome.input = TKUtils.obter_input() self.subelemento.quantidade = Atributo() self.subelemento.quantidade.label = TKUtils.obter_label() self.subelemento.quantidade.input = TKUtils.obter_input()
def __init__(self): super().__init__() self.defs.cnf['title'] = 'Cadastrar Atividade' self.subelemento.titulo = Atributo() self.subelemento.titulo.label = TKUtils.obter_label() self.subelemento.titulo.input = TKUtils.obter_input() self.subelemento.descricao = Atributo() self.subelemento.descricao.label = TKUtils.obter_label() self.subelemento.descricao.input = TKUtils.obter_input()
class Student(TKUtils.Container()): def __init__(self, master, controller, commands): super().__init__(master=master) self.pack(side='bottom') self.commands = commands self.__controller = controller self.actions = None self.student_list = None self._create_student_list() self._create_actions() def _create_student_list(self): commands = {} commands['raffle'] = self.commands['raffle'] if not self.student_list: self.student_list = StudentList(master=self, commands=commands) def _create_actions(self): commands = {} commands['raffle'] = self.commands['raffle'] commands['browse_file'] = self.__controller.browse_file_button self.actions = Actions(master=self, commands=commands)
class Aluno(TKUtils.Container()): def __init__(self, master, controller): super().__init__(master=master) self.controller = controller self.actions = None self.lista_de_alunos = None def iniciar(self): self.criar_actions() self.criar_lista_de_alunos() self.lista_de_alunos.iniciar() self.actions.iniciar() self.pack(side='bottom') def criar_lista_de_alunos(self): eventos = {} eventos['sortear'] = self.controller.evento_sortear if not self.lista_de_alunos: self.lista_de_alunos = ListaDeAlunos(master=self, eventos=eventos) def criar_actions(self): eventos = {} eventos['sortear'] = self.controller.evento_sortear eventos['arquivo'] = self.controller.evento_carregar_arquivo self.actions = Actions(master=self, eventos=eventos)
def inicializar_repositorio(self): label = TKUtils.obter_label() label.defs.cnf['text'] = 'Stuki: github.com/paulloclara/stuki' label.defs.mcnf['fz'] = 16 label.defs.pack['pady'] = 10 label.defs.pack['side'] = 'bottom' label.iniciar(master=self)
class RegisterWindow(TKUtils.Window()): def __init__(self, commands): super().__init__() self.commands = commands self.form = None self.title('Cadastrar Atividade') self.geometry('400x320') self.resizable(0, 0) self._create_form() def _create_form(self): commands = {} commands['submit'] = self.commands['submit_form'] commands['cancel'] = self.commands['cancel_form'] self.form = Form(master=self, commands=commands) def get_form(self): fields = {} fields['desc'] = self.form.desc_field['input'].get() fields['title'] = self.form.title_field['input'].get() return fields
def criar_container(self): cnf = {} cnf['bd'] = 10 self.container = TKUtils.obter_container(master=self, cnf=cnf) self.criar_label_de_erro() self.criar_botao_confirmar()
def __init__(self): super().__init__() self.defs.cnf['bd'] = 10 self.defs.pack['expand'] = True self.defs.pack['side'] = 'bottom' self.subelemento.cadastrar = TKUtils.obter_botao()
def _create_container(self): cnf = {} cnf['bd'] = 10 self.container = TKUtils.get_container(master=self, cnf=cnf) self._create_error_label() self._create_confirm_button()
def criar_label(self, texto, cor): cnf, pack = {}, {} cnf['text'] = texto cnf['bd'] = 4 cnf['fg'] = cor cnf['font'] = ('times new roman', 22, 'bold') return TKUtils.obter_label(master=self.container, cnf=cnf, pack=pack)
def criar_container(self, master): cnf = {} cnf['bd'] = 1 cnf['bg'] = 'grey' container = TKUtils.obter_container(master=master, cnf=cnf) return container
def criar_label(self, master, cnf={}, pack={}): cnf['fg'] = 'white' cnf['height'] = 2 pack['side'] = 'left' label = TKUtils.obter_label(master=master, cnf=cnf, pack=pack) return label
def criar_label(self): label = TKUtils.obter_label() label.defs.cnf['fg'] = 'white' label.defs.cnf['height'] = 2 label.defs.pack['side'] = 'left' return label
class Filtro(TKUtils.obter_container()): def __init__(self): super().__init__() self.defs.pack['pady'] = 6 self.defs.pack['side'] = 'top' self.elemento_ativo = '' self.subelemento.evento = TKUtils.obter_botao() self.subelemento.tarefa = TKUtils.obter_botao() self.subelemento.apresentacao = TKUtils.obter_botao() def iniciar(self, master): super().iniciar(master=master) self.inicializar_botao_evento() self.inicializar_botao_tarefa() self.inicializar_botao_apresentacao() def desativar_(self, elemento: str): getattr(self.subelemento, elemento).desativar() if self.elemento_ativo: getattr(self.subelemento, self.elemento_ativo).ativar() self.elemento_ativo = elemento def inicializar_botao_tarefa(self): self.subelemento.tarefa.defs.cnf['text'] = 'Tarefa' self.subelemento.tarefa.defs.cnf['bg'] = 'blue' self.subelemento.tarefa.defs.cnf['width'] = 8 self.subelemento.tarefa.defs.cnf['pady'] = 2 self.subelemento.tarefa.defs.pack['side'] = 'left' self.subelemento.tarefa.iniciar(master=self) def inicializar_botao_apresentacao(self): self.subelemento.apresentacao.defs.cnf['text'] = 'Apresentação' self.subelemento.apresentacao.defs.cnf['bg'] = 'green' self.subelemento.apresentacao.defs.cnf['width'] = 14 self.subelemento.apresentacao.defs.cnf['pady'] = 2 self.subelemento.apresentacao.defs.pack['side'] = 'right' self.subelemento.apresentacao.iniciar(master=self) def inicializar_botao_evento(self): self.subelemento.evento.defs.cnf['text'] = 'Evento' self.subelemento.evento.defs.cnf['bg'] = 'orange' self.subelemento.evento.defs.cnf['width'] = 8 self.subelemento.evento.defs.cnf['pady'] = 2 self.subelemento.evento.defs.pack['side'] = 'right' self.subelemento.evento.iniciar(master=self)
def _create_activity_label(self): cnf, pack = {}, {} cnf['text'] = f'Atividade: {self.activity_title}' cnf['bd'] = 4 cnf['fg'] = 'blue' cnf['font'] = ('arial', 16, 'bold') self.activity_label =\ TKUtils.get_label(master=self.container, cnf=cnf, pack=pack)
def _create_error_label(self): cnf, pack = {}, {} cnf['text'] = self.error_msg cnf['fg'] = 'red' cnf['font'] = ('arial', 16, 'bold') pack['pady'] = 10 self.error_label = TKUtils.get_label(master=self, cnf=cnf, pack=pack)
def _create_student_label(self): cnf, pack = {}, {} cnf['text'] = f'Aluno: {self.student_name}' cnf['bd'] = 4 cnf['fg'] = 'red' cnf['font'] = ('arial', 16, 'bold') self.student_label =\ TKUtils.get_label(master=self.container, cnf=cnf, pack=pack)
def inicializar_infos(self): infos = TKUtils.obter_mensagem() infos.defs.cnf['text'] = ( 'Projeto referente à disciplina de ' + 'Engenharia de Software I do Instituto Federal do Piauí - IFPI') infos.defs.cnf['width'] = 700 infos.defs.mcnf['fz'] = 18 infos.defs.pack['padx'] = 20 infos.defs.pack['pady'] = 20 infos.iniciar(master=self)
class Navbar(TKUtils.Container()): def __init__(self, master, commands): super().__init__(master=master) self.pack() self.commands = commands self.group_button = None self.student_button = None self.activity_button = None self.create_student_button() self.create_activity_button() self.create_group_button() def create_student_button(self): cnf, pack = {}, {} cnf['text'] = 'Alunos' cnf['bg'] = 'red' cnf['width'] = 14 cnf['font'] = ('arial', 16, 'bold') cnf['command'] = self.commands['student'] pack['side'] = 'left' self.student_button =\ TKUtils.get_button(master=self, cnf=cnf, pack=pack) def create_activity_button(self): cnf, pack = {}, {} cnf['text'] = 'Atividades' cnf['bg'] = 'blue' cnf['width'] = 24 cnf['font'] = ('arial', 16, 'bold') cnf['command'] = self.commands['activity'] pack['side'] = 'left' self.activity_button =\ TKUtils.get_button(master=self, cnf=cnf, pack=pack) def create_group_button(self): cnf, pack = {}, {} cnf['text'] = 'Grupos' cnf['bg'] = 'green' cnf['width'] = 14 cnf['font'] = ('arial', 16, 'bold') cnf['command'] = self.commands['group'] pack['side'] = 'left' self.group_button = TKUtils.get_button(master=self, cnf=cnf, pack=pack)
class JanelaDeCadastro(TKUtils.Janela()): def __init__(self, titulo): super().__init__() self.eventos = None self.titulo = titulo self.corpo = None self.botao_cancelar = None self.botao_confirmar = None def iniciar(self, texto, campos): self.texto = texto self.quantidade_de_campos = campos self.title(self.titulo) self.geometry('360x280') self.resizable(0, 0) self.criar_corpo() self.criar_botao_cancelar() self.criar_botao_confirmar() def criar_corpo(self): self.corpo = TKUtils.obter_container(master=self, cnf={'bd': 10}) def criar_botao_cancelar(self): cnf, grid = {}, {} cnf['text'] = 'Cancelar' cnf['bg'] = 'red' cnf['command'] = self.eventos['cancelar'] grid['row'] = self.quantidade_de_campos grid['column'] = 0 grid['sticky'] = 'W' self.botao_cancelar =\ TKUtils.obter_botao(master=self.corpo, cnf=cnf, grid=grid) def criar_botao_confirmar(self): cnf, grid = {}, {} cnf['text'] = self.texto cnf['bg'] = 'green' cnf['command'] = self.eventos['confirmar'] grid['row'] = self.quantidade_de_campos grid['column'] = 1 grid['sticky'] = 'E' grid['pady'] = 200 - self.quantidade_de_campos * 24 self.botao_confirmar =\ TKUtils.obter_botao(master=self.corpo, cnf=cnf, grid=grid)
class Home(TKUtils.Container()): def __init__(self, master, controller): super().__init__(master=master) self.controller = controller self.actions = None self.lista_de_elementos = None self.janela_de_cadastro = None def iniciar(self): self.criar_lista_de_elementos() self.criar_actions() self.lista_de_elementos.iniciar() self.actions.iniciar() self.pack(side='bottom') def criar_lista_de_elementos(self): eventos = {} eventos['click'] = self.controller.evento_click_no_label eventos['remover'] = self.controller.evento_remover_apresentacao self.lista_de_elementos = ListaDeElementos(master=self, eventos=eventos) def destruir_lista_de_elementos(self): for elemento in self.lista_de_elementos.elementos: elemento.destroy() self.lista_de_elementos.elementos = [] def criar_actions(self): eventos = {} eventos['ordenar'] = self.controller.evento_ordenar_lista eventos['cadastrar'] = self.controller.evento_cadastrar_apresentacao self.actions = Actions(master=self, eventos=eventos) def criar_janela_de_cadastro(self): eventos = {} eventos['cancelar'] = self.controller.evento_cancelar_cadastro eventos['confirmar'] = self.controller.evento_confirmar_cadastro self.janela_de_cadastro = Formulario(eventos=eventos) self.janela_de_cadastro.iniciar() def destruir_janela_de_cadastro(self): self.janela_de_cadastro.destroy() self.janela_de_cadastro = None
def criar_label_de_erro(self): cnf, pack = {}, {} cnf['text'] = self.msg_de_erro cnf['fg'] = 'red' cnf['font'] = ('arial', 16, 'bold') pack['pady'] = 10 self.label_de_erro =\ TKUtils.obter_label(master=self, cnf=cnf, pack=pack)