Draft: Multi text block
This PR allow to use standard text_block()
from any greenlet.
There is multiple con because
- The ctrl-c will not handle the greenlet launching the textblock but the first one which have created the textblock
- If a greenlet do not stop before the end of the eval greenlet, the textblock is not closed
- the inhibition of the stdout will stay during the whole life of the textblock
To me, one of the idea for the future is to consider to have an application during the whole life cycle of the eval greenlet. This way we could display everything inside, and a toolbar will always be displayed.
This would solve the problem of ownership of the TextBlock, cause in this case it will be owned by the BlissRepl or the eval greenlet itself.
import gevent
def test():
with text_block() as tb:
tb.set_text("Processing")
gevent.sleep(3)
tb.set_text("Close")
gevent.sleep(1)
g1 = gevent.spawn_later(1, test)
g2 = gevent.spawn_later(2, test)
g3 = gevent.spawn_later(3, test)
g4 = gevent.spawn_later(4, test)
gevent.joinall([g1, g2, g3, g4])
Edited by Valentin Valls