GithubHelp home page GithubHelp logo

deinstapel / cursive-async-view Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 2.0 1.19 MB

A loading-screen wrapper for gyscos/cursive views ๐Ÿ–ฅ๏ธ

License: BSD 3-Clause "New" or "Revised" License

Rust 93.88% Shell 4.63% jq 1.49%
cursive-views cursive loading progress terminal async

cursive-async-view's People

Contributors

fin-ger avatar gyscos avatar jwuensche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gyscos coolslimbo

cursive-async-view's Issues

Cannot build AsyncView in Cursive::call_on_name()

Hi,

I have the usecase where I need to build a AsyncView from Cursive::call_on_name().

I'm not sure how to do that.

The usecase is: I have a sidebar with a list of items and as soon one is selected, I want to add a tab (via cursive-tabs) in the main view, loading something. The loading process can take time (minutes!), so I figured to use cursive-async-view. But because I want to create the view in Cursive::call_on_name(), I cannot use &mut siv to pass to the constructor of AsyncView.

Do you have an idea how to work around this?

Adding method to modify the default `loading` in `AsyncView`

Is it possible to add a method like set_loading to modify the loading field in a AsyncView struct?

I want to center the loading animation but find it impossible because I cannot change the default loading field, which is a TextView without the center alignment option.

From iterator?

Would be nice if there would be an option to build the AsyncView from an iterator, with optional progress bar of course.

Something like:

AsyncView::from_iterator(it)

with from_iterator(i: I) where I: IntoIterator<Item = V>, V: View or something like this?
Or even

AsyncView::fold_from_iter(it, ListView::new(), |accu, elem| { accu.add_child("", elem); accu });

where the closure folds over the ListView and elem as element from the iterator?

Refreshing thread has been dropped before view has

Hey,
so sorry for opening another issue today, but I just stumbled upon this:

[2020-06-10 22:01:24.823295 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel
[2020-06-10 22:01:24.858575 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel
[2020-06-10 22:01:24.859999 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel
[2020-06-10 22:01:24.868513 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel
[2020-06-10 22:01:24.868739 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel
[2020-06-10 22:01:24.868935 +00:00] WARN [cursive_async_view::infinite] /home/leo/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive-async-view-0.3.3/src/infinite.rs:583: Refreshing thread has been dropped b
efore view has, this has no impact on your code and is a bug: sending on a disconnected channel

which also promptly quit my application.
I'm not sure what happened, it is possible that my thread fetching stuff from the DB died, but I would expect some panic log in that case..

Update `cursive` and replace with `cursive_core`

As part of the update to 0.15 cursive has migrated their logic (and by that the parts we actually need for this crate) to cursive_core. We should move to use this new crate, for now it requires us to move our end2end tests out of /src into /examples as proposed in our other view crates proposed.

As mentioned in deinstapel/cursive-tabs#5 we can make this work, but the cleaner way to handle the tests is switching to cursive::backends:puppet in all end2end tests.

Send requirement for AsyncProgressView

Hey!
I'm somewhat new to Rust, and I'm writing a terminal application that, among other things, loads some stuff from a database and displays it as a table. I'm using the cursive_table_view crate for the table, and that works, but I was staring at a static screen whenever I was loading new data, so I though: Why not use this cool crate to show a loading bar?

And so I did, and it works!
Now, the thing is: I load a bunch of rows in an initial query, and then I need to load additional info for each record. Which means I need to do many queries, but I know how many, so I want to display a progress bar that tells the user how far along we are.
So I simply replaced all the AsyncViews with AsyncProgressViews, and AsyncStates with AsyncProgressStates, and compilation fails.

The problem is that the table view is not Send, so (I think) the AsyncProgressView<TableView> is not a View.
I could be missing something, again -- not a veteran.
Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.