Changeset b1a7a81 in sasview for src/sas/qtgui/MainWindow


Ignore:
Timestamp:
Jul 5, 2018 11:03:11 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
f0a8f74
Parents:
e20870bc
Message:

fixed selected dataset deletion (see SASVIEW-956)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    re20870bc rb1a7a81  
    10121012        """ 
    10131013        # Assure this is indeed wanted 
    1014         delete_msg = "This operation will delete the selected data sets." +\ 
     1014        delete_msg = "This operation will delete the selected data sets " +\ 
     1015                     "and all the dependents." +\ 
    10151016                     "\nDo you want to continue?" 
    10161017        reply = QtWidgets.QMessageBox.question(self, 
     
    10231024            return 
    10241025 
    1025         indices = self.current_view.selectedIndexes() 
    10261026        proxy = self.current_view.model() 
    10271027        model = proxy.sourceModel() 
    10281028 
    1029         for index in indices: 
     1029        deleted_indices = [] 
     1030        deleted_names = [] 
     1031 
     1032        # Every time a row is removed, the indices change, so we'll just remove 
     1033        # rows and keep calling selectedIndexes until it returns an empty list. 
     1034        indices = self.current_view.selectedIndexes() 
     1035 
     1036        while len(indices) > 0: 
     1037            index = indices[0] 
    10301038            row_index = proxy.mapToSource(index) 
    10311039            item_to_delete = model.itemFromIndex(row_index) 
    10321040            if item_to_delete and item_to_delete.isCheckable(): 
    10331041                row = row_index.row() 
     1042 
     1043                # store the deleted item details so we can pass them on later 
     1044                deleted_names.append(str(self.model.item(row).text())) 
     1045                deleted_indices.append(self.model.item(row)) 
     1046 
    10341047                if item_to_delete.parent(): 
    10351048                    # We have a child item - delete from it 
     
    10381051                    # delete directly from model 
    10391052                    model.removeRow(row) 
    1040         pass 
     1053            indices = self.current_view.selectedIndexes() 
     1054 
     1055        # Let others know we deleted data 
     1056        self.communicator.dataDeletedSignal.emit(deleted_indices) 
     1057 
     1058        # update stored_data 
     1059        self.manager.update_stored_data(deleted_names) 
    10411060 
    10421061    def onAnalysisUpdate(self, new_perspective=""): 
Note: See TracChangeset for help on using the changeset viewer.