diff options
Diffstat (limited to 'python-plugins/hellopanel/panel.py')
-rw-r--r-- | python-plugins/hellopanel/panel.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/python-plugins/hellopanel/panel.py b/python-plugins/hellopanel/panel.py new file mode 100644 index 0000000..a06a08d --- /dev/null +++ b/python-plugins/hellopanel/panel.py @@ -0,0 +1,43 @@ + +from gi.repository import Gtk +from pychrysalide.features import * + + +DEFAULT_MSG = 'No active loaded binary' + + +class HelloPanel(PanelItem): + + def __init__(self): + """Initialize the GUI panel.""" + + self._label = Gtk.Label() + self._label.set_text(DEFAULT_MSG) + + params = { + + 'name' : 'Hello', + 'widget' : self._label, + + 'personality' : PanelItem.PIP_SINGLETON, + 'lname' : 'Hello panel description', + 'dock' : True, + 'path' : 'MEN' + + } + + super(HelloPanel, self).__init__(**params) + + + def _change_content(self, old, new): + """Get notified about loaded content change.""" + + if type(new) is LoadedBinary: + + count = len(list(new.processor.instrs)) + + self._label.set_text('Loaded binary with %u instructions' % count) + + else: + + self._label.set_text(DEFAULT_MSG) |