本文整理汇总了Python中pyqtgraph.dockarea.Dock类的典型用法代码示例。如果您正苦于以下问题:Python Dock类的具体用法?Python Dock怎么用?Python Dock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *args, **kwargs):
self.tab = kwargs.pop("tab", None)
self.main = kwargs.pop("main", None)
self.automaticDraw = True
Dock.__init__(self, *args, **kwargs)
self.dockArea = GoodnessDock.GoodnessTab(main = self.main, tab = self, tabName = "goodnessTab")
self.addWidget(self.dockArea)
示例2: __init__
def __init__(self, *args, **kwargs):
self.tab = kwargs.pop("tab", None)
self.main = kwargs.pop("main", None)
self.automaticDraw = True
Dock.__init__(self, *args, **kwargs)
self._dockarea = IterationsDock.Tab(main = self.main, tab = self, tabName = "IterationsTab")
self.addWidget(self._dockarea)
示例3: __init__
def __init__(self, *args, **kwargs):
self.tab = kwargs.pop("tab", None)
self.main = kwargs.pop("main", None)
self.automaticDraw = True
Dock.__init__(self, self.name(), **kwargs)
self.imv = MyImageView()
self.imv.setContentsMargins(2, 2, 2, 2)
self.addWidget(self.imv)
示例4: onAddPlot
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}
示例5: onAddPlot
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 )
示例6: __init__
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)
示例7: add_plot_dock
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
示例8: setup_plots
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)
示例9: setupPlots
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}
示例10: setupPlots
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}
示例11: check_dock
def check_dock(self):
if self.plot is not None:
self.plot.setParent(None)
self.plot = self.plot_type()()
if self.dock is None:
self.dock = Dock(self.name(), widget=self.plot)
win.outputs_dock_area.addDock(self.dock)
else:
self.dock.addWidget(self.plot)
示例12: setup_widgets
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)))
示例13: add_widgets
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)
示例14: initDialogSummary
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
示例15: load_protocol
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()