-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
4 changed files
with
124 additions
and
4 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
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,88 @@ | ||
"""Gerenciador de interface do usuário | ||
Esse módulo tem funções para gerenciar a interface com o usuário, incluindo CLI | ||
e GUI. | ||
""" | ||
|
||
import win32con | ||
import win32console | ||
from win32gui import MessageBox | ||
|
||
|
||
def confirm(text, title="God"): | ||
"""Pede confirmação para o usuário na forma de popup | ||
Parâmetros | ||
---------- | ||
text : str | ||
Texto da caixa de mensagem | ||
title : str | ||
Título da caixa de mensagem (Padrão: God) | ||
Retorno | ||
------- | ||
True caso o usuário confirme, False se não | ||
""" | ||
|
||
res = MessageBox(win32console.GetConsoleWindow(), | ||
text, title, | ||
win32con.MB_YESNO | win32con.MB_ICONINFORMATION) | ||
return res == win32con.IDYES | ||
|
||
|
||
def info(text, title="God"): | ||
"""Mostra uma caixa de mensagem de informação | ||
Parâmetros | ||
---------- | ||
text : str | ||
Texto da caixa de mensagem | ||
title : str | ||
Título da caixa de mensagem (Padrão: God) | ||
""" | ||
|
||
MessageBox(win32console.GetConsoleWindow(), | ||
text, title, | ||
win32con.MB_OK | win32con.MB_ICONINFORMATION) | ||
|
||
|
||
def error(text, title="God"): | ||
"""Mostra uma caixa de mensagem de erro | ||
Parâmetros | ||
---------- | ||
text : str | ||
Texto da caixa de mensagem | ||
title : str | ||
Título da caixa de mensagem (Padrão: God) | ||
""" | ||
|
||
MessageBox(win32console.GetConsoleWindow(), | ||
text, title, | ||
win32con.MB_OK | win32con.MB_ICONERROR) | ||
|
||
|
||
def warning(text, title="God"): | ||
"""Mostra uma caixa de mensagem de aviso | ||
Parâmetros | ||
---------- | ||
text : str | ||
Texto da caixa de mensagem | ||
title : str | ||
Título da caixa de mensagem (Padrão: God) | ||
""" | ||
|
||
MessageBox(win32console.GetConsoleWindow(), | ||
text, title, | ||
win32con.MB_OK | win32con.MB_ICONWARNING) |
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