Esempio n. 1
0
    def deleteAssociatedSubplots(self, ids):
        """
        Delete any subplots associated with the specified data or clustering ids
        
        @type ids: tuple
        @param ids: A tuple containing either a data ID and a clustering ID 
                    or a data ID and None.
        """
        all, figPlots = [ids[0]], {None: self.subplots}
        if ids[1] is None:
            DataStore.get(ids[0]).collectAllChildren(all)

        # add subplot lists from figures in the store
        for fID, fig in FigureStore.getFigures().items():
            if fID != FigureStore.getSelectedIndex():
                figPlots[fID] = fig.subplots

        # remove matching subplots from all figures
        for fID, plots in figPlots.items():
            toDelete = []
            for n, subplot in enumerate(plots):
                if subplot.dataIndex in all:
                    if ids[1] is None:
                        toDelete.append(n)
                    else:
                        if subplot.clustIndex == ids[1]:
                            toDelete.append(n)

            # delete flagged subplots by creating a new list w/o the deleted indices
            plots = [plots[i] for i in range(len(plots)) if not (i in toDelete)]
            if fID is None:
                self.subplots = plots
            else:
                FigureStore.get(fID).subplots = plots

            self.renumberPlots(fID)

        self.draw()
Esempio n. 2
0
    def renumberPlots(self, figureID=None):
        """ 
        Renumber the subplots and their titles by their position in the list
        beginning with 1.
        """
        fig = None, None
        if figureID is None:
            fig = self
        else:
            fig = FigureStore.get(figureID)

        # renumber
        for n, subplot in enumerate(fig.subplots):
            subplot.n = n + 1
            subplot.Title = subplot.Title.split(": ")[1]

        # set selected subplot
        ss = len(fig.subplots) if (len(fig.subplots) > 0) else None
        if figureID is None:
            self.SelectedSubplotIndex = ss
        else:
            fig.selectedSubplot = ss