本文整理汇总了Python中pyqtgraph.SignalProxy方法的典型用法代码示例。如果您正苦于以下问题:Python pyqtgraph.SignalProxy方法的具体用法?Python pyqtgraph.SignalProxy怎么用?Python pyqtgraph.SignalProxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph
的用法示例。
在下文中一共展示了pyqtgraph.SignalProxy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, plot, pen=None):
""" Initiates the crosshars onto a plot given the pen style.
Example pen:
pen=pg.mkPen(color='#AAAAAA', style=QtCore.Qt.DashLine)
"""
super().__init__()
self.vertical = pg.InfiniteLine(angle=90, movable=False, pen=pen)
self.horizontal = pg.InfiniteLine(angle=0, movable=False, pen=pen)
plot.addItem(self.vertical, ignoreBounds=True)
plot.addItem(self.horizontal, ignoreBounds=True)
self.position = None
self.proxy = pg.SignalProxy(plot.scene().sigMouseMoved, rateLimit=60,
slot=self.mouseMoved)
self.plot = plot
示例2: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self,parent):
"""Constructor"""
self.__view = parent
super(Crosshair, self).__init__()
self.__vLine = pg.InfiniteLine(angle=90, movable=False)
self.__hLine = pg.InfiniteLine(angle=0, movable=False)
self.__textPrice = pg.TextItem('price')
self.__textDate = pg.TextItem('date')
#mid 在y轴动态跟随最新价显示最新价和最新时间
self.__textLastPrice = pg.TextItem('lastTickPrice')
view = self.__view
view.addItem(self.__textDate, ignoreBounds=True)
view.addItem(self.__textPrice, ignoreBounds=True)
view.addItem(self.__vLine, ignoreBounds=True)
view.addItem(self.__hLine, ignoreBounds=True)
view.addItem(self.__textLastPrice, ignoreBounds=True)
self.proxy = pg.SignalProxy(view.scene().sigMouseMoved, rateLimit=60, slot=self.__mouseMoved)
#----------------------------------------------------------------------
示例3: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, image, **kwargs):
super().__init__(**kwargs)
self.viewer = pg.ImageView()
with warnings.catch_warnings():
# Pesky FutureWarning from PyQtGraph
warnings.simplefilter("ignore")
self.viewer.setImage(image)
self.cursor_info = pg.QtGui.QLabel("")
self.cursor_info.setAlignment(pg.QtCore.Qt.AlignCenter)
self.__cursor_proxy = pg.SignalProxy(
self.viewer.scene.sigMouseMoved,
rateLimit=60,
slot=self.update_cursor_info,
)
self.setWindowTitle("scikit-ued image viewer")
layout = pg.QtGui.QVBoxLayout()
layout.addWidget(self.viewer)
layout.addWidget(self.cursor_info)
self.setLayout(layout)
示例4: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, spool):
QtCore.QObject.__init__(self)
self.spool = spool
self.scene = None
self.frame = None
self.quadtree = None
self.covariance = None
self.aps = None
self.log = SceneLogModel(self)
self._ = SignalProxy(
self._sigQuadtreeChanged,
rateLimit=10,
delay=0,
slot=lambda: self.sigQuadtreeChanged.emit())
self._log_handler = logging.Handler()
self._log_handler.setLevel(logging.DEBUG)
self._log_handler.emit = self.sigLogRecord.emit
logging.root.addHandler(self._log_handler)
self._download_status = None
if pyrocko_download_callback:
pyrocko_download_callback(self.download_progress)
self.qtproxy = QSceneQuadtreeProxy(self)
self.worker_thread = QtCore.QThread()
self.moveToThread(self.worker_thread)
self.worker_thread.start()
示例5: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, sandbox, *args, **kwargs):
pg.GraphicsLayoutWidget.__init__(self, **kwargs)
self.sandbox = sandbox
self.plots = [
DisplacementPlot(
sandbox,
title='North',
component=lambda m: m.north),
DisplacementPlot(
sandbox,
title='East',
component=lambda m: m.east),
DisplacementVectorPlot(
sandbox,
title='Down',
component=lambda m: m.down),
DisplacementPlot(
sandbox,
title='LOS',
component=lambda m: m.displacement)
]
for plt in self.plots:
plt.vb.menu = QtWidgets.QMenu(self)
self.updateViews()
getConfig().qconfig.updated.connect(self.updateViews)
self._mov_sig = pg.SignalProxy(
self.scene().sigMouseMoved,
rateLimit=60, slot=self.mouseMoved)
示例6: create_plot
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def create_plot(self):
"""Create main spectrum plot"""
self.posLabel = self.layout.addLabel(row=0, col=0, justify="right")
self.plot = self.layout.addPlot(row=1, col=0)
self.plot.showGrid(x=True, y=True)
self.plot.setLabel("left", "Power", units="dB")
self.plot.setLabel("bottom", "Frequency", units="Hz")
self.plot.setLimits(xMin=0)
self.plot.showButtons()
#self.plot.setDownsampling(mode="peak")
#self.plot.setClipToView(True)
self.create_baseline_curve()
self.create_persistence_curves()
self.create_average_curve()
self.create_peak_hold_min_curve()
self.create_peak_hold_max_curve()
self.create_main_curve()
# Create crosshair
self.vLine = pg.InfiniteLine(angle=90, movable=False)
self.vLine.setZValue(1000)
self.hLine = pg.InfiniteLine(angle=0, movable=False)
self.vLine.setZValue(1000)
self.plot.addItem(self.vLine, ignoreBounds=True)
self.plot.addItem(self.hLine, ignoreBounds=True)
self.mouseProxy = pg.SignalProxy(self.plot.scene().sigMouseMoved,
rateLimit=60, slot=self.mouse_moved)
示例7: create_plot
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def create_plot(title='Finance Plot', rows=1, init_zoom_periods=1e10, maximize=True, yscale='linear'):
global windows, last_ax
pg.setConfigOptions(foreground=foreground, background=background)
win = FinWindow(title)
windows.append(win)
if maximize:
win.showMaximized()
# normally first graph is of higher significance, so enlarge
win.ci.layout.setRowStretchFactor(0, top_graph_scale)
win.ci.setContentsMargins(0, 0, 0 ,0)
win.ci.setSpacing(0)
axs = []
prev_ax = None
for n in range(rows):
ysc = yscale[n] if type(yscale) in (list,tuple) else yscale
ysc = YScale(ysc, 1)
v_zoom_scale = 0.97
viewbox = FinViewBox(win, init_steps=init_zoom_periods, yscale=ysc, v_zoom_scale=v_zoom_scale)
ax = prev_ax = _add_timestamp_plot(win, prev_ax, viewbox=viewbox, index=n, yscale=ysc)
_set_plot_x_axis_leader(ax)
if n == 0:
viewbox.setFocus()
axs += [ax]
win.proxy_mmove = pg.SignalProxy(win.scene().sigMouseMoved, rateLimit=144, slot=partial(_mouse_moved, win))
win._last_mouse_evs = None
win._last_mouse_y = 0
last_ax = axs[0]
if len(axs) == 1:
return axs[0]
return axs
示例8: set_time_inspector
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def set_time_inspector(inspector, ax=None):
'''Callback when clicked like so: inspector().'''
ax = ax if ax else last_ax
win = ax.vb.win
win.proxy_click = pg.SignalProxy(win.scene().sigMouseClicked, slot=partial(_time_clicked, ax, inspector))
示例9: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self,parent,master):
"""Constructor"""
self.__view = parent
self.master = master
super(Crosshair, self).__init__()
self.xAxis = 0
self.yAxis = 0
self.datas = None
self.ma_s_values = []
self.ma_l_values = []
self.yAxises = [0 for i in range(3)]
self.leftX = [0 for i in range(3)]
self.showHLine = [False for i in range(3)]
self.textPrices = [pg.TextItem('',anchor=(1,1)) for i in range(3)]
self.views = [parent.centralWidget.getItem(i+1,0) for i in range(3)]
self.rects = [self.views[i].sceneBoundingRect() for i in range(3)]
self.vLines = [pg.InfiniteLine(angle=90, movable=False) for i in range(3)]
self.hLines = [pg.InfiniteLine(angle=0, movable=False) for i in range(3)]
#mid 在y轴动态跟随最新价显示最新价和最新时间
self.__textDate = pg.TextItem('date',anchor=(1,1))
self.__textInfo = pg.TextItem('lastBarInfo')
self.__textSig = pg.TextItem('lastSigInfo',anchor=(1,0))
self.__textSubSig = pg.TextItem('lastSubSigInfo',anchor=(1,0))
self.__textVolume = pg.TextItem('lastBarVolume',anchor=(1,0))
self.__textDate.setZValue(2)
self.__textInfo.setZValue(2)
self.__textSig.setZValue(2)
self.__textSubSig.setZValue(2)
self.__textVolume.setZValue(2)
self.__textInfo.border = pg.mkPen(color=(230, 255, 0, 255), width=1)
for i in range(3):
self.textPrices[i].setZValue(2)
self.vLines[i].setPos(0)
self.hLines[i].setPos(0)
self.vLines[i].setZValue(0)
self.hLines[i].setZValue(0)
self.views[i].addItem(self.vLines[i])
self.views[i].addItem(self.hLines[i])
self.views[i].addItem(self.textPrices[i])
self.views[0].addItem(self.__textInfo, ignoreBounds=True)
self.views[0].addItem(self.__textSig, ignoreBounds=True)
self.views[1].addItem(self.__textVolume, ignoreBounds=True)
self.views[2].addItem(self.__textDate, ignoreBounds=True)
self.views[2].addItem(self.__textSubSig, ignoreBounds=True)
self.proxy = pg.SignalProxy(self.__view.scene().sigMouseMoved, rateLimit=360, slot=self.__mouseMoved)
# 跨线程刷新界面支持
self.signal.connect(self.update)
self.signalInfo.connect(self.plotInfo)
#----------------------------------------------------------------------
示例10: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self,parent,master):
"""Constructor"""
self.__view = parent
self.master = master
super(Crosshair, self).__init__()
self.xAxis = 0
self.yAxis = 0
self.datas = None
self.yAxises = [0 for i in range(3)]
self.leftX = [0 for i in range(3)]
self.showHLine = [False for i in range(3)]
self.textPrices = [pg.TextItem('',anchor=(1,1)) for i in range(3)]
self.views = [parent.centralWidget.getItem(i+1,0) for i in range(3)]
self.rects = [self.views[i].sceneBoundingRect() for i in range(3)]
self.vLines = [pg.InfiniteLine(angle=90, movable=False) for i in range(3)]
self.hLines = [pg.InfiniteLine(angle=0, movable=False) for i in range(3)]
#mid 在y轴动态跟随最新价显示最新价和最新时间
self.__textDate = pg.TextItem('date',anchor=(1,1))
self.__textInfo = pg.TextItem('lastBarInfo')
self.__textSig = pg.TextItem('lastSigInfo',anchor=(1,0))
self.__textSubSig = pg.TextItem('lastSubSigInfo',anchor=(1,0))
self.__textVolume = pg.TextItem('lastBarVolume',anchor=(1,0))
self.__textDate.setZValue(2)
self.__textInfo.setZValue(2)
self.__textSig.setZValue(2)
self.__textSubSig.setZValue(2)
self.__textVolume.setZValue(2)
self.__textInfo.border = pg.mkPen(color=(230, 255, 0, 255), width=1.2)
for i in range(3):
self.textPrices[i].setZValue(2)
self.vLines[i].setPos(0)
self.hLines[i].setPos(0)
self.vLines[i].setZValue(0)
self.hLines[i].setZValue(0)
self.views[i].addItem(self.vLines[i])
self.views[i].addItem(self.hLines[i])
self.views[i].addItem(self.textPrices[i])
self.views[0].addItem(self.__textInfo, ignoreBounds=True)
self.views[0].addItem(self.__textSig, ignoreBounds=True)
self.views[1].addItem(self.__textVolume, ignoreBounds=True)
self.views[2].addItem(self.__textDate, ignoreBounds=True)
self.views[2].addItem(self.__textSubSig, ignoreBounds=True)
self.proxy = pg.SignalProxy(self.__view.scene().sigMouseMoved, rateLimit=360, slot=self.__mouseMoved)
# 跨线程刷新界面支持
self.signal.connect(self.update)
self.signalInfo.connect(self.plotInfo)
#----------------------------------------------------------------------
示例11: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, parent, master):
"""Constructor"""
self.__view = parent
self.master = master
super(Crosshair, self).__init__()
self.xAxis = 0
self.yAxis = 0
# 文字信息是否显示标志位
self.flags = False
self.datas = None
self.yAxises = 0
self.leftX = 0
self.showHLine = False
self.textPrices = pg.TextItem('', anchor=(1, 1))
self.view = parent.centralWidget.getItem(1, 0)
self.rect = self.view.sceneBoundingRect()
self.vLines = pg.InfiniteLine(angle=90, movable=False)
self.hLines = pg.InfiniteLine(angle=0, movable=False)
# mid 在y轴动态跟随最新价显示资金信息和最新时间
self.__textDate = pg.TextItem('date')
self.__textInfo = pg.TextItem('lastBarInfo')
self.__textDate.setZValue(2)
# 堆叠顺序置于下层
self.__textInfo.setZValue(-1)
self.__textInfo.border = pg.mkPen(color=(181, 181, 181, 255), width=1.2)
self.__texts = [self.__textDate, self.__textInfo, self.textPrices]
self.textPrices.setZValue(2)
self.vLines.setPos(0)
self.hLines.setPos(0)
self.view.addItem(self.vLines)
self.view.addItem(self.hLines)
self.view.addItem(self.textPrices)
self.view.addItem(self.__textInfo, ignoreBounds=True)
self.view.addItem(self.__textDate, ignoreBounds=True)
self.__setVisibileOrNot(self.flags)
self.proxy = pg.SignalProxy(self.__view.scene().sigMouseMoved, rateLimit=60, slot=self.__mouseMoved)
self.click_slot = pg.SignalProxy(self.__view.scene().sigMouseClicked, rateLimit=60, slot=self.__mouseClicked)
# 跨线程刷新界面支持
self.signal.connect(self.update)
示例12: __init__
# 需要导入模块: import pyqtgraph [as 别名]
# 或者: from pyqtgraph import SignalProxy [as 别名]
def __init__(self, parent, master):
"""Constructor"""
self.__view = parent
self.master = master
super(GCrosshair, self).__init__()
self.xAxis = 0
self.yAxis = 0
# 文字信息是否显示标志位
self.flags = False
self.datas = None
self.yAxises = 0
self.leftX = 0
self.showHLine = False
self.view = parent.centralWidget.getItem(1, 0)
self.rect = self.view.sceneBoundingRect()
self.vLines = pg.InfiniteLine(angle=90, movable=False)
self.hLines = pg.InfiniteLine(angle=0, movable=False)
# mid 在y轴动态跟随最新价显示资金信息和最新时间
self.__textInfo = pg.TextItem('lastBarInfo')
# 堆叠顺序置于下层
self.__textInfo.setZValue(1)
self.__textInfo.border = pg.mkPen(color=(181, 181, 181, 255), width=1.2)
self.__texts = [self.__textInfo]
self.vLines.setPos(0)
self.hLines.setPos(0)
self.view.addItem(self.vLines)
self.view.addItem(self.hLines)
self.view.addItem(self.__textInfo, ignoreBounds=True)
self.__setVisibileOrNot(self.flags)
self.proxy = pg.SignalProxy(self.__view.scene().sigMouseMoved, rateLimit=60, slot=self.__mouseMoved)
self.click_slot = pg.SignalProxy(self.__view.scene().sigMouseClicked, rateLimit=60, slot=self.__mouseClicked)
# 跨线程刷新界面支持
self.signal.connect(self.update)