Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
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)
Beispiel #4
0
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
Beispiel #5
0
class Atividade(TKUtils.Container()):
    def __init__(self, master, controller):
        super().__init__(master=master)

        self.controller = controller

        self.actions = None
        self.lista_de_atividades = None
        self.janela_de_cadastro = None

    def iniciar(self):
        self.criar_actions()
        self.criar_lista_de_atividades()

        self.lista_de_atividades.iniciar()
        self.actions.iniciar()

        self.pack(side='bottom')

    def criar_actions(self):
        eventos = {}

        eventos['sortear'] = self.controller.evento_sortear
        eventos['cadastrar'] = self.controller.evento_cadastrar

        self.actions = Actions(master=self, eventos=eventos)

    def criar_lista_de_atividades(self):
        eventos = {}

        eventos['sortear'] = self.controller.evento_sortear
        eventos['remover'] = self.controller.evento_remover_atividade

        if not self.lista_de_atividades:
            self.lista_de_atividades =\
                ListaDeAtividades(master=self, eventos=eventos)

    def destruir_lista_de_atividades(self):
        for atividade in self.lista_de_atividades.atividades:
            atividade.destroy()

        self.lista_de_atividades.atividades = []

    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
Beispiel #6
0
class Activity(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.activities_list = None
        self.register_window = None

        self._create_activities_list()
        self._create_actions()

    def _create_actions(self):
        commands = {}

        commands['raffle'] = self.commands['raffle']
        commands['register'] = self.__controller.register_button

        self.actions = Actions(master=self, commands=commands)

    def _create_activities_list(self):
        commands = {}

        commands['raffle'] = self.commands['raffle']
        commands['remove'] = self.__controller.remove_activity_button

        if not self.activities_list:
            self.activities_list =\
                ActivitiesList(master=self, commands=commands)

    def destroy_activities_list(self):
        for activity in self.activities_list.label_list:
            activity.destroy()

        self.activities_list.label_list = []

    def create_register_window(self):
        commands = {}
        commands['submit_form'] = self.__controller.submit_form_button
        commands['cancel_form'] = self.__controller.cancel_form_button

        self.register_window = RegisterWindow(commands=commands)

    def destroy_register_window(self):
        self.register_window.destroy()
        self.register_window = None
Beispiel #7
0
class Actions(TKUtils.Container()):
    def __init__(self, master, eventos):
        super().__init__(master=master, bd=10)

        self.eventos = eventos

        self.botao_de_sorteio = None
        self.botao_de_cadastro = None

    def iniciar(self):
        self.criar_botao_de_sorteio()
        self.criar_botao_de_cadastro()

        self.pack(expand=True)

    def criar_botao_de_sorteio(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Sortear Atividade'
        cnf['bg'] = 'blue'
        cnf['width'] = 20
        cnf['command'] = lambda evt=None: self.eventos['sortear']({})

        pack['side'] = 'left'

        self.botao_de_sorteio =\
            TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_de_cadastro(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Cadastrar Atividade'
        cnf['bg'] = 'green'
        cnf['width'] = 20
        cnf['command'] = self.eventos['cadastrar']

        pack['side'] = 'right'

        self.botao_de_cadastro = TKUtils.obter_botao(master=self,
                                                     cnf=cnf,
                                                     pack=pack)
Beispiel #8
0
class Actions(TKUtils.Container()):
    def __init__(self, master, commands):
        super().__init__(master=master, cnf={'bd': 10})
        self.pack(expand=True)

        self.commands = commands

        self.raffle_button = None
        self.browse_file_button = None

        self._create_raffle_button()
        self._create_browse_file_button()

    def _create_raffle_button(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Sortear Aluno'
        cnf['bg'] = 'blue'
        cnf['width'] = 20
        cnf['command'] = self.commands['raffle']

        pack['side'] = 'left'

        self.raffle_button = TKUtils.get_button(master=self,
                                                cnf=cnf,
                                                pack=pack)

    def _create_browse_file_button(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Procurar CSV'
        cnf['bg'] = 'green'
        cnf['width'] = 20
        cnf['command'] = self.commands['browse_file']

        pack['side'] = 'right'

        self.register_button = TKUtils.get_button(master=self,
                                                  cnf=cnf,
                                                  pack=pack)
Beispiel #9
0
class Actions(TKUtils.Container()):
    def __init__(self, master, eventos):
        super().__init__(master=master, bd=10)

        self.eventos = eventos

        self.botao_ordenar = None
        self.botao_cadastrar = None

    def iniciar(self):
        self.criar_botao_ordenar()
        self.criar_botao_cadastrar()

        self.pack(expand=True)

    def criar_botao_ordenar(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Ordenar Apresentações'
        cnf['bg'] = 'blue'
        cnf['width'] = 30
        cnf['command'] = self.eventos['ordenar']

        pack['side'] = 'left'

        self.botao_ordenar =\
            TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_cadastrar(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Cadastrar Apresentação'
        cnf['bg'] = 'green'
        cnf['width'] = 30
        cnf['command'] = self.eventos['cadastrar']

        pack['side'] = 'left'

        self.botao_cadastrar =\
            TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)
Beispiel #10
0
class Group(TKUtils.Container()):
    def __init__(self, master):
        super().__init__(master=master)
        self.pack()

        label_temp = TKUtils.get_label(master=self, cnf={'text': 'Grupos'})
Beispiel #11
0
class Navbar(TKUtils.Container()):
    def __init__(self, master, controller):
        super().__init__(master=master)

        self.controller = controller

        self.botao_home = None
        self.botao_aluno = None
        self.botao_grupo = None
        self.botao_atividade = None
        self.botao_sobre = None

    def iniciar(self):
        self.criar_botao_aluno()
        self.criar_botao_grupo()
        self.criar_botao_home()
        self.criar_botao_atividade()
        self.criar_botao_sobre()

        self.pack(side='top')

    def criar_botao_home(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Home'
        cnf['bg'] = 'orange'
        cnf['width'] = 28
        cnf['pady'] = 9
        cnf['font'] = ('times new roman', 15, 'bold')
        cnf['command'] = self.controller.evento_tela_home

        pack['side'] = 'left'

        self.botao_home = TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_aluno(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Alunos'
        cnf['bg'] = 'red'
        cnf['width'] = 14
        cnf['pady'] = 9
        cnf['font'] = ('times new roman', 15, 'bold')
        cnf['command'] = self.controller.evento_tela_aluno

        pack['side'] = 'left'

        self.botao_aluno = TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_atividade(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Atividades'
        cnf['bg'] = 'blue'
        cnf['width'] = 14
        cnf['pady'] = 9
        cnf['font'] = ('times new roman', 15, 'bold')
        cnf['command'] = self.controller.evento_tela_atividade

        pack['side'] = 'left'

        self.botao_atividade =\
            TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_grupo(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Grupos'
        cnf['bg'] = 'green'
        cnf['width'] = 14
        cnf['pady'] = 9
        cnf['font'] = ('times new roman', 15, 'bold')
        cnf['command'] = self.controller.evento_tela_grupo

        pack['side'] = 'left'

        self.botao_grupo = TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)

    def criar_botao_sobre(self):
        cnf, pack = {}, {}

        cnf['text'] = 'Sobre'
        cnf['bg'] = 'grey'
        cnf['width'] = 14
        cnf['pady'] = 9
        cnf['font'] = ('times new roman', 15, 'bold')
        cnf['command'] = self.controller.evento_tela_sobre

        pack['side'] = 'left'

        self.botao_sobre = TKUtils.obter_botao(master=self, cnf=cnf, pack=pack)
Beispiel #12
0
class Form(TKUtils.Container()):
    def __init__(self, master, commands):
        super().__init__(master=master, cnf={'bd': 10})
        self.pack()

        self.commands = commands

        self.desc_field = {}
        self.title_field = {}
        self.submit_button = None
        self.cancel_button = None

        self._create_title_field()
        self._create_desc_field()
        self._create_submit_button()
        self._create_cancel_button()

    def _create_title_field(self):
        cnf, grid = {}, {}

        cnf['text'] = 'Titulo'
        cnf['pady'] = 4

        grid['row'] = 0
        grid['column'] = 0
        grid['sticky'] = 'W'

        self.title_field['label'] =\
            TKUtils.get_label(master=self, cnf=cnf, grid=grid)

        cnf, grid = {}, {}

        grid['row'] = 0
        grid['column'] = 1

        self.title_field['input'] =\
            TKUtils.get_input(master=self, cnf=cnf, grid=grid)

    def _create_desc_field(self):
        cnf, grid = {}, {}

        cnf['text'] = 'Descrição'
        cnf['pady'] = 4

        grid['row'] = 1
        grid['column'] = 0
        grid['sticky'] = 'W'

        self.desc_field['label'] = TKUtils.get_label(master=self,
                                                     cnf=cnf,
                                                     grid=grid)

        cnf, grid = {}, {}

        grid['row'] = 1
        grid['column'] = 1

        self.desc_field['input'] = TKUtils.get_input(master=self,
                                                     cnf=cnf,
                                                     grid=grid)

    def _create_cancel_button(self):
        cnf, grid = {}, {}

        cnf['text'] = 'Cancelar'
        cnf['bg'] = 'red'
        cnf['command'] = self.commands['cancel']

        grid['row'] = 3
        grid['column'] = 0
        grid['sticky'] = 'W'
        grid['pady'] = 350 - self.winfo_screenmmheight()

        self.cancel_button = TKUtils.get_button(master=self,
                                                cnf=cnf,
                                                grid=grid)

    def _create_submit_button(self):
        cnf, grid = {}, {}

        cnf['text'] = 'Salvar'
        cnf['bg'] = 'green'
        cnf['command'] = self.commands['submit']

        grid['row'] = 3
        grid['column'] = 1
        grid['sticky'] = 'E'
        grid['pady'] = 350 - self.winfo_screenmmheight()

        self.submit_button = TKUtils.get_button(master=self,
                                                cnf=cnf,
                                                grid=grid)
Beispiel #13
0
class Sobre(TKUtils.Container()):
    def __init__(self, master):
        super().__init__(master=master)

    def iniciar(self):
        self.pack(side='bottom')