Discussion:
[PySide] QSettings confusion - again
Frank Rueter | OHUfx
2018-08-02 06:36:15 UTC
Permalink
Hi all,

I just wrote a little snippet to store a simple string in a settings file:

|from PySide2 import QtCore settings = QtCore.QSettings("TestName",
"TestApp") settings.setValue('groupName/attrName', 'testValue') |

Then I launch my application that reads the above like this:

|settings = QtCore.QSettings("TestName", "TestApp") my_value =
settings.value('groupName/attrName', 'testValue') |

The app retrieves the value “testValue” but now I want to kill the file
and start from scratch.
Problem is, the file does not exist where the docs say it should.
I’m on OSX and checked:
~/Library/Preferences
as well as:
/Library/Preferences

According to settings.fileName() the plist file should be in:

|~/Library/Preferences/com.testname.TestApp.plist |

but that file does not exist.

Weird thing is when I close and open my app again it still manages to
retrieve the value “testValue”, but I have no clue where it gets it from.

What am I missing?

Cheers,
frank

​
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>


Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>
Frank Rueter | OHUfx
2018-08-03 01:47:54 UTC
Permalink
Some more weirdness:
I just created a new settings instance with a new name and when I run
allKeys() on it, it lists a ton of lists from various plist files on my
system (see below)
Is this a bug of am I expecting the wrong thing? I guess I need to use
an explicit ini file location for now.

|settings = QtCore.QSettings("NewTest", "TestApp") settings.allKeys() [u'
USB DISK 3/0', u'AKDeviceUnlockState', u'AKLastCheckInAttemptDate',
u'AKLastCheckInSuccessDate', u'AKLastEmailListRequestDateKey',
u'AKLastIDMSEnvironment', u'Apple Inc/ FaceTime HD Camera (Built-in)',
u'AppleActionOnDoubleClick', u'AppleKeyboardUIMode', u'AppleLanguages',
u'AppleLanguagesDidMigrate', u'AppleLocale',
u'AppleMiniaturizeOnDoubleClick', u'AppleTextDirection',
u'CGPostScriptDisabled', u'Country', u'HGST TOURO S',
u'MultipleSessionEnabled', u'NSAllowsInputManagerPlugins',
u'NSFileViewer', u'NSLinguisticDataAssetsRequestTime',
u'NSLinguisticDataAssetsRequested',
u'NSNavPanelFileLastListModeForOpenModeKey',
u'NSNavPanelFileLastListModeForSaveModeKey',
u'NSNavPanelFileListModeForOpenMode2',
u'NSNavPanelFileListModeForSaveMode2', u'NSNavRecentPlaces',
u'NSPersonNameDefaultDisplayNameOrder',
u'NSPersonNameDefaultShortNameFormat',
u'NSPersonNameDefaultShouldPreferNicknamesPreference',
u'NSPreferredWebServices', u'NSUserDictionaryReplacementItems',
u'NavPanelFileListModeForOpenMode', u'NavPanelFileListModeForSaveMode',
u'PKSecureElementAvailableFlags', u'Wacom Co,/Ltd/ Wacom Intuos Pro M',
u'Western Digital Elements 25A2', u'_HIHideMenuBar',
u'com/apple/AppleModemSettingTool/LastCountryCode',
u'com/apple/ColorSync/Devices',
u'com/apple/CommonPanels/CalibrateDisplay/identifier-042BB5DC',
u'com/apple/CommonPanels/CalibrateDisplay/seed',
u'com/apple/TimeZonePref/Last_Selected_City',
u'com/apple/finder/SyncExtensions', u'com/apple/keyboard/fnState',
u'com/apple/preferences/timezone/selected_city',
u'com/apple/sound/beep/flash', u'com/apple/springing/delay',
u'com/apple/springing/enabled', u'com/apple/swipescrolldirection',
u'com/apple/trackpad/enableSecondaryClick',
u'com/apple/trackpad/fiveFingerPinchSwipeGesture',
u'com/apple/trackpad/forceClick',
u'com/apple/trackpad/fourFingerHorizSwipeGesture',
u'com/apple/trackpad/fourFingerPinchSwipeGesture',
u'com/apple/trackpad/fourFingerVertSwipeGesture',
u'com/apple/trackpad/momentumScroll',
u'com/apple/trackpad/pinchGesture', u'com/apple/trackpad/rotateGesture',
u'com/apple/trackpad/scrollBehavior',
u'com/apple/trackpad/threeFingerDragGesture',
u'com/apple/trackpad/threeFingerHorizSwipeGesture',
u'com/apple/trackpad/threeFingerTapGesture',
u'com/apple/trackpad/threeFingerVertSwipeGesture',
u'com/apple/trackpad/twoFingerDoubleTapGesture',
u'com/apple/trackpad/twoFingerFromRightEdgeSwipeGesture',
u'com/apple/trackpad/version', u'java/lang/disabled'] |
Post by Frank Rueter | OHUfx
Hi all,
|from PySide2 import QtCore settings = QtCore.QSettings("TestName",
"TestApp") settings.setValue('groupName/attrName', 'testValue') |
|settings = QtCore.QSettings("TestName", "TestApp") my_value =
settings.value('groupName/attrName', 'testValue') |
The app retrieves the value “testValue” but now I want to kill the
file and start from scratch.
Problem is, the file does not exist where the docs say it should.
~/Library/Preferences
/Library/Preferences
|~/Library/Preferences/com.testname.TestApp.plist |
but that file does not exist.
Weird thing is when I close and open my app again it still manages to
retrieve the value “testValue”, but I have no clue where it gets it from.
What am I missing?
Cheers,
frank
​
--
ohufxLogo 50x50 <http://www.ohufx.com>
*vfx compositing <http://ohufx.com/compositing.html> | *workflow
customisation and consulting <http://ohufx.com/customising.html>* *
*<http://ohufx.com/compositing.html>*
<http://www.nukepedia.com/nubridge>
Your gateway to over 1,000 free tools... right inside of Nuke
<http://www.nukepedia.com/nubridge>
_______________________________________________
PySide mailing list
http://lists.qt-project.org/mailman/listinfo/pyside
​

Loading...