Home Download Buy Blog Forum Support

Update contents of quick panel

Update contents of quick panel

Postby vikkun on Thu Mar 01, 2012 6:49 pm

I have two questions about quick panel API in Sublime Text 2.

1) How can I update the items being shown in quick panel

Say for example, I am using the following command to display the contents of list/array itemsList in quick panel.
Code: Select all
self.window.show_quick_panel(itemsList, self.on_done)

I want that when the contents of itemsList are changed, the contents being shown in quick panel should change.
What I am doing right now is when the list itemsList is updated, I call show_quick_panel once again to show the new contents, but what that does is it opens two quick panels. Hence my question that how can I update the quick panel to show contents of itemsList here.

2) In case contents cannot be updated, can I close the quick panel programmatically?
Posts: 2
Joined: Sat Feb 25, 2012 2:42 am

Re: Update contents of quick panel

Postby Esente on Sat Apr 07, 2012 3:23 am

Here is a quick example to do what you want:

Code: Select all
temp = ["1", "2", "3", "4"]
def add_update():
   if len(temp) < 10:
      self.window.show_quick_panel(temp, None)
      sublime.set_timeout(add_update, 1000)
sublime.set_timeout(add_update, 1000)

Disclaimer: I have just looked at Sublime's API for an hour or so, and I haven't done Python before.
Posts: 26
Joined: Mon Aug 16, 2010 7:20 pm

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests