Python pyqtgraph.SignalProxy() Examples
The following are 13
code examples of pyqtgraph.SignalProxy().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pyqtgraph
, or try the search function
.
Example #1
Source File: curves.py From pymeasure with MIT License | 6 votes |
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
Example #2
Source File: uiCrosshair.py From InplusTrader_Linux with MIT License | 6 votes |
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) #----------------------------------------------------------------------
Example #3
Source File: diffshow.py From scikit-ued with MIT License | 6 votes |
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)
Example #4
Source File: scene_model.py From kite with GNU General Public License v3.0 | 5 votes |
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()
Example #5
Source File: multiplot.py From kite with GNU General Public License v3.0 | 5 votes |
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)
Example #6
Source File: plot.py From qspectrumanalyzer with GNU General Public License v3.0 | 5 votes |
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)
Example #7
Source File: __init__.py From finplot with MIT License | 5 votes |
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
Example #8
Source File: __init__.py From finplot with MIT License | 5 votes |
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))
Example #9
Source File: uiCrosshair.py From uiKLine with MIT License | 4 votes |
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) #----------------------------------------------------------------------
Example #10
Source File: multiplot.py From kite with GNU General Public License v3.0 | 4 votes |
def __init__(self, sandbox, *args, **kwargs): pg.GraphicsLayoutWidget.__init__(self, **kwargs) self.sandbox = sandbox self.plots = [ DisplacementPlot( sandbox, title='Scene Displacement', component=lambda m: m.reference.scene.displacement), DisplacementPlot( sandbox, title='Model Residual', component=lambda m: m.reference.difference)] self.plots[-1].addHintText() self._mov_sig = pg.SignalProxy( self.scene().sigMouseMoved, rateLimit=60, slot=self.mouseMoved) for ip, plt in enumerate(self.plots): row = ip / 2 col = ip % 2 + 1 self.addItem(plt, row=row, col=col) plt.showGrid(x=True, y=True) plt.hideAxis('bottom') plt.hideAxis('left') plt.vb.border = pg.mkPen(50, 50, 50) if ip != 0: plt.setXLink(self.plots[0]) plt.setYLink(self.plots[0]) def getAxis(plt, orientation, label): axis = pg.AxisItem( orientation=orientation, linkView=plt.vb) axis.setLabel(label, units='m') return axis plts = self.plots self.addItem(getAxis(plts[0], 'left', 'Northing'), row=0, col=0) self.addItem(getAxis(plts[1], 'left', 'Northing'), row=1, col=0) self.addItem(getAxis(plts[0], 'bottom', 'Easting'), row=2, col=1) self.addItem(getAxis(plts[1], 'bottom', 'Easting'), row=2, col=2)
Example #11
Source File: uiCrosshair.py From uiKLine with MIT License | 4 votes |
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) #----------------------------------------------------------------------
Example #12
Source File: crosshair.py From equant with GNU General Public License v2.0 | 4 votes |
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)
Example #13
Source File: graphtab.py From equant with GNU General Public License v2.0 | 4 votes |
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)