ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
78 stars 19 forks source link

Adding "with loading_bar.paused" construct (Issue #126) #130

Closed psbleep closed 5 years ago

psbleep commented 5 years ago

This should allow for the syntax referenced in issue #126 . Python does not allow a function to be used as a context manager, so my solution was to create an object that calls back to the pause and resume methods on the loading bar.

For my test file I did notice and attempt to replicate the try/catch ImportError block from the existing test files, but I must admit I do not understand what scenario this exception handling addresses so I am not certain I succeeded.

Let me know if you have any questions, thanks!

CRImier commented 5 years ago

Thank you, amazing! Will now try and rewrite an app to rely on it, to see how it works

CRImier commented 5 years ago

For my test file I did notice and attempt to replicate the try/catch ImportError block from the existing test files, but I must admit I do not understand what scenario this exception handling addresses so I am not certain I succeeded.

It's for running individual tests, i.e. python test_loading_indicators.py - I tested it now, and it didn't work like that, so I fixed it. Thank you for adding it!