# 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
    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
                self.dataChanged.emit(QModelIndex(), QModelIndex())

class PluginsProxyModel(QSortFilterProxyModel):
    def __init__(self, parent=None):
        super(PluginsProxyModel, self).__init__(parent)
        self.name_filter = QRegExp()
        self.hide_core_plugins = True

    def set_name_filter(self, regexp):
        self.name_filter = regexp
        self.invalidateFilter()

    def set_hide_core_plugins(self, do_hide):
        self.hide_core_plugins = do_hide
        self.invalidateFilter()

    def filterAcceptsRow(self, source_row, source_parent):
        if self.hide_core_plugins:
            plugin = self.sourceModel().plugin_for_row(source_row)

# 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

    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
                self.dataChanged.emit(QModelIndex(), QModelIndex())

class PluginsProxyModel(QSortFilterProxyModel):
    def __init__(self, parent=None):
        super(PluginsProxyModel, self).__init__(parent)
        self.name_filter = QRegExp()
        self.hide_core_plugins = True

    def set_name_filter(self, regexp):
        self.name_filter = regexp
        self.invalidateFilter()

    def set_hide_core_plugins(self, do_hide):
        self.hide_core_plugins = do_hide
        self.invalidateFilter()

    def filterAcceptsRow(self, source_row, source_parent):
        if self.hide_core_plugins:
            plugin = self.sourceModel().plugin_for_row(source_row)

            if plugin.ui.category == Category.Core: