Exemplo n.º 1
0
    def getKeywords(self):
        """The values in the profile provide keywords that can be
        matched against addon dependencies."""

        keys = []

        for setting in st.getSettings():
            # Must be either a toggle or a choice.
            if setting.getType() != 'toggle' and setting.getType() != 'choice':
                continue

            # Must have a value defined.
            v = self.getValue(setting.getId())
            if not v:
                continue

            # Active toggles define a keyword.
            if setting.getType() == 'toggle' and v.getValue() == 'yes':
                if v.getId() not in keys:
                    keys.append(v.getId())

            # Choices define a keyword.
            if setting.getType() == 'choice':
                if v.getValue() not in keys:
                    keys.append(v.getValue())

            # Other setting types don't create keywords.

        return keys
Exemplo n.º 2
0
def populateTabs():
    """Create setting widgets in all the tabs."""

    global shownSettings
    shownSettings = []

    for areaId, area in categoryTabs:
        # Use the appropriate layout parameters.
        area.setWeight(0)
        #area.setBorder(2)

        # Create a title inside the tab.
        #if areaId != 'addons-options' and areaId[-8:] == '-options':
        #    area.createText(areaId).setHeadingStyle()
        #    area.createLine()

        def settingFilter(s):
            if len(s.getRequiredAddons()) > 0:
                ident = s.getRequiredAddons()[0]
                properTab = ident

                # The addon does not exist?
                if not ao.exists(ident) or ao.get(ident).isUninstalled():
                    return False

                if s.getGroup():
                    # Addon setting with a group.
                    properTab += '-' + s.getGroup()
            elif not s.getGroup():
                properTab = 'general-options'
            else:
                properTab = s.getGroup()
            return properTab == areaId

        # Collect a list of all the settings for this tab (group).
        tabSettings = st.getSettings(settingFilter)

        populateWithSettings(areaId, area, tabSettings)