Esempio n. 1
0
    def _updateTemporaryTrends1D(self, trends1d):
        '''adds necessary trend1D panels and removes no longer needed ones

        :param trends1d: (dict) A dict whose keys are tuples of axes and
                         whose values are list of model names to plot

        :returns: (tuple) two lists new,rm:new contains the names of the new
                  panels and rm contains the names of the removed panels
        '''
        from taurus.qt.qtgui.plot import TaurusTrend
        newpanels = []
        for axes, plotables in trends1d.items():
            if not axes:
                continue
            if axes not in self._trends1d:
                w = TaurusTrend()
                w.setXIsTime(False)
                w.setScanDoor(self.getModelObj().fullname)
                # TODO: use a standard key for <idx> and <mov>
                w.setScansXDataKey(axes[0])
                pname = u'Trend1D - %s' % ":".join(axes)
                panel = self.createPanel(w,
                                         pname,
                                         registerconfig=False,
                                         permanent=False)
                try:  # if the panel is a dockwidget, raise it
                    panel.raise_()
                except:
                    pass
                self._trends1d[axes] = pname
                newpanels.append(pname)

            widget = self.getPanelWidget(self._trends1d[axes])
            flt = ChannelFilter(plotables)
            widget.onScanPlotablesFilterChanged(flt)

        # remove trends that are no longer configured
        removedpanels = []
        olditems = list(self._trends1d.items())
        for axes, name in olditems:
            if axes not in trends1d:
                removedpanels.append(name)
                self.removePanel(name)
                self._trends1d.pop(axes)

        return newpanels, removedpanels
Esempio n. 2
0
    def _updateTemporaryTrends1D(self, trends1d):
        '''adds necessary trend1D panels and removes no longer needed ones

        :param trends1d: (dict) A dict whose keys are tuples of axes and
                         whose values are list of model names to plot

        :returns: (tuple) two lists new,rm:new contains the names of the new
                  panels and rm contains the names of the removed panels
        '''
        from taurus.qt.qtgui.plot import TaurusTrend  # TODO: use tpg instead!
        newpanels = []
        for axes, plotables in trends1d.items():
            if not axes:
                continue
            if axes not in self._trends1d:
                w = TaurusTrend()
                w.setXIsTime(False)
                w.setScanDoor(self.getModelObj().fullname)
                # TODO: use a standard key for <idx> and <mov>
                w.setScansXDataKey(axes[0])
                pname = u'Trend1D - %s' % ":".join(axes)
                panel = self.createPanel(w, pname, registerconfig=False,
                                         permanent=False)
                try:  # if the panel is a dockwidget, raise it
                    panel.raise_()
                except Exception:
                    pass
                self._trends1d[axes] = pname
                newpanels.append(pname)

            widget = self.getPanelWidget(self._trends1d[axes])
            flt = ChannelFilter(plotables)
            widget.onScanPlotablesFilterChanged(flt)

        # remove trends that are no longer configured
        removedpanels = []
        olditems = list(self._trends1d.items())
        for axes, name in olditems:
            if axes not in trends1d:
                removedpanels.append(name)
                self.removePanel(name)
                self._trends1d.pop(axes)

        return newpanels, removedpanels