User Settings#
Interface to support user-specific application settings.
Use this for remembering:
window positions and geometry
user preferences
The name of the settings file is given in the main window.
Note, the settings file may have the suffix .ini
on some operating systems.
Remove the settings file to clear any settings.
This module uses QtCore.QSettings
.
(https://doc.qt.io/qtforpython-5/PySide2/QtCore/QSettings.html#qsettings)
Note
Multi-monitor support : method restoreWindowGeometry()
On multi-monitor systems such as laptops, window may be restored to offscreen position. Here is how it happens:
geo was saved while window was on 2nd screen while docked
now re-opened on laptop display and window is off-screen
For now, keep the windows on the main screen or learn how to edit the settings file.
- see:
|
Manage and preserve settings for this application using QSettings. |
Application settings object (a singleton). |
- class gemviz.user_settings.ApplicationQSettings(*args: Any, **kwargs: Any)[source]#
Manage and preserve settings for this application using QSettings.
Use the .ini file format and save under user directory.
to_dict
()Return a dict with all the settings.
init_global_keys
()_keySplit_
(full_key)split full_key into (group, key) tuple
keyExists
(key)does the named key exist?
getKey
(key)Return the Python object of key or None if not found.
setKey
(key, value)Set the value of a configuration key, creates the key if it does not exist.
Reset all application settings to default values.
updateTimeStamp
()saveWindowGeometry
(window, label)Remember the window's location.
restoreWindowGeometry
(window, label)Put the window back in place.
saveSplitter
(splitter, label)remember where the splitter was
restoreSplitter
(splitter, label)put the splitter back where it was
- _keySplit_(full_key)[source]#
split full_key into (group, key) tuple
- Parameters:
full_key (str) – either key or group/key, default group (unspecified) is GLOBAL_GROUP
- restoreSplitter(splitter, label)[source]#
put the splitter back where it was
- Parameters:
splitter (obj) – instance of QSplitter
label (str) – group name to use in settings file
- restoreWindowGeometry(window, label)[source]#
Put the window back in place.
- Parameters:
window (obj) – instance of QWidget
label (str) – group name to use in settings file
- saveSplitter(splitter, label)[source]#
remember where the splitter was
- Parameters:
splitter (obj) – instance of QSplitter
label (str) – group name to use in settings file
- saveWindowGeometry(window, label)[source]#
Remember the window’s location.
- Parameters:
window (obj) – instance of QWidget
label (str) – group name to use in settings file
- gemviz.user_settings.settings#
Application settings object (a singleton).