packages/vaex-ui/vaex/ui/ranking.py
def sort(self, Ncol, order):
        """Sort table by given column number.
        """
        self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()"))
        if Ncol == 0:
            print("by name")
            # get indices, sorted by pair name
            sortlist = list(zip(self.pairs, list(range(len(self.pairs)))))
            print(sortlist)
            sortlist.sort(key=operator.itemgetter(0))
            print(sortlist)
            self.indices = list(map(operator.itemgetter(1), sortlist))
            print((self.indices))
        if Ncol == 1:
            # get indices, sorted by ranking, or no sorting
            if None not in self.ranking:
                sortlist = list(zip(self.ranking, list(range(len(self.pairs)))))
                sortlist.sort(key=operator.itemgetter(0))
                self.indices = list(map(operator.itemgetter(1), sortlist))
            else:
                self.indices = list(range(len(self.pairs)))
            print((self.indices))
        if order == QtCore.Qt.DescendingOrder:
            self.indices.reverse()
        print((self.indices))
        self.emit(QtCore.SIGNAL("layoutChanged()"))
def sort(self, Ncol, order):
        """Sort table by given column number.
        """
        self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()"))
        if Ncol == 0:
            print("by name")
            # get indices, sorted by pair name
            sortlist = list(zip(self.pairs, list(range(len(self.pairs)))))
            print(sortlist)
            sortlist.sort(key=operator.itemgetter(0))
            print(sortlist)
            self.indices = list(map(operator.itemgetter(1), sortlist))
            print((self.indices))
        if Ncol == 1:
            # get indices, sorted by ranking, or no sorting
            if None not in self.ranking:
                sortlist = list(zip(self.ranking, list(range(len(self.pairs)))))
                sortlist.sort(key=operator.itemgetter(0))
                self.indices = list(map(operator.itemgetter(1), sortlist))
            else:
                self.indices = list(range(len(self.pairs)))
            print((self.indices))
        if order == QtCore.Qt.DescendingOrder:
            self.indices.reverse()
        print((self.indices))
        self.emit(QtCore.SIGNAL("layoutChanged()"))
Sort table by given column number.