Skip to content

Commit

Permalink
Update to cursive_core
Browse files Browse the repository at this point in the history
  • Loading branch information
jwuensche committed Jul 2, 2020
1 parent 7a7528e commit b19afc2
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ documentation = "https://docs.rs/cursive-async-view"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cursive = { version = "0.14.0", default-features = false }
cursive_core = "0.1"
log = "0.4.8"
interpolation = "0.2.0"
crossbeam = "0.7.3"
Expand All @@ -23,7 +23,7 @@ lazy_static = "1.4.0"
doc-comment = "0.3.3"

[dev-dependencies]
cursive = "0.14.0"
cursive = "0.15.0"

[badges]
travis-ci = { repository = "deinstapel/cursive-async-view" }
22 changes: 13 additions & 9 deletions examples/bg_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::thread;
use std::time::Duration;

use cursive::views::{Dialog, TextView};
use cursive::Cursive;
use cursive::{Cursive, CursiveExt};
use cursive_async_view::AsyncView;

fn main() {
Expand All @@ -13,14 +13,18 @@ fn main() {
// We can quit by pressing `q`
siv.add_global_callback('q', Cursive::quit);

let async_view = AsyncView::new_with_bg_creator(&mut siv, move || {
// this function is executed in a background thread, so we can block
// here as long as we like
thread::sleep(Duration::from_secs(5));

// enough blocking, let's show the content
Ok("Yeet! It worked 🖖")
}, TextView::new); // create a text view from the string
let async_view = AsyncView::new_with_bg_creator(
&mut siv,
move || {
// this function is executed in a background thread, so we can block
// here as long as we like
thread::sleep(Duration::from_secs(5));

// enough blocking, let's show the content
Ok("Yeet! It worked 🖖")
},
TextView::new,
); // create a text view from the string

// dialogs are cool, so let's use one!
let dialog = Dialog::around(async_view.with_width(40)).button("Ok", |s| s.quit());
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::thread;
use std::time::Duration;

use cursive::views::{Dialog, LinearLayout, RadioGroup};
use cursive::Cursive;
use cursive::{Cursive, CursiveExt};
use cursive_async_view::{AsyncState, AsyncView};

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/progress.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extern crate cursive_async_view;

use std::time::{Instant, Duration};
use cursive::{self, views::Dialog, views::TextView, Cursive};
use cursive::{self, views::Dialog, views::TextView, Cursive, CursiveExt};
use cursive_async_view::{AsyncProgressState, AsyncProgressView};
use std::time::{Duration, Instant};

fn main() {
cursive::logger::init();
Expand Down
4 changes: 2 additions & 2 deletions examples/progress_fail.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extern crate cursive_async_view;

use std::time::{Instant, Duration};
use cursive::{self, views::Dialog, views::TextView, Cursive};
use cursive::{self, views::Dialog, views::TextView, Cursive, CursiveExt};
use cursive_async_view::{AsyncProgressState, AsyncProgressView};
use std::time::{Duration, Instant};

fn main() {
cursive::logger::init();
Expand Down
4 changes: 1 addition & 3 deletions examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
extern crate cursive_async_view;

use std::time::{Instant, Duration};

use cursive::views::{Dialog, TextView};
use cursive::Cursive;
use cursive::{Cursive, CursiveExt};
use cursive_async_view::{AsyncState, AsyncView};

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion examples/timeout.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cursive::{
views::{Dialog, TextView},
Cursive,
Cursive, CursiveExt,
};
use cursive_async_view::{AsyncState, AsyncView};
use std::sync::mpsc::{channel, TryRecvError};
Expand Down
16 changes: 8 additions & 8 deletions src/infinite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use std::thread;
use std::time::{Duration, Instant};

use crossbeam::channel::{self, Receiver, Sender, TryRecvError};
use cursive::align::HAlign;
use cursive::direction::Direction;
use cursive::event::{AnyCb, Event, EventResult};
use cursive::theme::PaletteColor;
use cursive::utils::markup::StyledString;
use cursive::view::{Selector, View};
use cursive::views::TextView;
use cursive::{Cursive, Printer, Rect, Vec2};
use cursive_core::align::HAlign;
use cursive_core::direction::Direction;
use cursive_core::event::{AnyCb, Event, EventResult};
use cursive_core::theme::PaletteColor;
use cursive_core::utils::markup::StyledString;
use cursive_core::view::{Selector, View};
use cursive_core::views::TextView;
use cursive_core::{Cursive, Printer, Rect, Vec2};
use interpolation::Ease;
use log::warn;
use num::clamp;
Expand Down
14 changes: 7 additions & 7 deletions src/progress.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crossbeam::channel::{bounded, unbounded, Receiver, Sender};
use cursive::direction::Direction;
use cursive::event::{AnyCb, Event, EventResult};
use cursive::theme::PaletteColor;
use cursive::utils::markup::StyledString;
use cursive::view::{Selector, View};
use cursive::views::TextView;
use cursive::{Cursive, Printer, Rect, Vec2};
use cursive_core::direction::Direction;
use cursive_core::event::{AnyCb, Event, EventResult};
use cursive_core::theme::PaletteColor;
use cursive_core::utils::markup::StyledString;
use cursive_core::view::{Selector, View};
use cursive_core::views::TextView;
use cursive_core::{Cursive, Printer, Rect, Vec2};
use interpolation::Ease;
use log::warn;
use num::clamp;
Expand Down

0 comments on commit b19afc2

Please sign in to comment.