stuff
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
from nicegui import ui
|
||||
from utils import data_manager
|
||||
from utils import SystemMonitor, GPUMonitor
|
||||
|
||||
|
||||
class Header(ui.header):
|
||||
def __init__(self):
|
||||
def __init__(self, system_monitor: SystemMonitor, gpu_monitor: GPUMonitor):
|
||||
super().__init__(fixed=True, elevated=False)
|
||||
|
||||
with self.classes('bg-transparent'):
|
||||
@@ -16,23 +16,18 @@ class Header(ui.header):
|
||||
# Right side - system status only
|
||||
with ui.row().classes('items-center gap-4'):
|
||||
# Get real-time data
|
||||
dashboard_data = data_manager.get_dashboard_data()
|
||||
|
||||
# System load indicator
|
||||
with ui.row().classes('items-center gap-2'):
|
||||
ui.icon('memory', size='sm', color='cyan')
|
||||
ui.label(f'CPU: {dashboard_data["cpu"]["percent"]}%').classes('text-sm text-white')
|
||||
ui.label().classes('text-sm text-white').bind_text_from(system_monitor, 'cpu_percent',
|
||||
lambda x: f'{x:.1f}%')
|
||||
|
||||
with ui.row().classes('items-center gap-2'):
|
||||
ui.icon('gpu_on', size='sm', color='orange')
|
||||
if dashboard_data['gpu']['available']:
|
||||
ui.label(f'GPU: {dashboard_data["gpu"]["percent"]}%').classes('text-sm text-white')
|
||||
else:
|
||||
ui.label('GPU: N/A').classes('text-sm text-white')
|
||||
ui.label().classes('text-sm text-white').bind_text_from(gpu_monitor, 'GPU ',
|
||||
lambda x: f'{x:.1f}%')
|
||||
|
||||
with ui.row().classes('items-center gap-2'):
|
||||
ui.icon('thermostat', size='sm', color='red')
|
||||
if dashboard_data['gpu']['available'] and dashboard_data['gpu']['temperature'] > 0:
|
||||
ui.label(f'{dashboard_data["gpu"]["temperature"]}°C').classes('text-sm text-white')
|
||||
else:
|
||||
ui.label('--°C').classes('text-sm text-white')
|
||||
ui.label().classes('text-sm text-white').bind_text_from(gpu_monitor, 'temperature',
|
||||
lambda x: f'{x:.1f}°C')
|
||||
|
||||
Reference in New Issue
Block a user