Example #1
0
    def show_quick_panel(self,
                         items,
                         on_select,
                         flags=0,
                         selected_index=-1,
                         on_highlight=None):
        """
        on_select is called when the the quick panel is finished, and should
        accept a single integer, specifying which item was selected, or -1 for none

        on_highlight is called when the quick panel is still active, and
        indicates the current highlighted index

        flags is a bitwise OR of MONOSPACE_FONT, and KEEP_OPEN_ON_FOCUS_LOST
        """
        items_per_row = 1
        flat_items = items
        if len(items) > 0 and isinstance(items[0], list):
            items_per_row = len(items[0])
            flat_items = []

            for i in range(len(items)):
                if isinstance(items[i], str):
                    flat_items.append(items[i])
                    for j in range(1, items_per_row):
                        flat_items.append("")
                else:
                    for j in range(items_per_row):
                        flat_items.append(items[i][j])

        sublime_api.window_show_quick_panel(self.window_id, flat_items,
                                            items_per_row, on_select,
                                            on_highlight, flags,
                                            selected_index)
Example #2
0
    def show_quick_panel(self, items, on_select, flags=0, selected_index=-1, on_highlight=None):
        """
        on_select is called when the the quick panel is finished, and should
        accept a single integer, specifying which item was selected, or -1 for none

        on_highlight is called when the quick panel is still active, and
        indicates the current highlighted index

        flags is a bitwise OR of MONOSPACE_FONT, and KEEP_OPEN_ON_FOCUS_LOST
        """
        items_per_row = 1
        flat_items = items
        if len(items) > 0 and isinstance(items[0], list):
            items_per_row = len(items[0])
            flat_items = []

            for i in range(len(items)):
                if isinstance(items[i], str):
                    flat_items.append(items[i])
                    for j in range(1, items_per_row):
                        flat_items.append("")
                else:
                    for j in range(items_per_row):
                        flat_items.append(items[i][j])

        sublime_api.window_show_quick_panel(
            self.window_id, flat_items, items_per_row, on_select, on_highlight,
            flags, selected_index)
Example #3
0
    def show_quick_panel(self, items, on_select, flags = 0, selected_index = -1, on_highlight = None):
        """
        on_select is called when the the quick panel is finished, and should accept a single integer, specifying which item was selected, or -1 for none
        on_highlight is called when the quick panel is still active, and indicates the current highlighted index
        """
        items_per_row = 1
        flat_items = items
        if len(items) > 0 and isinstance(items[0], list):
            items_per_row = len(items[0])
            flat_items = []

            for i in range(len(items)):
                for j in range(items_per_row):
                    flat_items.append(items[i][j])

        return sublime_api.window_show_quick_panel(self.window_id, flat_items,
            items_per_row, on_select, on_highlight, flags, selected_index)