Skip to content

Commit

Permalink
owtable: output sorted data
Browse files Browse the repository at this point in the history
  • Loading branch information
JakaKokosar committed Apr 10, 2020
1 parent db4e7ce commit ca01af1
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions Orange/widgets/data/owtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand All @@ -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))
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit ca01af1

Please sign in to comment.