mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-10 14:44:18 +00:00
deps: migrate from tui to ratatui (#1086)
This commit is contained in:
parent
8c6ae3bbc7
commit
6ea3635b28
4 changed files with 24 additions and 38 deletions
46
Cargo.lock
generated
46
Cargo.lock
generated
|
@ -117,7 +117,7 @@ dependencies = [
|
|||
"concat-string",
|
||||
"const_format",
|
||||
"core-foundation",
|
||||
"crossterm 0.26.1",
|
||||
"crossterm",
|
||||
"ctrlc",
|
||||
"dirs",
|
||||
"fern",
|
||||
|
@ -135,6 +135,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"predicates",
|
||||
"procfs",
|
||||
"ratatui",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -144,7 +145,6 @@ dependencies = [
|
|||
"thiserror",
|
||||
"time",
|
||||
"toml_edit",
|
||||
"tui",
|
||||
"typed-builder",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
|
@ -325,22 +325,6 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi",
|
||||
"libc",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.26.1"
|
||||
|
@ -909,6 +893,19 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.2"
|
||||
|
@ -1288,19 +1285,6 @@ dependencies = [
|
|||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tui"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm 0.25.0",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typed-builder"
|
||||
version = "0.14.0"
|
||||
|
|
|
@ -99,7 +99,7 @@ sysinfo = "0.28.4"
|
|||
thiserror = "1.0.40"
|
||||
time = { version = "0.3.20", features = ["formatting", "macros"] }
|
||||
toml_edit = { version = "0.19.8", features = ["serde"] }
|
||||
tui = "0.19.0"
|
||||
tui = { version = "0.20.1", package = "ratatui" }
|
||||
typed-builder = "0.14.0"
|
||||
unicode-segmentation = "1.10.1"
|
||||
unicode-width = "0.1.10"
|
||||
|
|
|
@ -345,8 +345,8 @@ impl Painter {
|
|||
})
|
||||
.collect::<Vec<(u16, u16, u16, u16, usize)>>();
|
||||
|
||||
for (btn, pos) in buttons.into_iter().zip(layout.into_iter()) {
|
||||
f.render_widget(Paragraph::new(btn).alignment(Alignment::Left), pos);
|
||||
for (btn, pos) in buttons.into_iter().zip(layout.iter()) {
|
||||
f.render_widget(Paragraph::new(btn).alignment(Alignment::Left), *pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ impl Painter {
|
|||
|
||||
let num_entries = cpu_data.len();
|
||||
let mut row_counter = num_entries;
|
||||
for (itx, column) in columns.into_iter().enumerate() {
|
||||
for (itx, column) in columns.iter().enumerate() {
|
||||
if REQUIRED_COLUMNS > itx {
|
||||
let to_divide = REQUIRED_COLUMNS - itx;
|
||||
let num_taken = min(
|
||||
|
@ -106,9 +106,11 @@ impl Painter {
|
|||
.direction(Direction::Vertical)
|
||||
.constraints(vec![Constraint::Length(1); remaining_height])
|
||||
.horizontal_margin(1)
|
||||
.split(column);
|
||||
.split(*column);
|
||||
|
||||
for ((start_label, inner_label, ratio, style), row) in chunk.zip(rows) {
|
||||
for ((start_label, inner_label, ratio, style), row) in
|
||||
chunk.zip(rows.iter())
|
||||
{
|
||||
f.render_widget(
|
||||
PipeGauge::default()
|
||||
.gauge_style(style)
|
||||
|
@ -117,7 +119,7 @@ impl Painter {
|
|||
.start_label(start_label)
|
||||
.ratio(ratio)
|
||||
.hide_parts(hide_parts),
|
||||
row,
|
||||
*row,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue