Skip to content

Commit

Permalink
refactor: botoes de sorteio em atividade, grupo e aluno removidos
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulloClara committed Jan 8, 2020
1 parent 45a6423 commit 303b777
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 64 deletions.
9 changes: 5 additions & 4 deletions src/controller/aluno/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
"""Controller do Aluno."""
"""Aluno no contexto do Controller."""

from src.controller.aluno.actions import Actions
from src.controller.aluno.listagem import Listagem


class Aluno(Actions, Listagem):
"""Classe responsavel por controlar componentes relacionados ao aluno."""
"""Controla os componentes relacionados a camada Aluno em View e Model."""

def __init__(self) -> None:
"""Construtor padrao, define define os atributos view e model."""
"""Inicializa Actions e Listagem da camada Aluno a nivel Controller."""
Actions.__init__(self)
Listagem.__init__(self)

def iniciar(self, controller: object):
def iniciar(self, controller: object) -> None:
"""Inicializa as configuracoes em Actions e Listagem."""
self.view = controller.view
self.model = controller.model

Expand Down
26 changes: 13 additions & 13 deletions src/controller/aluno/actions.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
class Actions(object):
"""Actions de Aluno no contexto do Controller."""

from src.utils.tipo import Tipo

def __init__(self):
pass

def sortear(self, evt):
self.view.ocultar_container_ativo()
self.view.mostrar_container('home')
class Actions(object):
"""Controla os eventos relacionados a View da camada Aluno."""

self.cadastrar_tarefa(evt=None)
def __init__(self) -> None:
"""."""
pass

def arquivo(self, evt) -> None:
def arquivo(self, evt: Tipo.evento_tk()) -> None:
"""Evento click do botao para carregar arquivo csv."""
pass

def configurar(self):
actions = self.view.aluno.actions.subelemento

actions.arquivo.evento['<Button-1>'] = self.arquivo
actions.sortear.evento['<Button-1>'] = self.sortear
def configurar(self) -> None:
"""Configura os elementos."""
self.view.aluno.actions.subelemento.arquivo.evento['<Button-1>'] =\
self.arquivo

self.view.aluno.actions.carregar_eventos()
7 changes: 0 additions & 7 deletions src/controller/atividade/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,10 @@ class Actions(object):
def __init__(self):
pass

def sortear(self, evt):
self.view.ocultar_container_ativo()
self.view.mostrar_container('home')

self.cadastrar_apresentacao(evt=None)

def configurar(self) -> None:
"""Disparado quando o componente Atividade da View e montado."""
actions = self.view.atividade.actions.subelemento

actions.sortear.evento['<Button-1>'] = self.sortear
actions.cadastrar.evento['<Button-1>'] = self.cadastrar

self.view.atividade.actions.carregar_eventos()
Expand Down
7 changes: 0 additions & 7 deletions src/controller/grupo/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ class Actions(object):
def __init__(self):
pass

def sortear(self, evt) -> None:
self.view.ocultar_container_ativo()
self.view.mostrar_container('home')

self.cadastrar_apresentacao(evt=None)

def configurar(self):
actions = self.view.grupo.actions.subelemento

actions.sortear.evento['<Button-1>'] = self.sortear
actions.cadastrar.evento['<Button-1>'] = self.cadastrar

self.view.grupo.actions.carregar_eventos()
Expand Down
11 changes: 0 additions & 11 deletions src/view/aluno/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@ def __init__(self):
self.defs.pack['expand'] = True
self.defs.pack['side'] = 'bottom'

self.subelemento.sortear = TKUtils.obter_botao()
self.subelemento.arquivo = TKUtils.obter_botao()

def iniciar(self, master):
super().iniciar(master=master)

self.inicializar_botao_sorteio()
self.inicializar_botao_carregar_arquivo()

def inicializar_botao_sorteio(self):
self.subelemento.sortear.defs.cnf['text'] = 'Sortear Aluno'
self.subelemento.sortear.defs.cnf['bg'] = 'blue'
self.subelemento.sortear.defs.cnf['width'] = 20

self.subelemento.sortear.defs.pack['side'] = 'left'

self.subelemento.sortear.iniciar(master=self)

def inicializar_botao_carregar_arquivo(self):
self.subelemento.arquivo.defs.cnf['text'] = 'Procurar CSV'
self.subelemento.arquivo.defs.cnf['bg'] = 'green'
Expand Down
11 changes: 0 additions & 11 deletions src/view/atividade/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@ def __init__(self):
self.defs.pack['expand'] = True
self.defs.pack['side'] = 'bottom'

self.subelemento.sortear = TKUtils.obter_botao()
self.subelemento.cadastrar = TKUtils.obter_botao()

def iniciar(self, master):
super().iniciar(master=master)

self.inicializar_botao_sorteio()
self.inicializar_botao_cadastro()

def inicializar_botao_sorteio(self):
self.subelemento.sortear.defs.cnf['text'] = 'Sortear Atividade'
self.subelemento.sortear.defs.cnf['bg'] = 'blue'
self.subelemento.sortear.defs.cnf['width'] = 20

self.subelemento.sortear.defs.pack['side'] = 'left'

self.subelemento.sortear.iniciar(master=self)

def inicializar_botao_cadastro(self):
self.subelemento.cadastrar.defs.cnf['text'] = 'Cadastrar Atividade'
self.subelemento.cadastrar.defs.cnf['bg'] = 'green'
Expand Down
11 changes: 0 additions & 11 deletions src/view/grupo/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,13 @@ def __init__(self):
self.defs.pack['expand'] = True
self.defs.pack['side'] = 'bottom'

self.subelemento.sortear = TKUtils.obter_botao()
self.subelemento.cadastrar = TKUtils.obter_botao()

def iniciar(self, master):
super().iniciar(master=master)

self.inicializar_botao_sorteio()
self.inicializar_botao_cadastro()

def inicializar_botao_sorteio(self):
self.subelemento.sortear.defs.cnf['text'] = 'Sortear Grupo'
self.subelemento.sortear.defs.cnf['bg'] = 'blue'
self.subelemento.sortear.defs.cnf['width'] = 20

self.subelemento.sortear.defs.pack['side'] = 'left'

self.subelemento.sortear.iniciar(master=self)

def inicializar_botao_cadastro(self):
self.subelemento.cadastrar.defs.cnf['text'] = 'Gerar Grupos'
self.subelemento.cadastrar.defs.cnf['bg'] = 'green'
Expand Down

0 comments on commit 303b777

Please sign in to comment.