def setModel(self, doorname): '''reimplemented from :meth:`TaurusBaseComponent` :param doorname: (str) device name corresponding to a Door device. ''' TaurusBaseComponent.setModel(self, doorname) # self._onDoorChanged(doorname) if not doorname: return self.door = self.getModelObj() if not isinstance(self.door, Qt.QObject): msg = "Unexpected type (%s) for %s" % (repr(type( self.door)), doorname) Qt.QMessageBox.critical(self.parent(), 'Door connection error', msg) return self._checkJsonRecorder() # read the expconf expconf = self.door.getExperimentConfiguration() self.onExpConfChanged(expconf) # Connect experimentConfigurationChanged signal, # The event can be emitted by parents like expconf or emitted by QDoor if self._parent_can_notify_changes: self.parent().experimentConfigurationChanged.connect( self.onExpConfChanged) else: self.door.recordDataUpdated.connect(self.onRecordDataUpdated) self.old_arg = None
def __init__(self, *args, **kwargs): """ Accepts same args and kwargs as PlotDataItem, plus: :param xModel: (str) Taurus model name for abscissas values. Default=None :param yModel: (str) Taurus model name for ordinate values. Default=None :param colors: (generator) An infinite generator of QColor objects """ xModel = kwargs.pop("xModel", None) yModel = kwargs.pop("yModel", None) colors = kwargs.pop("colors", LoopList(CURVE_COLORS)) if "pen" not in kwargs: kwargs["pen"] = next(colors) PlotDataItem.__init__(self, *args, **kwargs) TaurusBaseComponent.__init__(self, "TaurusBaseComponent") self._x = None self._y = None self.xModel = None if xModel is not None: self.setXModel(xModel) if yModel is not None: self.setModel(yModel) self.registerConfigProperty(self.getOpts, self.setOpts, "opts") self.setModelInConfig(True) self.registerConfigProperty( self.getXModelName, self.setXModel, "XModel" )
def __init__(self, plot=None, parent=None): Qt.QObject.__init__(self, parent) TaurusBaseComponent.__init__(self, self.__class__.__name__) self._group_mode = self.XAxis self.plot = plot or MultiPlotWidget()
def __init__(self, param=None, buffersize=512, stackMode='datetime'): """ :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' """ XYImageItem.__init__(self, numpy.arange(2), numpy.arange(2), numpy.zeros((2, 2)), param=param) TaurusBaseComponent.__init__(self, self.__class__.__name__) self.maxBufferSize = buffersize self._yValues = None self._xBuffer = None self._zBuffer = None self.stackMode = stackMode self.set_interpolation(INTERP_NEAREST) self.__timeOffset = None # Config properties self.registerConfigProperty(self.get_lut_range, self.set_lut_range, 'lut_range') self.registerConfigProperty(self._get_interpolation_cfg, self._set_interpolation_cfg, 'interpolation') self.registerConfigProperty(self.get_color_map_name, self.set_color_map, 'color_map')
def applyConfig(self, configdict, depth=None): """ Reimplemented from BaseConfigurableClass to manage the config properties of the trendsets attached to this plot """ try: # Temporarily register trendsets as delegates tmpreg = [] tsets = [] for name in configdict['__orderedConfigNames__']: if name.startswith('__TaurusTrendSet_'): # Instantiate empty TaurusTrendSet tset = TaurusTrendSet() tsets.append(tset) self.registerConfigDelegate(tset, name) tmpreg.append(name) # remove the trendsets from the second axis (Y2) to avoid dups self._y2.clearItems() TaurusBaseComponent.applyConfig(self, configdict=configdict, depth=depth) plot_item = self.getPlotItem() legend = plot_item.legend # keep a dict of existing trendsets (to use it for avoiding dups) currentTrendSets = dict() curveNames = [] for tset in plot_item.listDataItems(): if isinstance(tset, TaurusTrendSet): currentTrendSets[tset.getFullModelName()] = tset curveNames.extend([c.name for c in tset]) # remove trendsets that exists in currentTrendSets from plot # (to avoid duplicates). Also remove curves from the legend for tset in tsets: ts = currentTrendSets.get(tset.getFullModelName(), None) if ts is not None: plot_item.removeItem(ts) # Add to plot **after** their configuration has been applied for tset in tsets: # First we add all the trendsets to self. This way the plotItem # can keep a list of dataItems (PlotItem.listDataItems()) self.addItem(tset) # Add trendsets to Y2 axis, when the trendset configurations # have been applied. # Ideally, the Y2ViewBox class must handle the action of adding # trendsets to itself, but we want add the trendsets when they # are restored with all their properties. if tset.getFullModelName() in self._y2.getCurves(): plot_item.getViewBox().removeItem(tset) self._y2.addItem(tset) finally: # Ensure that temporary delegates are unregistered for n in tmpreg: self.unregisterConfigurableItem(n, raiseOnError=False)
def __init__(self, parent=None): Qt.QObject.__init__(self, parent) TaurusBaseComponent.__init__(self, self.__class__.__name__) self.__panels = {} self._trends1d = {} self._trends2d = {}
def __init__(self, xmodel=None, id=None): Qt.QObject.__init__(self) TaurusBaseComponent.__init__(self, self.__class__.__name__) self._attrnamevalidator = ATTRNAMEVALIDATOR self.id = id self.sev = SafeEvaluator() self._referencedQAttrs = [] self.value = None self._setExtendedModel(xmodel)
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() TaurusBaseComponent.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)
def setModel(self, model): # do the standard stuff TaurusBaseComponent.setModel(self, model) #... and fire a fake event for initialization try: value = self.getModelObj().read() self.fireEvent( self, taurus.core.taurusbasetypes.TaurusEventType.Change, value) except: pass
def __init__(self, param=None, buffersize=512, stackMode='datetime'): XYImageItem.__init__(self, numpy.arange(2), numpy.arange( 2), numpy.zeros((2, 2)), param=param) TaurusBaseComponent.__init__(self, self.__class__.__name__) self.maxBufferSize = buffersize self._yValues = None self._xBuffer = None self._zBuffer = None self.stackMode = stackMode self.set_interpolation(INTERP_NEAREST) self.__timeOffset = None
def __init__(self, curveparam=None, taurusparam=None): CurveItem.__init__(self, curveparam=curveparam) TaurusBaseComponent.__init__(self, self.__class__.__name__) # I need to do this because I am not using the standard model attach # mechanism self.taurusEvent.connect(self.filterEvent) self._xcomp = None self._ycomp = None if taurusparam is None: taurusparam = TaurusCurveParam() self.taurusparam = taurusparam
def __init__(self, parent=None): Qt.QObject.__init__(self, parent) TaurusBaseComponent.__init__(self, self.__class__.__name__) self._group_mode = self.XAxis Qt.qApp.SDM.connectWriter("shortMessage", self, 'newShortMessage') self._plot = MultiPlotWidget() self.createPanel(self._plot, 'Scan plot', registerconfig=False, permanent=False)
def __init__(self, parent=None): Qt.QObject.__init__(self, parent) TaurusBaseComponent.__init__(self, self.__class__.__name__) self.__panels = {} self._trends1d = {} self._trends2d = {} self._parent_can_notify_changes = False if hasattr(parent, 'experimentConfigurationChanged'): self._parent_can_notify_changes = True
def __init__(self, curveparam=None, taurusparam=None): CurveItem.__init__(self, curveparam=curveparam) TaurusBaseComponent.__init__(self, self.__class__.__name__) self.__xBuffer = None self.__yBuffer = None self.__timeOffset = None if taurusparam is None: taurusparam = TaurusTrendParam() self.taurusparam = taurusparam self.updateTaurusParams()
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( TaurusBaseComponent.createConfig( self, allowUnpickable=allowUnpickable)) finally: # Ensure that temporary delegates are unregistered for n in tmpreg: self.unregisterConfigurableItem(n, raiseOnError=False) return configdict
def __init__(self,api,qtparent,tauparent=None): QtGui.QListWidgetItem.__init__(self) TaurusBaseComponent.__init__(self,tauparent) self.api = api self.qtparent = qtparent self.alarm = None self.alarmDisabled = None self.alarmAcknowledged = None self.font=QtGui.QFont(QtCore.QString("Courier")) self.font.setPointSize(10) self.setFont(self.font) self.errors = 0 self.status = '' self.changed = False #This flag should be kept until updateStyle is called!!! self.quality = None self.setTextAlignment(Qt.Qt.AlignLeft)
def __init__(self, api, qtparent, tauparent=None): QtGui.QListWidgetItem.__init__(self) TaurusBaseComponent.__init__(self, tauparent) self.api = api self.qtparent = qtparent self.alarm = None self.alarmDisabled = None self.alarmAcknowledged = None self.font = QtGui.QFont(QtCore.QString("Courier")) self.font.setPointSize(10) self.setFont(self.font) self.errors = 0 self.status = '' self.changed = False #This flag should be kept until updateStyle is called!!! self.quality = None self.setTextAlignment(Qt.Qt.AlignLeft)
def __init__(self, parent=None, **kwargs): TaurusBaseComponent.__init__(self, 'TaurusPlot') PlotWidget.__init__(self, parent=parent, **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 model_chooser_tool = TaurusXYModelChooserTool(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) # Register config properties self.registerConfigDelegate(self._y2, 'Y2Axis') self.registerConfigDelegate(legend_tool, 'legend')
def setModel(self, doorname): '''reimplemented from :meth:`TaurusBaseComponent` :param doorname: (str) device name corresponding to a Door device. ''' TaurusBaseComponent.setModel(self, doorname) # self._onDoorChanged(doorname) if not doorname: return door = self.getModelObj() if not isinstance(door, Qt.QObject): msg = "Unexpected type (%s) for %s" % (repr(type(door)), doorname) Qt.QMessageBox.critical(self.parent(), 'Door connection error', msg) return self._checkJsonRecorder() # read the expconf expconf = door.getExperimentConfiguration() self.onExpConfChanged(expconf)
def setModel(self, doorname): '''reimplemented from :meth:`TaurusBaseComponent` :param doorname: (str) device name corresponding to a Door device. ''' TaurusBaseComponent.setModel(self, doorname) # self._onDoorChanged(doorname) if not doorname: return self.door = self.getModelObj() if not isinstance(self.door, Qt.QObject): msg = "Unexpected type (%s) for %s" % (repr(type( self.door)), doorname) Qt.QMessageBox.critical(self.parent(), 'Door connection error', msg) return self._checkJsonRecorder() self.door.recordDataUpdated.connect(self.onRecordDataUpdated) self.message_template = 'Ready!'
def setModel(self, doorname): '''reimplemented from :meth:`TaurusBaseComponent` :param doorname: (str) device name corresponding to a Door device. ''' TaurusBaseComponent.setModel(self, doorname) # self._onDoorChanged(doorname) if not doorname: return door = self.getModelObj() if not isinstance(door, Qt.QObject): msg = "Unexpected type (%s) for %s" % (repr(type(door)), doorname) Qt.QMessageBox.critical( self.parent(), 'Door connection error', msg) return self._checkJsonRecorder() # read the expconf expconf = door.getExperimentConfiguration() self.onExpConfChanged(expconf)
def __init__(self, classname): TaurusBaseComponent.__init__(self, classname) self._signalGen = Qt.QObject()
def __init__(self, *args, **kwargs): ImageItem.__init__(self, *args, **kwargs) TaurusBaseComponent.__init__(self, "TaurusImageItem")