From bb61028e0c8130cbaeb9102f3e75e04e4223720c Mon Sep 17 00:00:00 2001 From: Florian Dehau Date: Sun, 3 Sep 2017 15:34:05 +0200 Subject: [PATCH] Fix examples --- examples/barchart.rs | 6 +++--- examples/block.rs | 6 +++--- examples/canvas.rs | 6 +++--- examples/chart.rs | 6 +++--- examples/custom_widget.rs | 4 ++-- examples/demo.rs | 16 ++++++++-------- examples/gauge.rs | 6 +++--- examples/list.rs | 6 +++--- examples/paragraph.rs | 6 +++--- examples/sparkline.rs | 6 +++--- examples/table.rs | 6 +++--- examples/tabs.rs | 6 +++--- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/examples/barchart.rs b/examples/barchart.rs index cad989a3..eba070cd 100644 --- a/examples/barchart.rs +++ b/examples/barchart.rs @@ -10,7 +10,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, BarChart}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color, Modifier}; @@ -64,7 +64,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -123,7 +123,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() .direction(Direction::Vertical) diff --git a/examples/block.rs b/examples/block.rs index 6f12dda6..016ba54b 100644 --- a/examples/block.rs +++ b/examples/block.rs @@ -6,13 +6,13 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color, Modifier}; fn main() { - let mut terminal = Terminal::new(TermionBackend::new().unwrap()).unwrap(); + let mut terminal = Terminal::new(MouseBackend::new().unwrap()).unwrap(); let stdin = io::stdin(); terminal.clear().unwrap(); terminal.hide_cursor().unwrap(); @@ -34,7 +34,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, size: &Rect) { +fn draw(t: &mut Terminal, size: &Rect) { // Wrapping block for a group // Just draw the block and the group on the same area and build the group diff --git a/examples/canvas.rs b/examples/canvas.rs index b5216372..4abef154 100644 --- a/examples/canvas.rs +++ b/examples/canvas.rs @@ -10,7 +10,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border}; use tui::widgets::canvas::{Canvas, Map, MapResolution, Line}; use tui::layout::{Group, Rect, Direction, Size}; @@ -75,7 +75,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -150,7 +150,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() diff --git a/examples/chart.rs b/examples/chart.rs index 8a373f3d..076562e4 100644 --- a/examples/chart.rs +++ b/examples/chart.rs @@ -13,7 +13,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, Chart, Axis, Marker, Dataset}; use tui::layout::Rect; use tui::style::{Style, Color, Modifier}; @@ -64,7 +64,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -123,7 +123,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Chart::default() .block(Block::default() diff --git a/examples/custom_widget.rs b/examples/custom_widget.rs index b61e7b21..e4071e1f 100644 --- a/examples/custom_widget.rs +++ b/examples/custom_widget.rs @@ -1,7 +1,7 @@ extern crate tui; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::Widget; use tui::buffer::Buffer; use tui::layout::Rect; @@ -31,7 +31,7 @@ impl<'a> Label<'a> { } fn main() { - let mut terminal = Terminal::new(TermionBackend::new().unwrap()).unwrap(); + let mut terminal = Terminal::new(MouseBackend::new().unwrap()).unwrap(); let size = terminal.size().unwrap(); terminal.clear().unwrap(); Label::default().text("Test").render(&mut terminal, &size); diff --git a/examples/demo.rs b/examples/demo.rs index c032b07e..6b96ead6 100644 --- a/examples/demo.rs +++ b/examples/demo.rs @@ -16,7 +16,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, SelectableList, List, Gauge, Sparkline, Paragraph, border, Chart, Axis, Dataset, BarChart, Marker, Tabs, Table}; use tui::widgets::canvas::{Canvas, Map, MapResolution, Line}; @@ -193,7 +193,7 @@ fn main() { } }); - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); terminal.clear().unwrap(); terminal.hide_cursor().unwrap(); @@ -266,7 +266,7 @@ fn main() { terminal.clear().unwrap(); } -fn draw(t: &mut Terminal, app: &App) -> Result<(), io::Error> { +fn draw(t: &mut Terminal, app: &App) -> Result<(), io::Error> { Group::default() .direction(Direction::Vertical) @@ -293,7 +293,7 @@ fn draw(t: &mut Terminal, app: &App) -> Result<(), io::Error> { Ok(()) } -fn draw_first_tab(t: &mut Terminal, app: &App, area: &Rect) { +fn draw_first_tab(t: &mut Terminal, app: &App, area: &Rect) { Group::default() .direction(Direction::Vertical) .sizes(&[Size::Fixed(7), Size::Min(7), Size::Fixed(7)]) @@ -304,7 +304,7 @@ fn draw_first_tab(t: &mut Terminal, app: &App, area: &Rect) { }); } -fn draw_gauges(t: &mut Terminal, app: &App, area: &Rect) { +fn draw_gauges(t: &mut Terminal, app: &App, area: &Rect) { Block::default() .borders(border::ALL) @@ -332,7 +332,7 @@ fn draw_gauges(t: &mut Terminal, app: &App, area: &Rect) { }); } -fn draw_charts(t: &mut Terminal, app: &App, area: &Rect) { +fn draw_charts(t: &mut Terminal, app: &App, area: &Rect) { let sizes = if app.show_chart { vec![Size::Percent(50), Size::Percent(50)] } else { @@ -430,7 +430,7 @@ fn draw_charts(t: &mut Terminal, app: &App, area: &Rect) { }); } -fn draw_text(t: &mut Terminal, area: &Rect) { +fn draw_text(t: &mut Terminal, area: &Rect) { Paragraph::default() .block(Block::default() .borders(border::ALL) @@ -449,7 +449,7 @@ fn draw_text(t: &mut Terminal, area: &Rect) { .render(t, area); } -fn draw_second_tab(t: &mut Terminal, app: &App, area: &Rect) { +fn draw_second_tab(t: &mut Terminal, app: &App, area: &Rect) { Group::default() .direction(Direction::Horizontal) .sizes(&[Size::Percent(30), Size::Percent(70)]) diff --git a/examples/gauge.rs b/examples/gauge.rs index 8d69c587..c149e111 100644 --- a/examples/gauge.rs +++ b/examples/gauge.rs @@ -10,7 +10,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, Gauge}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color, Modifier}; @@ -61,7 +61,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -120,7 +120,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() .direction(Direction::Vertical) diff --git a/examples/list.rs b/examples/list.rs index e5fac7b4..c0226a70 100644 --- a/examples/list.rs +++ b/examples/list.rs @@ -10,7 +10,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, SelectableList, List}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color, Modifier}; @@ -81,7 +81,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -156,7 +156,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() .direction(Direction::Horizontal) diff --git a/examples/paragraph.rs b/examples/paragraph.rs index b151835a..a3e0dbc9 100644 --- a/examples/paragraph.rs +++ b/examples/paragraph.rs @@ -6,13 +6,13 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, Paragraph}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color}; fn main() { - let mut terminal = Terminal::new(TermionBackend::new().unwrap()).unwrap(); + let mut terminal = Terminal::new(MouseBackend::new().unwrap()).unwrap(); let stdin = io::stdin(); terminal.clear().unwrap(); terminal.hide_cursor().unwrap(); @@ -36,7 +36,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, size: &Rect) { +fn draw(t: &mut Terminal, size: &Rect) { Block::default() .style(Style::default().bg(Color::White)) diff --git a/examples/sparkline.rs b/examples/sparkline.rs index 8e26fd40..813dd715 100644 --- a/examples/sparkline.rs +++ b/examples/sparkline.rs @@ -13,7 +13,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, Sparkline}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color}; @@ -61,7 +61,7 @@ enum Event { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // Channels @@ -120,7 +120,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() .direction(Direction::Vertical) diff --git a/examples/table.rs b/examples/table.rs index 4822014b..05717d52 100644 --- a/examples/table.rs +++ b/examples/table.rs @@ -7,7 +7,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, Table}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color, Modifier}; @@ -35,7 +35,7 @@ impl<'a> App<'a> { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); @@ -83,7 +83,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &App) { +fn draw(t: &mut Terminal, app: &App) { Group::default() .direction(Direction::Horizontal) diff --git a/examples/tabs.rs b/examples/tabs.rs index 8e62b070..967ff984 100644 --- a/examples/tabs.rs +++ b/examples/tabs.rs @@ -9,7 +9,7 @@ use termion::event; use termion::input::TermRead; use tui::Terminal; -use tui::backend::TermionBackend; +use tui::backend::MouseBackend; use tui::widgets::{Widget, Block, border, Tabs}; use tui::layout::{Group, Direction, Size, Rect}; use tui::style::{Style, Color}; @@ -21,7 +21,7 @@ struct App<'a> { fn main() { // Terminal initialization - let backend = TermionBackend::new().unwrap(); + let backend = MouseBackend::new().unwrap(); let mut terminal = Terminal::new(backend).unwrap(); // App @@ -63,7 +63,7 @@ fn main() { terminal.show_cursor().unwrap(); } -fn draw(t: &mut Terminal, app: &mut App) { +fn draw(t: &mut Terminal, app: &mut App) { Block::default() .style(Style::default().bg(Color::White))