mirror of
https://github.com/ovosimpatico/bingo.git
synced 2026-01-15 16:12:52 -03:00
Fix bugs and typos
* Error handling to language selection * Fixed a bug where typing a invalid value on the game would display a wrong language * Commented all language selector and main * Removed unused, commented code * Fixed english typos
This commit is contained in:
@@ -6,8 +6,4 @@ Diferenciais:
|
|||||||
* Detecção e instalação de dependências, caso necessário.
|
* Detecção e instalação de dependências, caso necessário.
|
||||||
* Tutorial - apenas é mostrado na primeira vez
|
* Tutorial - apenas é mostrado na primeira vez
|
||||||
* Flexível - Cartelas podem ser adicionadas ou substituídas, dado que seja seguido o modelo.
|
* Flexível - Cartelas podem ser adicionadas ou substituídas, dado que seja seguido o modelo.
|
||||||
* Não usa nenhuma função predefinida do python para trabalhar com listas (com exceção de len)
|
* Não usa nenhuma função predefinida do python para trabalhar com listas (com exceção de len)
|
||||||
|
|
||||||
Pendente:
|
|
||||||
* Achar e tratar erros - tudo adicionado ou alterado com o commit "Now in English!"
|
|
||||||
* idioma em arquivo?
|
|
||||||
25
main.py
25
main.py
@@ -1,19 +1,28 @@
|
|||||||
def main():
|
def main():
|
||||||
|
import os
|
||||||
from src.init import inicio, idioma
|
from src.init import inicio, idioma
|
||||||
from src.cartelas import TUI_principal
|
from src.cartelas import TUI_principal
|
||||||
|
#Lógica da seleção de idiomas - outras partes do programa dependem
|
||||||
language = idioma()
|
#das variáveis language e locale para apresentar o idioma correto
|
||||||
if language == "BR":
|
language = ""
|
||||||
x = 'src.constants.constants'
|
while language == "":
|
||||||
elif language == "EN":
|
language = idioma()
|
||||||
x = 'src.constants.constantsen'
|
if language == "BR":
|
||||||
|
x = 'src.constants.constants'
|
||||||
|
elif language == "EN":
|
||||||
|
x = 'src.constants.constantsen'
|
||||||
|
elif language == "":
|
||||||
|
os.system("cls || clear")
|
||||||
|
input("Valor de entrada inválido\nPressione ENTER para continuar\n\nInvalid input value\nPress ENTER to continue")
|
||||||
import importlib
|
import importlib
|
||||||
locale = importlib.import_module(x)
|
locale = importlib.import_module(x)
|
||||||
|
#Introdução, verifica / instala dependências
|
||||||
|
#verifica/cria arquivo de configuração
|
||||||
|
#comentado em mais detalhes em init()
|
||||||
x = inicio(locale)
|
x = inicio(locale)
|
||||||
if x == "instalado":
|
if x == "instalado":
|
||||||
print(locale.START["librariesinstalled"])
|
print(locale.START["librariesinstalled"])
|
||||||
return None
|
return None
|
||||||
|
#Inicia o jogo
|
||||||
TUI_principal(locale, language)
|
TUI_principal(locale, language)
|
||||||
main()
|
main()
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#from src.constants import ERRORS, SELECTED, SCOREBOARD, GAME
|
|
||||||
from src.funcoes import aleatorio
|
from src.funcoes import aleatorio
|
||||||
def listas():
|
def listas():
|
||||||
#Geração de listas a partir do arquivo de cartelas. Essas listas são separadas em
|
#Geração de listas a partir do arquivo de cartelas. Essas listas são separadas em
|
||||||
@@ -126,8 +125,7 @@ def maketable(elemento_inicial, lista, playerselect, backend_results, modelovito
|
|||||||
#Determina se a entrada do usuário é inválida, e aje de acordo
|
#Determina se a entrada do usuário é inválida, e aje de acordo
|
||||||
elif elemento_inicial != "1" or elemento_inicial != "2" or elemento_inicial != "3" or elemento_inicial != "4" or elemento_inicial != "":
|
elif elemento_inicial != "1" or elemento_inicial != "2" or elemento_inicial != "3" or elemento_inicial != "4" or elemento_inicial != "":
|
||||||
print(f"""
|
print(f"""
|
||||||
{locale.ERRORS["invalid"]}
|
{locale.ERRORS["invalid"]}[1, 2, 3, 4]
|
||||||
Valores possíveis: [1, 2, 3, 4]
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
#Montagem e apresentação da tabela usando PrettyTable
|
#Montagem e apresentação da tabela usando PrettyTable
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ SELECTED = {
|
|||||||
"notplayer": " "}
|
"notplayer": " "}
|
||||||
|
|
||||||
ERRORS = {
|
ERRORS = {
|
||||||
"invalid": "Valor de entrada inválido",}
|
"invalid": "Valor de entrada inválido. Possíveis valores são: ",}
|
||||||
|
|
||||||
WARNING = {
|
WARNING = {
|
||||||
"firstime": """
|
"firstime": """
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ START = {
|
|||||||
""",
|
""",
|
||||||
"libraries": """
|
"libraries": """
|
||||||
|
|
||||||
The program detected that dependencies are not installed
|
The program detected dependencies are not installed
|
||||||
Press ENTER to install the necessary libraries
|
Press ENTER to install the necessary libraries
|
||||||
|
|
||||||
(Note that you will need to open the program again after completion)
|
(You will need to open the program again after completion)
|
||||||
""",
|
""",
|
||||||
"librariesinstalled": "Dependencies installed successfully.\nOpen the program again\n"}
|
"librariesinstalled": "Dependencies installed successfully.\nOpen the program again\n"}
|
||||||
INTRO = {
|
INTRO = {
|
||||||
@@ -123,11 +123,11 @@ SELECTED = {
|
|||||||
"notplayer": " "}
|
"notplayer": " "}
|
||||||
|
|
||||||
ERRORS = {
|
ERRORS = {
|
||||||
"invalid": "Invalid input value",}
|
"invalid": "Invalid input value. Possible values are: ",}
|
||||||
|
|
||||||
WARNING = {
|
WARNING = {
|
||||||
"firstime": """
|
"firstime": """
|
||||||
The program has detected that this is the first time it is playing.
|
The program has detected this is the first time you're playing.
|
||||||
|
|
||||||
Press ENTER to watch the tutorial.
|
Press ENTER to watch the tutorial.
|
||||||
Alternatively, press 1 to skip the tutorial (Recommended for experienced players)
|
Alternatively, press 1 to skip the tutorial (Recommended for experienced players)
|
||||||
|
|||||||
11
src/init.py
11
src/init.py
@@ -1,17 +1,20 @@
|
|||||||
import os
|
import os
|
||||||
def idioma():
|
def idioma():
|
||||||
|
#Apresenta idiomas disponíveis ao usuário
|
||||||
os.system("cls || clear")
|
os.system("cls || clear")
|
||||||
x = int(input("""
|
x = input("""
|
||||||
Selecione seu idioma
|
Selecione seu idioma
|
||||||
Select your language
|
Select your language
|
||||||
|
|
||||||
1 = Português Brasileiro
|
1 = Português Brasileiro
|
||||||
2 = English
|
2 = English
|
||||||
"""))
|
""")
|
||||||
if x == 1:
|
if x == "1":
|
||||||
return "BR"
|
return "BR"
|
||||||
elif x == 2:
|
elif x == "2":
|
||||||
return "EN"
|
return "EN"
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
def tutorial(locale):
|
def tutorial(locale):
|
||||||
#Tutorial - Busca as informações do constants.py e apresenta na tela em
|
#Tutorial - Busca as informações do constants.py e apresenta na tela em
|
||||||
|
|||||||
Reference in New Issue
Block a user