Hi,

seems I have to dive a lot deeper into Qt and pyqtgraph than I had hoped.

What about extending  RemoteGraphicsView to provide more than one remote 
view so one could create several RemotePlotWidgets?

For now I added checkboxes to switch the Plots invisible which does part of 
the job.

Gregor

On Thursday, 1 July 2021 at 08:21:30 UTC+2 Patrick wrote:

> Hi,
>
> Ah yes, the issue with inter-process communications will be a problem when 
> using multiple RemoteGraphicsView objects (for linking axes etc)...
>
> First, I think you need to make sure you know the distinction between Qt 
> and pyqtgraph "Widgets" versus Qt and pyqtgraph "GraphicsItems". See the 
> diagram in the documentation here 
> <https://pyqtgraph.readthedocs.io/en/latest/plotting.html>. A 
> GraphicsView is a Widget, but then everything placed inside of the 
> GraphicsView must be GraphicsItems. That is, you can't place a QSplitter 
> Widget inside a GraphicsView and use it to arrange the other GraphicsItems.
>
> What you want is possible of course, but there is no pre-built "splitter" 
> type of GraphicItem that I know of, and so it would require coding one for 
> yourself.
> Perhaps first look at the pyqtgraph GraphicsLayout example to see how 
> GraphicsItems can be arranged inside of a GraphicsLayout, and imagine that 
> the very top and left labels (which are LabelItems 
> <https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/labelitem.html>) 
> span the rows and columns like you'd want a splitter to do. Labels don't 
> have any user interaction though, so starting with something that does, 
> like an AxisItem 
> <https://pyqtgraph.readthedocs.io/en/latest/_modules/pyqtgraph/graphicsItems/AxisItem.html#AxisItem>
>  
> or ButtonItem 
> <https://pyqtgraph.readthedocs.io/en/latest/_modules/pyqtgraph/graphicsItems/ButtonItem.html#ButtonItem>,
>  
> might be a good idea. You'd then need to connect mouse drags to changes to 
> the GraphicsLayout.layout 
> <https://pyqtgraph.readthedocs.io/en/latest/_modules/pyqtgraph/graphicsItems/GraphicsLayout.html#GraphicsLayout>
>  
> (which is a QGraphicsGridLayout 
> <https://doc.qt.io/qt-5/qgraphicsgridlayout.html> object). It sounds a 
> little complicated, but I *think* it should work!
>
> Patrick
> On Thursday, 1 July 2021 at 2:49:01 pm UTC+9:30 [email protected] wrote:
>
>> Hi,
>>
>>
>> thank you for your answer.
>>
>>
>> Am Donnerstag, 1. Juli 2021, 05:13:01 CEST schrieb Patrick:
>>
>> > I think the easiest is to actually create three QSplitters ...
>>
>> > then add four separate pyqtgraph GraphicsView ...
>>
>> > Hope that helps!
>>
>> No, unfortunately not.
>>
>> This only resembles my second code snippet how it would work with local 
>>
>> GraphicViews.
>>
>> I need to use a RemoteGraphicsView for performance reasons and I think I 
>> have 
>>
>> to use only one because the x-axes of the plots are linked together.
>>
>> On the RemoteGraphicsView I only found methods to addItems but no way to 
>>
>> addWidgets.
>>
>>
>> May be I need a way to turn a QSplitter into an Item to do something like:
>>
>> view.setCentralItem(splitter)
>>
>>
>> Gregor
>>
>> On Thu, Jul 1, 2021 at 5:13 AM Patrick <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I think the easiest is to actually create three QSplitters (either two 
>>> horizontal inside one vertical, or vice-versa) so you have the four 
>>> resizable panels, then add four separate pyqtgraph GraphicsView (or 
>>> similar) instances into that splitter grid.
>>>
>>> Boilerplate code generated from Qt Designer and pyside2-uic for 
>>> demonstration:
>>>
>>> self.horizontalLayout = QHBoxLayout(Form)
>>> self.splitter_3 = QSplitter(Form)
>>> self.splitter_3.setOrientation(Qt.Vertical)
>>> self.splitter = QSplitter(self.splitter_3)
>>> self.splitter.setOrientation(Qt.Horizontal)
>>> self.graphicsView = GraphicsView(self.splitter)
>>> self.splitter.addWidget(self.graphicsView)
>>> self.graphicsView_2 = GraphicsView(self.splitter)
>>> self.splitter.addWidget(self.graphicsView_2)
>>> self.splitter_3.addWidget(self.splitter)
>>> self.splitter_2 = QSplitter(self.splitter_3)
>>> self.splitter_2.setOrientation(Qt.Horizontal)
>>> self.graphicsView_3 = GraphicsView(self.splitter_2)
>>> self.splitter_2.addWidget(self.graphicsView_3)
>>> self.graphicsView_4 = GraphicsView(self.splitter_2)
>>> self.splitter_2.addWidget(self.graphicsView_4)
>>> self.splitter_3.addWidget(self.splitter_2)
>>> self.horizontalLayout.addWidget(self.splitter_3)
>>>
>>>
>>> Hope that helps!
>>> Patrick
>>> On Wednesday, 30 June 2021 at 8:03:09 pm UTC+9:30 [email protected] 
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> I have an application with 4 online plots handled by RemoteGraphicsView 
>>>> for performance reasons. Something like this:
>>>>
>>>> import pyqtgraph as pg
>>>> import pyqtgraph.widgets.RemoteGraphicsView
>>>>
>>>> app = pg.mkQApp()
>>>> layout = pg.LayoutWidget()
>>>>
>>>> view = pg.widgets.RemoteGraphicsView.RemoteGraphicsView()
>>>> layout.addWidget(view)
>>>> win = view.pg.GraphicsLayout()
>>>> view.setCentralItem(win)
>>>>
>>>> plt = [view.pg.PlotItem() for i in range(0,4)]
>>>> [win.addItem(p, col=0, row=i) for i,p in enumerate(plt)]
>>>>
>>>> layout.show()
>>>>
>>>> if __name__ == '__main__':
>>>>     app.exec()
>>>>
>>>> I tried to make the individual plot sizes adjustable with help of 
>>>> QSplitter, which in the local case worked like this:
>>>>
>>>> import pyqtgraph as pg
>>>> from pyqtgraph.Qt import QtGui, QtCore
>>>>
>>>> app = pg.mkQApp()
>>>> layout = pg.LayoutWidget()
>>>>
>>>> splitter = QtGui.QSplitter()
>>>> splitter.setOrientation(QtCore.Qt.Orientation.Vertical)
>>>> layout.addWidget(splitter)
>>>>
>>>> plt = [pg.PlotWidget() for i in range(0,4)]
>>>> [splitter.addWidget(p) for p in plt]
>>>>
>>>> layout.show()
>>>>
>>>> if __name__ == '__main__':
>>>>     app.exec()
>>>>
>>>> however I wasn't able to get this working in the remote case. I tried 
>>>> local and remote versions of the splitter (view.pg.Qt.QtGui.QSplitter) 
>>>> but always got lost in the interactions of widgets, items and remote 
>>>> proxies.
>>>>
>>>> Some ideas how to get this or something similar working?
>>>>
>>>> Thanks for your help!
>>>>
>>>> Gregor
>>>>
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "pyqtgraph" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/pyqtgraph/buXRTEefm-0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/pyqtgraph/b569fae4-75a6-4580-851d-97200c2a1f5bn%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/pyqtgraph/b569fae4-75a6-4580-851d-97200c2a1f5bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/00f10b6a-cece-45a6-9004-2a01e81e354cn%40googlegroups.com.

Reply via email to