paramsx 1.1.3__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: paramsx
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Librería para gestionar y respaldar parámetros de AWS SSM de manera sencilla y eficiente.
5
5
  Home-page: https://github.com/pistatxos/paramsx
6
6
  Author: Mariox
@@ -9,6 +9,14 @@ Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: boto3
11
11
  Requires-Dist: windows-curses; platform_system == "Windows"
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: description-content-type
16
+ Dynamic: home-page
17
+ Dynamic: license-file
18
+ Dynamic: requires-dist
19
+ Dynamic: summary
12
20
 
13
21
  # ParamsX
14
22
 
@@ -183,49 +183,186 @@ def show_main_menu(stdscr):
183
183
  stdscr.addstr(start_line + 2, 0, "3. Crear Backup de parámetros".ljust(60))
184
184
  stdscr.addstr(start_line + 3, 0, "Elija una opción (1/2): ")
185
185
 
186
+ # Mostrar menú principal con navegación
187
+ def show_main_menu_selection(stdscr):
188
+ selected = 0
189
+ buffer = ""
190
+ options = [
191
+ "Leer parámetros",
192
+ "Cargar parámetros desde archivo",
193
+ "Crear Backup de parámetros"
194
+ ]
195
+
196
+ def render():
197
+ stdscr.clear()
198
+ draw_header(stdscr)
199
+ start_line = HEADER_ASCII.count("\n") + 1
200
+
201
+ for idx, option in enumerate(options, start=1):
202
+ line = f"{idx}. {option}"
203
+ if idx - 1 == selected:
204
+ stdscr.addstr(start_line + idx - 1, 0, line, curses.A_REVERSE)
205
+ else:
206
+ stdscr.addstr(start_line + idx - 1, 0, line)
207
+
208
+ # Mostrar instrucciones y buffer de entrada
209
+ input_line = start_line + len(options) + 1
210
+ stdscr.addstr(input_line, 0, f"Usa ↑/↓ para navegar, Enter para seleccionar, o escribe número: {buffer}")
211
+ draw_footer(stdscr)
212
+ stdscr.refresh()
213
+
214
+ render()
215
+
216
+ while True:
217
+ key = stdscr.getkey()
218
+
219
+ if key == '\x1b': # Esc
220
+ return None
221
+ elif key == 'KEY_UP':
222
+ if selected > 0:
223
+ selected -= 1
224
+ buffer = ""
225
+ render()
226
+ elif key == 'KEY_DOWN':
227
+ if selected < len(options) - 1:
228
+ selected += 1
229
+ buffer = ""
230
+ render()
231
+ elif key == '\n' or key == '\r': # Enter
232
+ if buffer.isdigit():
233
+ choice = int(buffer) - 1
234
+ if 0 <= choice < len(options):
235
+ return choice
236
+ buffer = ""
237
+ render()
238
+ else:
239
+ return selected
240
+ elif key == 'KEY_BACKSPACE' or key == '\b' or key == '\x7f':
241
+ buffer = buffer[:-1]
242
+ render()
243
+ elif key.isdigit():
244
+ buffer += key
245
+ render()
246
+ elif key.lower() == 'q':
247
+ return None
248
+
186
249
  # Mostrar selección de parámetros
187
250
  def show_parameter_selection(stdscr, options):
188
- stdscr.clear()
189
- draw_header(stdscr)
190
- start_line = HEADER_ASCII.count("\n") + 1 # Calcula el inicio después del header
191
- stdscr.addstr(start_line, 0, "Seleccione un parámetro para leer:".center(60, "-"))
192
- for idx, option in enumerate(options, start=1):
193
- stdscr.addstr(start_line + idx, 0, f"{idx}. {option}")
194
- draw_footer(stdscr)
195
- stdscr.refresh()
196
-
251
+ selected = 0
252
+ buffer = ""
253
+
254
+ def render():
255
+ stdscr.clear()
256
+ draw_header(stdscr)
257
+ start_line = HEADER_ASCII.count("\n") + 1
258
+ stdscr.addstr(start_line, 0, "Seleccione un parámetro para leer:".center(60, "-"))
259
+
260
+ for idx, option in enumerate(options, start=1):
261
+ line = f"{idx}. {option}"
262
+ if idx - 1 == selected:
263
+ stdscr.addstr(start_line + idx, 0, line, curses.A_REVERSE)
264
+ else:
265
+ stdscr.addstr(start_line + idx, 0, line)
266
+
267
+ # Mostrar instrucciones y buffer de entrada
268
+ input_line = start_line + len(options) + 2
269
+ stdscr.addstr(input_line, 0, f"Usa ↑/↓ para navegar, Enter para seleccionar, o escribe número: {buffer}")
270
+ draw_footer(stdscr)
271
+ stdscr.refresh()
272
+
273
+ render()
274
+
197
275
  while True:
198
276
  key = stdscr.getkey()
199
- if key == '\x1b': # Si se presiona Esc
200
- return None # Cancelar selección
201
- try:
202
- choice = int(key) - 1
203
- if 0 <= choice < len(options):
204
- return choice
205
- except ValueError:
206
- pass # Ignorar entradas inválidas
277
+
278
+ if key == '\x1b': # Esc
279
+ return None
280
+ elif key == 'KEY_UP':
281
+ if selected > 0:
282
+ selected -= 1
283
+ buffer = ""
284
+ render()
285
+ elif key == 'KEY_DOWN':
286
+ if selected < len(options) - 1:
287
+ selected += 1
288
+ buffer = ""
289
+ render()
290
+ elif key == '\n' or key == '\r': # Enter
291
+ if buffer.isdigit():
292
+ choice = int(buffer) - 1
293
+ if 0 <= choice < len(options):
294
+ return choice
295
+ buffer = ""
296
+ render()
297
+ else:
298
+ return selected
299
+ elif key == 'KEY_BACKSPACE' or key == '\b' or key == '\x7f':
300
+ buffer = buffer[:-1]
301
+ render()
302
+ elif key.isdigit():
303
+ buffer += key
304
+ render()
305
+ elif key.lower() == 'q':
306
+ return None
207
307
 
208
308
  # Mostrar selección de entorno
209
309
  def show_environment_selection(stdscr, environments):
210
- stdscr.clear()
211
- draw_header(stdscr)
212
- start_line = HEADER_ASCII.count("\n") + 1
213
- stdscr.addstr(start_line, 0, "Seleccione el entorno:".center(60, "-"))
214
- for idx, env in enumerate(environments, start=1):
215
- stdscr.addstr(start_line + idx, 0, f"{idx}. {env}")
216
- draw_footer(stdscr)
217
- stdscr.refresh()
218
-
310
+ selected = 0
311
+ buffer = ""
312
+
313
+ def render():
314
+ stdscr.clear()
315
+ draw_header(stdscr)
316
+ start_line = HEADER_ASCII.count("\n") + 1
317
+ stdscr.addstr(start_line, 0, "Seleccione el entorno:".center(60, "-"))
318
+
319
+ for idx, env in enumerate(environments, start=1):
320
+ line = f"{idx}. {env}"
321
+ if idx - 1 == selected:
322
+ stdscr.addstr(start_line + idx, 0, line, curses.A_REVERSE)
323
+ else:
324
+ stdscr.addstr(start_line + idx, 0, line)
325
+
326
+ # Mostrar instrucciones y buffer de entrada
327
+ input_line = start_line + len(environments) + 2
328
+ stdscr.addstr(input_line, 0, f"Usa ↑/↓ para navegar, Enter para seleccionar, o escribe número: {buffer}")
329
+ draw_footer(stdscr)
330
+ stdscr.refresh()
331
+
332
+ render()
333
+
219
334
  while True:
220
335
  key = stdscr.getkey()
221
- if key == '\x1b': # Si se presiona Esc
222
- return None # Cancelar selección
223
- try:
224
- choice = int(key) - 1
225
- if 0 <= choice < len(environments):
226
- return choice
227
- except ValueError:
228
- pass # Ignorar entradas inválidas
336
+
337
+ if key == '\x1b': # Esc
338
+ return None
339
+ elif key == 'KEY_UP':
340
+ if selected > 0:
341
+ selected -= 1
342
+ buffer = ""
343
+ render()
344
+ elif key == 'KEY_DOWN':
345
+ if selected < len(environments) - 1:
346
+ selected += 1
347
+ buffer = ""
348
+ render()
349
+ elif key == '\n' or key == '\r': # Enter
350
+ if buffer.isdigit():
351
+ choice = int(buffer) - 1
352
+ if 0 <= choice < len(environments):
353
+ return choice
354
+ buffer = ""
355
+ render()
356
+ else:
357
+ return selected
358
+ elif key == 'KEY_BACKSPACE' or key == '\b' or key == '\x7f':
359
+ buffer = buffer[:-1]
360
+ render()
361
+ elif key.isdigit():
362
+ buffer += key
363
+ render()
364
+ elif key.lower() == 'q':
365
+ return None
229
366
 
230
367
  # Pantalla de confirmación o resultados
231
368
  def show_message(stdscr, message, color_pair=1):
@@ -7,7 +7,7 @@ from .funcions import (
7
7
  draw_header, draw_footer, show_main_menu, show_comparison_results,
8
8
  show_environment_selection, show_message, show_parameter_selection,
9
9
  get_parameters_by_prefix, delete_parameter, export_parameters_to_file,
10
- compare_parameters, load_parameters
10
+ compare_parameters, load_parameters, show_main_menu_selection
11
11
  )
12
12
 
13
13
 
@@ -41,18 +41,13 @@ def main(stdscr):
41
41
  PARAMETER_LIST = config['parameter_list']
42
42
 
43
43
  while True:
44
- stdscr.clear()
45
- draw_header(stdscr)
46
- show_main_menu(stdscr)
47
- draw_footer(stdscr)
48
- stdscr.refresh()
49
-
50
- choice = stdscr.getkey()
51
-
52
- if choice == '\x1b': # Código ASCII para 'Esc'
53
- break # Salir del programa
44
+ # Usar el menú con navegación por flechas
45
+ choice_idx = show_main_menu_selection(stdscr)
46
+ if choice_idx is None: # Esc en el menú principal
47
+ break
48
+ choice = choice_idx + 1
54
49
 
55
- elif choice == '1':
50
+ if choice == 1:
56
51
  # Leer parámetros
57
52
  param_choice = show_parameter_selection(stdscr, PARAMETER_LIST)
58
53
  if param_choice is None: # Si se presionó Esc
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: paramsx
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Librería para gestionar y respaldar parámetros de AWS SSM de manera sencilla y eficiente.
5
5
  Home-page: https://github.com/pistatxos/paramsx
6
6
  Author: Mariox
@@ -9,6 +9,14 @@ Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: boto3
11
11
  Requires-Dist: windows-curses; platform_system == "Windows"
12
+ Dynamic: author
13
+ Dynamic: author-email
14
+ Dynamic: description
15
+ Dynamic: description-content-type
16
+ Dynamic: home-page
17
+ Dynamic: license-file
18
+ Dynamic: requires-dist
19
+ Dynamic: summary
12
20
 
13
21
  # ParamsX
14
22
 
@@ -76,7 +76,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
76
76
  # Configuración del paquete
77
77
  setup(
78
78
  name="paramsx",
79
- version="1.1.3",
79
+ version="1.1.4",
80
80
  packages=find_packages(),
81
81
  include_package_data=True,
82
82
  package_data={
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes