Exemplo n.º 1
0
    def sort(self, reversed_=False):
        all_items = self.tileview.items
        try:
            if not all_items:
                raise NoSampleError
            sorter = Sorter(self.sortAlgorithm.currentText(), all_items,
                            self.sort_filter_indices)
            if sorter.requiresTreeData():
                sorter.treedata = self.sortFilterFeatures(self.model.features)
        except NoSampleError:
            return

        try:
            dist = sorter()
        except Exception as e:
            QMessageBox.warning(self, 'Warning', str(e))
            return

        if reversed_:
            dist = -1*dist

        if dist is not None:
            for d, item in zip(dist, all_items):
                item.sortkey = d
            self.startSorting.emit()
Exemplo n.º 2
0
    def sort(self, reversed_=False):
        all_items = self.tileview.items
        try:
            if not all_items:
                raise NoSampleError
            sorter = Sorter(self.sortAlgorithm.currentText(), all_items,
                            self.sort_filter_indices)
            if sorter.requiresTreeData():
                sorter.treedata = self.sortFilterFeatures(self.model.features)
        except NoSampleError:
            return

        try:
            dist = sorter()
        except Exception as e:
            QMessageBox.warning(self, 'Warning', str(e))
            return

        if reversed_:
            dist = -1 * dist

        if dist is not None:
            for d, item in zip(dist, all_items):
                item.sortkey = d
            self.startSorting.emit()