Beispiel #1
0
    ##### Actions #############################################################

    @addons.action("Use &Style", default=True)
    def use(self):
        """ Make this the active style. """
        activate_style(self)

    @use.is_enabled
    def is_enabled(self):
        return _current_style is self

# Registration
addons.add_type(
    'style',
    StyleInfo,
    "{name}/style.ini",
    ['styles'],
    text="Styles",
    icon='styles'
)

###############################################################################
# Style Application - Where the Magic Happens!
###############################################################################

def load_qss(name, style=None, use_inheritance=True, _always_return=True):
    if not style:
        style = _current_style
    if not style:
        if _always_return:
            return ''
        return
Beispiel #2
0
                    log.exception('Unable to instance plugin %r.' %
                                  self.data['name'])
                    raise ImportError
        else:
            log.exception('Cannot find subclass of IPlugin in plugin %r.' %
                          self.data['name'])
            raise ImportError

        # Log how happy we are.
        log.info('Loaded plugin %r.' % self.data['name'])

# Registration
addons.add_type(
    'plugin',
    PluginInfo,
    search_paths=['plugins'],
    text="Plugins",
    icon='plugins'
)

###############################################################################
# PluginManager Class
###############################################################################

class PluginManager(object):
    """
    This class handles the loading of plugins, as well as the connection of
    signals and slots between the plugins and the rest of the application.
    """

    def __init__(self):