Exemplo n.º 1
0
    def __init__(self, cmdargs, text=None, icon=None, parent=None, interactive=True):
        '''creator

        :param cmdargs: (list<str> or str) A list of strings to be passed to
                        :meth:`subprocess.Popen` for launching the external
                        application. It can also be a single string containing a
                        command. See :meth:`setCmdArgs`
        :param text: (str) see :class:`Qt.QAction`
        :param icon: (QIcon or any other object that can be passed to QIcon creator) see :class:`Qt.QAction`
        :param parent: (QObject) The parent object
        '''
        if isinstance(cmdargs, (basestring, Qt.QString)):
            import shlex
            cmdargs = shlex.split(str(cmdargs))
        self.path = os.path.realpath(cmdargs and cmdargs[0] or '')
        if text is None:
            text = os.path.basename(cmdargs and cmdargs[0] or '')
        if icon is None:
            icon = Qt.QIcon.fromTheme(self.DEFAULT_ICON_NAME)
        elif isinstance(icon, basestring):
            tmp = Qt.QIcon.fromTheme(icon)
            if not tmp.isNull():
                icon = tmp

        Qt.QAction.__init__(self, Qt.QIcon(icon), text, parent)
        BaseConfigurableClass.__init__(self)
        self.interactive = interactive
        self._process = []
        self.setCmdArgs(cmdargs)
        self.triggered.connect(self.actionTriggered)
        self.setToolTip("Launches %s (external application)" % text)
        self.registerConfigProperty(self.cmdArgs, self.setCmdArgs, 'cmdArgs')
Exemplo n.º 2
0
    def __init__(self,
                 parent=None,
                 period=0,
                 text="Forced read",
                 autoconnect=True):
        BaseConfigurableClass.__init__(self)
        QtGui.QWidgetAction.__init__(self, parent)

        # defining the widget
        self._w = QtGui.QWidget()
        self._w.setLayout(QtGui.QHBoxLayout())
        tt = "Period between forced readings.\nSet to 0 to disable"
        self._w.setToolTip(tt)
        self._label = QtGui.QLabel(text)
        self._w.layout().addWidget(self._label)
        self._sb = QtGui.QSpinBox()
        self._w.layout().addWidget(self._sb)
        self._sb.setRange(0, 604800000)
        self._sb.setValue(period)
        self._sb.setSingleStep(500)
        self._sb.setSuffix(" ms")
        self._sb.setSpecialValueText("disabled")
        self._autoconnect = autoconnect

        self.setDefaultWidget(self._w)

        # register config properties
        self.registerConfigProperty(self.period, self.setPeriod, "period")
        self.registerConfigProperty(self.autoconnect, self.setAutoconnect,
                                    "autoconnect")

        # internal conections
        self._sb.valueChanged[int].connect(self._onValueChanged)
Exemplo n.º 3
0
 def __init__(self, parent):
     Qt.QDialog.__init__(self, parent)
     BaseConfigurableClass.__init__(self)
     self._tabwidget = Qt.QTabWidget()
     self.setModal(True)
     self.externalAppsPage = None
     self.setLayout(Qt.QVBoxLayout())
     self.layout().addWidget(self._tabwidget)
Exemplo n.º 4
0
 def __init__(self, manager, scrollFactor=0.2, toolbar_id=None):
     ToggleTool.__init__(self, manager, title='Auto Scroll', icon=None,
             tip='Force X scale to always show the last value',
             toolbar_id=toolbar_id)
     BaseConfigurableClass.__init__(self)
     self.scrollFactor = scrollFactor
     self.registerConfigProperty(self.action.isChecked,
                                 self.setChecked,
                                 'actionChecked')
Exemplo n.º 5
0
Arquivo: tools.py Projeto: cmft/taurus
 def __init__(self, manager, scrollFactor=0.2, toolbar_id=None):
     ToggleTool.__init__(self, manager, title='Auto Scroll', icon=None,
             tip='Force X scale to always show the last value',
             toolbar_id=toolbar_id)
     BaseConfigurableClass.__init__(self)
     self.scrollFactor = scrollFactor
     self.registerConfigProperty(self.action.isChecked,
                                 self.action.setChecked,
                                 'actionChecked')
Exemplo n.º 6
0
    def applyConfig(self, configdict, depth=None):
        """
        Reimplemented from BaseConfigurableClass to manage the config
        properties of the curves attached to this plot
        """
        try:
            # Temporarily register curves as delegates
            tmpreg = []
            curves = []
            for name in configdict["__orderedConfigNames__"]:
                if name.startswith("__TaurusPlotDataItem_"):
                    # Instantiate empty TaurusPlotDataItem
                    curve = TaurusPlotDataItem()
                    curves.append(curve)
                    self.registerConfigDelegate(curve, name)
                    tmpreg.append(name)

            # remove the curves from the second axis (Y2) for avoid dups
            self._y2.clearItems()

            BaseConfigurableClass.applyConfig(self,
                                              configdict=configdict,
                                              depth=depth)

            # keep a dict of existing curves (to use it for avoiding dups)
            currentCurves = dict()
            for curve in self.getPlotItem().listDataItems():
                if isinstance(curve, TaurusPlotDataItem):
                    currentCurves[curve.getFullModelNames()] = curve

            # remove curves that exists in currentCurves, also remove from
            # the legend (avoid duplicates)
            for curve in curves:
                c = currentCurves.get(curve.getFullModelNames(), None)
                if c is not None:
                    self.getPlotItem().legend.removeItem(c.name())
                    self.getPlotItem().removeItem(c)

            # Add to plot **after** their configuration has been applied
            for curve in curves:
                # First we add all the curves in self. This way the plotItem
                # can keeps a list of dataItems (plotItem.listDataItems())
                self.addItem(curve)

                # Add curves to Y2 axis, when the curve configurations
                # have been applied.
                # Ideally, the Y2ViewBox class must handle the action of adding
                # curves to itself, but we want add the curves when they are
                # restored with all their properties.
                if curve.getFullModelNames() in self._y2.getCurves():
                    self.getPlotItem().getViewBox().removeItem(curve)
                    self._y2.addItem(curve)
        finally:
            # Ensure that temporary delegates are unregistered
            for n in tmpreg:
                self.unregisterConfigurableItem(n, raiseOnError=False)
Exemplo n.º 7
0
 def __init__(self, manager, axis, toolbar_id=None):
     ToggleTool.__init__(self,
                         manager,
                         title='Auto-scale %s axis' % axis,
                         icon=None,
                         tip='Auto-scale %s axis when data changes',
                         toolbar_id=toolbar_id)
     BaseConfigurableClass.__init__(self)
     self.axis = axis
     self.registerConfigProperty(self.action.isChecked, self.setChecked,
                                 'actionChecked')
Exemplo n.º 8
0
 def __init__(self, parent=None, **kwargs):
     BaseConfigurableClass.__init__(self)
     QtGui.QWidgetAction.__init__(self, parent)
     self._cb = QtGui.QCheckBox()
     self._cb.setText("Show legend")
     self.setDefaultWidget(self._cb)
     self.registerConfigProperty(
         self._cb.isChecked, self._cb.setChecked, "checked"
     )
     # TODO: register config prop for legend position
     self._cb.toggled.connect(self._onToggled)
     self._legend = None
     self._legend_kwargs = kwargs
Exemplo n.º 9
0
    def __init__(self, parent=None):
        BaseConfigurableClass.__init__(self)
        Qt.QWidgetAction.__init__(self, parent)
        self._cb = Qt.QCheckBox()
        self._cb.setText("Data Inspector")
        self._cb.toggled.connect(self._onToggled)
        self.setDefaultWidget(self._cb)

        self.plot_item = None
        self.enable = False
        self.data_inspector = DataInspectorLine()

        self.registerConfigProperty(self.isChecked, self.setChecked, "checked")
Exemplo n.º 10
0
    def __init__(self, parent=None, itemClass=None, showX=True):
        BaseConfigurableClass.__init__(self)
        Qt.QAction.__init__(self, "Model selection", parent)
        self.triggered.connect(self._onTriggered)
        self.plot_item = None
        self.legend = None
        self._curveColors = None
        if itemClass is None:
            itemClass = TaurusPlotDataItem
        self.itemClass = itemClass
        self._showX = showX

        self.registerConfigProperty(self._getCurveInfo,
                                    self._restoreCurvesFromInfo, "CurveInfo")
Exemplo n.º 11
0
    def __init__(self, parent=None, **kwargs):
        if Qt.QT_VERSION < 0x050000:
            # Workaround for issue when using super with pyqt<5
            BaseConfigurableClass.__init__(self)
            PlotWidget.__init__(self, parent=parent, **kwargs)
        else:
            super(TaurusPlot, self).__init__(parent=None, **kwargs)

        # set up cyclic color generator
        self._curveColors = LoopList(CURVE_COLORS)
        self._curveColors.setCurrentIndex(-1)

        # add save & retrieve configuration actions
        menu = self.getPlotItem().getViewBox().menu
        saveConfigAction = QtGui.QAction("Save configuration", menu)
        saveConfigAction.triggered.connect(self.saveConfigFile)
        menu.addAction(saveConfigAction)

        loadConfigAction = QtGui.QAction("Retrieve saved configuration", menu)
        loadConfigAction.triggered.connect(self.loadConfigFile)
        menu.addAction(loadConfigAction)

        self.registerConfigProperty(self._getState, self.restoreState, "state")

        # add legend tool
        legend_tool = PlotLegendTool(self)
        legend_tool.attachToPlotItem(self.getPlotItem())

        # add model chooser
        self._model_chooser_tool = TaurusXYModelChooserTool(self)
        self._model_chooser_tool.attachToPlotItem(self.getPlotItem(), self,
                                                  self._curveColors)

        # add Y2 axis
        self._y2 = Y2ViewBox()
        self._y2.attachToPlotItem(self.getPlotItem())

        # add plot configuration dialog
        cprop_tool = CurvesPropertiesTool(self)
        cprop_tool.attachToPlotItem(self.getPlotItem(), y2=self._y2)

        # add a data inspector
        inspector_tool = DataInspectorTool(self)
        inspector_tool.attachToPlotItem(self.getPlotItem())

        # Register config properties
        self.registerConfigDelegate(self._y2, "Y2Axis")
        self.registerConfigDelegate(legend_tool, "legend")
        self.registerConfigDelegate(inspector_tool, "inspector")
Exemplo n.º 12
0
 def __init__(self, parent=None):
     BaseConfigurableClass.__init__(self)
     QtGui.QAction.__init__(self, "Plot configuration", parent)
     self.triggered.connect(self._onTriggered)
     self.plot_item = None
     self.Y2Axis = None
     self.registerConfigProperty(
         self._getCurveAppearanceProperties,
         self._setCurveAppearanceProperties,
         "CurveProperties",
     )
     self.registerConfigProperty(
         self._getBackgroundColor,
         self._setBackgroundColor,
         "PlotBackground",
     )
Exemplo n.º 13
0
    def __init__(self, parent=None):
        Qt.QTreeView.__init__(self, parent)
        BaseConfigurableClass.__init__(self)
        self._idIndexDict = {}

        self.setSelectionBehavior(Qt.QTreeView.SelectRows)
        self.setSelectionMode(Qt.QTreeView.SingleSelection)
        self.setRootIsDecorated(False)
#        self.setItemsExpandable(False)
        self.setDragEnabled(True)
        self.setAcceptDrops(True)
        self.setTabKeyNavigation(True)
        self.setEditTriggers(Qt.QAbstractItemView.EditKeyPressed |
                             Qt.QAbstractItemView.CurrentChanged)
        self.setDropIndicatorShown(True)

        self.deleteAction = Qt.QAction(
            Qt.QIcon.fromTheme("list-remove"), "Remove macro", self)
        self.deleteAction.triggered.connect(self.deleteMacro)
        self.deleteAction.setToolTip(
            "Clicking this button will remove current macro.")

        self.moveUpAction = Qt.QAction(Qt.QIcon.fromTheme("go-up"), "Move up",
                                       self)
        self.moveUpAction.triggered.connect(self.upMacro)
        self.moveUpAction.setToolTip(
            "Clicking this button will move current macro up.")

        self.moveDownAction = Qt.QAction(
            Qt.QIcon.fromTheme("go-down"), "Move down", self)
        self.moveDownAction.triggered.connect(self.downMacro)
        self.moveDownAction.setToolTip(
            "Clicking this button will move current macro down.")

        self.moveLeftAction = Qt.QAction(
            Qt.QIcon.fromTheme("go-previous"), "Move left", self)
        self.moveLeftAction.triggered.connect(self.leftMacro)
        self.moveLeftAction.setToolTip(
            "Clicking this button will move current macro to the left.")

        self.moveRightAction = Qt.QAction(
            Qt.QIcon.fromTheme("go-next"), "Move right", self)
        self.moveRightAction.triggered.connect(self.rightMacro)
        self.moveRightAction.setToolTip(
            "Clicking this button will move current macro to the right.")
Exemplo n.º 14
0
    def __init__(self, parent=None):
        Qt.QTreeView.__init__(self, parent)
        BaseConfigurableClass.__init__(self)
        self._idIndexDict = {}

        self.setSelectionBehavior(Qt.QTreeView.SelectRows)
        self.setSelectionMode(Qt.QTreeView.SingleSelection)
        self.setRootIsDecorated(False)
#        self.setItemsExpandable(False)
        self.setDragEnabled(True)
        self.setAcceptDrops(True)
        self.setTabKeyNavigation(True)
        self.setEditTriggers(Qt.QAbstractItemView.EditKeyPressed |
                             Qt.QAbstractItemView.CurrentChanged)
        self.setDropIndicatorShown(True)

        self.deleteAction = Qt.QAction(
            getThemeIcon("list-remove"), "Remove macro", self)
        self.deleteAction.triggered.connect(self.deleteMacro)
        self.deleteAction.setToolTip(
            "Clicking this button will remove current macro.")

        self.moveUpAction = Qt.QAction(getThemeIcon("go-up"), "Move up", self)
        self.moveUpAction.triggered.connect(self.upMacro)
        self.moveUpAction.setToolTip(
            "Clicking this button will move current macro up.")

        self.moveDownAction = Qt.QAction(
            getThemeIcon("go-down"), "Move down", self)
        self.moveDownAction.triggered.connect(self.downMacro)
        self.moveDownAction.setToolTip(
            "Clicking this button will move current macro down.")

        self.moveLeftAction = Qt.QAction(
            getThemeIcon("go-previous"), "Move left", self)
        self.moveLeftAction.triggered.connect(self.leftMacro)
        self.moveLeftAction.setToolTip(
            "Clicking this button will move current macro to the left.")

        self.moveRightAction = Qt.QAction(
            getThemeIcon("go-next"), "Move right", self)
        self.moveRightAction.triggered.connect(self.rightMacro)
        self.moveRightAction.setToolTip(
            "Clicking this button will move current macro to the right.")
Exemplo n.º 15
0
    def __init__(
        self,
        parent=None,
        period=0,
        text="Change forced read period...",
        autoconnect=True,
    ):
        BaseConfigurableClass.__init__(self)
        QtGui.QAction.__init__(self, text, parent)
        tt = "Period between forced readings.\nSet to 0 to disable"
        self.setToolTip(tt)
        self._period = period
        self._autoconnect = autoconnect

        # register config properties
        self.registerConfigProperty(self.period, self.setPeriod, "period")
        self.registerConfigProperty(
            self.autoconnect, self.setAutoconnect, "autoconnect"
        )

        # internal conections
        self.triggered.connect(self._onTriggered)
Exemplo n.º 16
0
    def __init__(self,
                 cmdargs,
                 text=None,
                 icon=None,
                 parent=None,
                 interactive=True):
        '''creator

        :param cmdargs: (list<str> or str) A list of strings to be passed to
                        :meth:`subprocess.Popen` for launching the external
                        application. It can also be a single string containing a
                        command. See :meth:`setCmdArgs`
        :param text: (str) see :class:`Qt.QAction`
        :param icon: (QIcon or any other object that can be passed to QIcon creator) see :class:`Qt.QAction`
        :param parent: (QObject) The parent object
        '''
        if isinstance(cmdargs, string_types):
            import shlex
            cmdargs = shlex.split(str(cmdargs))
        self.path = os.path.realpath(cmdargs and cmdargs[0] or '')
        if text is None:
            text = os.path.basename(cmdargs and cmdargs[0] or '')
        if icon is None:
            icon = Qt.QIcon.fromTheme(self.DEFAULT_ICON_NAME)
        elif isinstance(icon, string_types):
            tmp = Qt.QIcon.fromTheme(icon)
            if not tmp.isNull():
                icon = tmp

        Qt.QAction.__init__(self, Qt.QIcon(icon), text, parent)
        BaseConfigurableClass.__init__(self)
        self.interactive = interactive
        self._process = []
        self.setCmdArgs(cmdargs)
        self.triggered.connect(partial(self.actionTriggered, args=None))
        self.setToolTip("Launches %s (external application)" % text)
        self.registerConfigProperty(self.cmdArgs, self.setCmdArgs, 'cmdArgs')
Exemplo n.º 17
0
    def createConfig(self, allowUnpickable=False):
        """
        Reimplemented from BaseConfigurableClass to manage the config
        properties of the curves attached to this plot
        """
        try:
            # Temporarily register curves as delegates
            tmpreg = []
            curve_list = self.getPlotItem().listDataItems()
            for idx, curve in enumerate(curve_list):
                if isinstance(curve, TaurusPlotDataItem):
                    name = "__TaurusPlotDataItem_%d__" % idx
                    tmpreg.append(name)
                    self.registerConfigDelegate(curve, name)

            configdict = copy.deepcopy(
                BaseConfigurableClass.createConfig(
                    self, allowUnpickable=allowUnpickable))

        finally:
            # Ensure that temporary delegates are unregistered
            for n in tmpreg:
                self.unregisterConfigurableItem(n, raiseOnError=False)
        return configdict
Exemplo n.º 18
0
    def __init__(self,
                 parent=None,
                 designMode=False,
                 toolbar=True,
                 stackMode='deltatime',
                 buffersize=512,
                 options=None,
                 autoscale='xyz',
                 **kwargs):
        """

        :param param: param to be passed to XYImageItem constructor
        :param buffersize: (int) size of the stack
        :param stackMode: (str) can be 'datetime', 'timedelta' or 'event'
        :param autoscale: (str) if autscale string contains 'x', the x axis 
                          will be autoscaled. Same with 'y' and 'z'.
                          Defaults to 'xyz'
        """
        """see :class:`guiqwt.plot.ImageDialog` for other valid initialization
        parameters"""
        defaultOptions = dict(lock_aspect_ratio=False)
        if options is not None:
            defaultOptions.update(options)
        ImageDialog.__init__(self,
                             parent=parent,
                             toolbar=toolbar,
                             options=defaultOptions,
                             **kwargs)
        TaurusBaseWidget.__init__(self, "TaurusTrend2DDialog")
        self.trendItem = None
        self.buffersize = buffersize
        self._useArchiving = False
        self._stackMode = stackMode
        self.setStackMode(stackMode)
        self.setWindowFlags(Qt.Qt.Widget)
        # add some tools
        for toolklass in (TaurusModelChooserTool, AutoScrollTool,
                          AutoScaleXTool, AutoScaleYTool, AutoScaleZTool):
            self.add_tool(toolklass)
        self.get_tool(TaurusModelChooserTool).singleModel = True

        if 'x' in autoscale.lower():
            self.get_tool(AutoScaleXTool).setChecked(True)
        if 'y' in autoscale.lower():
            self.get_tool(AutoScaleYTool).setChecked(True)
        if 'z' in autoscale.lower():
            self.get_tool(AutoScaleZTool).setChecked(True)

        self.setModifiableByUser(self._modifiableByUser)
        self.setContextMenuPolicy(Qt.Qt.CustomContextMenu)

        # Config properties
        self.setModelInConfig(True)
        self.registerConfigDelegate(self.trendItem or BaseConfigurableClass(),
                                    name='trendItem')
        self.registerConfigDelegate(self.get_tool(AutoScrollTool),
                                    name='AutoScrollTool')
        self.registerConfigDelegate(self.get_tool(AutoScaleXTool),
                                    name='AutoScaleXTool')
        self.registerConfigDelegate(self.get_tool(AutoScaleYTool),
                                    name='AutoScaleYTool')
        self.registerConfigDelegate(self.get_tool(AutoScaleZTool),
                                    name='AutoScaleZTool')
        self.registerConfigProperty(self.getStackMode, self.setStackMode,
                                    'stackMode')
        self.registerConfigProperty(self._get_axes_conf, self._set_axes_conf,
                                    'axes_confs')
Exemplo n.º 19
0
    def fillTaurusConfig(self, item, configdict):
        '''
        Fills the non-top nodes of the dictionary recursively.

        :param item: (Qt.QStandardItem) parent item
        :param configdict: (dict) a configuration dictionary.  See :class:`BaseConfigurableClass`
        '''
        if not BaseConfigurableClass.isTaurusConfig(configdict):
            return
        # fill the registered keys
        registeredkeys = configdict.get('__orderedConfigNames__', [])
        valuesdict = configdict.get('__itemConfigurations__', {})
        for k in registeredkeys:
            value = valuesdict[k]
            child = Qt.QStandardItem(k)
            if BaseConfigurableClass.isTaurusConfig(value):
                child.setEditable(False)
                item.appendRow(child)

                txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                path = Qt.QVariant(txt + ";__itemConfigurations__;" + k)
                child.setData(path, Qt.Qt.UserRole)
                # recursive call to fill all nodes
                self.fillTaurusConfig(child, value)
            else:
                typeV = Qt.QStandardItem(repr(type(value)))
                valueV = Qt.QStandardItem(repr(value))

                typeV.setForeground(Qt.QBrush(Qt.QColor('gray')))
                child.setForeground(Qt.QBrush(Qt.QColor('gray')))

                item.appendRow([child, typeV, valueV])

                txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                path = Qt.QVariant(txt + ";__itemConfigurations__;" + k)
                child.setEditable(False)
                typeV.setEditable(False)

                child.setData(path, Qt.Qt.UserRole)
                typeV.setData(path, Qt.Qt.UserRole)
                valueV.setData(path, Qt.Qt.UserRole)

        customkeys = [k for k in configdict if k not in (
            '__orderedConfigNames__', '__itemConfigurations__', 'ConfigVersion', '__pickable__')]
        if len(customkeys) > 0:

            custom = Qt.QStandardItem('[custom]')
            item.appendRow(custom)
            custom.setEditable(False)
            # custom.setSelectable(False)
            custom.setBackground(Qt.QBrush(Qt.QColor('gray')))
            for k in customkeys:
                value = configdict[k]
                child = Qt.QStandardItem(str(k))
                # item.appendRow(child)

                if BaseConfigurableClass.isTaurusConfig(value):
                    child.setEditable(False)
                    item.appendRow(child)
                    txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                    path = Qt.QVariant(txt + ";" + k)
                    child.setData(path, Qt.Qt.UserRole)
                    # recursive call to fill all nodes
                    self.fillTaurusConfig(child, value)
                else:
                    typeV = Qt.QStandardItem(repr(type(value)))
                    valueV = Qt.QStandardItem(repr(value))
                    typeV.setForeground(Qt.QBrush(Qt.QColor('gray')))
                    child.setForeground(Qt.QBrush(Qt.QColor('gray')))
                    item.appendRow([child, typeV, valueV])
                    txt = Qt.from_qvariant(item.data(Qt.Qt.UserRole), str)
                    path = Qt.QVariant(txt + ";" + k)

                    child.setData(path, Qt.Qt.UserRole)
                    child.setEditable(False)
                    typeV.setEditable(False)
                    typeV.setData(path, Qt.Qt.UserRole)
                    valueV.setData(path, Qt.Qt.UserRole)
Exemplo n.º 20
0
    def __init__(self, parent=None, **kwargs):

        if Qt.QT_VERSION < 0x050000:
            # Workaround for issue when using super with pyqt<5
            BaseConfigurableClass.__init__(self)
            PlotWidget.__init__(self, parent=parent, **kwargs)
        else:
            super(TaurusTrend, self).__init__(parent=parent, **kwargs)

        # Compose with a Logger
        self._logger = Logger(name=self.__class__.__name__)
        self.debug = self._logger.debug
        self.info = self._logger.info
        self.warning = self._logger.warning
        self.error = self._logger.error

        # set up cyclic color generator
        self._curveColors = LoopList(CURVE_COLORS)
        self._curveColors.setCurrentIndex(-1)

        plot_item = self.getPlotItem()
        menu = plot_item.getViewBox().menu

        # add save & retrieve configuration actions
        saveConfigAction = QtGui.QAction("Save configuration", menu)
        saveConfigAction.triggered.connect(self.saveConfigFile)
        menu.addAction(saveConfigAction)

        loadConfigAction = QtGui.QAction("Retrieve saved configuration", menu)
        loadConfigAction.triggered.connect(self.loadConfigFile)
        menu.addAction(loadConfigAction)

        self.registerConfigProperty(self._getState, self.restoreState, "state")

        # add legend tool
        legend_tool = PlotLegendTool(self)
        legend_tool.attachToPlotItem(plot_item)

        # add model chooser
        self._model_chooser_tool = TaurusXYModelChooserTool(
            self, itemClass=TaurusTrendSet, showX=False)
        self._model_chooser_tool.attachToPlotItem(self.getPlotItem(), self,
                                                  self._curveColors)

        # add Y2 axis
        self._y2 = Y2ViewBox()
        self._y2.attachToPlotItem(plot_item)

        # Add time X axis
        axis = DateAxisItem(orientation="bottom")
        axis.attachToPlotItem(plot_item)

        # add plot configuration dialog
        self._cprop_tool = CurvesPropertiesTool(self)
        self._cprop_tool.attachToPlotItem(plot_item, y2=self._y2)

        # add data inspector widget
        inspector_tool = DataInspectorTool(self)
        inspector_tool.attachToPlotItem(self.getPlotItem())

        # add force read tool
        self._fr_tool = ForcedReadTool(self)
        self._fr_tool.attachToPlotItem(self.getPlotItem())

        # Add the auto-pan ("oscilloscope mode") tool
        self._autopan = XAutoPanTool()
        self._autopan.attachToPlotItem(self.getPlotItem())

        # Register config properties
        self.registerConfigDelegate(self._model_chooser_tool, "XYmodelchooser")
        # self.registerConfigDelegate(self._y2, "Y2Axis")
        self.registerConfigDelegate(self._cprop_tool, "CurvePropertiesTool")
        self.registerConfigDelegate(legend_tool, "legend")
        self.registerConfigDelegate(self._fr_tool, "forceread")
        self.registerConfigDelegate(inspector_tool, "inspector")