#!/usr/bin/python
# -*- coding: utf-8 -*-

from pychrysalide import Plugin
from pychrysalide.gui.panels import LogPanel

from basic_blocks import show_basic_blocks


class Demo(Plugin):
    """Demonstration plugin."""

    def init(self, ref):
        """Initialize the plugin."""

        LogPanel.log_message(LogPanel.LMT_WARNING, 'Welcome to the demo Python plugin !')

        return True


    def get_action(self):
        """Register the plugin for given actions."""

        return Plugin.PGA_BINARY_GROUPED


    def execute_on_binary(self, binary, action):
        """Process registered actions."""

        show_basic_blocks(binary)