# Path: hashmal_lib/plugins/base.py
# class Category(object):
#     """Plugin category.
# 
#     Use one of the below class attributes for a dock's category attribute
#     e.g. 'category = Category.Script'.
#     """
#     Core = PluginCategory('Core', 'Core Hashmal functionality implemented as a plugin.')
#     General = PluginCategory('General', 'General or uncategorized plugin.')
#     Block = PluginCategory('Blocks', 'Plugin that involves blocks and/or block headers.')
#     Data = PluginCategory('Data', 'Plugin that retrieves blockchain data.')
#     Key = PluginCategory('Keys', 'Plugin that involves keys, addresses, etc.')
#     Script = PluginCategory('Scripts', 'Plugin that involves scripts.')
#     Tx = PluginCategory('Transactions', 'Plugin that involves transactions.')
# 
#     @classmethod
#     def categories(cls):
#         category_list = []
#         for i in dir(cls):
#             attr = getattr(cls, i)
#             if attr.__class__.__name__ == 'PluginCategory':
#                 category_list.append(attr)
#         return category_list


import __builtin__
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from hashmal_lib.plugins.base import Category
from gui_utils import Separator, required_plugins, default_plugins
            elif is_checked and not in_favorites:
                favorites.append(name)
            # Remove from favorites.
            elif not is_checked and in_favorites:
                favorites.remove(name)

            self.config.set_option('favorite_plugins', favorites)
            return True

        return True

    def plugin_for_index(self, index):
        if not index.isValid():
            return None
        return self.plugin_for_row(index.row())

    def plugin_for_row(self, row):
        plugin = sorted(self.plugins, key=lambda i: i.name)[row]
        return plugin

    def on_option_changed(self, key):
        if key == 'enabled_plugins':
            new_enabled = self.config.get_option('enabled_plugins', default_plugins)
            # Update view if necessary.
            if self.enabled_plugins != new_enabled:
                self.enabled_plugins = new_enabled
                self.dataChanged.emit(QModelIndex(), QModelIndex())
        elif key == 'favorite_plugins':
            new_favorites = self.config.get_option('favorite_plugins', [])
            if self.favorite_plugins != new_favorites:

# Path: hashmal_lib/plugins/base.py
# class Category(object):
#     """Plugin category.
# 
#     Use one of the below class attributes for a dock's category attribute
#     e.g. 'category = Category.Script'.
#     """
#     Core = PluginCategory('Core', 'Core Hashmal functionality implemented as a plugin.')
#     General = PluginCategory('General', 'General or uncategorized plugin.')
#     Block = PluginCategory('Blocks', 'Plugin that involves blocks and/or block headers.')
#     Data = PluginCategory('Data', 'Plugin that retrieves blockchain data.')
#     Key = PluginCategory('Keys', 'Plugin that involves keys, addresses, etc.')
#     Script = PluginCategory('Scripts', 'Plugin that involves scripts.')
#     Tx = PluginCategory('Transactions', 'Plugin that involves transactions.')
# 
#     @classmethod
#     def categories(cls):
#         category_list = []
#         for i in dir(cls):
#             attr = getattr(cls, i)
#             if attr.__class__.__name__ == 'PluginCategory':
#                 category_list.append(attr)
#         return category_list


# Path: hashmal_lib/plugin_manager.py
import __builtin__
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from hashmal_lib.plugins.base import Category
from gui_utils import Separator, required_plugins, default_plugins

            elif is_checked and not in_favorites:
                favorites.append(name)
            # Remove from favorites.
            elif not is_checked and in_favorites:
                favorites.remove(name)

            self.config.set_option('favorite_plugins', favorites)
            return True

        return True

    def plugin_for_index(self, index):
        if not index.isValid():
            return None
        return self.plugin_for_row(index.row())

    def plugin_for_row(self, row):
        plugin = sorted(self.plugins, key=lambda i: i.name)[row]
        return plugin

    def on_option_changed(self, key):
        if key == 'enabled_plugins':
            new_enabled = self.config.get_option('enabled_plugins', default_plugins)
            # Update view if necessary.
            if self.enabled_plugins != new_enabled:
                self.enabled_plugins = new_enabled
                self.dataChanged.emit(QModelIndex(), QModelIndex())
        elif key == 'favorite_plugins':
            new_favorites = self.config.get_option('favorite_plugins', [])
            if self.favorite_plugins != new_favorites:

                self.favorite_plugins = new_favorites