Programmatically defining layout

40 views
Skip to first unread message

Duy

unread,
Nov 1, 2018, 7:28:15 AM11/1/18
to Glue users
Hi Glue Devs!

Thanks for working on the tool! I have glue startup script that automatically loads a CSV and two fits files. 
I'd like to specify the locations of these widgets within glue like in this wireframe: 

I found this post back in 2014, but the API link seems to be broken, and I can't find any mention of a "move" method
https://groups.google.com/forum/#!searchin/glue-viz/location/glue-viz/VbWrhpfW-GI/zXLXRvP41aQJ

Is this possible/does this fit within the glue paradigm?

Thanks!
Duy

Thomas Robitaille

unread,
Nov 1, 2018, 7:33:11 AM11/1/18
to glue...@googlegroups.com, duytnguyen...@gmail.com
Hi Duy,

You can access the ``viewers`` attribute on the glue application object - this is a list of tabs, each of which is a list of viewers, so to get the first viewer in the first tab you would do:

>>> viewer = viewers[0][0]

you can then resize and move the viewer using:

>>> viewer.position = 100, 100
>>> viewer.size = 300, 300

For some reason, the resizing is not working with the latest developer version of glue, but I'll investigate that today.

Cheers,
Tom



--
You received this message because you are subscribed to the Google Groups "Glue users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to glue-viz+u...@googlegroups.com.
To post to this group, send email to glue...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/glue-viz/da0751fd-66d3-4b5f-a501-2c016f472357%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thomas Robitaille

unread,
Nov 1, 2018, 7:36:43 AM11/1/18
to glue...@googlegroups.com, duytnguyen...@gmail.com
Hi Duy,

In fact it was not a bug - to resize, you need to do:

>>> viewer.viewer_size = 300,300

(rather than just viewer.size).

Cheers,
Tom

Duy

unread,
Nov 1, 2018, 8:32:02 AM11/1/18
to Glue users
Great, thanks Tom! As a follow up, is it possible to get the size of the entire Glue Window to set these values dynamically? Perhaps so that if the user resizes the window, the widgets will scale together as well?

Thomas Robitaille

unread,
Nov 7, 2018, 6:27:31 AM11/7/18
to glue...@googlegroups.com, duytnguyen...@gmail.com
Hi Duy,

I'm sorry for not replying sooner - yes this is possible. First set up your widgets, then call:

app.gather_current_tab()

and this should make the widgets now be 'tiled' and resize with the window. Let me know if it doesn't work!

Cheers,
Tom


Duy

unread,
Nov 8, 2018, 10:34:32 PM11/8/18
to Glue users
Thanks Tom!

Actually digging through the glueviz docs, I stumbled upon the "custom fixed layout tab" experimental section. I think this might fit my needs better, and would value your input here!

Since the documentation is sparse due to this feature's experimental nature, could you provide a little more documentation here, about how to actually go about implementing this?

Much appreciated!
Duy

Thomas Robitaille

unread,
Jan 8, 2019, 5:48:43 AM1/8/19
to glue...@googlegroups.com
Hi Duy,

I'm very sorry for not replying sooner - the fixed layout tab functionality is somewhat experimental at the moment hence why I haven't documented it in detail. It currently requires a good understanding of Qt/PyQt. Here's an example of how it's used in a package called cubeviz:


I'm hoping to have a more final implementation of this functionality along with documentation in the next couple of months.

Cheers,
Tom


Reply all
Reply to author
Forward
0 new messages