paint_over_graph

summary: paint text on graph view edges

description:

This sample registers an action enabling painting of a recognizable string of text over horizontal nodes edge sections beyond a satisfying size threshold.

In a disassembly view, open the context menu and select “Paint on edges”. This should work for both graph disassembly, and proximity browser.

Using an “event filter”, we will intercept paint events targeted at the disassembly view, let it paint itself, and then add our own markers along.

level: advanced

Attributes

edge_segment_threshold

text_color

text_antialiasing

verbose

painter

action_name

hooks

Classes

painter_t

paint_on_edges_t

context_menu_hooks_t

Module Contents

paint_over_graph.edge_segment_threshold = 50
paint_over_graph.text_color
paint_over_graph.text_antialiasing = True
paint_over_graph.verbose = False
class paint_over_graph.painter_t(w, verbose=False)

Bases: PySide6.QtCore.QObject

idaview
idaview_pyqt
target
painting = False
eventFilter(receiver, event)
paint_over_graph.painter = None
class paint_over_graph.paint_on_edges_t

Bases: ida_kernwin.action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

get_idaview(ctx)
paint_over_graph.action_name = 'paint_over_graph:enable'
class paint_over_graph.context_menu_hooks_t(_flags: int = 0, _hkcb_flags: int = 1)

Bases: ida_kernwin.UI_Hooks

finish_populating_widget_popup(widget, popup)

IDA is about to be done populating the context menu for a widget. This is your chance to attach_action_to_popup().

Parameters:
  • widget – (TWidget *)

  • popup_handle – (TPopupMenu *)

  • ctx – (const action_activation_ctx_t *)

Returns:

void

paint_over_graph.hooks