@@ -859,7 +859,6 @@ def get_selection(view):
859859 rows = numpy .array (rows , dtype = numpy .intp )
860860 # map the rows through the applied sorting (if any)
861861 rows = model .mapToSourceRows (rows )
862- rows .sort ()
863862 rows = rows .tolist ()
864863 return rows , cols
865864
@@ -890,21 +889,6 @@ def commit(self):
890889 rowsel , colsel = self .get_selection (view )
891890 self .selected_rows , self .selected_cols = rowsel , colsel
892891
893- def select (data , rows , domain ):
894- """
895- Select the data subset with specified rows and domain subsets.
896-
897- If either rows or domain is None they mean select all.
898- """
899- if rows is not None and domain is not None :
900- return data .from_table (domain , data , rows )
901- elif rows is not None :
902- return data .from_table (data .domain , rows )
903- elif domain is not None :
904- return data .from_table (domain , data )
905- else :
906- return data
907-
908892 domain = table .domain
909893
910894 if len (colsel ) < len (domain ) + len (domain .metas ):
@@ -930,10 +914,8 @@ def select_vars(role):
930914 # Avoid a copy if all/none rows are selected.
931915 if not rowsel :
932916 selected_data = None
933- elif len (rowsel ) == len (table ):
934- selected_data = select (table , None , domain )
935917 else :
936- selected_data = select ( table , rowsel , domain )
918+ selected_data = table . from_table ( domain , table , rowsel )
937919
938920 self .Outputs .selected_data .send (selected_data )
939921 self .Outputs .annotated_data .send (create_annotated_table (table , rowsel ))
@@ -1100,21 +1082,6 @@ def is_sortable(table):
11001082 return False
11011083
11021084
1103- def test_model ():
1104- app = QApplication ([])
1105- view = QTableView (
1106- sortingEnabled = True
1107- )
1108- data = Orange .data .Table ("lenses" )
1109- model = TableModel (data )
1110-
1111- view .setModel (model )
1112-
1113- view .show ()
1114- view .raise_ ()
1115- return app .exec ()
1116-
1117-
11181085if __name__ == "__main__" : # pragma: no cover
11191086 WidgetPreview (OWDataTable ).run (
11201087 [(Table ("iris" ), "iris" ),
0 commit comments