taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

maintain gui's default look #1096

Closed kklmn closed 4 years ago

kklmn commented 4 years ago

Hello,

We have two gui applications where the arrangement of panels is not preserved after a restart. Not only the sizes are changed but also relative positions, e.g. what was on the left appears at the bottom.

Q1. Can I get the gui geometry saved/restored automatically?

Q2. Can a predefined perspective (e.g. 'default') be loaded automatically? Presently, every time we restart a gui we apply a perspective, which is ok for beamline staff but not ok for external users.

Thank you!

cpascual commented 4 years ago

Hi @kklmn ,

Q1. Can I get the gui geometry saved/restored automatically?

Saving should occur automatically unless you are affected by bug #1062). In normal circumstances, the TaurusMainWindow.closeEvent() method calls to self.saveSettings()). Check if you see an INFO-level log message about it in the console when closing (something like "Settings saved in foo.ini") .

Restoring also should occur automatically for "normal" TaurusGuis (e.g. those made with the wizard). More precisely, they call self.loadConfiguration() which it ends up calling self._loadIniFile(), which calls TaurusMainWindow.loadSettings().

Check for INFO-level "MainWindow settings restored" log message during initialization.

Maybe your GUIs are custom-made ones? If so, maybe they are missing a call to TaurusMainWindow.loadSettings() . Or maybe the loadConfiguration() is exiting prematurely due to some exception?

Q2. Can a predefined perspective (e.g. 'default') be loaded automatically?

Programmatically: use TaurusMainWindow.loadSettings(), or (since taurus 4.6) you can pass the settings file path to the TaurusGUI constructor using the settingsname argument.

From the Command line, since taurus 4.6, you can use the --ini argument to the taurus gui command to specify the desired settings file to be loaded.

kklmn commented 4 years ago

Thank you Carlos! This was a very informative answer! I immediately created a request to our KITS to implement it and was hoping to report here on the results but it seems it will take a while. For now, I assume it will work and close the issue. Thanks again!