当前位置: 首页>>代码示例>>Python>>正文


Python QtBlissGraph.setAutoLegend方法代码示例

本文整理汇总了Python中PyMca.QtBlissGraph.QtBlissGraph.setAutoLegend方法的典型用法代码示例。如果您正苦于以下问题:Python QtBlissGraph.setAutoLegend方法的具体用法?Python QtBlissGraph.setAutoLegend怎么用?Python QtBlissGraph.setAutoLegend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyMca.QtBlissGraph.QtBlissGraph的用法示例。


在下文中一共展示了QtBlissGraph.setAutoLegend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SoleilScanPlotBrick

# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setAutoLegend [as 别名]
class SoleilScanPlotBrick(BlissWidget):
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSlot("newScan", ())

        self.defineSlot("newScanPoint", ())

        self.scanObject = None
        self.xdata = []
        self.ydata = []

        self.isConnected = None
        self.canAddPoint = True

        self.addProperty("specVersion", "string", "")
        self.addProperty("backgroundColor", "combo", ("white", "default"), "white")
        self.addProperty("graphColor", "combo", ("white", "default"), "white")
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)

        QObject.connect(
            self.graph, PYSIGNAL("QtBlissGraphSignal"), self.handleBlissGraphSignal
        )
        QObject.disconnect(
            self.graph,
            SIGNAL("plotMousePressed(const QMouseEvent&)"),
            self.graph.onMousePressed,
        )
        QObject.disconnect(
            self.graph,
            SIGNAL("plotMouseReleased(const QMouseEvent&)"),
            self.graph.onMouseReleased,
        )
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)

    def propertyChanged(self, property, oldValue, newValue):
        if property == "specVersion":
            if self.scanObject is not None:
                self.safeDisconnect()

            self.scanObject = None
            if self.scanObject is not None:
                self.safeConnect()

        elif property == "backgroundColor":
            if newValue == "white":
                self.setPaletteBackgroundColor(Qt.white)
            elif newValue == "default":
                self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))

        elif property == "graphColor":
            if newValue == "white":
                self.graph.canvas().setPaletteBackgroundColor(Qt.white)
            elif newValue == "default":
                self.graph.canvas().setPaletteBackgroundColor(
                    QWidget.paletteBackgroundColor(self)
                )

        else:
            BlissWidget.propertyChanged(self, property, oldValue, newValue)

    def newScan(self, scanParameters):
        logging.info("newScan scanParameters %s" % str(scanParameters))
        self.lblTitle.setText("<nobr><b>%s</b></nobr>" % scanParameters["title"])
        self.graph.xlabel(scanParameters["xlabel"])
        self.graph.ylabel(scanParameters["ylabel"])
        self.graph.setx1timescale(False)
        self.xdata = []
        self.ydata = []
        self.graph.newcurve("scan", self.xdata, self.ydata)
        self.graph.replot()

    def newScanPoint(self, x, y):
        logging.info("newScanPoint x %s, y %s" % (x, y))
        self.xdata.append(x)
        self.ydata.append(y)
        self.graph.newcurve("scan", self.xdata, self.ydata, curveinfo="bo-")
        self.graph.replot()

    def handleBlissGraphSignal(self, signalDict):
#.........这里部分代码省略.........
开发者ID:IvarsKarpics,项目名称:mxcube,代码行数:103,代码来源:SoleilScanPlotBrick.py

示例2: SpecScanPlotBrick

# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setAutoLegend [as 别名]
class SpecScanPlotBrick(BlissWidget):
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSignal('newScan', ())

        self.scanObject = None
        self.xdata = []
        self.ylable = ""
        self.mylog = 0

        self.isConnected = None
        #self.canAddPoint = None
        self.canAddPoint = True

        self.addProperty('specVersion', 'string', '')
        self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white')
        self.addProperty('graphColor', 'combo', ('white', 'default'), 'white')
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        #self.cmdZoomIn = QToolButton(buttonBox)
        #self.cmdZoomOut = QToolButton(buttonBox)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)
                         
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
        QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
        QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
        #QObject.connect(self.cmdZoomIn, SIGNAL('clicked()'), self.cmdZoomInClicked)
        #QObject.connect(self.cmdZoomOut, SIGNAL('clicked()'), self.cmdZoomOutClicked)

        #self.cmdZoomIn.setIconSet(QIconSet(Icons.load("zoomin")))
        #self.cmdZoomOut.setIconSet(QIconSet(Icons.load("zoomout")))
        #self.cmdZoomIn.setToggleButton(True)
        #self.cmdZoomOut.setToggleButton(True)
        #self.cmdZoomIn.setUsesTextLabel(False)
        #self.cmdZoomOut.setUsesTextLabel(False)
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)


    def propertyChanged(self, property, oldValue, newValue):
        if property == 'specVersion':
            if self.scanObject is not None:
                self.safeDisconnect()
                
            self.scanObject = QSpecScan(newValue)

            if self.scanObject is not None:
                self.safeConnect()

        elif property == 'backgroundColor':
            if newValue == 'white':
                self.setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))
        
        elif property == 'graphColor':
            if newValue == 'white':
                self.graph.canvas().setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.graph.canvas().setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))

        else:
            BlissWidget.propertyChanged(self,property,oldValue,newValue)
               

    def newScan(self, scanParameters):
        #self.canAddPoint = True
        self.emit(PYSIGNAL('newScan'), ())
        self.lblTitle.setText('<nobr><b>%s</b></nobr>' % scanParameters['title'])
        self.xdata = []

        self.graph.clearcurves()
        self.graph.xlabel(scanParameters['xlabel'])
        self.ylabel = scanParameters['ylabel']

        ylabels = self.ylabel.split()
        self.ydatas = [[] for x in range(len(ylabels))]
        for labels,ydata in zip(ylabels,self.ydatas):
            self.graph.newcurve(labels,self.xdata,ydata)
            
        
        self.graph.ylabel(self.ylabel)
#.........这里部分代码省略.........
开发者ID:MartinSavko,项目名称:mxcube,代码行数:103,代码来源:SpecScanPlotBrick.py

示例3: BlissScanPlotBrick

# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setAutoLegend [as 别名]
class BlissScanPlotBrick(BlissWidget):
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSignal('newScan', ())

        self.scanObject = None
        self.xdata = []
        self.ylable = ""
        self.mylog = 0
        self.canAddPoint = True
        self.dm = DataManager()
        event.connect(self.dm, "scan_new", self.newScan)
        event.connect(self.dm, "scan_data", self.newScanPoint)

        self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white')
        self.addProperty('graphColor', 'combo', ('white', 'default'), 'white')
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)
                         
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
        QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
        QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
 
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)


    def propertyChanged(self, property, oldValue, newValue):
        if property == 'backgroundColor':
            if newValue == 'white':
                self.setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))
        
        elif property == 'graphColor':
            if newValue == 'white':
                self.graph.canvas().setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.graph.canvas().setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))
        else:
            BlissWidget.propertyChanged(self,property,oldValue,newValue)
               
    #def newScan(self, dm, scan_id, filename, motors, npoints, counters, save_flag=True):
    def newScan(self, scan_id, filename, motors, npoints, counters, save_flag=True):
        self.emit(PYSIGNAL('newScan'), ())
        self.lblTitle.setText('<nobr><b>%s</b></nobr>' % filename)
        self.xdata = []

        self.graph.clearcurves()
        #self.graph.xlabel(scanParameters['xlabel'])
        self.graph.xlabel("Energy")
        self.ylabel = "Counts"

        ylabels = self.ylabel.split()
        self.ydatas = [[] for x in range(len(ylabels))]
        for labels,ydata in zip(ylabels,self.ydatas):
            self.graph.newcurve(labels,self.xdata,ydata)
            
        self.graph.ylabel(self.ylabel)
        if motors == 'Time':
            self.graph.setx1timescale(True)
        else:
            self.graph.setx1timescale(False)

        self.graph.replot()
        
    def newScanPoint(self, scan_id, values):
        x = values[0]
        self.xdata.append(x)
        for label,ydata,yvalue in zip(self.ylabel.split(),self.ydatas,values[1:]):
            ydata.append(float(yvalue))
            self.graph.newcurve(label,self.xdata,ydata)
        self.graph.replot()
        
    def handleBlissGraphSignal(self, signalDict):
        if signalDict['event'] == 'MouseAt':
            self.lblPosition.setText("(X: %f, Y: %f)" % (signalDict['x'], signalDict['y']))
开发者ID:MartinSavko,项目名称:mxcube,代码行数:98,代码来源:BlissScanPlotBrick.py

示例4: SoleilScanPlotBrick

# 需要导入模块: from PyMca.QtBlissGraph import QtBlissGraph [as 别名]
# 或者: from PyMca.QtBlissGraph.QtBlissGraph import setAutoLegend [as 别名]
class SoleilScanPlotBrick(BlissWidget):
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.defineSlot('newScan', ())
	
        self.defineSlot('newScanPoint',())

        self.scanObject = None
        self.xdata = []
        self.ydata = []

        self.isConnected = None
        self.canAddPoint = True

        self.addProperty('specVersion', 'string', '')
        self.addProperty('backgroundColor', 'combo', ('white', 'default'), 'white')
        self.addProperty('graphColor', 'combo', ('white', 'default'), 'white')
        self.lblTitle = QLabel(self)
        self.graphPanel = QFrame(self)
        buttonBox = QHBox(self)
        self.lblPosition = QLabel(buttonBox)
        self.graph = QtBlissGraph(self.graphPanel)
                         
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.handleBlissGraphSignal)
        QObject.disconnect(self.graph, SIGNAL('plotMousePressed(const QMouseEvent&)'), self.graph.onMousePressed)
        QObject.disconnect(self.graph, SIGNAL('plotMouseReleased(const QMouseEvent&)'), self.graph.onMouseReleased)
        self.graph.canvas().setMouseTracking(True)
        self.graph.enableLegend(False)
        self.graph.enableZoom(False)
        self.graph.setAutoLegend(False)
        self.lblPosition.setAlignment(Qt.AlignRight)
        self.lblTitle.setAlignment(Qt.AlignHCenter)
        self.lblTitle.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lblPosition.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        buttonBox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        
        QVBoxLayout(self.graphPanel)
        self.graphPanel.layout().addWidget(self.graph)

        QVBoxLayout(self)
        self.layout().addWidget(self.lblTitle)
        self.layout().addWidget(buttonBox)
        self.layout().addWidget(self.graphPanel)


    def propertyChanged(self, property, oldValue, newValue):
        if property == 'specVersion':
            if self.scanObject is not None:
                self.safeDisconnect()
                
            self.scanObject = None
            if self.scanObject is not None:
                self.safeConnect()

        elif property == 'backgroundColor':
            if newValue == 'white':
                self.setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))
        
        elif property == 'graphColor':
            if newValue == 'white':
                self.graph.canvas().setPaletteBackgroundColor(Qt.white)
            elif newValue == 'default':
                self.graph.canvas().setPaletteBackgroundColor(QWidget.paletteBackgroundColor(self))

        else:
            BlissWidget.propertyChanged(self,property,oldValue,newValue)
               

    def newScan(self, scanParameters):
        logging.info('newScan scanParameters %s' % str(scanParameters) )
        self.lblTitle.setText('<nobr><b>%s</b></nobr>' % scanParameters['title'])
        self.graph.xlabel(scanParameters['xlabel'])
        self.graph.ylabel(scanParameters['ylabel'])
        self.graph.setx1timescale(False)
        self.xdata = []
        self.ydata = []
        self.graph.newcurve('scan', self.xdata, self.ydata)
        self.graph.replot() 

    def newScanPoint(self, x, y):
        logging.info('newScanPoint x %s, y %s' % (x,y))
        self.xdata.append(x)
        self.ydata.append(y)
        self.graph.newcurve('scan', self.xdata, self.ydata, curveinfo='bo-')
        self.graph.replot() 
        
    def handleBlissGraphSignal(self, signalDict):
        if signalDict['event'] == 'MouseAt':
            self.lblPosition.setText("(X: %f, Y: %f)" % (signalDict['x'], signalDict['y']))


    def safeConnect(self):
        if not self.isConnected:
            self.connect(self.scanObject, PYSIGNAL('newScanPoint'), self.newScan)
            self.connect(self.scanObject, PYSIGNAL('newPoint'), self.newScanPoint)
            self.isConnected=True

#.........这里部分代码省略.........
开发者ID:douglasbeniz,项目名称:mxcube,代码行数:103,代码来源:SoleilScanPlotBrick.py


注:本文中的PyMca.QtBlissGraph.QtBlissGraph.setAutoLegend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。