Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a notify loading popup. #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add a notify loading popup. #102

wants to merge 1 commit into from

Conversation

Fran6nd
Copy link

@Fran6nd Fran6nd commented Apr 30, 2020

Hello Sir!

A little contribution...

I made these changes for this project:

The idea was that we have some requests taking a few seconds...
To prevent the app from freezing, I managed to add a notify_loading() function
wich can display an animation until the function given as parameter has finished.



I thing this might be useful for other people doing requests from npyscreen apps. br>


Here is a basic example:

#!/usr/bin/env python
# encoding: utf-8

import npyscreen
import time
class TestApp(npyscreen.NPSApp):
    def main(self):
        F  = npyscreen.Form()
        btn= F.add(npyscreen.ButtonPress)
        def test():
            def cb():
                time.sleep(5)
                return "gogo"
            res = npyscreen.utilNotify.notify_loading(cb)
            npyscreen.notify_confirm(res)
        btn.whenPressed = test
        # This lets the user interact with the Form.
        F.edit()

if __name__ == "__main__":
    App = TestApp()
    App.run()```

@Fran6nd Fran6nd force-pushed the master branch 2 times, most recently from 39e3b07 to b4218af Compare April 30, 2020 09:34
@Fran6nd Fran6nd changed the title Add a loading popup. Add a notify loading popup. Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant