From ca01af12531fba787a04cb270379fdc9cfcaf1da Mon Sep 17 00:00:00 2001 From: jakakokosar Date: Fri, 10 Apr 2020 16:21:59 +0200 Subject: [PATCH] owtable: output sorted data --- Orange/widgets/data/owtable.py | 35 +--------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/Orange/widgets/data/owtable.py b/Orange/widgets/data/owtable.py index 7288937d537..9bc42d7203f 100644 --- a/Orange/widgets/data/owtable.py +++ b/Orange/widgets/data/owtable.py @@ -859,7 +859,6 @@ def get_selection(view): rows = numpy.array(rows, dtype=numpy.intp) # map the rows through the applied sorting (if any) rows = model.mapToSourceRows(rows) - rows.sort() rows = rows.tolist() return rows, cols @@ -890,21 +889,6 @@ def commit(self): rowsel, colsel = self.get_selection(view) self.selected_rows, self.selected_cols = rowsel, colsel - def select(data, rows, domain): - """ - Select the data subset with specified rows and domain subsets. - - If either rows or domain is None they mean select all. - """ - if rows is not None and domain is not None: - return data.from_table(domain, data, rows) - elif rows is not None: - return data.from_table(data.domain, rows) - elif domain is not None: - return data.from_table(domain, data) - else: - return data - domain = table.domain if len(colsel) < len(domain) + len(domain.metas): @@ -930,10 +914,8 @@ def select_vars(role): # Avoid a copy if all/none rows are selected. if not rowsel: selected_data = None - elif len(rowsel) == len(table): - selected_data = select(table, None, domain) else: - selected_data = select(table, rowsel, domain) + selected_data = table.from_table(domain, table, rowsel) self.Outputs.selected_data.send(selected_data) self.Outputs.annotated_data.send(create_annotated_table(table, rowsel)) @@ -1100,21 +1082,6 @@ def is_sortable(table): return False -def test_model(): - app = QApplication([]) - view = QTableView( - sortingEnabled=True - ) - data = Orange.data.Table("lenses") - model = TableModel(data) - - view.setModel(model) - - view.show() - view.raise_() - return app.exec() - - if __name__ == "__main__": # pragma: no cover WidgetPreview(OWDataTable).run( [(Table("iris"), "iris"),