Skip to content

Commit

Permalink
FunctionContextMenu: Add entry to show function info dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Sep 18, 2023
1 parent f1e167e commit ce01427
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions angrmanagement/ui/menus/function_context_menu.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from angrmanagement.logic import GlobalInfo

from .menu import Menu
from .menu import Menu, MenuEntry


class FunctionContextMenu(Menu):
def __init__(self, parent):
def __init__(self, workspace, parent):
super().__init__("Function", parent=parent)
self.workspace = workspace

self.funcs = []

Expand All @@ -16,9 +17,15 @@ def set(self, funcs):
return self

def qmenu(self, extra_entries=None):
self.entries = []
if len(self.funcs):
self.entries.append(
MenuEntry("Show Function Info", lambda: self.workspace.show_function_info(self.funcs[0]))
)
if extra_entries is None:
extra_entries = ()
return super().qmenu(
extra_entries=list(GlobalInfo.main_window.workspace.plugins.build_context_menu_functions(self.funcs))
+ list(extra_entries)
+ list(extra_entries),
cached=False,
)
2 changes: 1 addition & 1 deletion angrmanagement/ui/widgets/qfunction_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def __init__(self, parent, workspace, instance, selection_callback=None):
super().__init__(parent)
self.workspace = workspace
self.instance = instance
self._context_menu = FunctionContextMenu(self)
self._context_menu = FunctionContextMenu(workspace, self)

self._function_table: QFunctionTable = parent
self._selected_func = ObjectContainer(None, "Currently selected function")
Expand Down

0 comments on commit ce01427

Please sign in to comment.