Ignore:
File:
1 edited

Legend:

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

    r9ce69ec r2b8286c  
    574574        new_plots = [] 
    575575        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: 
    578577                continue 
    579578            # Don't plot intermediate results, e.g. P(Q), S(Q) 
     
    583582                continue 
    584583            # 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 plot 
    587                 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: 
    588587                    plot.yscale='linear' 
    589588                    self.plotData([(item, plot)]) 
     
    598597        Forces display of charts for the given data set 
    599598        """ 
    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) 
    631605 
    632606    def addDataPlot2D(self, plot_set, item): 
     
    712686 
    713687        # Update the active chart list 
    714         self.active_plots[new_plot.data.name] = new_plot 
     688        #self.active_plots[new_plot.data.id] = new_plot 
    715689 
    716690    def appendPlot(self): 
     
    726700        # old plot data 
    727701        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) 
    732704 
    733705        old_plot = PlotHelper.plotById(plot_id) 
     
    757729        data_id = data.name 
    758730        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) 
    762732            return True 
    763733        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) 
    766735            return True 
    767736        return False 
     
    977946        self.context_menu.addAction(self.actionQuick3DPlot) 
    978947        self.context_menu.addAction(self.actionEditMask) 
    979         #self.context_menu.addSeparator() 
    980         #self.context_menu.addAction(self.actionFreezeResults) 
    981948        self.context_menu.addSeparator() 
    982949        self.context_menu.addAction(self.actionDelete) 
     
    990957        self.actionEditMask.triggered.connect(self.showEditDataMask) 
    991958        self.actionDelete.triggered.connect(self.deleteItem) 
    992         self.actionFreezeResults.triggered.connect(self.freezeSelectedItems) 
    993959 
    994960    def onCustomContextMenu(self, position): 
     
    1011977        self.actionQuick3DPlot.setEnabled(is_2D) 
    1012978        self.actionEditMask.setEnabled(is_2D) 
    1013  
    1014         # Freezing 
    1015         # check that the selection has inner items 
    1016         freeze_enabled = False 
    1017         if model_item.parent() is not None: 
    1018             freeze_enabled = True 
    1019         self.actionFreezeResults.setEnabled(freeze_enabled) 
    1020  
    1021979        # Fire up the menu 
    1022980        self.context_menu.exec_(self.current_view.mapToGlobal(position)) 
     
    11541112        mask_editor.exec_() 
    11551113 
    1156     def freezeItem(self, item=None): 
    1157         """ 
    1158         Freeze given item 
    1159         """ 
    1160         if item is None: 
    1161             return 
    1162         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 items 
    1170         """ 
    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  
    11821114    def deleteItem(self): 
    11831115        """ 
     
    13401272 
    13411273        # Caption for the theories 
    1342         checkbox_item.setChild(2, QtGui.QStandardItem("FIT RESULTS")) 
     1274        checkbox_item.setChild(2, QtGui.QStandardItem("THEORIES")) 
    13431275 
    13441276        # New row in the model 
Note: See TracChangeset for help on using the changeset viewer.