daplis_rtp.gui.session module
What the tabs remember between runs.
A tab is opened, a folder is chosen, the daughterboard and the firmware and the timestamp count are set - and until now all of it was thrown away when the window closed, so the next session began by typing the same six things again. The Synchronization tab already remembered its executable and its two folders; nothing else remembered anything.
A widget is bound to a key here, and from then on it saves itself
whenever it changes and restores itself when the tab is next built.
Storage is QSettings, the same per-user store the theme uses, under
a session/<tab> group.
Only inputs are bound. A readout, a status lamp or a plot is a statement about the data in front of you, and restoring one of those on a fresh start would be a statement about nothing.
- class daplis_rtp.gui.session.SessionStore(scope)[source]
Bases:
objectThe settings one tab remembers, and the widgets they belong to.
- Parameters:
scope (str) – Names the tab. Becomes the
QSettingsgroup, so it must not change once a version has shipped or everyone’s settings are silently forgotten.
- bind(key, widget)[source]
Remember one widget under
key.The key is given rather than taken from the widget’s name: an object name is a layout detail that gets renamed in a tidy-up, and renaming one here would quietly lose what it stored.
- restore()[source]
Put back what was stored, for every bound widget.
Saving is suppressed while this runs. Writing a widget makes it emit its change signal, and without the guard the first widget restored would save the unrestored value of the ones after it - which is only not a bug because they are about to be overwritten anyway, and is exactly the kind of thing that stops being true later.