Skip to content

Commit d39780a

Browse files
committed
feat: Reemplaza el panel de logs en tiempo real por un panel de estado de conexión y un botón para acceder a la pantalla de logs.
1 parent ea0e627 commit d39780a

1 file changed

Lines changed: 162 additions & 75 deletions

File tree

src/fiscalberry/ui/kv/main.kv

Lines changed: 162 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -284,39 +284,29 @@ ScreenManager:
284284
pos: self.pos
285285
size: self.size
286286

287-
# Header mejorado con mejor diseño
287+
# Header
288288
BoxLayout:
289289
orientation: 'horizontal'
290290
size_hint_y: None
291291
height: dp(60)
292292
spacing: dp(15)
293293
canvas.before:
294294
Color:
295-
rgba: 1, 1, 1, 0.8 # Fondo blanco semi-transparente
295+
rgba: 1, 1, 1, 0.8
296296
RoundedRectangle:
297297
pos: self.pos
298298
size: self.size
299299
radius: [dp(10)]
300300
padding: dp(15)
301-
302-
303-
# Logo (string vacío - no se mostrará)
304-
Image:
305-
source: app.logo_image
306-
size_hint: None, None
307-
size: dp(40), dp(40)
308-
allow_stretch: True
309-
keep_ratio: True
310-
301+
311302
Label:
312-
text: "Fiscalberry - Servidor de Impresión"
303+
text: "Fiscalberry - Servidor de Impresion"
313304
font_size: '18sp'
314305
bold: True
315306
halign: 'left'
316307
valign: 'middle'
317308
color: 0.1, 0.2, 0.5, 1
318309
size_hint_x: 1
319-
320310

321311

322312
# Panel de información del comercio mejorado
@@ -370,47 +360,93 @@ ScreenManager:
370360
text_size: self.width, None
371361
size_hint_x: 0.4
372362

373-
# Panel de logs en tiempo real
363+
# ── Panel de estado de conexión ──────────────────────────────────
374364
BoxLayout:
375365
orientation: 'vertical'
376-
spacing: dp(5)
366+
size_hint_y: None
367+
height: dp(120)
368+
spacing: dp(8)
377369
canvas.before:
378370
Color:
379-
rgba: 0.1, 0.1, 0.15, 1
371+
rgba: 1, 1, 1, 0.9
380372
RoundedRectangle:
381373
pos: self.pos
382374
size: self.size
383375
radius: [dp(10)]
384-
padding: dp(10)
376+
Color:
377+
rgba: 0.8, 0.8, 0.9, 1
378+
Line:
379+
rounded_rectangle: (self.pos[0], self.pos[1], self.size[0], self.size[1], dp(10))
380+
width: 1
381+
padding: [dp(15), dp(10)]
385382

386383
Label:
387-
text: "REGISTRO DE ACTIVIDAD"
384+
text: "ESTADO DE CONEXIÓN"
388385
font_size: '12sp'
389386
bold: True
390-
color: 0.7, 0.7, 0.8, 1
387+
color: 0.1, 0.2, 0.5, 1
391388
size_hint_y: None
392-
height: dp(20)
393-
halign: 'left'
389+
height: dp(18)
390+
halign: 'center'
394391
text_size: self.size
395392

396-
ScrollView:
397-
id: main_scroll_view
398-
do_scroll_x: False
399-
scroll_y: 0 # 0 = fondo (logs más recientes)
400-
TextInput:
401-
id: main_log_output
402-
text: app.logs
403-
on_text: main_scroll_view.scroll_y = 0 # Auto-scroll al final cuando hay nuevos logs
404-
readonly: True
405-
font_size: '14sp'
406-
background_color: 0, 0, 0, 0
407-
foreground_color: 0.8, 0.9, 0.8, 1
408-
size_hint_y: None
409-
height: max(self.minimum_height, main_scroll_view.height)
410-
multiline: True
411-
cursor_color: 0, 0, 0, 0
393+
# Chips de estado lado a lado
394+
BoxLayout:
395+
orientation: 'horizontal'
396+
spacing: dp(10)
397+
size_hint_y: None
398+
height: dp(40)
399+
400+
# ── Chip Socket.IO ──
401+
BoxLayout:
402+
orientation: 'horizontal'
403+
spacing: dp(6)
404+
padding: [dp(10), dp(5)]
405+
canvas.before:
406+
Color:
407+
rgba: (0.85, 1, 0.85, 1) if app.sioConnected else (1, 0.85, 0.85, 1)
408+
RoundedRectangle:
409+
pos: self.pos
410+
size: self.size
411+
radius: [dp(8)]
412+
Color:
413+
rgba: (0.1, 0.6, 0.1, 0.6) if app.sioConnected else (0.7, 0.1, 0.1, 0.6)
414+
Line:
415+
rounded_rectangle: (self.pos[0], self.pos[1], self.size[0], self.size[1], dp(8))
416+
width: 1
417+
418+
Label:
419+
text: ("Socket.IO\nCONECTADO" if app.sioConnected else "Socket.IO\nDESCONECTADO")
420+
font_size: '11sp'
421+
bold: True
422+
color: (0.05, 0.45, 0.05, 1) if app.sioConnected else (0.55, 0.05, 0.05, 1)
423+
halign: 'center'
424+
valign: 'middle'
425+
text_size: self.size
412426

413-
# Footer mejorado
427+
# ── Botón Ver Logs ──
428+
Button:
429+
text: "Ver Logs en Tiempo Real"
430+
size_hint_y: None
431+
height: dp(36)
432+
font_size: '13sp'
433+
bold: True
434+
background_normal: ''
435+
background_color: 0.1, 0.2, 0.5, 1
436+
color: 1, 1, 1, 1
437+
on_press: app.root.current = 'logs'
438+
canvas.before:
439+
Color:
440+
rgba: 0.1, 0.2, 0.5, 1
441+
RoundedRectangle:
442+
pos: self.pos
443+
size: self.size
444+
radius: [dp(8)]
445+
446+
# Espaciador flexible: absorbe el espacio sobrante
447+
Widget:
448+
449+
# Footer
414450
BoxLayout:
415451
orientation: 'horizontal'
416452
size_hint_y: None
@@ -452,43 +488,94 @@ ScreenManager:
452488
<LogScreen>:
453489
BoxLayout:
454490
orientation: 'vertical'
455-
padding: 10
456-
spacing: 10
491+
padding: dp(15)
492+
spacing: dp(10)
493+
canvas.before:
494+
Color:
495+
rgba: 0.96, 0.96, 1, 1
496+
Rectangle:
497+
pos: self.pos
498+
size: self.size
457499

458-
Label:
459-
text: "Logs del Servicio"
460-
font_size: 24
461-
size_hint_y: None
462-
height: 50
463-
464-
Button:
465-
text: root.logFilePath
466-
font_size: 12
500+
# Header con botón volver y título
501+
BoxLayout:
502+
orientation: 'horizontal'
467503
size_hint_y: None
468-
height: self.texture_size[1] + dp(10) # Adjust height based on text
469-
# Style to look like a clickable link
470-
background_color: 0, 0, 0, 0 # Transparent background
471-
color: 0.1, 0.2, 0.8, 1 # Blue color like a hyperlink
472-
# Action to open the file using a method defined in the Python class
473-
# Ensure 'open_log_file' method exists in your LogScreen Python class
474-
on_press: root.open_log_file()
475-
476-
ScrollView:
477-
id: scroll_view # Agregar un ID para acceder desde Python
478-
size_hint: (1, 1)
479-
TextInput:
480-
id: log_output
481-
text: root.logs
482-
readonly: True
483-
font_size: 14
484-
background_color: 0, 0, 0, 1 # Fondo negro
485-
foreground_color: 1, 1, 1, 1 # Texto blanco
486-
size_hint_y: None
487-
height: self.minimum_height
488-
multiline: True
504+
height: dp(55)
505+
spacing: dp(10)
506+
canvas.before:
507+
Color:
508+
rgba: 1, 1, 1, 0.9
509+
RoundedRectangle:
510+
pos: self.pos
511+
size: self.size
512+
radius: [dp(10)]
513+
padding: dp(10)
489514

490-
Button:
491-
text: "Volver"
515+
Button:
516+
text: "< Volver"
517+
size_hint_x: None
518+
width: dp(90)
519+
font_size: '13sp'
520+
bold: True
521+
background_normal: ''
522+
background_color: 0, 0, 0, 0
523+
color: 0.1, 0.2, 0.5, 1
524+
on_press: app.root.current = "main"
525+
526+
Label:
527+
text: "Logs en Tiempo Real"
528+
font_size: '16sp'
529+
bold: True
530+
color: 0.1, 0.2, 0.5, 1
531+
halign: 'center'
532+
valign: 'middle'
533+
534+
Button:
535+
text: "Abrir archivo"
536+
size_hint_x: None
537+
width: dp(100)
538+
font_size: '12sp'
539+
background_normal: ''
540+
background_color: 0, 0, 0, 0
541+
color: 0.1, 0.2, 0.8, 1
542+
on_press: root.open_log_file()
543+
544+
# Ruta del archivo de log
545+
Label:
546+
text: root.logFilePath if root.logFilePath else "Sin archivo de log configurado"
547+
font_size: '10sp'
548+
color: 0.5, 0.5, 0.5, 1
492549
size_hint_y: None
493-
height: 50
494-
on_press: app.root.current = "main"
550+
height: dp(18)
551+
halign: 'center'
552+
text_size: self.size
553+
554+
# Panel de logs con fondo oscuro (terminal style)
555+
BoxLayout:
556+
orientation: 'vertical'
557+
canvas.before:
558+
Color:
559+
rgba: 0.06, 0.06, 0.1, 1
560+
RoundedRectangle:
561+
pos: self.pos
562+
size: self.size
563+
radius: [dp(8)]
564+
padding: dp(8)
565+
566+
ScrollView:
567+
id: scroll_view
568+
do_scroll_x: False
569+
scroll_y: 0
570+
TextInput:
571+
id: log_output
572+
text: root.logs
573+
on_text: scroll_view.scroll_y = 0
574+
readonly: True
575+
font_size: '13sp'
576+
background_color: 0, 0, 0, 0
577+
foreground_color: 0.75, 0.95, 0.75, 1
578+
size_hint_y: None
579+
height: max(self.minimum_height, scroll_view.height)
580+
multiline: True
581+
cursor_color: 0, 0, 0, 0

0 commit comments

Comments
 (0)