It looks like you're new here. If you want to get involved, click one of these buttons!
Is it possible to auto-run a ruby code after a layout is loaded from a file (either through drag/drop or File=>Open) ? I would like to auto-select the technology and apply it so the correct layers show, based on either the file name or the encountered layers.
Comments
Hi!
Looks like you could handle
MainWindow.on_view_created
event. Alternatively you could create macro that will ask user for file name withQFileDialog
, callMainWindow.load_layout
and perform other customizations.Eugene.
Hi,
I like the second proposal of Eugene.
You can basically capture the events which indicated a new layout, but there is also the option to add a layout to a view which you also have to consider (with what consequences I don't know). If you want to go the way of the events, capture "on_view_created" to install a new event "on_file_open" for this view. This event will be triggered finally when a layout was loaded.
Matthias
Hi,
I am finally getting around to implementing this automatic tech switcher. I succeeded in the test case below: when the file is loaded, the technology switches and adjust the layers. However, the Technology Manager widget in the tool bar remains on the old, previous technology. Is there a way to programmatically switching that also ?
Thanks.
Thomas.
Oh yes, the tool bar thing ...
Actually and unfortunately counter-intuitive, the tech button in the toolbar does not reflect the current layout's technology but rather the one you will apply if you push this button. It's the same logic that you have with the ruler: you select a ruler type and then push to activate it.
This logic is shared by all elements of the toolbar, so I cannot simply change one.
The technology your current layout carries is shown in the status bar next to the small "T" ("D25Test" in this case):
Is this explanation helpful?
Matthias
Hi Matthias,
this confirms my fears. I take from your response that there is no good way of forcing the tech-button to show another item ? I understand that the technology has already switched, I just would like to also switch the tech-button from ruby to reflect that. However, it's also not a big deal
Thanks.
Thomas.