-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2c6a8a
commit f1f3ef5
Showing
96 changed files
with
2,630 additions
and
2,397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- fazer desinstalador | ||
- fazer modulo para help q consulta a docstring | ||
|
||
- verificar o tipo do retorno do select no store na hr de converter | ||
- transformar classe Tipo global | ||
- criar container Main das janelas direto no MJanela | ||
- criar variaveis globais no __init__ do src | ||
- mover definir_incone de dentro da classe TKUtils para classe MJanela como cnf | ||
- criar schema para model, uma classe com todos os metodos e atributos padroes | ||
- desativar botão de cadastro de algo quando ja tiver uma janela aberta | ||
- fazer obter do modelo retornar apenas o valor achado e nao uma lista | ||
- levar validar data para Utils | ||
- remover redundancia de nomes como "data_apresentacao" para "data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""".""" | ||
|
||
from src.utils.caminho import Caminho | ||
|
||
|
||
ARQUIVO_CSV = Caminho.ate('src/store/file/alunos.csv') | ||
BANCO_DE_DADOS = Caminho.ate('src/store/file/bd.sqlite') | ||
|
||
ICONE_MAIN = Caminho.ate('src/assets/icone_main.png') |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,45 @@ | ||
"""Controller Root.""" | ||
|
||
from src.controller.navbar import Navbar | ||
|
||
from src.controller.home import Home | ||
from src.controller.aluno import Aluno | ||
from src.controller.grupo import Grupo | ||
from src.controller.atividade import Atividade | ||
from src.controller.sobre import Sobre | ||
from src.controller.tarefa import Tarefa | ||
from src.controller.atividade import Atividade | ||
from src.controller.apresentacao import Apresentacao | ||
|
||
|
||
class Controller(object): | ||
"""Classe responsavel por gerenciar o fluxo de execucao da aplicacao. | ||
Attributes: | ||
view (View:obj): Objeto root View. | ||
model (Model:obj): Objeto root Model. | ||
navbar (Controller:Navbar:obj): Padrao None. | ||
home (Controller:Home:obj): Padrao None. | ||
aluno (Controller:Aluno:obj): Padrao None. | ||
grupo (Controller:Grupo:obj): Padrao None. | ||
atividade (Controller:Atividade:obj): Padrao None. | ||
sobre (Controller:Sobre:obj): Padrao None. | ||
""" | ||
"""Classe responsavel por gerenciar o fluxo de execucao da aplicacao.""" | ||
|
||
def __init__(self) -> None: | ||
"""Contrutor padrao, declara os atributos da classe.""" | ||
self.view = None | ||
self.model = None | ||
|
||
self.navbar = None | ||
self.home = None | ||
self.aluno = None | ||
self.grupo = None | ||
self.atividade = None | ||
self.sobre = None | ||
self.navbar = Navbar() | ||
|
||
def segundo_init(self, model: object, view: object) -> None: | ||
"""Segundo contrutor, recebe os objetos Model e View instanciados. | ||
self.home = Home() | ||
self.aluno = Aluno() | ||
self.grupo = Grupo() | ||
self.sobre = Sobre() | ||
self.tarefa = Tarefa() | ||
self.atividade = Atividade() | ||
self.apresentacao = Apresentacao() | ||
|
||
Args: | ||
model (Model:obj): Objeto root Model | ||
view (View:obj): Objeto root View | ||
""" | ||
def iniciar(self, view, model) -> None: | ||
"""Instancia/cria os sub-objetos e inicializa Model root e View root.""" | ||
self.view = view | ||
self.model = model | ||
|
||
def iniciar(self) -> None: | ||
"""Instancia/cria os sub-objetos e inicializa Model root e View root.""" | ||
self.navbar = Navbar(controller=self) | ||
self.home = Home(controller=self) | ||
self.aluno = Aluno(controller=self) | ||
self.atividade = Atividade(controller=self) | ||
self.grupo = Grupo(controller=self) | ||
self.sobre = Sobre(controller=self) | ||
|
||
self.model.iniciar() | ||
self.view.iniciar() | ||
self.navbar.iniciar(controller=self) | ||
|
||
self.home.iniciar(controller=self) | ||
self.aluno.iniciar(controller=self) | ||
self.grupo.iniciar(controller=self) | ||
self.sobre.iniciar(controller=self) | ||
self.tarefa.iniciar(controller=self) | ||
self.atividade.iniciar(controller=self) | ||
self.apresentacao.iniciar(controller=self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,22 @@ | ||
"""Controller do Aluno.""" | ||
from src.controller.aluno.eventos import Eventos | ||
|
||
from src.controller.aluno.actions import Actions | ||
from src.controller.aluno.listagem import Listagem | ||
|
||
class Aluno(object): | ||
"""Classe responsavel por controlar componentes relacionados ao aluno. | ||
|
||
Attributes: | ||
view (View:obj): Objeto root View | ||
model (Model:obj): Objeto root Model | ||
""" | ||
class Aluno(Actions, Listagem): | ||
"""Classe responsavel por controlar componentes relacionados ao aluno.""" | ||
|
||
def __init__(self, controller: object) -> None: | ||
"""Construtor padrao, define define os atributos view e model. | ||
def __init__(self) -> None: | ||
"""Construtor padrao, define define os atributos view e model.""" | ||
Actions.__init__(self) | ||
Listagem.__init__(self) | ||
|
||
Args: | ||
controller (Controller:obj): Objeto root Controller | ||
""" | ||
def iniciar(self, controller: object): | ||
self.view = controller.view | ||
self.model = controller.model | ||
|
||
self.eventos = Eventos(controller=self) | ||
self.cadastrar_tarefa = controller.tarefa.cadastrar | ||
|
||
def carregar_lista_de_alunos(self) -> None: | ||
"""Busca os alunos no model e cria os componentes visuais.""" | ||
for aluno in self.model.aluno.alunos: | ||
self.view.aluno.lista.adicionar(nome_do_aluno=aluno) | ||
|
||
def elemento_montado(self) -> None: | ||
"""Disparado quando o container Aluno for criado. | ||
- Inicia o componente Aluno | ||
- Carrega a lista de alunos na View | ||
""" | ||
self.view.aluno.iniciar() | ||
self.carregar_lista_de_alunos() | ||
|
||
self.view.aluno.desativar() | ||
Actions.configurar(self) | ||
Listagem.configurar(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class Actions(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def sortear(self, evt): | ||
self.view.ocultar_container_ativo() | ||
self.view.mostrar_container('home') | ||
|
||
self.cadastrar_tarefa(evt=None) | ||
|
||
def arquivo(self, evt) -> 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 | ||
|
||
self.view.aluno.actions.carregar_eventos() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class Listagem(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def sortear_(self, evt, aluno): | ||
self.model.aluno.aluno = aluno | ||
|
||
self.view.ocultar_container_ativo() | ||
self.view.mostrar_container('home') | ||
|
||
self.cadastrar_tarefa(evt=None) | ||
|
||
def expandir_label(self, evt, elemento): | ||
pass | ||
|
||
def configurar_(self, elemento): | ||
elemento.subelemento.sortear.evento['<Button-1>'] =\ | ||
lambda evt: self.sortear_(evt, aluno=elemento.dados) | ||
|
||
elemento.carregar_eventos() | ||
|
||
def configurar(self): | ||
for aluno in self.model.aluno.alunos: | ||
elemento = self.view.aluno.listagem.adicionar(nome_do_aluno=aluno) | ||
self.configurar_(elemento) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Controller da Home e da Apresentacao.""" | ||
|
||
from src.controller.apresentacao.listagem import Listagem | ||
from src.controller.apresentacao.cadastro import Cadastro | ||
|
||
|
||
class Apresentacao(Listagem, Cadastro): | ||
"""Classe responsavel por gerenciar Home de View e Apresentacao de Model.""" | ||
|
||
def __init__(self) -> None: | ||
"""Construtor padrao, define os atributos view e model.""" | ||
Listagem.__init__(self) | ||
Cadastro.__init__(self) | ||
|
||
def iniciar(self, controller: object): | ||
self.view = controller.view | ||
self.model = controller.model | ||
|
||
Listagem.configurar(self) | ||
|
||
def cadastrar(self, evt) -> None: | ||
"""Evento click do botao cadastrar na actions.""" | ||
self.view.home.cadastro_apresentacao.iniciar() | ||
Cadastro.configurar(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
class Cadastro(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def confirmar(self, evt=None) -> None: | ||
"""Evento click do botao confirmar no formulario de cadastro.""" | ||
formulario = self.view.home.cadastro_apresentacao.obter_campos() | ||
|
||
erro = self.model.apresentacao.validar(formulario) | ||
if erro: | ||
return self.view.janela_erro.iniciar(erro) | ||
|
||
erro = 'Todos os Grupos estão em uso' | ||
grupo = self.model.grupo.sortear() | ||
if not grupo: | ||
return self.view.janela_erro.iniciar(erro) | ||
|
||
id_grupo = grupo['id_grupo'] | ||
formulario['id_grupo'] = id_grupo | ||
|
||
erro = 'Todas as Atividades estão em uso' | ||
atividade = self.model.atividade.sortear() | ||
if not atividade: | ||
self.view.janela_erro.iniciar(erro) | ||
return | ||
|
||
id_atividade = atividade['id_atividade'] | ||
formulario['id_atividade'] = id_atividade | ||
|
||
apresentacao = self.model.apresentacao.cadastrar(formulario) | ||
|
||
self.model.grupo.atualizar(id_grupo, campos={'em_uso': 1}) | ||
self.model.atividade.atualizar(id_atividade, campos={'em_uso': 1}) | ||
|
||
self.view.home.cadastro_apresentacao.fechar() | ||
|
||
elemento = self.view.home.listagem.adicionar(apresentacao) | ||
self.configurar_(elemento) | ||
|
||
self.view.grupo.listagem.desativar(id_grupo) | ||
self.view.atividade.listagem.desativar(id_atividade) | ||
|
||
def cancelar(self, evt=None) -> None: | ||
"""Evento click do botao cancelar no formulario de cadastro.""" | ||
self.view.home.cadastro_apresentacao.fechar() | ||
|
||
def configurar(self) -> None: | ||
cadastro = self.view.home.cadastro_apresentacao.subelemento | ||
|
||
cadastro.data.input.evento['<Return>'] = self.confirmar | ||
cadastro.duracao.input.evento['<Return>'] = self.confirmar | ||
|
||
cadastro.cancelar.defs.mcnf['command'] = self.cancelar | ||
cadastro.confirmar.defs.mcnf['command'] = self.confirmar | ||
|
||
self.view.home.cadastro_apresentacao.carregar_eventos() |
Oops, something went wrong.