Skip to content

Commit

Permalink
batter layout with Fill instead of Length constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed May 22, 2024
1 parent 58a57c7 commit 9e59bc1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Board {
]),
];

let widths = [Constraint::Length(6), Constraint::Length(30)];
let widths = [Constraint::Length(6), Constraint::Fill(1)];

let board = Table::new(rows, widths).block(
Block::default()
Expand Down
2 changes: 1 addition & 1 deletion src/fan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Fan {
},
])];

let widths = [Constraint::Length(10), Constraint::Length(10)];
let widths = [Constraint::Length(10), Constraint::Fill(1)];

let fan = Table::new(rows, widths)
.header(Row::new(vec!["Profile", "RPM"]).style(Style::new().bold()))
Expand Down
27 changes: 13 additions & 14 deletions src/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,21 +267,20 @@ impl Power {
};

// nvpmodel

let nvpmodel = Table::new(
[Row::new(vec![
Cell::new("Mode").style(Style::default().bold()),
Cell::new(match &self.nvpmode {
Some(nvpmode) => match &nvpmode.mode {
Some(mode) => format!("{}W", &mode.name),
None => " - ".to_string(),
},
let rows = [Row::new(vec![
Cell::new("Mode").style(Style::default().bold()),
Cell::new(match &self.nvpmode {
Some(nvpmode) => match &nvpmode.mode {
Some(mode) => format!("{}W", &mode.name),
None => " - ".to_string(),
}),
])],
[Constraint::Length(16), Constraint::Length(6)],
)
.block(Block::default());
},
None => " - ".to_string(),
}),
])];

let widths = [Constraint::Length(16), Constraint::Length(7)];

let nvpmodel = Table::new(rows, widths).block(Block::default());

// Power consumption
let rows: Vec<Row> = self
Expand Down
2 changes: 1 addition & 1 deletion src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl System {
]),
];

let widths = [Constraint::Length(10), Constraint::Length(30)];
let widths = [Constraint::Length(10), Constraint::Fill(1)];

let system = Table::new(rows, widths).block(
Block::default()
Expand Down
1 change: 1 addition & 0 deletions src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl Tracing {

let log_file = OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(log_file_path)?;

Expand Down

0 comments on commit 9e59bc1

Please sign in to comment.