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:
@@ -7,7 +7,3 @@ Diferenciais:
|
||||
* Tutorial - apenas é mostrado na primeira vez
|
||||
* 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)
|
||||
|
||||
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():
|
||||
import os
|
||||
from src.init import inicio, idioma
|
||||
from src.cartelas import TUI_principal
|
||||
|
||||
language = idioma()
|
||||
if language == "BR":
|
||||
x = 'src.constants.constants'
|
||||
elif language == "EN":
|
||||
x = 'src.constants.constantsen'
|
||||
|
||||
#Lógica da seleção de idiomas - outras partes do programa dependem
|
||||
#das variáveis language e locale para apresentar o idioma correto
|
||||
language = ""
|
||||
while language == "":
|
||||
language = idioma()
|
||||
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
|
||||
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)
|
||||
if x == "instalado":
|
||||
print(locale.START["librariesinstalled"])
|
||||
return None
|
||||
#Inicia o jogo
|
||||
TUI_principal(locale, language)
|
||||
main()
|
||||
@@ -1,4 +1,3 @@
|
||||
#from src.constants import ERRORS, SELECTED, SCOREBOARD, GAME
|
||||
from src.funcoes import aleatorio
|
||||
def listas():
|
||||
#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
|
||||
elif elemento_inicial != "1" or elemento_inicial != "2" or elemento_inicial != "3" or elemento_inicial != "4" or elemento_inicial != "":
|
||||
print(f"""
|
||||
{locale.ERRORS["invalid"]}
|
||||
Valores possíveis: [1, 2, 3, 4]
|
||||
{locale.ERRORS["invalid"]}[1, 2, 3, 4]
|
||||
""")
|
||||
|
||||
#Montagem e apresentação da tabela usando PrettyTable
|
||||
|
||||
@@ -123,7 +123,7 @@ SELECTED = {
|
||||
"notplayer": " "}
|
||||
|
||||
ERRORS = {
|
||||
"invalid": "Valor de entrada inválido",}
|
||||
"invalid": "Valor de entrada inválido. Possíveis valores são: ",}
|
||||
|
||||
WARNING = {
|
||||
"firstime": """
|
||||
|
||||
@@ -10,10 +10,10 @@ START = {
|
||||
""",
|
||||
"libraries": """
|
||||
|
||||
The program detected that dependencies are not installed
|
||||
Press ENTER to install the necessary libraries
|
||||
The program detected dependencies are not installed
|
||||
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"}
|
||||
INTRO = {
|
||||
@@ -123,11 +123,11 @@ SELECTED = {
|
||||
"notplayer": " "}
|
||||
|
||||
ERRORS = {
|
||||
"invalid": "Invalid input value",}
|
||||
"invalid": "Invalid input value. Possible values are: ",}
|
||||
|
||||
WARNING = {
|
||||
"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.
|
||||
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
|
||||
def idioma():
|
||||
#Apresenta idiomas disponíveis ao usuário
|
||||
os.system("cls || clear")
|
||||
x = int(input("""
|
||||
x = input("""
|
||||
Selecione seu idioma
|
||||
Select your language
|
||||
|
||||
1 = Português Brasileiro
|
||||
2 = English
|
||||
"""))
|
||||
if x == 1:
|
||||
""")
|
||||
if x == "1":
|
||||
return "BR"
|
||||
elif x == 2:
|
||||
elif x == "2":
|
||||
return "EN"
|
||||
else:
|
||||
return ""
|
||||
|
||||
def tutorial(locale):
|
||||
#Tutorial - Busca as informações do constants.py e apresenta na tela em
|
||||
|
||||
Reference in New Issue
Block a user