refactor: modularizar como PocketSync con soporte de perfiles
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import tkinter as tk
|
||||
|
||||
from ui import styles
|
||||
|
||||
_MAX_FILE_LEN = 80
|
||||
|
||||
|
||||
class StatusBar(tk.Frame):
|
||||
"""Barra de estado con tres labels: sistema, fase y archivo actual."""
|
||||
|
||||
def __init__(self, parent, **kwargs):
|
||||
super().__init__(parent, bg=styles.STATUS_BG, relief="sunken", bd=2, **kwargs)
|
||||
|
||||
self._label_system = tk.Label(
|
||||
self,
|
||||
text="Sistema: -",
|
||||
font=styles.FONT_LABEL + ("bold",) if isinstance(styles.FONT_LABEL, tuple) else styles.FONT_LABEL,
|
||||
bg=styles.STATUS_BG,
|
||||
fg=styles.STATUS_SYSTEM_FG,
|
||||
anchor="w",
|
||||
)
|
||||
self._label_system.pack(fill="x", padx=10, pady=3)
|
||||
|
||||
self._label_phase = tk.Label(
|
||||
self,
|
||||
text="Fase: -",
|
||||
font=styles.FONT_LABEL,
|
||||
bg=styles.STATUS_BG,
|
||||
fg=styles.STATUS_PHASE_FG,
|
||||
anchor="w",
|
||||
)
|
||||
self._label_phase.pack(fill="x", padx=10, pady=3)
|
||||
|
||||
self._label_file = tk.Label(
|
||||
self,
|
||||
text="Archivo: -",
|
||||
font=styles.FONT_SMALL,
|
||||
bg=styles.STATUS_BG,
|
||||
fg=styles.STATUS_FILE_FG,
|
||||
anchor="w",
|
||||
)
|
||||
self._label_file.pack(fill="x", padx=10, pady=3)
|
||||
|
||||
def set_system(self, text: str) -> None:
|
||||
self._label_system.config(text=text)
|
||||
self._label_system.update_idletasks()
|
||||
|
||||
def set_phase(self, text: str) -> None:
|
||||
self._label_phase.config(text=text)
|
||||
self._label_phase.update_idletasks()
|
||||
|
||||
def set_file(self, text: str) -> None:
|
||||
if len(text) > _MAX_FILE_LEN:
|
||||
text = "..." + text[-(_MAX_FILE_LEN - 3):]
|
||||
self._label_file.config(text=f"Archivo: {text}")
|
||||
self._label_file.update_idletasks()
|
||||
|
||||
def reset(self) -> None:
|
||||
self.set_system("Sistema: ✅ COMPLETADO")
|
||||
self.set_phase("Fase: -")
|
||||
self.set_file("-")
|
||||
Reference in New Issue
Block a user