Index: .gitignore
===================================================================
--- .gitignore (revision ce1f4914dd57dae8862f62d00a9418e190b8f39c)
+++ .gitignore (revision 7cc38a7abf6f807b37c917293bfb6a384bc956e7)
@@ -16,4 +16,5 @@
*.pyproj
*.sln
+.*.swp
.DS_Store
/.settings
Index: src/sas/qtgui/MainWindow/DataExplorer.py
===================================================================
--- src/sas/qtgui/MainWindow/DataExplorer.py (revision 60d55a7bee9728940641005a1bf038626e067160)
+++ src/sas/qtgui/MainWindow/DataExplorer.py (revision 0cd98a1bff2f5cc0a67f68ad681ae7a3c8379c75)
@@ -42,5 +42,4 @@
# Main model for keeping loaded data
self.model = QtGui.QStandardItemModel(self)
-
# Secondary model for keeping frozen data sets
self.theory_model = QtGui.QStandardItemModel(self)
@@ -98,4 +97,5 @@
self.communicator.plotUpdateSignal.connect(self.updatePlot)
self.communicator.maskEditorSignal.connect(self.showEditDataMask)
+ self.communicator.extMaskEditorSignal.connect(self.extShowEditDataMask)
self.cbgraph.editTextChanged.connect(self.enableGraphCombo)
@@ -598,5 +598,5 @@
plot2D.plot(plot_set)
self.addPlot(plot2D)
- self.active_plots[plot2D.data.id] = plot2D
+ self.active_plots[plot2D.data.name] = plot2D
#============================================
# Experimental hook for silx charts
@@ -626,5 +626,5 @@
new_plot.plot(plot_set, transform=transform)
# active_plots may contain multiple charts
- self.active_plots[plot_set.id] = new_plot
+ self.active_plots[plot_set.name] = new_plot
elif isinstance(plot_set, Data2D):
self.addDataPlot2D(plot_set, item)
@@ -697,5 +697,5 @@
old_plot.plot()
# need this for lookup - otherwise this plot will never update
- self.active_plots[plot_set.id] = old_plot
+ self.active_plots[plot_set.name] = old_plot
def updatePlot(self, data):
@@ -711,7 +711,7 @@
ids_keys = list(self.active_plots.keys())
- ids_vals = [val.data.id for val in self.active_plots.values()]
-
- data_id = data.id
+ ids_vals = [val.data.name for val in self.active_plots.values()]
+
+ data_id = data.name
if data_id in ids_keys:
self.active_plots[data_id].replacePlot(data_id, data)
@@ -952,15 +952,17 @@
model = proxy.sourceModel()
- if index.isValid():
- model_item = model.itemFromIndex(proxy.mapToSource(index))
- # Find the mapped index
- orig_index = model_item.isCheckable()
- if orig_index:
- # Check the data to enable/disable actions
- is_2D = isinstance(GuiUtils.dataFromItem(model_item), Data2D)
- self.actionQuick3DPlot.setEnabled(is_2D)
- self.actionEditMask.setEnabled(is_2D)
- # Fire up the menu
- self.context_menu.exec_(self.current_view.mapToGlobal(position))
+ if not index.isValid():
+ return
+ model_item = model.itemFromIndex(proxy.mapToSource(index))
+ # Find the mapped index
+ orig_index = model_item.isCheckable()
+ if not orig_index:
+ return
+ # Check the data to enable/disable actions
+ is_2D = isinstance(GuiUtils.dataFromItem(model_item), Data2D)
+ self.actionQuick3DPlot.setEnabled(is_2D)
+ self.actionEditMask.setEnabled(is_2D)
+ # Fire up the menu
+ self.context_menu.exec_(self.current_view.mapToGlobal(position))
def showDataInfo(self):
@@ -1059,15 +1061,36 @@
self.new_plot.show()
+ def extShowEditDataMask(self):
+ self.showEditDataMask()
+
def showEditDataMask(self, data=None):
"""
Mask Editor for 2D plots
"""
- if data is None or not isinstance(data, Data2D):
- index = self.current_view.selectedIndexes()[0]
- proxy = self.current_view.model()
- model = proxy.sourceModel()
- model_item = model.itemFromIndex(proxy.mapToSource(index))
-
- data = GuiUtils.dataFromItem(model_item)
+ try:
+ if data is None or not isinstance(data, Data2D):
+ index = self.current_view.selectedIndexes()[0]
+ proxy = self.current_view.model()
+ model = proxy.sourceModel()
+ model_item = model.itemFromIndex(proxy.mapToSource(index))
+
+ data = GuiUtils.dataFromItem(model_item)
+
+ if data is None or not isinstance(data, Data2D):
+ msg = QtWidgets.QMessageBox()
+ msg.setIcon(QtWidgets.QMessageBox.Information)
+ msg.setText("Error: cannot apply mask. \
+ Please select a 2D dataset.")
+ msg.setStandardButtons(QtWidgets.QMessageBox.Cancel)
+ msg.exec_()
+ return
+ except:
+ msg = QtWidgets.QMessageBox()
+ msg.setIcon(QtWidgets.QMessageBox.Information)
+ msg.setText("Error: No dataset selected. \
+ Please select a 2D dataset.")
+ msg.setStandardButtons(QtWidgets.QMessageBox.Cancel)
+ msg.exec_()
+ return
mask_editor = MaskEditor(self, data)
Index: src/sas/qtgui/MainWindow/GuiManager.py
===================================================================
--- src/sas/qtgui/MainWindow/GuiManager.py (revision f84d793343c420fd47b44c3b601e90f9e82ea451)
+++ src/sas/qtgui/MainWindow/GuiManager.py (revision 339e22b9f5c08262b1d5b0b551ce467bcf83178c)
@@ -422,5 +422,4 @@
self._workspace.actionExcel.triggered.connect(self.actionExcel)
self._workspace.actionLatex.triggered.connect(self.actionLatex)
-
# View
self._workspace.actionShow_Grid_Window.triggered.connect(self.actionShow_Grid_Window)
@@ -452,4 +451,6 @@
self._workspace.actionManage_Custom_Models.triggered.connect(self.actionManage_Custom_Models)
self._workspace.actionAddMult_Models.triggered.connect(self.actionAddMult_Models)
+ self._workspace.actionEditMask.triggered.connect(self.actionEditMask)
+
# Window
self._workspace.actionCascade.triggered.connect(self.actionCascade)
@@ -781,4 +782,8 @@
self.add_mult_editor.show()
+ def actionEditMask(self):
+
+ self.communicate.extMaskEditorSignal.emit()
+
#============ ANALYSIS =================
def actionFitting(self):
Index: src/sas/qtgui/MainWindow/UI/MainWindowUI.ui
===================================================================
--- src/sas/qtgui/MainWindow/UI/MainWindowUI.ui (revision dda8f16d5052858e8e3b59357f178cbd74fe3664)
+++ src/sas/qtgui/MainWindow/UI/MainWindowUI.ui (revision 2f14b5d7fb7a3d8d1023220bb53c48e8763cdf5a)
@@ -113,4 +113,6 @@
+
+