def index_from_filename(self, path):
        """
        Checks if the path is already open in an editor tab.

        :param path: path to check
        :returns: The tab index if found or -1
        """
        if path:
            for i in range(self.count()):
                widget = self.widget(i)
                try:
                    if widget.file.path == path:
                        return i
                except AttributeError:
                    pass  # not an editor widget
        return -1
Checks if the path is already open in an editor tab.

        :param path: path to check
        :returns: The tab index if found or -1