diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-14 16:41:51 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-14 16:41:51 (GMT) |
commit | 370169058fc6f4a7ed6013d0f965ac75beff4f5e (patch) | |
tree | 5df84ac93eaed31402f41f97e2ede3a81265efe7 /python-plugins/hellopanel/panel.py | |
parent | 0081d76ba15b08be04cd2a7c7c65a7c0e6e7a6fe (diff) |
Created a demo GUI panel.
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) |