Sublime Forum

show_input_panel() sometimes not showing

#1

Hello,

I’m writing a plugin:

class ClassCreate(sublime_plugin.WindowCommand):

    def run(self):
        # Ask for directory path
        self.window.show_input_panel(
            'Podaj ścieżkę do katalogu docelowego plików:',
            '.', self.__on_done, None, None)

        # Ask for name
        self.window.show_input_panel(
            'Podaj ścieżkę i nazwę tworzonej klasy:',
            'NowaKlasa', self.__on_class_name_done, None, None)

I need to get input from user two times:

  • first call to show_input_panel() - view is not showing up, method self.__on_done is never executed.
  • second call to show_input_panel() - everything is working fine

Why first call to show_input_panel() fails and second one is working?

:open_mouth:

0 Likes

#2

show_input_panel is not modal, it is executed asynchronously. That’s why you need the “on_done” callback.

What happens is that the second input panel closes the first panel immediately after it was opened. You need to ask for the name in self.__on_done.

1 Like