Pyqtgraph with QML

Showing 1-8 of 8 messages
Pyqtgraph with QML Papee 10/31/12 7:35 AM
Hi,
Could anyone point me to a simple example where we can use pyqtgraph inside a QML generated window?
Thanks in advance - papee
Re: [pyqtgraph] Pyqtgraph with QML Luke Campagnola 10/31/12 12:24 PM
I have not worked with QML at all, but my impression is that it is still very new and QML+Python is experimental at best. PySide claims to have some support for QML but I have not seen this in use anywhere outside of some very basic examples. PyQt appears to have incomplete support for QML (notably, it does not support qmlRegisterType).

So I think the answer for now is no, but in time this could become a possibility. 

Luke


-- [ You are subscribed to pyqt...@googlegroups.com. To unsubscribe, send email to pyqtgraph+...@googlegroups.com ]

Re: Pyqtgraph with QML Papee 11/5/12 12:54 PM

Luke,

I have raised a question regarding pyqtgraph and qml in stackoverflow http://stackoverflow.com/questions/13240066/graph-pyqtgrapg-is-not-getting-plotted-inside-qml-generated-window . I got the graph window but no plotting. If you have any suggestion please reply.

regards ,

--afilash

Re: [pyqtgraph] Re: Pyqtgraph with QML Luke Campagnola 11/5/12 2:12 PM
On Mon, Nov 5, 2012 at 3:54 PM, Papee <afi...@gmail.com> wrote:

Luke,

I have raised a question regarding pyqtgraph and qml in stackoverflow http://stackoverflow.com/questions/13240066/graph-pyqtgrapg-is-not-getting-plotted-inside-qml-generated-window . I got the graph window but no plotting. If you have any suggestion please reply.


Cool! I'm impressed it works at all. Thanks for figuring that out!

My best guess is that the problem is related to this bug:

However it only appears to be a problem within the QML context. 
You can work around the problem by commenting out the 'itemChange' method in pyqtgraph/graphicsItems/GraphicsObject.py.

Luke

Re: Pyqtgraph with QML Papee 11/6/12 3:21 AM
Thanks Luke, It worked.
Re: Pyqtgraph with QML Papee 11/6/12 3:36 AM
I know how hard to search for working examples, This is my code, if it helps someone!

#! /usr/bin/python

 

'''

Created on 03-Nov-2012

@author: Afilash

Main.py : Executable for creating application GUI</span

...
Re: Pyqtgraph with QML Papee 11/11/12 9:32 AM

Hi Luke,

When running the above program , Memory is getting eaten up. It is slowly getting increasing. If we leave the program like that I think the system will purge it. Any solution ?

Re: [pyqtgraph] Re: Pyqtgraph with QML Luke Campagnola 11/11/12 10:56 AM
On Sun, Nov 11, 2012 at 12:32 PM, Papee <afi...@gmail.com> wrote:

Hi Luke,

When running the above program , Memory is getting eaten up. It is slowly getting increasing. If we leave the program like that I think the system will purge it. Any solution ?

No solution yet, but here's some detective work:

1) Stopping the timer also stops the memory leak
2) Removing QML from the system and using a regular GraphicsView instead does not help
3) Switching to PyQt4 instead of PySide fixes the problem.
4) It does not appear that there are any python objects being leaked (see below). Putting this together with #3 suggests that the leak is internal to the PySide library. The question remains, then, whether this is due to a PySide bug or improper use of the library.

Here's why I don't think there are any python objects being leaked:  If you disable the timer and add some code immediately before the Qt event loop is started:

    import pyqtgraph.console as con
    c = con.ConsoleWidget()
    c.show()

Then you'll get a console you can do some testing from (this is necessary because PySide still blocks the Python interactive prompt). In the console, I ran this code:

import __main__
graph = __main__.rootObject.children()[0]

## run updates many times to get the memory profile 'settled'
for i in range(500): 
    graph.UpdatePlotData()
    QtGui.QApplication.processEvents()

## take a snapshot of all python objects, then run again
## see help(pg.debug.ObjTracker) for more information on how this works.
ot = pg.debug.ObjTracker()
for i in range(500): 
    graph.UpdatePlotData()
    QtGui.QApplication.processEvents()

## take a second snapshot, run again
ot.diff()
for i in range(500): 
    graph.UpdatePlotData()
    QtGui.QApplication.processEvents()

## and take a third snapshot. This will give you a list of 'persistent' 
## objects--those that were created between the first and second snapshots,
## but were not re-collected by the third snapshot.
ot.diff()

This outputs a lot of information, but at the end is this:

----------- 116 Created since start (persistent): ------------

1 504 <type 'unicode'>

87 1566 <type 'long'>

28 12208 <type 'type'>


So only 116 'persistent' objects are present in this test, none of which are large objects like arrays, graphics items, etc.
I wouldn't consider this proof that nothing is being leaked from pyqtgraph, but it's  reasonably strong evidence.


Luke