Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1KB

  1. #!/usr/bin/env python3
  2. # SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. # ---------------------------------------------------------------------------------------------------------------------
  5. # Imports (Global)
  6. from qt_compat import qt_config
  7. if qt_config == 5:
  8. from PyQt5.QtCore import QSettings
  9. elif qt_config == 6:
  10. from PyQt6.QtCore import QSettings
  11. # ---------------------------------------------------------------------------------------------------------------------
  12. # Safer QSettings class, which does not throw if type mismatches
  13. class QSafeSettings(QSettings):
  14. def value(self, key, defaultValue, valueType):
  15. if not isinstance(defaultValue, valueType):
  16. print("QSafeSettings.value() - defaultValue type mismatch for key", key)
  17. try:
  18. return QSettings.value(self, key, defaultValue, valueType)
  19. except:
  20. return defaultValue
  21. # ---------------------------------------------------------------------------------------------------------------------