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


Python Dock.addWidget方法代码示例

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


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

示例1: setup_widgets

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def setup_widgets(self, parent, name):
        dock_area = DockArea()
        parent.addTab(dock_area, name)

        dock_position = Dock("Position")
        dock_area.addDock(dock_position)

        # Position 2d plot
        position_graphics = pg.GraphicsLayoutWidget()
        position_graphics.show()
        view = position_graphics.addViewBox()
        self.position_img = pg.ImageItem(border='w')
        view.addItem(self.position_img)
        dock_position.addWidget(position_graphics)

        # Status widget
        dock_status = Dock("Status", size=(800, 1))
        dock_area.addDock(dock_status, 'top')
        cw = QtGui.QWidget()
        cw.setStyleSheet("QWidget {background-color:white}")
        layout = QtGui.QGridLayout()
        cw.setLayout(layout)
        self.spin_box = Qt.QSpinBox(value=1)
        self.spin_box.setMaximum(10)
        self.spin_box.setSuffix(" Threshold")

        layout.addWidget(self.spin_box, 0, 6, 0, 1)
        dock_status.addWidget(cw)

        self.spin_box.valueChanged.connect(lambda value: self.send_command(str(value)))
开发者ID:SiLab-Bonn,项目名称:online_monitor,代码行数:32,代码来源:bidirectional_receiver.py

示例2: onAddPlot

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
 def onAddPlot(self):
     name, ok = QtGui.QInputDialog.getText(self, 'Plot Name', 'Please enter a plot name: ')
     if ok and name!= 'Autoload':
         name = str(name)
         dock = Dock(name)
         widget = DateTimePlotWidget(self)
         view = widget._graphicsView
         self.area.addDock(dock, "bottom")
         dock.addWidget(widget)
         self.plotDict[name] = {"dock":dock, "widget":widget, "view":view}
开发者ID:pyIonControl,项目名称:IonControl,代码行数:12,代码来源:DedicatedCounters.py

示例3: onAddPlot

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
 def onAddPlot(self):
     name, ok = QtWidgets.QInputDialog.getText(self, 'Plot Name', 'Please enter a plot name: ')
     if ok:
         name = str(name)
         dock = Dock(name)
         widget = CoordinatePlotWidget(self)
         view = widget._graphicsView
         self.area.addDock(dock, "bottom")
         dock.addWidget(widget)
         self.plotDict[name] = {"dock":dock, "widget":widget, "view":view}
         self.plotConfigurationChanged.emit( self.plotDict )
开发者ID:pyIonControl,项目名称:IonControl,代码行数:13,代码来源:PicoampMeterUi.py

示例4: __init__

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def __init__(self, deviceClass, config, parent=None):
        Base.__init__(self, parent)
        Form.__init__(self)
        Form.setupUi(self, self)
        self.config = config
        self.configname = "AWGOptimizer"
        self.setWindowTitle("AWG Optimizer")
        guiState = self.config.get(self.configname+".guiState")
        state = self.config.get(self.configname+'.state')
        pos = self.config.get(self.configname+'.pos')
        size = self.config.get(self.configname+'.size')
        isMaximized = self.config.get(self.configname+'.isMaximized')
        restoreGuiState(self, self.config.get(self.configname+".guiState"))
        if state: self.restoreState(state)
        if pos: self.move(pos)
        if size: self.resize(size)
        if isMaximized: self.showMaximized()

        self.show()
        self.awgUi = AWGUi(deviceClass, config, dict())
        self.awgUi.setupUi(self.awgUi)
        self.splitter.insertWidget(1, self.awgUi)

        #oscilloscope plot window
        name = "Oscilloscope Trace"
        self.scopeDock = Dock(name)
        self.scopePlot = CoordinatePlotWidget(self, name=name)
        self.scopeView = self.scopePlot._graphicsView
        self.scopeDock.addWidget(self.scopePlot)
        self.area = DockArea()
        self.area.addDock(self.scopeDock)
        self.plotDict ={name: {"dock":self.scopeDock, "widget":self.scopePlot, "view":self.scopeView}}
        self.verticalLayout.insertWidget(0, self.area)

        #trace ui
        self.penicons = pens.penicons().penicons()
        self.traceui = Traceui.Traceui(self.penicons, self.config, self.configname, self.plotDict, hasMeasurementLog=False, highlightUnsaved=False)
        self.traceui.setupUi(self.traceui)
        traceDock = Dock("Traces")
        traceDock.addWidget(self.traceui)
        self.area.addDock(traceDock, 'left')
        self.device = self.awgUi.device

        self.measureWaveformButton.clicked.connect(self.onMeasureWaveform)
        self.optimizeButton.clicked.connect(self.onOptimize)

        dockAreaState = self.config.get(self.configname+'.dockAreaState')
        try:
            if dockAreaState: self.area.restoreState(dockAreaState)
        except Exception as e:
            print(e)
开发者ID:pyIonControl,项目名称:IonControl,代码行数:53,代码来源:AWGOptimizer.py

示例5: add_plot_dock

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def add_plot_dock(self, depth, widget):
        dock = Dock(depth, size=(1,1), closable=False, autoOrientation=False)
        split_dock_widget = SplitDockWidget(widget)

        ### Connect signals ###
        self.s.x_range_updated.connect(widget.set_x_range)
        self.s.y_range_updated.connect(widget.set_y_range)
        widget.s.title_updated.connect(dock.setTitle)

        if settings.annotation_on:
            self.toggle_annotation.toggled.connect(split_dock_widget.toggle_second_widget)

        dock.addWidget(split_dock_widget)
        self.selected_depths[depth] = dock       
开发者ID:eagonmeng,项目名称:Bamboo,代码行数:16,代码来源:graph_area.py

示例6: setup_plots

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def setup_plots(self, parent, name):
        dock_area = DockArea()
        parent.addTab(dock_area, name)

        dock_position = Dock("Position Correlation")
        dock_area.addDock(dock_position)

        # Position 2d plot
        position_graphics = pg.GraphicsLayoutWidget()
        position_graphics.show()
        view = position_graphics.addViewBox()
        self.position_img = pg.ImageItem(border='w')
        view.addItem(self.position_img)
        dock_position.addWidget(position_graphics)
开发者ID:leloup314,项目名称:online_monitor,代码行数:16,代码来源:position_correlator_receiver.py

示例7: setupPlots

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
 def setupPlots(self):
     self.area = DockArea()
     self.setCentralWidget(self.area)
     self.plotDict = dict()
     # initialize all the plot windows we want
     plotNames = self.config.get( 'PlotNames', ['Scan'] )
     if len(plotNames)<1:
         plotNames.append('Scan')
     for name in plotNames:
         dock = Dock(name)
         widget = CoordinatePlotWidget(self)
         view = widget._graphicsView
         self.area.addDock(dock, "bottom")
         dock.addWidget(widget)
         self.plotDict[name] = {"dock":dock, "widget":widget, "view":view}
开发者ID:pyIonControl,项目名称:IonControl,代码行数:17,代码来源:PicoampMeterUi.py

示例8: setupPlots

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
 def setupPlots(self):
     self.area = DockArea()
     self.setCentralWidget(self.area)
     self.plotDict = SequenceDict()
     # initialize all the plot windows we want
     plotNames = self.config.get(self.configName+'.PlotNames', ['Plot'])
     if len(plotNames) < 1:
         plotNames.append('Plot')
     if 'Autoload' not in plotNames:
         plotNames.append('Autoload')
     for name in plotNames:
         dock = Dock(name)
         widget = DateTimePlotWidget(self, name=name)
         view = widget._graphicsView
         self.area.addDock(dock, "bottom")
         dock.addWidget(widget)
         self.plotDict[name] = {"dock":dock, "widget":widget, "view":view}
开发者ID:pyIonControl,项目名称:IonControl,代码行数:19,代码来源:DedicatedCounters.py

示例9: initDialog

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def initDialog(self,results=None,KData=None,bDrawText=False):
        # 1) creates layouts
        dialog = QtGui.QDialog()   
        mainLayout = QtGui.QHBoxLayout()
        rightLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(rightLayout)
        dialog.setLayout(mainLayout)        
        dialog.setWindowTitle(('Strategy Results'))
        # 2) creates widgets         
        from Widgets.pgCandleWidgetCross import pgCandleWidgetCross
        from Widgets.pgCrossAddition import pgCrossAddition
        from pyqtgraph.dockarea import DockArea,Dock     
        
    

        area = DockArea()
        ## Create docks, place them into the window one at a time.
        ## Note that size arguments are only a suggestion; docks will still have to
        ## fill the entire dock area and obey the limits of their internal widgets.
        d1 = Dock("price", size=(200,100))
        d2 = Dock("position", size=(200,100))


        area.addDock(d1, 'bottom')  
        area.addDock(d2, 'bottom')  

        rightLayout.addWidget(area)
       
       
       
        
        pgCandleView = pgCandleWidgetCross(dataForCandle=KData)            
        PyqtGraphindicators = pgCrossAddition()
        toShow = pgCandleView
        self.pricePlot(toShow) 
        d1.addWidget(toShow)   
        
        PyqtGraphPosition = pgCrossAddition()
        self.positionPlot(PyqtGraphPosition)        
        d2.addWidget(PyqtGraphPosition)
        PyqtGraphPosition.showGrid(x=True, y=True)
        
        PyqtGraphPosition.setXLink(toShow)        
        return dialog
开发者ID:UpSea,项目名称:ZipLineMid,代码行数:46,代码来源:PriceScatter.py

示例10: load_protocol

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
	def load_protocol(self, path):
		lua = lupa.LuaRuntime(attribute_handlers=(getter, setter))
		self.lua = lua
		lua.globals()["flow"] = flow
		lua.globals()["channels"] = self.context.get_channels()
		lua.globals()["context"] = self.context
		source = open(path).read()

		try:
			lua.execute(source)
			self.guiBlocks = lua.eval('setup()')
			#lua.eval('gui()')
		except Exception as e:
			print ('Lua Exception occured: ', e, type(e))
			raise

		for block in self.guiBlocks:
			dock = Dock(block.name)
			dock.addWidget(block.widget())
			self.dockarea.addDock(dock)

		if 'doc_config' in lua.globals():
			self.restore_layout()
开发者ID:abiggerhammer,项目名称:OpenNFB,代码行数:25,代码来源:launcher.py

示例11: add_widgets

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def add_widgets(self):
        # Main window with dock area
        self.dock_area = DockArea()
        self.setCentralWidget(self.dock_area)

        # Docks
        dock_waveform = Dock("Waveform", size=(600, 400))
        dock_histogram = Dock("Histogram", size=(600, 400))
        dock_status = Dock("Status", size=(1200, 40))
        self.dock_area.addDock(dock_waveform, 'left')
        self.dock_area.addDock(dock_histogram, 'right', dock_waveform)
        self.dock_area.addDock(dock_status, 'top')

        # Status widget
        cw = QtGui.QWidget()
        cw.setStyleSheet("QWidget {background-color:white}")
        layout = QtGui.QGridLayout()
        layout.setColumnStretch(2, 1)
        cw.setLayout(layout)
        self.event_rate_label = QtGui.QLabel("Event Rate\n0 Hz")
        self.total_events_label = QtGui.QLabel("Total Events\n0")
        self.spin_box = Qt.QSpinBox(value=20, maximum=1000)
        self.reset_button = Qt.QPushButton('Reset', self)
        self.reset_button.clicked.connect(self.reset_plots)
        layout.addWidget(self.event_rate_label, 0, 1, 1, 1)
        layout.addWidget(self.total_events_label, 1, 1, 1, 1)
        layout.addWidget(self.spin_box, 0, 3, 1, 1)
        layout.addWidget(self.reset_button, 1, 3, 1, 1)
        
        dock_status.addWidget(cw)

        # Different plot docks
        waveform_widget = pg.PlotWidget(background="w")
        self.waveform_plot = waveform_widget.plot(range(0, 200), np.zeros(shape=(200)))
        self.thr_line = pg.InfiniteLine(pos=1000, angle=0, pen={'color':0.0, 'style':QtCore.Qt.DashLine})
        waveform_widget.addItem(self.thr_line)
        dock_waveform.addWidget(waveform_widget)

        histogram_widget = pg.PlotWidget(background="w")
        self.histogram_plot = histogram_widget.plot(range(0, 2**14 + 1), np.zeros(shape=(2**14)), stepMode=True)
        histogram_widget.showGrid(y=True)
        self.thr_line_hist = pg.InfiniteLine(pos=1000, angle=90, pen={'color':0.0, 'style':QtCore.Qt.DashLine})
        histogram_widget.addItem(self.thr_line_hist)
        dock_histogram.addWidget(histogram_widget)
开发者ID:SiLab-Bonn,项目名称:MCA,代码行数:46,代码来源:online_monitor.py

示例12: initDialogSummary

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def initDialogSummary(self,result,KData=None):
        # 1) creates layouts
        dialog = QtGui.QDialog()   
        mainLayout = QtGui.QHBoxLayout()
        rightLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(rightLayout)
        dialog.setLayout(mainLayout)        
        dialog.setWindowTitle(('Strategy Results'))

        import os,sys        
        xpower = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir,os.pardir,os.pardir,'midProjects','histdataUI'))
        sys.path.append(xpower)

        from Widgets.pgCandleWidgetCross import pgCandleWidgetCross
        from Widgets.pgCrossAddition import pgCrossAddition
        from pyqtgraph.dockarea import DockArea,Dock 
        area = DockArea()   
        rightLayout.addWidget(area)


        # 2) creates widgets 
        #  2.1)candle        
        pgCandleView = pgCandleWidgetCross(dataForCandle=KData)        
        dCandle = Dock("candles",closable=True, size=(200,300))     ## give this dock the minimum possible size
        area.addDock(dCandle, 'bottom') 
        dCandle.addWidget(pgCandleView)       
        # 2) creates widgets 
        # 2.3)position_cost 
        if(True):
            PyqtGraphPositionCost = pgCrossAddition()
            self.availableCashPlot(PyqtGraphPositionCost)
            dAvailableCash = Dock("available_cash",closable=True, size=(200,100))
            area.addDock(dAvailableCash, 'bottom')        
            dAvailableCash.addWidget(PyqtGraphPositionCost)             
            PyqtGraphPositionCost.setXLink(pgCandleView)         
        # 2.3)position_cost 
        if(True):
            PyqtGraphPositionCost = pgCrossAddition()
            self.portfolioPlot(PyqtGraphPositionCost)
            dPortfolioValue = Dock("portfolio_value",closable=True, size=(200,100))
            area.addDock(dPortfolioValue, 'bottom')        
            dPortfolioValue.addWidget(PyqtGraphPositionCost)             
            PyqtGraphPositionCost.setXLink(pgCandleView) 
        return dialog        
开发者ID:UpSea,项目名称:PyAlgoTradeMid,代码行数:46,代码来源:midBaseAnalyzer.py

示例13: initDialogSymbol

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def initDialogSymbol(self,results=None,KData=None,bDrawText=False,InKLine = False):
        # 1) creates layouts
        dialog = QtGui.QDialog()   
        mainLayout = QtGui.QHBoxLayout()
        rightLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(rightLayout)
        dialog.setLayout(mainLayout)        
        dialog.setWindowTitle(('Strategy Results'))

        import os,sys        
        xpower = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir,os.pardir,os.pardir,'midProjects','histdataUI'))
        sys.path.append(xpower)

        from Widgets.pgCandleWidgetCross import pgCandleWidgetCross
        from Widgets.pgCrossAddition import pgCrossAddition
        from pyqtgraph.dockarea import DockArea,Dock 
        area = DockArea()   
        rightLayout.addWidget(area)

        # 2) creates widgets 
        #  2.1)candle        
        pgCandleView = pgCandleWidgetCross(dataForCandle=KData)        
        self.pricePlot(pgCandleView) 
        if(InKLine):
            self.indicatorsPlot(pgCandleView) 
        #self.signalPlot(pgCandleView,yBuy = KData.take([1],axis=1),ySell = KData.take([1],axis=1))
        self.signalPlot(pgCandleView)
        dCandle = Dock("candles",closable=True, size=(200,300))     ## give this dock the minimum possible size
        area.addDock(dCandle, 'bottom') 
        dCandle.addWidget(pgCandleView)        

        #  2.2)long_pnl 当前position_pnl曲线
        if(True):
            PyqtGraphPnl = pgCrossAddition()
            self.longPnlPlot(PyqtGraphPnl,bDrawText=bDrawText)
            long_pnl = np.array(self.results.long_pnl)
            self.signalPlot(PyqtGraphPnl,yBuy = long_pnl,ySell = long_pnl)
            dPnl = Dock("long_pnl", closable=True, size=(200,100))
            area.addDock(dPnl, 'bottom')    
            dPnl.addWidget(PyqtGraphPnl)           
            PyqtGraphPnl.setXLink(pgCandleView)
        # 2.3)long_cost 
        if(True):
            PyqtGraphPositionCost = pgCrossAddition()
            self.longCostPlot(PyqtGraphPositionCost)
            dPositionCost = Dock("long_cost",closable=True, size=(200,100))
            area.addDock(dPositionCost, 'bottom')        
            dPositionCost.addWidget(PyqtGraphPositionCost)             
            PyqtGraphPositionCost.setXLink(pgCandleView)         
        
        #  2.2)long_pnl 当前position_pnl曲线
        if(True):
            PyqtGraphPnl = pgCrossAddition()
            self.shortPnlPlot(PyqtGraphPnl,bDrawText=bDrawText)
            short_pnl = np.array(self.results.short_pnl)
            self.signalPlot(PyqtGraphPnl,yBuy = short_pnl,ySell = short_pnl)
            dPnl = Dock("short_pnl", closable=True, size=(200,100))
            area.addDock(dPnl, 'bottom')    
            dPnl.addWidget(PyqtGraphPnl)           
            PyqtGraphPnl.setXLink(pgCandleView)
        # 2.3)long_cost 
        if(True):
            PyqtGraphPositionCost = pgCrossAddition()
            self.shortCostPlot(PyqtGraphPositionCost)
            dPositionCost = Dock("short_cost",closable=True, size=(200,100))
            area.addDock(dPositionCost, 'bottom')        
            dPositionCost.addWidget(PyqtGraphPositionCost)             
            PyqtGraphPositionCost.setXLink(pgCandleView)          
        
        #  2.3)position_volume
        if(False):
            PyqtGraphPosition = pgCrossAddition()
            self.positionVolumePlot(PyqtGraphPosition)
            dPosition = Dock("position_volume",closable=True, size=(200,100))
            area.addDock(dPosition, 'bottom')        
            dPosition.addWidget(PyqtGraphPosition)             
            PyqtGraphPosition.setXLink(pgCandleView)
        #  2.4)portfolio  总资产变动曲线 cash + equity
        if(True):
            PyqtGraphPortfolio = pgCrossAddition()
            self.positionValuePlot(PyqtGraphPortfolio)
            dPortfolio = Dock("portfolio", closable=True,size=(200,100))
            area.addDock(dPortfolio, 'bottom')     
            dPortfolio.addWidget(PyqtGraphPortfolio)        
            PyqtGraphPortfolio.setXLink(pgCandleView)
        #  2.5)indicator
        if(True):
            PyqtGraphindicators = pgCrossAddition()
            self.pricePlot(PyqtGraphindicators)    
            self.indicatorsPlot(PyqtGraphindicators)
            
            self.signalPlot(PyqtGraphindicators)
            
            dIndicator = Dock("indicator",closable=True, size=(200,100))
            dIndicator.addWidget(PyqtGraphindicators)
            area.addDock(dIndicator, 'bottom', dCandle)  
            PyqtGraphindicators.setXLink(pgCandleView)
        #  2.2)position_pnl 当前position_pnl曲线
        if(False):
            PyqtGraphPortfolioInstruments = pgCrossAddition()
#.........这里部分代码省略.........
开发者ID:UpSea,项目名称:PyAlgoTradeMid,代码行数:103,代码来源:midBaseAnalyzer.py

示例14: setup_widgets

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def setup_widgets(self, parent, name):
        dock_area = DockArea()
        parent.addTab(dock_area, name)

        # Occupancy Docks
        self.occupancy_images = []

        for plane in range(3):  # Loop over 3 * 2 plot widgets
            # Dock left
            dock_occcupancy = Dock("Occupancy plane %d" % 2 * plane, size=(100, 200))
            dock_area.addDock(dock_occcupancy)
            occupancy_graphics = pg.GraphicsLayoutWidget()  # Plot docks
            occupancy_graphics.show()
            view = occupancy_graphics.addViewBox()
            self.occupancy_images.append(pg.ImageItem(border='w'))
            view.addItem(self.occupancy_images[2 * plane])
            view.setRange(QtCore.QRectF(0, 0, 80, 336))
            dock_occcupancy.addWidget(occupancy_graphics)

            # Dock right
            dock_occcupancy_2 = Dock("Occupancy plane %d" % (2 * plane + 1), size=(100, 200))
            dock_area.addDock(dock_occcupancy_2, 'right', dock_occcupancy)  
            occupancy_graphics = pg.GraphicsLayoutWidget()  # Plot docks
            occupancy_graphics.show()
            view = occupancy_graphics.addViewBox()
            self.occupancy_images.append(pg.ImageItem(border='w'))
            view.addItem(self.occupancy_images[2 * plane + 1])
            view.setRange(QtCore.QRectF(0, 0, 80, 336))
            dock_occcupancy_2.addWidget(occupancy_graphics)

        # dock_event_status = Dock("Event status", size=(400, 400))
        # dock_trigger_status = Dock("Trigger status", size=(400, 400))

        # dock_area.addDock(dock_trigger_status, 'above', dock_service_records)
        # dock_area.addDock(dock_event_status, 'above', dock_trigger_status)
        dock_status = Dock("Status", size=(800, 40))
        dock_area.addDock(dock_status, 'top')

        # Status dock on top
        cw = QtGui.QWidget()
        cw.setStyleSheet("QWidget {background-color:white}")
        layout = QtGui.QGridLayout()
        cw.setLayout(layout)
        self.rate_label = QtGui.QLabel("Readout Rate\n0 Hz")
        self.hit_rate_label = QtGui.QLabel("Hit Rate\n0 Hz")
        self.event_rate_label = QtGui.QLabel("Event Rate\n0 Hz")
        self.timestamp_label = QtGui.QLabel("Data Timestamp\n")
        self.plot_delay_label = QtGui.QLabel("Plot Delay\n")
        self.scan_parameter_label = QtGui.QLabel("Scan Parameters\n")
        self.spin_box = Qt.QSpinBox(value=0)
        self.spin_box.setMaximum(1000000)
        self.spin_box.setSuffix(" Readouts")
        self.reset_button = QtGui.QPushButton('Reset')
        self.noisy_checkbox = QtGui.QCheckBox('Mask noisy pixels')
        layout.addWidget(self.timestamp_label, 0, 0, 0, 1)
        layout.addWidget(self.plot_delay_label, 0, 1, 0, 1)
        layout.addWidget(self.rate_label, 0, 2, 0, 1)
        layout.addWidget(self.hit_rate_label, 0, 3, 0, 1)
        layout.addWidget(self.event_rate_label, 0, 4, 0, 1)
        layout.addWidget(self.scan_parameter_label, 0, 5, 0, 1)
        layout.addWidget(self.spin_box, 0, 6, 0, 1)
        layout.addWidget(self.noisy_checkbox, 0, 7, 0, 1)
        layout.addWidget(self.reset_button, 0, 8, 0, 1)
        dock_status.addWidget(cw)

        # Connect widgets
        self.reset_button.clicked.connect(lambda: self.send_command('RESET'))
        self.spin_box.valueChanged.connect(lambda value: self.send_command(str(value)))
        self.noisy_checkbox.stateChanged.connect(lambda value: self.send_command('MASK %d' % value))

#         event_status_widget = pg.PlotWidget()
#         self.event_status_plot = event_status_widget.plot(np.linspace(-0.5, 15.5, 17), np.zeros((16)), stepMode=True)
#         event_status_widget.showGrid(y=True)
#         dock_event_status.addWidget(event_status_widget)

#         trigger_status_widget = pg.PlotWidget()
#         self.trigger_status_plot = trigger_status_widget.plot(np.linspace(-0.5, 7.5, 9), np.zeros((8)), stepMode=True)
#         trigger_status_widget.showGrid(y=True)
#         dock_trigger_status.addWidget(trigger_status_widget)

        self.plot_delay = 0
开发者ID:SiLab-Bonn,项目名称:silab_online_monitor,代码行数:83,代码来源:pybar_mimosa26.py

示例15: setup_widgets

# 需要导入模块: from pyqtgraph.dockarea import Dock [as 别名]
# 或者: from pyqtgraph.dockarea.Dock import addWidget [as 别名]
    def setup_widgets(self, parent, name):
        dock_area = DockArea()
        parent.addTab(dock_area, name)

        # Docks
        dock_occcupancy = Dock("Occupancy", size=(400, 400))
        dock_run_config = Dock("Run configuration", size=(400, 400))
        dock_global_config = Dock("Global configuration", size=(400, 400))
        dock_tot = Dock("Time over threshold values (TOT)", size=(400, 400))
        dock_tdc = Dock("Time digital converter values (TDC)", size=(400, 400))
        dock_event_status = Dock("Event status", size=(400, 400))
        dock_trigger_status = Dock("Trigger status", size=(400, 400))
        dock_service_records = Dock("Service records", size=(400, 400))
        dock_hit_timing = Dock("Hit timing (rel. BCID)", size=(400, 400))
        dock_status = Dock("Status", size=(800, 40))
        dock_area.addDock(dock_global_config, 'left')
        dock_area.addDock(dock_run_config, 'above', dock_global_config)
        dock_area.addDock(dock_occcupancy, 'above', dock_run_config)
        dock_area.addDock(dock_tdc, 'right', dock_occcupancy)
        dock_area.addDock(dock_tot, 'above', dock_tdc)
        dock_area.addDock(dock_service_records, 'bottom', dock_occcupancy)
        dock_area.addDock(dock_trigger_status, 'above', dock_service_records)
        dock_area.addDock(dock_event_status, 'above', dock_trigger_status)
        dock_area.addDock(dock_hit_timing, 'bottom', dock_tot)
        dock_area.addDock(dock_status, 'top')

        # Status dock on top
        cw = QtGui.QWidget()
        cw.setStyleSheet("QWidget {background-color:white}")
        layout = QtGui.QGridLayout()
        cw.setLayout(layout)
        self.rate_label = QtGui.QLabel("Readout Rate\n0 Hz")
        self.hit_rate_label = QtGui.QLabel("Hit Rate\n0 Hz")
        self.event_rate_label = QtGui.QLabel("Event Rate\n0 Hz")
        self.timestamp_label = QtGui.QLabel("Data Timestamp\n")
        self.plot_delay_label = QtGui.QLabel("Plot Delay\n")
        self.scan_parameter_label = QtGui.QLabel("Scan Parameters\n")
        self.spin_box = Qt.QSpinBox(value=0)
        self.spin_box.setMaximum(1000000)
        self.spin_box.setSuffix(" Readouts")
        self.reset_button = QtGui.QPushButton('Reset')
        layout.addWidget(self.timestamp_label, 0, 0, 0, 1)
        layout.addWidget(self.plot_delay_label, 0, 1, 0, 1)
        layout.addWidget(self.rate_label, 0, 2, 0, 1)
        layout.addWidget(self.hit_rate_label, 0, 3, 0, 1)
        layout.addWidget(self.event_rate_label, 0, 4, 0, 1)
        layout.addWidget(self.scan_parameter_label, 0, 5, 0, 1)
        layout.addWidget(self.spin_box, 0, 6, 0, 1)
        layout.addWidget(self.reset_button, 0, 7, 0, 1)
        dock_status.addWidget(cw)

        # Connect widgets
        self.reset_button.clicked.connect(lambda: self.send_command('RESET'))
        self.spin_box.valueChanged.connect(lambda value: self.send_command(str(value)))

        # Run config dock
        self.run_conf_list_widget = Qt.QListWidget()
        dock_run_config.addWidget(self.run_conf_list_widget)

        # Global config dock
        self.global_conf_list_widget = Qt.QListWidget()
        dock_global_config.addWidget(self.global_conf_list_widget)

        # Different plot docks
        occupancy_graphics = pg.GraphicsLayoutWidget()
        occupancy_graphics.show()
        view = occupancy_graphics.addViewBox()
        self.occupancy_img = pg.ImageItem(border='w')
        view.addItem(self.occupancy_img)
        view.setRange(QtCore.QRectF(0, 0, 80, 336))
        dock_occcupancy.addWidget(occupancy_graphics)

        tot_plot_widget = pg.PlotWidget(background="w")
        self.tot_plot = tot_plot_widget.plot(np.linspace(-0.5, 15.5, 17), np.zeros((16)), stepMode=True)
        tot_plot_widget.showGrid(y=True)
        dock_tot.addWidget(tot_plot_widget)

        tdc_plot_widget = pg.PlotWidget(background="w")
        self.tdc_plot = tdc_plot_widget.plot(np.linspace(-0.5, 4095.5, 4097), np.zeros((4096)), stepMode=True)
        tdc_plot_widget.showGrid(y=True)
        tdc_plot_widget.setXRange(0, 800, update=True)
        dock_tdc.addWidget(tdc_plot_widget)

        event_status_widget = pg.PlotWidget()
        self.event_status_plot = event_status_widget.plot(np.linspace(-0.5, 15.5, 17), np.zeros((16)), stepMode=True)
        event_status_widget.showGrid(y=True)
        dock_event_status.addWidget(event_status_widget)

        trigger_status_widget = pg.PlotWidget()
        self.trigger_status_plot = trigger_status_widget.plot(np.linspace(-0.5, 7.5, 9), np.zeros((8)), stepMode=True)
        trigger_status_widget.showGrid(y=True)
        dock_trigger_status.addWidget(trigger_status_widget)

        service_record_widget = pg.PlotWidget()
        self.service_record_plot = service_record_widget.plot(np.linspace(-0.5, 31.5, 33), np.zeros((32)), stepMode=True)
        service_record_widget.showGrid(y=True)
        dock_service_records.addWidget(service_record_widget)

        hit_timing_widget = pg.PlotWidget()
        self.hit_timing_plot = hit_timing_widget.plot(np.linspace(-0.5, 15.5, 17), np.zeros((16)), stepMode=True)
#.........这里部分代码省略.........
开发者ID:SiLab-Bonn,项目名称:silab_online_monitor,代码行数:103,代码来源:pybar_fei4.py


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