Skip to content

Commit

Permalink
fix: sobrescrita de instancias TK.tk (janela)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulloClara committed Jan 3, 2020
1 parent f1f3ef5 commit af5f773
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/controller/atividade/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ def sortear(self, evt):

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

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

actions.carregar_eventos()
self.view.atividade.actions.carregar_eventos()

self.view.atividade.cadastro.defs.mcnf['<Start>'] =\
actions.cadastrar.desativar
self.view.atividade.cadastro.defs.mcnf['<Destroy>'] =\
actions.cadastrar.ativar
5 changes: 5 additions & 0 deletions src/controller/grupo/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ def configurar(self):
actions.cadastrar.evento['<Button-1>'] = self.cadastrar

self.view.grupo.actions.carregar_eventos()

self.view.grupo.cadastro.defs.mcnf['<Start>'] =\
actions.cadastrar.desativar
self.view.grupo.cadastro.defs.mcnf['<Destroy>'] =\
actions.cadastrar.ativar
12 changes: 11 additions & 1 deletion src/controller/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Home(object):
def __init__(self):
pass

def iniciar(self, controller: object):
def iniciar(self, controller: object) -> None:
self.view = controller.view
self.model = controller.model

Expand All @@ -19,3 +19,13 @@ def configurar(self) -> None:
actions.cadastrar.evento['<Button-1>'] = self.cadastrar_apresentacao

self.view.home.actions.carregar_eventos()

self.view.home.cadastro_apresentacao.defs.mcnf['<Start>'] =\
actions.cadastrar.desativar
self.view.home.cadastro_apresentacao.defs.mcnf['<Destroy>'] =\
actions.cadastrar.ativar

self.view.home.cadastro_tarefa.defs.mcnf['<Start>'] =\
actions.tarefa.desativar
self.view.home.cadastro_tarefa.defs.mcnf['<Destroy>'] =\
actions.tarefa.ativar
8 changes: 8 additions & 0 deletions src/utils/tk/janela.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def iniciar(self) -> None:
"""Inicializa e configura."""
Tk.__init__(self)

self.protocol("WM_DELETE_WINDOW", self.fechar)

if 'icon' in self.defs.cnf:
self.wm_iconphoto(True, PhotoImage(file=self.defs.cnf['icon']))

Expand All @@ -28,6 +30,12 @@ def iniciar(self) -> None:
if not self.defs.cnf['resizable']:
self.resizable(0, 0)

if '<Start>' in self.defs.mcnf:
self.defs.mcnf['<Start>']()

def fechar(self) -> None:
"""Destroi a janela"""
self.destroy()

if '<Destroy>' in self.defs.mcnf:
self.defs.mcnf['<Destroy>']()

0 comments on commit af5f773

Please sign in to comment.