def has_qsettings_write_permission(settings):
value = datetime.datetime.now().isoformat("T")
settings.setValue(MARKER_KEY, value)
settings.sync()
# there's a race here, if another thread/process also
# performs the same check at the same time
if settings.status() != QtCore.QSettings.NoError:
return False
if settings.value(MARKER_KEY) != value:
return False
settings.remove(MARKER_KEY)
settings.sync()
return True
评论列表
文章目录