From 5e916e2b80151df7d1bb205e40549bcc39930c68 Mon Sep 17 00:00:00 2001 From: Jaby Date: Wed, 26 Jul 2023 22:08:10 +0200 Subject: [PATCH] Improve Gauge usage --- src/Tools/psxreadmap/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Tools/psxreadmap/src/lib.rs b/src/Tools/psxreadmap/src/lib.rs index a9fdb518..aa108164 100644 --- a/src/Tools/psxreadmap/src/lib.rs +++ b/src/Tools/psxreadmap/src/lib.rs @@ -6,9 +6,8 @@ use tool_helper::Error; use tui::{ layout::{Alignment, Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, - symbols, text::{Span, Spans}, - widgets::{Block, Borders, BorderType, LineGauge, Paragraph, Tabs} + widgets::{Block, Borders, BorderType, Gauge, Paragraph, Tabs} }; pub type EventReceiver = std::sync::mpsc::Receiver>; @@ -196,16 +195,15 @@ impl ConsoleUI { frame.render_widget(mem_gauge, frames[1]); } - fn create_overall_mem_gauge<'a>(highest_adr: u64) -> LineGauge<'a> { + fn create_overall_mem_gauge<'a>(highest_adr: u64) -> Gauge<'a> { const RAM_TOP:u64 = ConsoleUIData::HIGHEST_RAM_ADDRESS & !ConsoleUIData::RAM_BASE_ADDRESS; let highest_adr_masked = highest_adr & !ConsoleUIData::RAM_BASE_ADDRESS; let adr_ratio = (highest_adr_masked as f64)/RAM_TOP as f64; - LineGauge::default().block(Block::default().borders(Borders::ALL) + Gauge::default().block(Block::default().borders(Borders::ALL) .title(format!("Memory Usage: {}% [0x{:x}/0x{:x}]", adr_ratio*100.0f64, highest_adr, ConsoleUIData::HIGHEST_RAM_ADDRESS))) - .gauge_style(Style::default().fg(Color::White).bg(Color::Black).add_modifier(Modifier::BOLD)) - .line_set(symbols::line::THICK) + .gauge_style(Style::default().fg(Color::Cyan).bg(Color::Black).add_modifier(Modifier::BOLD)) .ratio(adr_ratio) }