auto_instantiate_widget_plugin

summary: restore custom widgets across sessions

description:

This is an example demonstrating how one can create widgets from a plugin, and have them re-created automatically at IDA startup-time or at desktop load-time.

This example should be placed in the ‘plugins’ directory of the IDA installation, for it to work.

There are 2 ways to use this example: 1) reloading an IDB, where the widget was opened

  • open the widget (‘View > Open subview > …’)

  • save this IDB, and close IDA

  • restart IDA with this IDB => the widget will be visible

  1. reloading a desktop, where the widget was opened - open the widget (‘View > Open subview > …’) - save the desktop (‘Windows > Save desktop…’) under, say, the name ‘with_auto’ - start another IDA instance with some IDB, and load that desktop

    => the widget will be visible

keywords: desktop

level: advanced

Attributes

title

auto_inst

auto_inst_hooks

Classes

auto_inst_t

The base class for implementing simple custom viewers

auto_inst_plugin_t

Base class for all scripted plugins.

Functions

register_open_action()

Provide the action that will create the widget

register_autoinst_hooks()

Register hooks that will create the widget when IDA

PLUGIN_ENTRY()

Module Contents

auto_instantiate_widget_plugin.title = 'Auto-instantiable at IDA startup'
class auto_instantiate_widget_plugin.auto_inst_t

Bases: ida_kernwin.simplecustviewer_t

The base class for implementing simple custom viewers

Create()

Creates the custom view. This should be the first method called after instantiation

Parameters:

title – The title of the view

Returns:

Boolean whether it succeeds or fails. It may fail if a window with the same title is already open. In this case better close existing windows

auto_instantiate_widget_plugin.auto_inst = None
auto_instantiate_widget_plugin.register_open_action()

Provide the action that will create the widget when the user asks for it.

auto_instantiate_widget_plugin.auto_inst_hooks = None
auto_instantiate_widget_plugin.register_autoinst_hooks()

Register hooks that will create the widget when IDA requires it because of the IDB/desktop

class auto_instantiate_widget_plugin.auto_inst_plugin_t

Bases: ida_idaapi.plugin_t

Base class for all scripted plugins.

flags = 0
comment = 'This plugin creates a widget that will be recreated automatically if needed, either at startup...
help = 'No help, really'
wanted_name = 'autoinst'
wanted_hotkey = ''
init()
run(arg)
term()
auto_instantiate_widget_plugin.PLUGIN_ENTRY()