Changes in src/sas/qtgui/MainWindow/DataExplorer.py [9ce69ec:2b8286c] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r9ce69ec r2b8286c 574 574 new_plots = [] 575 575 for item, plot in plots.items(): 576 if self.updatePlot(plot): 577 # Don't create plots which are already displayed 576 if self.updatePlot(plot) and filename != plot.name: 578 577 continue 579 578 # Don't plot intermediate results, e.g. P(Q), S(Q) … … 583 582 continue 584 583 # Don't include plots from different fitpages, but always include the original data 585 if fitpage_name in plot.name or filename in plot.name or filename == plot.filename:586 # Residuals get their own plot587 if plot.plot_role == Data1D.ROLE_RESIDUAL:584 if fitpage_name in plot.name or filename == plot.name: 585 # 'sophisticated' test to generate standalone plot for residuals 586 if 'esiduals' in plot.title: 588 587 plot.yscale='linear' 589 588 self.plotData([(item, plot)]) … … 598 597 Forces display of charts for the given data set 599 598 """ 600 # data_list = [QStandardItem, Data1D/Data2D] 601 plot_to_show = data_list[1] 602 plot_item = data_list[0] 603 604 # plots to show 605 new_plots = [] 606 607 # Check if this is merely a plot update 608 if self.updatePlot(plot_to_show): 609 return 610 611 # Residuals get their own plot 612 if plot_to_show.plot_role == Data1D.ROLE_RESIDUAL: 613 plot_to_show.yscale='linear' 614 self.plotData([(plot_item, plot_to_show)]) 615 elif plot_to_show.plot_role == Data1D.ROLE_DELETABLE: 616 # No plot 617 return 618 else: 619 # Plots with main data points on the same chart 620 # Get the main data plot 621 main_data = GuiUtils.dataFromItem(plot_item.parent()) 622 if main_data is None: 623 # Try the current item 624 main_data = GuiUtils.dataFromItem(plot_item) 625 if main_data is not None: 626 new_plots.append((plot_item, main_data)) 627 new_plots.append((plot_item, plot_to_show)) 628 629 if new_plots: 630 self.plotData(new_plots) 599 plot_to_show = data_list[0] 600 # passed plot is used ONLY to figure out its title, 601 # so all the charts related by it can be pulled from 602 # the data explorer indices. 603 filename = plot_to_show.filename 604 self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 631 605 632 606 def addDataPlot2D(self, plot_set, item): … … 712 686 713 687 # Update the active chart list 714 self.active_plots[new_plot.data.name] = new_plot688 #self.active_plots[new_plot.data.id] = new_plot 715 689 716 690 def appendPlot(self): … … 726 700 # old plot data 727 701 plot_id = str(self.cbgraph.currentText()) 728 try: 729 assert plot_id in PlotHelper.currentPlots(), "No such plot: %s"%(plot_id) 730 except: 731 return 702 703 assert plot_id in PlotHelper.currentPlots(), "No such plot: %s"%(plot_id) 732 704 733 705 old_plot = PlotHelper.plotById(plot_id) … … 757 729 data_id = data.name 758 730 if data_id in ids_keys: 759 # We have data, let's replace data that needs replacing 760 if data.plot_role != Data1D.ROLE_DATA: 761 self.active_plots[data_id].replacePlot(data_id, data) 731 self.active_plots[data_id].replacePlot(data_id, data) 762 732 return True 763 733 elif data_id in ids_vals: 764 if data.plot_role != Data1D.ROLE_DATA: 765 list(self.active_plots.values())[ids_vals.index(data_id)].replacePlot(data_id, data) 734 list(self.active_plots.values())[ids_vals.index(data_id)].replacePlot(data_id, data) 766 735 return True 767 736 return False … … 977 946 self.context_menu.addAction(self.actionQuick3DPlot) 978 947 self.context_menu.addAction(self.actionEditMask) 979 #self.context_menu.addSeparator()980 #self.context_menu.addAction(self.actionFreezeResults)981 948 self.context_menu.addSeparator() 982 949 self.context_menu.addAction(self.actionDelete) … … 990 957 self.actionEditMask.triggered.connect(self.showEditDataMask) 991 958 self.actionDelete.triggered.connect(self.deleteItem) 992 self.actionFreezeResults.triggered.connect(self.freezeSelectedItems)993 959 994 960 def onCustomContextMenu(self, position): … … 1011 977 self.actionQuick3DPlot.setEnabled(is_2D) 1012 978 self.actionEditMask.setEnabled(is_2D) 1013 1014 # Freezing1015 # check that the selection has inner items1016 freeze_enabled = False1017 if model_item.parent() is not None:1018 freeze_enabled = True1019 self.actionFreezeResults.setEnabled(freeze_enabled)1020 1021 979 # Fire up the menu 1022 980 self.context_menu.exec_(self.current_view.mapToGlobal(position)) … … 1154 1112 mask_editor.exec_() 1155 1113 1156 def freezeItem(self, item=None):1157 """1158 Freeze given item1159 """1160 if item is None:1161 return1162 self.model.beginResetModel()1163 new_item = self.cloneTheory(item)1164 self.model.appendRow(new_item)1165 self.model.endResetModel()1166 1167 def freezeSelectedItems(self):1168 """1169 Freeze selected items1170 """1171 indices = self.treeView.selectedIndexes()1172 1173 proxy = self.treeView.model()1174 model = proxy.sourceModel()1175 1176 for index in indices:1177 row_index = proxy.mapToSource(index)1178 item_to_copy = model.itemFromIndex(row_index)1179 if item_to_copy and item_to_copy.isCheckable():1180 self.freezeItem(item_to_copy)1181 1182 1114 def deleteItem(self): 1183 1115 """ … … 1340 1272 1341 1273 # Caption for the theories 1342 checkbox_item.setChild(2, QtGui.QStandardItem(" FIT RESULTS"))1274 checkbox_item.setChild(2, QtGui.QStandardItem("THEORIES")) 1343 1275 1344 1276 # New row in the model
Note: See TracChangeset
for help on using the changeset viewer.