def __init__(self, libraryWindow=None):
        super(LibrariesMenu, self).__init__(libraryWindow)

        self.setTitle('Libraries')

        libraries = studiolibrary.readSettings()
        default = studiolibrary.defaultLibrary()

        for name in libraries:

            library = libraries[name]

            path = library.get('path', '')
            kwargs = library.get('kwargs', {})

            enabled = True
            if libraryWindow:
                enabled = name != libraryWindow.name()

            text = name
            if name == default and name.lower() != "default":
                text = name + " (default)"

            action = QtWidgets.QAction(text, self)
            action.setEnabled(enabled)
            callback = partial(self.showLibrary, name, path, **kwargs)
            action.triggered.connect(callback)
            self.addAction(action)
Beispiel #2
0
def updateSettings(data):
    """
    Update the existing settings with the given data.

    :type data: dict
    """
    settings = studiolibrary.readSettings()
    update(settings, data)
    studiolibrary.saveSettings(settings)
    def __init__(self, libraryWindow=None):
        super(LibrariesMenu, self).__init__(libraryWindow)

        self.setTitle('Libraries')

        libraries = studiolibrary.readSettings()

        for name in libraries:

            library = libraries[name]

            path = library.get('path', '')
            kwargs = library.get('kwargs', {})

            enabled = True
            if libraryWindow:
                enabled = name != libraryWindow.name()

            action = QtWidgets.QAction(name, self)
            action.setEnabled(enabled)
            callback = partial(self.showLibrary, name, path, **kwargs)
            action.triggered.connect(callback)
            self.addAction(action)