Dear all,
I’m evaluating ST2 by developing a plugin. I periodically need to update an output panel, unfortunately I cannot get this to work properly.
import sublime, sublime_plugin, time
# start new test
class TestPanelCommand(sublime_plugin.TextCommand):
def run(self, edit):
panel = self.view.window().get_output_panel('test_panel')
for i in range(0, 3):
panel_edit = panel.begin_edit()
panel.insert(panel_edit, panel.size(), 'hello\n')
panel.end_edit(panel_edit)
panel.show(panel.size())
self.view.window().run_command("show_panel", {"panel": "output.test_panel"})
time.sleep(3)
I save this code to test.py which I put in the Packages/Default directory, then run it with view.run_command(‘test_panel’).
I would have expected the output panel to show ‘hello’, then wait 3 seconds, then print another ‘hello’, and again. Unfortunately, the output panel just comes out and prints the 3 ‘hello’ at the same time, after 9 seconds.
Is there a way to flush to the output panel, or refresh it? Do you happen to know what I am doing wrong?
Thank you,
r.