Changeset 7d8bebf in sasview for src/sas


Ignore:
Timestamp:
Oct 1, 2017 3:07:17 PM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
4f790d2
Parents:
61a8b58
Message:

Some improvements in plot handling

Location:
src/sas/qtgui
Files:
2 edited

Legend:

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

    rfef38e8 r7d8bebf  
    9090        self.communicator = self.parent.communicator() 
    9191        self.communicator.fileReadSignal.connect(self.loadFromURL) 
    92         self.communicator.activeGraphsSignal.connect(self.updateGraphCombo) 
     92        self.communicator.activeGraphsSignal.connect(self.updateGraphCount) 
    9393        self.communicator.activeGraphName.connect(self.updatePlotName) 
    9494        self.communicator.plotUpdateSignal.connect(self.updatePlot) 
     
    417417        self.cbgraph.setItemText(ind, current_name) 
    418418 
     419    def updateGraphCount(self, graph_list): 
     420        """ 
     421        Modify the graph name combo and potentially remove 
     422        deleted graphs 
     423        """ 
     424        self.updateGraphCombo(graph_list) 
     425 
     426        if not self.active_plots: 
     427            return 
     428        new_plots = [PlotHelper.plotById(plot) for plot in graph_list] 
     429        active_plots_copy = self.active_plots.keys() 
     430        for plot in active_plots_copy: 
     431            if self.active_plots[plot] in new_plots: 
     432                continue 
     433            self.active_plots.pop(plot) 
     434 
    419435    def updateGraphCombo(self, graph_list): 
    420436        """ 
     
    423439        orig_text = self.cbgraph.currentText() 
    424440        self.cbgraph.clear() 
    425         #graph_titles= [str(graph) for graph in graph_list] 
    426  
    427         #self.cbgraph.insertItems(0, graph_titles) 
    428441        self.cbgraph.insertItems(0, graph_list) 
    429442        ind = self.cbgraph.findText(orig_text) 
     
    454467            plot_id = plot.id 
    455468            if plot_id in self.active_plots.keys(): 
    456                 self.active_plots[plot_id].replacePlot(plot_id, plot_to_show) 
     469                self.active_plots[plot_id].replacePlot(plot_id, plot) 
    457470            else: 
    458471                self.plotData([(None, plot)]) 
     
    486499        # Call show on requested plots 
    487500        # All same-type charts in one plot 
    488         new_plot = Plotter(self) 
     501        #if isinstance(plot_set, Data1D): 
     502        #    new_plot = Plotter(self) 
    489503 
    490504        for item, plot_set in plots: 
    491505            if isinstance(plot_set, Data1D): 
     506                if not 'new_plot' in locals(): 
     507                    new_plot = Plotter(self) 
    492508                new_plot.plot(plot_set) 
    493509            elif isinstance(plot_set, Data2D): 
     
    497513                raise AttributeError, msg 
    498514 
    499         if plots and \ 
     515        if 'new_plot' in locals() and \ 
    500516            hasattr(new_plot, 'data') and \ 
    501517            isinstance(new_plot.data, Data1D): 
     
    521537        title = str(PlotHelper.idOfPlot(new_plot)) 
    522538        new_plot.setWindowTitle(title) 
     539 
     540        # Set the object name to satisfy the Squish object picker 
     541        new_plot.setObjectName(title) 
    523542 
    524543        # Add the plot to the workspace 
  • src/sas/qtgui/Plotting/PlotterBase.py

    rdc5ef15 r7d8bebf  
    128128        """ title setter """ 
    129129        self._title = title 
     130        # Set the object name to satisfy the Squish object picker 
     131        self.canvas.setObjectName(title) 
    130132 
    131133    @property 
     
    271273        # Please remove me from your database. 
    272274        PlotHelper.deletePlot(PlotHelper.idOfPlot(self)) 
     275 
    273276        # Notify the listeners 
    274277        self.manager.communicator.activeGraphsSignal.emit(PlotHelper.currentPlots()) 
     278 
    275279        event.accept() 
    276280 
Note: See TracChangeset for help on using the changeset viewer.