Mejorar la respuesta del script a diferentes eventos
oginstaller/pipeline/head There was a failure building this commit Details

working-installer
Nicolas Arenas 2024-11-14 09:02:20 +01:00
parent 278564d35f
commit e53fc605bb
1 changed files with 8 additions and 7 deletions

View File

@ -6,8 +6,6 @@ from git import Repo
CONFIGS_DIR = "/tmp/oginstall"
os.makedirs(CONFIGS_DIR, exist_ok=True)
# Uso ogCore para obtener ellistado de tags
REPO_URL = "https://ognproject.evlt.uma.es/gitea/opengnsys/ogcore.git"
def get_git_tags():
@ -36,7 +34,6 @@ def get_password(stdscr, y, x, prompt, default=""):
password = ""
masked_password = ""
# Mostrar prompt sin enmascarar el valor predeterminado hasta que el usuario comience a escribir
stdscr.move(y, x + len(prompt)) # Coloca el cursor después del prompt
while True:
@ -60,6 +57,10 @@ def get_password(stdscr, y, x, prompt, default=""):
return password
def get_input(stdscr, y, x, prompt, default=""):
max_y, max_x = stdscr.getmaxyx()
if x + len(prompt) >= max_x:
raise ValueError("El prompt es demasiado largo para caber en la pantalla.")
stdscr.addstr(y, x, prompt, curses.color_pair(1))
input_text = ""
prompt_end_x = x + len(prompt) # Calcula la posición final del prompt
@ -79,13 +80,13 @@ def get_input(stdscr, y, x, prompt, default=""):
input_text = default
break
elif 32 <= key <= 126: # Rango de caracteres imprimibles
input_text += chr(key)
stdscr.addstr(y, prompt_end_x, input_text) # Muestra el texto actualizado
stdscr.move(y, prompt_end_x + len(input_text)) # Mueve el cursor al final del texto
if prompt_end_x + len(input_text) < max_x - 1:
input_text += chr(key)
stdscr.addstr(y, prompt_end_x, input_text) # Muestra el texto actualizado
stdscr.move(y, prompt_end_x + len(input_text)) # Mueve el cursor al final del texto
return input_text
def main(stdscr):
# Inicializar colores
curses.start_color()