本文整理汇总了Python中pyqtgraph.dockarea.DockArea类的典型用法代码示例。如果您正苦于以下问题:Python DockArea类的具体用法?Python DockArea怎么用?Python DockArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DockArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)))
示例2: addTempArea
def addTempArea(self):
if self.home is None:
area = DockArea(temporary=True, home=self)
self.tempAreas.append(area)
win = TempAreaWindow(area, self)
area.win = win
win.show()
else:
area = self.home.addTempArea()
#print 'added temp area', area, area.window()
return area
示例3: addTempArea
def addTempArea(self):
if self.home is None:
area = DockArea(temporary=True, home=self)
self.tempAreas.append(area)
win = TempAreaWindow(area)
win.setWindowFlags(Qt.Qt.WindowMinimizeButtonHint)
area.win = win
win.show()
else:
area = self.home.addTempArea()
#print "added temp area", area, area.window()
return area
示例4: MainWindow
class MainWindow(QMainWindow, Ui_MainWindow):
"""The only window of the application."""
def __init__(self, settings):
super(MainWindow, self).__init__()
self.settings = settings
self.setupUi(self)
self.dock_area = DockArea()
self.setCentralWidget(self.dock_area)
self.createDocks()
self.loadSettings()
def createDocks(self):
self.zmq_subscriber = ZMQSubscriber(self.settings, self)
self.zmq_subscriber_dock = Dock('Subscriber',
widget=self.zmq_subscriber)
self.dock_area.addDock(self.zmq_subscriber_dock)
def loadSettings(self):
"""Load window state from self.settings"""
self.settings.beginGroup('mainwindow')
geometry = self.settings.value('geometry').toByteArray()
state = self.settings.value('windowstate').toByteArray()
dock_string = str(self.settings.value('dockstate').toString())
if dock_string is not "":
dock_state = eval(dock_string)
self.dock_area.restoreState(dock_state)
self.settings.endGroup()
self.restoreGeometry(geometry)
self.restoreState(state)
def saveSettings(self):
"""Save window state to self.settings."""
self.settings.beginGroup('mainwindow')
self.settings.setValue('geometry', self.saveGeometry())
self.settings.setValue('windowstate', self.saveState())
dock_state = self.dock_area.saveState()
# dock_state returned here is a python dictionary. Coundn't find a good
# way to save dicts in QSettings, hence just using representation
# of it.
self.settings.setValue('dockstate', repr(dock_state))
self.settings.endGroup()
def closeEvent(self, event):
self.zmq_subscriber.saveSettings()
self.saveSettings()
示例5: 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)
示例6: __init__
def __init__(self, settings):
super(MainWindow, self).__init__()
self.settings = settings
self.setupUi(self)
# MainWindow is a collection of widgets in their respective docks.
# We make DockArea our central widget
self.dock_area = DockArea()
self.setCentralWidget(self.dock_area)
self.createDocks()
self.initAfterCreatingDockWidgets()
self.loadSettings()
self.connectSignalsToSlots()
# all signals in place, send out the first image
# self.image_browser.populateAndEmitImageInfo()
self.image_browser.initialEmit()
self.roi_editor_h.initialEmit()
self.roi_editor_v.initialEmit()
self.roi_editor_int.initialEmit()
self.roi_editor_err.initialEmit()
self.loadPlugins()
示例7: initDialog
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
示例8: __init__
def __init__(self):
logging.debug('Creating main window.')
QtGui.QMainWindow.__init__(self)
self.setWindowTitle("colorgraphs dock")
self.dockarea = DockArea()
self.setCentralWidget(self.dockarea)
self.resize(*_MAIN_WINDOW_SIZE)
self.initUI()
self.show()
self.raise_()
示例9: __init__
def __init__(self):
DockArea.__init__(self)
self.project_tree_dock = Dock(u"Project Tree", hideTitle=True)
self.addDock(self.project_tree_dock,
'top') #'above', self.flowcharts_dock)
self.project_tree = SegmentTreeWidget()
self.project_tree_dock.addWidget(self.project_tree)
self.properties_table = TableWidget(sortable=False, editable=False)
self.properties_table.setFormat("%.3f",1)
self.properties_table.setColumnCount(1)
self.properties_table.contextMenu.clear()
self.properties_table.horizontalHeader().hide()
self.properties_dock = Dock("Selected Object Properties",
widget=self.properties_table,
hideTitle=True)
self.addDock(self.properties_dock, 'bottom')
MarkWriteMainWindow.instance().sigProjectChanged.connect(
self.handleProjectChange)
MarkWriteMainWindow.instance().sigSegmentCreated.connect(
self.handleSegmentCreated)
MarkWriteMainWindow.instance().sigSegmentRemoved.connect(
self.handleSegmentRemoved)
MarkWriteMainWindow.instance().sigActiveObjectChanged.connect(
self.handleActiveObjectChanged)
self.project_tree.currentItemChanged.connect(
self.currentTreeItemChangedEvent)
self.project_tree.itemDoubleClicked.connect(
self.treeItemDoubleClickedEvent)
self.project_tree.customContextMenuRequested.connect(
self.rightClickTreeEvent)
# self.project_tree.itemSelectionChanged.connect(self.handleItemSelectionChanged)
self.project_tree.setExpandsOnDoubleClick(False)
self.doNotSetActiveObject=False
示例10: __init__
def __init__(self, settings):
super(MainWindow, self).__init__()
self.settings = settings
self.setupUi(self)
self.dock_area = DockArea()
self.setCentralWidget(self.dock_area)
self.createDocks()
self.loadSettings()
示例11: __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)
示例12: setup_status_widget
def setup_status_widget(self, parent): # Visualizes the nodes + their connections + CPU usage
# Status dock area showing setup
dock_area = DockArea()
parent.addTab(dock_area, 'Status')
self.status_dock = Dock("Status")
dock_area.addDock(self.status_dock)
# GraphicsLayout to align graphics
status_graphics_widget = pg.GraphicsLayoutWidget()
status_graphics_widget.show()
self.status_dock.addWidget(status_graphics_widget)
try:
self.configuration['receiver']
except KeyError:
return
# Create nodes with links from configuration file for converter/receiver
for receiver_index, (receiver_name, receiver_settings) in enumerate(self.configuration['receiver'].items()):
# Add receiver info
view = status_graphics_widget.addViewBox(row=receiver_index, col=5, lockAspect=True, enableMouse=False)
text = pg.TextItem('Receiver\n%s' % receiver_name, border='b', fill=(0, 0, 255, 100), anchor=(0.5, 0.5), color=(0, 0, 0, 200))
text.setPos(0.5, 0.5)
view.addItem(text)
# Add corresponding producer info
try:
if self.configuration['converter']:
try:
actual_converter = self.configuration['converter'][receiver_name]
view = status_graphics_widget.addViewBox(row=receiver_index, col=1, lockAspect=True, enableMouse=False)
text = pg.TextItem('Producer\n%s' % receiver_name, border='b', fill=(0, 0, 255, 100), anchor=(0.5, 0.5), color=(0, 0, 0, 200))
text.setPos(0.5, 0.5)
view.addItem(text)
view = status_graphics_widget.addViewBox(row=receiver_index, col=3, lockAspect=True, enableMouse=False)
text = pg.TextItem('Converter\n%s' % receiver_settings, border='b', fill=(0, 0, 255, 100), anchor=(0.5, 0.5), color=(0, 0, 0, 200))
text.setPos(0.5, 0.5)
view.addItem(text)
except KeyError: # no converter for receiver
pass
except KeyError: # No converter defined in configruation
pass
示例13: _InitDocks
def _InitDocks(self):
# Define docking area
if hasattr(self, "_dockArea"):
self._dockArea.setParent(None)
self._dockArea = DockArea()
self._plotDocks = self._defaultDockPos.keys()
# Add dock to area
for dock, pos in self._defaultDockPos.iteritems():
self._dockArea.addDock(dock, *pos)
self._layout.addWidget(self._dockArea, 0, 0, 1, 1)
示例14: 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}
示例15: 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}