Skip to content

Commit

Permalink
bump ratatui to 0.24.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabus1184 committed Oct 24, 2023
1 parent f600e66 commit a8765f7
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 29 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ serde = { version = "1.0.181", features = ["derive", "rc"] }
serde_json = { version = "1.0.104" }
walkdir = "2.3.3"
tempfile = "3.7.1"
bitcode = { version = "0.4.0", features = ["serde"] }
bitcode = { version = "0.5.0", features = ["serde"] }
anyhow = "1.0.75"
dirs = "5.0.1"
ordered-float = { version = "3.9.0", features = ["serde"] }
ordered-float = { version = "4.1.1", features = ["serde"] }

# tui
crossterm = "0.26.1"
ratatui = { version = "0.23.0", features = ["all-widgets"] }
crossterm = "0.27.0"
ratatui = { version = "0.24.0", features = ["all-widgets"] }
image = { version = "0.24.7", default-features = false, features = [
"png",
"jpeg",
Expand Down
9 changes: 3 additions & 6 deletions src/tui/fancy.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use std::{
io::Stdout,
sync::{Arc, Mutex},
};
use std::sync::{Arc, Mutex};

use crossterm::event::Event;
use image::imageops::FilterType;
use log::trace;
use ratatui::{
prelude::{Alignment, Constraint, CrosstermBackend, Direction, Layout, Rect},
prelude::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Style, Stylize},
text::{Line, Span},
widgets::{Block, BorderType, Borders, Cell, Padding, Paragraph, Row, Table},
Expand All @@ -29,7 +26,7 @@ impl Fancy {
}

impl Tui for Fancy {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()> {
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()> {
trace!("locking player");
let player = self.player.lock().expect("Failed to lock player");

Expand Down
5 changes: 2 additions & 3 deletions src/tui/files.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{
cmp::Ordering,
io::Stdout,
path::PathBuf,
sync::{Arc, Mutex},
};
Expand All @@ -9,7 +8,7 @@ use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use itertools::Itertools;
use log::trace;
use ratatui::{
prelude::{Constraint, CrosstermBackend, Direction, Layout, Rect},
prelude::{Constraint, Direction, Layout, Rect},
style::{Color, Style, Stylize},
text::{Line, Span},
widgets::{Paragraph, Table, TableState},
Expand Down Expand Up @@ -198,7 +197,7 @@ impl Files {
}

impl Tui for Files {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()> {
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()> {
trace!("drawing files");

let (inner_area, filter_area) = match self.filter {
Expand Down
3 changes: 1 addition & 2 deletions src/tui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ mod status;
mod tabs;

use std::{
io::Stdout,
sync::{Arc, Mutex},
time::Duration,
};
Expand Down Expand Up @@ -42,7 +41,7 @@ pub fn format_duration(duration: Duration) -> String {
}

pub trait Tui {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()>;
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()>;
fn input(&mut self, event: &Event) -> anyhow::Result<()>;
}

Expand Down
6 changes: 1 addition & 5 deletions src/tui/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ impl Queue {
}

impl Tui for Queue {
fn draw(
&self,
area: ratatui::prelude::Rect,
f: &mut ratatui::Frame<'_, ratatui::prelude::CrosstermBackend<std::io::Stdout>>,
) -> anyhow::Result<()> {
fn draw(&self, area: ratatui::prelude::Rect, f: &mut ratatui::Frame) -> anyhow::Result<()> {
trace!("drawing queue");

trace!("lock player");
Expand Down
5 changes: 2 additions & 3 deletions src/tui/search.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
io::Stdout,
path::PathBuf,
sync::{Arc, Mutex},
};
Expand All @@ -8,7 +7,7 @@ use crossterm::event::{Event, KeyCode, KeyEvent};
use itertools::Itertools;
use ordered_float::OrderedFloat;
use ratatui::{
prelude::{Constraint, CrosstermBackend, Direction, Layout, Rect},
prelude::{Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style, Stylize},
text::{Line, Span},
widgets::{Paragraph, Table, TableState},
Expand Down Expand Up @@ -85,7 +84,7 @@ impl Search {
}

impl Tui for Search {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()> {
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()> {
let layout = Layout::default()
.direction(Direction::Vertical)
.constraints([
Expand Down
5 changes: 2 additions & 3 deletions src/tui/status.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use std::{
io::Stdout,
sync::{Arc, Mutex},
};

use itertools::Itertools;
use log::trace;
use ratatui::{
prelude::{Constraint, CrosstermBackend, Direction, Layout, Margin, Rect},
prelude::{Constraint, Direction, Layout, Margin, Rect},
style::{Color, Style, Stylize},
text::{Line, Span, Text},
widgets::{LineGauge, Paragraph},
Expand All @@ -28,7 +27,7 @@ impl Status {
}

impl Tui for Status {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()> {
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()> {
let layout = Layout::default()
.direction(ratatui::prelude::Direction::Vertical)
.constraints([Constraint::Min(1), Constraint::Length(1)].as_ref())
Expand Down
6 changes: 3 additions & 3 deletions src/tui/tabs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{io::Stdout, sync::Mutex};
use std::{sync::Mutex};

use crossterm::event::{Event, KeyCode, KeyEvent};
use log::trace;
use ratatui::{
prelude::{CrosstermBackend, Margin, Rect},
prelude::{Margin, Rect},
style::{Color, Modifier, Style},
text::{Line, Span},
widgets::{block::Title, Block, BorderType, Borders},
Expand All @@ -29,7 +29,7 @@ impl<'a> Tabs<'a> {
}

impl Tui for Tabs<'_> {
fn draw(&self, area: Rect, f: &mut Frame<'_, CrosstermBackend<Stdout>>) -> anyhow::Result<()> {
fn draw(&self, area: Rect, f: &mut Frame) -> anyhow::Result<()> {
let block = Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
Expand Down

0 comments on commit a8765f7

Please sign in to comment.