Changes in src/sas/qtgui/MainWindow/DataExplorer.py [60d55a7:0cd98a1] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r60d55a7 r0cd98a1 42 42 # Main model for keeping loaded data 43 43 self.model = QtGui.QStandardItemModel(self) 44 45 44 # Secondary model for keeping frozen data sets 46 45 self.theory_model = QtGui.QStandardItemModel(self) … … 98 97 self.communicator.plotUpdateSignal.connect(self.updatePlot) 99 98 self.communicator.maskEditorSignal.connect(self.showEditDataMask) 99 self.communicator.extMaskEditorSignal.connect(self.extShowEditDataMask) 100 100 101 101 self.cbgraph.editTextChanged.connect(self.enableGraphCombo) … … 598 598 plot2D.plot(plot_set) 599 599 self.addPlot(plot2D) 600 self.active_plots[plot2D.data. id] = plot2D600 self.active_plots[plot2D.data.name] = plot2D 601 601 #============================================ 602 602 # Experimental hook for silx charts … … 626 626 new_plot.plot(plot_set, transform=transform) 627 627 # active_plots may contain multiple charts 628 self.active_plots[plot_set. id] = new_plot628 self.active_plots[plot_set.name] = new_plot 629 629 elif isinstance(plot_set, Data2D): 630 630 self.addDataPlot2D(plot_set, item) … … 697 697 old_plot.plot() 698 698 # need this for lookup - otherwise this plot will never update 699 self.active_plots[plot_set. id] = old_plot699 self.active_plots[plot_set.name] = old_plot 700 700 701 701 def updatePlot(self, data): … … 711 711 712 712 ids_keys = list(self.active_plots.keys()) 713 ids_vals = [val.data. idfor val in self.active_plots.values()]714 715 data_id = data. id713 ids_vals = [val.data.name for val in self.active_plots.values()] 714 715 data_id = data.name 716 716 if data_id in ids_keys: 717 717 self.active_plots[data_id].replacePlot(data_id, data) … … 952 952 model = proxy.sourceModel() 953 953 954 if index.isValid(): 955 model_item = model.itemFromIndex(proxy.mapToSource(index)) 956 # Find the mapped index 957 orig_index = model_item.isCheckable() 958 if orig_index: 959 # Check the data to enable/disable actions 960 is_2D = isinstance(GuiUtils.dataFromItem(model_item), Data2D) 961 self.actionQuick3DPlot.setEnabled(is_2D) 962 self.actionEditMask.setEnabled(is_2D) 963 # Fire up the menu 964 self.context_menu.exec_(self.current_view.mapToGlobal(position)) 954 if not index.isValid(): 955 return 956 model_item = model.itemFromIndex(proxy.mapToSource(index)) 957 # Find the mapped index 958 orig_index = model_item.isCheckable() 959 if not orig_index: 960 return 961 # Check the data to enable/disable actions 962 is_2D = isinstance(GuiUtils.dataFromItem(model_item), Data2D) 963 self.actionQuick3DPlot.setEnabled(is_2D) 964 self.actionEditMask.setEnabled(is_2D) 965 # Fire up the menu 966 self.context_menu.exec_(self.current_view.mapToGlobal(position)) 965 967 966 968 def showDataInfo(self): … … 1059 1061 self.new_plot.show() 1060 1062 1063 def extShowEditDataMask(self): 1064 self.showEditDataMask() 1065 1061 1066 def showEditDataMask(self, data=None): 1062 1067 """ 1063 1068 Mask Editor for 2D plots 1064 1069 """ 1065 if data is None or not isinstance(data, Data2D): 1066 index = self.current_view.selectedIndexes()[0] 1067 proxy = self.current_view.model() 1068 model = proxy.sourceModel() 1069 model_item = model.itemFromIndex(proxy.mapToSource(index)) 1070 1071 data = GuiUtils.dataFromItem(model_item) 1070 try: 1071 if data is None or not isinstance(data, Data2D): 1072 index = self.current_view.selectedIndexes()[0] 1073 proxy = self.current_view.model() 1074 model = proxy.sourceModel() 1075 model_item = model.itemFromIndex(proxy.mapToSource(index)) 1076 1077 data = GuiUtils.dataFromItem(model_item) 1078 1079 if data is None or not isinstance(data, Data2D): 1080 msg = QtWidgets.QMessageBox() 1081 msg.setIcon(QtWidgets.QMessageBox.Information) 1082 msg.setText("Error: cannot apply mask. \ 1083 Please select a 2D dataset.") 1084 msg.setStandardButtons(QtWidgets.QMessageBox.Cancel) 1085 msg.exec_() 1086 return 1087 except: 1088 msg = QtWidgets.QMessageBox() 1089 msg.setIcon(QtWidgets.QMessageBox.Information) 1090 msg.setText("Error: No dataset selected. \ 1091 Please select a 2D dataset.") 1092 msg.setStandardButtons(QtWidgets.QMessageBox.Cancel) 1093 msg.exec_() 1094 return 1072 1095 1073 1096 mask_editor = MaskEditor(self, data)
Note: See TracChangeset
for help on using the changeset viewer.