Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

positioning of plotting windows #34

Closed
eendebakpt opened this issue Feb 17, 2016 · 8 comments
Closed

positioning of plotting windows #34

eendebakpt opened this issue Feb 17, 2016 · 8 comments
Assignees

Comments

@eendebakpt
Copy link
Contributor

I am trying to position the plot widows. Can we add a general setGeometry method to the BasePlot object?

The QtPlot object has member plotQ.win which is a pyqtgraph.GraphicsWindow. I can call plotQ.win.setGeometry to set the position (this works), but if I look at the object I get the following error:

> plotQ.win
===== Remote process raised exception on request: =====
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/pyqtgraph/multiprocess/remoteproxy.py", line 213, in handleRequest
    result = getattr(opts['obj'], opts['attr'])
AttributeError: 'GraphicsWindow' object has no attribute '_ipython_display_'

===== Local Traceback to request follows: =====
===== Remote process raised exception on request: =====
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/pyqtgraph/multiprocess/remoteproxy.py", line 213, in handleRequest
    result = getattr(opts['obj'], opts['attr'])
AttributeError: 'GraphicsWindow' object has no attribute '_repr_png_'
...
@alexcjohnson
Copy link
Contributor

Ah, the pyqtgraph object proxies are... so nice in some ways and such a pain in others.

Offhand I'd think setGeometry should belong to QtPlot rather than BasePlot. It won't pertain to matplotlib, will it? Nor to plotly, if I ever get around to adding that... but yes, that would definitely be nice to add. I haven't looked at its arguments, but perhaps there would be a way to add it to the QtPlot constructor too, as with figsize?

@eendebakpt
Copy link
Contributor Author

I think setGeometry should be in BasePlot. Matplotlib figures do not have a
geometry from itself, but depending on the backend we can set the position
as well (e.g. fig.canvas.manager.window.SetPosition).
Adding the position to the constructor is fine, but I also want it in the
object class.

Usually I have many windows floating around and I like to use the
setGeometry function to tile the windows onto my second monitor.

On Mon, Feb 29, 2016 at 12:15 AM, alexcjohnson notifications@github.com
wrote:

Ah, the pyqtgraph object proxies are... so nice in some ways and such a
pain in others.

Offhand I'd think setGeometry should belong to QtPlot rather than BasePlot.
It won't pertain to matplotlib, will it? Nor to plotly, if I ever get
around to adding that... but yes, that would definitely be nice to add. I
haven't looked at its arguments, but perhaps there would be a way to add it
to the QtPlot constructor too, as with figsize?


Reply to this email directly or view it on GitHub
qdev-dk-archive#34 (comment).

@giulioungaretti
Copy link
Contributor

@eendebakpt looking at this again I think we can close this issue, you are seing an error because you are using ipython/jupyter!
Whenever you return an object to the ipython console, or the jupyter html notebook they will try to find a repr function, and the pyqt remote proxies will happily accept any function call and proxy it to the real object which then will raise an exception and then the proxy raises another exception that has a different type than what the console/ notebook expect.

Thas is a classic failure mode of poorly designed systems, like the remote pyqtgraph (which was just designed for speed, not interactive use).

@peendebak
Copy link
Contributor

@Unga In #387 there is no issue any more, so in that sense the issue can be closed. Related there are the following two issues:

  • There should be a generic .setGeometry that is both valid for the Qt and Matplotlib style windows.
  • In Feature/qt_plot_2 #387 the plotting object is a subclass of QWidget. This has both advantages and disadvantages and we should decide whether we want this or not.

@giulioungaretti
Copy link
Contributor

@peendebak yes, because 387 uses pyqtgraph the way it's meant to be used :D

Possibly true that there should be .setGeometry but in matplotlib that gets tricky ( @jenshnielsen may know a lot more about this than me though) it also gets tricky in the web world where one does not take control of the desktop behavior!

@giulioungaretti
Copy link
Contributor

for pyqtgraph this can be solved like this:
qdev-dk-archive@ae32c1a

Wether or not we want to merge this back in qcodes it's something we can decide here!

@jenshnielsen you call the shot on this one!

@jenshnielsen
Copy link
Collaborator

Probably we should expose a setting from config that sets a default position. That way you can configure your measurement computer with say the notebook/python console on the left and windows always popping up to the right of that and if you don't set anything in config it will default to the current behaviour.

The tricky part is handling multi monitor in a way thats both general enough and actually useful

spauka pushed a commit to spauka/Qcodes that referenced this issue Jun 7, 2017
@jenshnielsen
Copy link
Collaborator

For pyqtgraph this is possible via fig_x_position and fig_y_position https://github.com/QCoDeS/Qcodes/blob/master/qcodes/plots/pyqtgraph.py#L68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants