I’m working on creating an easy to implement progress bar, but am running into an issue with updating it in realtime.
My original proof of concept accomplished its effect by using an increasing delay
value @ set_timeout
.
For actual implementation, I’d like to be able to establish various points throughout code where the progress bar will be updated.
This is a simplified example of what I’m trying to achieve:
progressValues = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ]
burnSomeTime = 5000000
for value in progressValues:
sublime.set_timeout( lambda: view.show_popup( value ), 0 )
for x in range( 0, burnSomeTime ):
pass
( the burnSomeTime
loop is meant to represent potentially resource-intense functions that are running in between progress updates )
The result I’m expecting:
show_popup
will display the current progressValue
each time the code reaches set_timeout
.
( I also tried set_timeout_async
)
The actual result:
Only the final value of progressValues
is being displayed, after the entire script has finished.