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


Python QtBlissGraph.setPaletteBackgroundColor方法代码示例

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


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

示例1: LakeshoreBrick

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

        self.addProperty("mnemonic", "string", "")
        self.addProperty("unit", "combo", ("C", "K"), "C")
        self.addProperty("baseTime", "combo", ("current time", "0"), "0")

        self.lstChannelValueDisplay = []
        self.lstChannelWidgets = []
        self.data = {}
        self.lakeshore = None

        graphBox = QVBox(self)
        graphButtonsBox = QHBox(graphBox)
        graphButtonsBox.setSpacing(5)
        self.graph = QtBlissGraph(graphBox)
        self.graph.setx1timescale(True)
        self.graph.xlabel("time")
        self.graph.ylabel("temperature (%s)" % self["unit"])
        self.graph.setPaletteBackgroundColor(Qt.white)
        self.graph.canvas().setMouseTracking(True)
        self.cmdResetZoom = QPushButton("Reset zoom", graphButtonsBox)
        self.lblXY = QLabel("X = ? ; Y = ?", graphButtonsBox)
        HorizontalSpacer(graphButtonsBox)
        self.cmdSaveData = QToolButton(graphButtonsBox)
        self.cmdSaveData.setUsesTextLabel(True)
        self.cmdSaveData.setTextLabel("Save data to file")
        self.cmdSaveData.setIconSet(QIconSet(Icons.load("save")))
        self.cmdSaveData.setTextPosition(QToolButton.BesideIcon)

        self.topFrame = QVGroupBox("Lakeshore - ", self)
        updateFreqBox = QHBox(self.topFrame)
        updateFreqBox.setSpacing(5)
        QLabel("Update frequency : every", updateFreqBox)
        self.spnUpdateFrequency = QSpinBox(64, 30000, 500, updateFreqBox)
        QLabel("millisecond", updateFreqBox)
        self.lblUpdateFrequency = QLabel("<nobr><b>current = ?</b></nobr>", updateFreqBox) 
        self.cmdUpdateFrequency = QPushButton("Change", updateFreqBox)
        HorizontalSpacer(updateFreqBox)
        self.lblStatus = QLabel("<h1>status</h1>", self.topFrame)
        self.lblStatus.setAlignment(Qt.AlignCenter)
        innerBox = QVBox(self.topFrame)
        self.channelsBox = QGrid(8, innerBox)
        self.channelsBox.setSpacing(5)
        self.channelsBox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        commandsBox = QVBox(innerBox)
        VerticalSpacer(self.topFrame)
        resetBox = QHBox(self.topFrame)
        HorizontalSpacer(resetBox)
        #self.cmdReset = QToolButton(resetBox)
        #self.cmdReset.setUsesTextLabel(True)
        #self.cmdReset.setTextLabel("Reset instrument")
        #self.cmdReset.setIconSet(QIconSet(Icons.load("reload")))
        #self.cmdReset.setTextPosition(QToolButton.BesideIcon)

        #QObject.connect(self.cmdReset, SIGNAL("clicked()"), self.lsReset)
        QObject.connect(self.cmdResetZoom, SIGNAL('clicked()'), self.graph.ResetZoom)
        QObject.connect(self.cmdSaveData, SIGNAL('clicked()'), self.saveGraph)
        QObject.connect(self.graph, PYSIGNAL('QtBlissGraphSignal'), self.graphSignal)
        QObject.connect(self.cmdUpdateFrequency, SIGNAL("clicked()"), self.lsUpdateFrequency) 
 
        QVBoxLayout(self, 5, 5)
        self.layout().addWidget(graphBox)
        self.layout().addWidget(self.topFrame)
        

    def graphSignal(self, dict):
        if dict['event'] == 'MouseAt':            
            self.lblXY.setText("X = %.3f ; Y = %.3f" % (dict['x'], dict['y']))


    def setStatus(self, status):
        self.lblStatus.setText("<nobr><h1>status: %s</h1></nobr>" % status)


    def updateFrequency(self, freq):
        self.lblUpdateFrequency.setText("<nobr><b>current = %d</b></nobr>" % freq)
        self.spnUpdateFrequency.setValue(freq)


    def propertyChanged(self, property, oldValue, newValue):
        if property == 'mnemonic':
            self.lakeshore = self.getHardwareObject(newValue)

            if self.lakeshore is not None:
                self.lakeshore.setUnit(self["unit"])
                self.topFrame.setTitle("Lakeshore - %s" % self.lakeshore.getIdent())
                self.updateFrequency(self.lakeshore.interval)
 
                for w in self.lstChannelWidgets:
                    w.close(True)

                self.lstChannelValueDisplay = []
                self.lstChannelWidgets = []
                self.channelCheckboxCb = weakref.WeakKeyDictionary()
                
                for i in range(self.lakeshore.getChannelsNumber()):
                    newCheckbox = QCheckBox("Channel %d" % (i+1), self.channelsBox)
                    self.lstChannelWidgets.append(newCheckbox)
#.........这里部分代码省略.........
开发者ID:douglasbeniz,项目名称:BlissFramework,代码行数:103,代码来源:LakeshoreBrick.py


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