Changeset c6fb57c in sasview for src/sas/qtgui/MainWindow/DataExplorer.py
- Timestamp:
- Nov 22, 2017 7:49:06 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, 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:
- cb4d219
- Parents:
- 0580c77
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r6a3e1fe rc6fb57c 858 858 self.context_menu.addAction(self.actionQuick3DPlot) 859 859 self.context_menu.addAction(self.actionEditMask) 860 self.context_menu.addSeparator() 861 self.context_menu.addAction(self.actionDelete) 862 860 863 861 864 # Define the callbacks … … 865 868 self.actionQuick3DPlot.triggered.connect(self.quickData3DPlot) 866 869 self.actionEditMask.triggered.connect(self.showEditDataMask) 870 self.actionDelete.triggered.connect(self.deleteItem) 867 871 868 872 def onCustomContextMenu(self, position): … … 996 1000 mask_editor.exec_() 997 1001 1002 def deleteItem(self): 1003 """ 1004 Delete the current item 1005 """ 1006 # Assure this is indeed wanted 1007 delete_msg = "This operation will delete the selected data sets." +\ 1008 "\nDo you want to continue?" 1009 reply = QtWidgets.QMessageBox.question(self, 1010 'Warning', 1011 delete_msg, 1012 QtWidgets.QMessageBox.Yes, 1013 QtWidgets.QMessageBox.No) 1014 1015 if reply == QtWidgets.QMessageBox.No: 1016 return 1017 1018 indices = self.current_view.selectedIndexes() 1019 proxy = self.current_view.model() 1020 model = proxy.sourceModel() 1021 1022 for index in indices: 1023 row_index = proxy.mapToSource(index) 1024 item_to_delete = model.itemFromIndex(row_index) 1025 if item_to_delete.isCheckable(): 1026 row = row_index.row() 1027 if item_to_delete.parent(): 1028 # We have a child item - delete from it 1029 item_to_delete.parent().removeRow(row) 1030 else: 1031 # delete directly from model 1032 model.removeRow(row) 1033 pass 1034 998 1035 def loadComplete(self, output): 999 1036 """
Note: See TracChangeset
for help on using the changeset viewer.