inserito resource monitor nella gui e rivista l'interfaccia
This commit is contained in:
parent
562d074eb6
commit
f0c3047437
1090
baseline/target_simulator__20251126T093023_local/metadata.json
Normal file
1090
baseline/target_simulator__20251126T093023_local/metadata.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -48,8 +48,16 @@ class App(tk.Tk):
|
||||
self.export_btn = ttk.Button(actions_frame, text="Export CSV", command=self._on_action_export, state="disabled")
|
||||
self.export_btn.grid(row=0, column=5, padx=(4,4))
|
||||
|
||||
# Shared progress bar used by all actions
|
||||
# Note: progress bar and counters moved to a bottom status bar below Results
|
||||
# Progress frame: progress bar and file counter below Actions
|
||||
progress_frame = ttk.Frame(self)
|
||||
progress_frame.pack(fill="x", side="top", padx=8, pady=(0,6))
|
||||
|
||||
ttk.Label(progress_frame, text="Progress:").pack(side="left", padx=(6,6))
|
||||
self.progress = ttk.Progressbar(progress_frame, mode="determinate")
|
||||
self.progress.pack(side="left", fill="x", expand=True, padx=(0,12))
|
||||
|
||||
self._lbl_files = ttk.Label(progress_frame, text="Files: 0/0")
|
||||
self._lbl_files.pack(side="right", padx=(6,6))
|
||||
|
||||
# Results frame contains a single Treeview that will be reused by all actions
|
||||
results_frame = ttk.LabelFrame(self, text="Results")
|
||||
@ -74,19 +82,33 @@ class App(tk.Tk):
|
||||
# Keep the notebook and individual tabs instantiated for compatibility (not packed)
|
||||
self.notebook = ttk.Notebook(self)
|
||||
|
||||
# Status bar at the bottom: phase label, wide progress bar, and file counter
|
||||
status_frame = ttk.Frame(self)
|
||||
status_frame.pack(fill="x", side="bottom", padx=6, pady=(0,6))
|
||||
self.phase_var = tk.StringVar(value="Idle")
|
||||
self._lbl_phase = ttk.Label(status_frame, textvariable=self.phase_var)
|
||||
# Status bar at the bottom: operation status (left) and resource monitor (right)
|
||||
status_frame = ttk.Frame(self, relief=tk.SUNKEN, borderwidth=1)
|
||||
status_frame.pack(fill="x", side="bottom", padx=0, pady=0)
|
||||
|
||||
# Left side: operation status
|
||||
self.phase_var = tk.StringVar(value="Ready")
|
||||
self._lbl_phase = ttk.Label(status_frame, textvariable=self.phase_var, anchor="w")
|
||||
self._lbl_phase.pack(side="left", padx=(6,12))
|
||||
self.progress = ttk.Progressbar(status_frame, mode="determinate")
|
||||
self.progress.pack(side="left", fill="x", expand=True, padx=(0,12))
|
||||
# file counter on the right of the status bar
|
||||
self._lbl_files = ttk.Label(status_frame, text="Files: 0/0")
|
||||
self._lbl_files.pack(side="right", padx=(6,6))
|
||||
|
||||
# Right side: resource monitor
|
||||
from resource_monitor import TkinterResourceMonitor
|
||||
self.resource_var = tk.StringVar(value="CPU: 0% | RAM: 0 MB | Threads: 0")
|
||||
self._lbl_resources = ttk.Label(status_frame, textvariable=self.resource_var, anchor="e")
|
||||
self._lbl_resources.pack(side="right", padx=(12,6))
|
||||
|
||||
# Initialize and start resource monitor
|
||||
try:
|
||||
self.resource_monitor = TkinterResourceMonitor(
|
||||
tk_widget=self,
|
||||
string_var=self.resource_var,
|
||||
poll_interval=1.0 # Update every second
|
||||
)
|
||||
self.resource_monitor.start()
|
||||
except Exception as e:
|
||||
self.log(f"Resource monitor not available: {e}", level="WARNING")
|
||||
|
||||
# Log frame below the status bar
|
||||
# Log frame above the status bar
|
||||
log_frame = ttk.LabelFrame(self, text="Log")
|
||||
log_frame.pack(fill="x", side="bottom", padx=6, pady=(0,6))
|
||||
# ScrolledText for logs (read-only)
|
||||
@ -980,10 +1002,19 @@ class App(tk.Tk):
|
||||
def on_closing(self):
|
||||
"""Cleanup when closing the application."""
|
||||
try:
|
||||
# Stop resource monitor
|
||||
if hasattr(self, 'resource_monitor'):
|
||||
self.resource_monitor.stop()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
# Shutdown logger system
|
||||
if hasattr(self, 'logger_system'):
|
||||
self.logger_system.shutdown()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.destroy()
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
pygount
|
||||
lizard
|
||||
Pygments
|
||||
Pygments
|
||||
psutil
|
||||
Loading…
Reference in New Issue
Block a user