Skip to content

Commit

Permalink
Use qta open/save icons for menu/toolbar file actions (#1363)
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson authored Dec 17, 2024
1 parent 1056a26 commit 12239e1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions angrmanagement/ui/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"docs": "mdi6.book-open-page-variant",
"file": "mdi.file",
"file-open": "mdi.folder-open",
"file-save": "mdi.floppy",
"functions-view": "mdi.function",
"hex-view": "mdi.hexadecimal",
"jobs-view": "fa5s.hammer",
Expand Down
30 changes: 25 additions & 5 deletions angrmanagement/ui/menus/file_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RecentMenuEntry(MenuEntry):

def __init__(self, path) -> None:
self.path = path
super().__init__(path, self.action_target)
super().__init__(path, self.action_target, icon=icon("file"))

def action_target(self) -> None:
GlobalInfo.main_window.load_file(self.path)
Expand All @@ -42,8 +42,18 @@ def __init__(self, main_window: MainWindow) -> None:
self._project = main_window.workspace.main_instance.project

self._save_entries = [
MenuEntry("&Save angr database...", main_window.save_database, shortcut=QKeySequence("Ctrl+S")),
MenuEntry("S&ave angr database as...", main_window.save_database_as, shortcut=QKeySequence("Ctrl+Shift+S")),
MenuEntry(
"&Save angr database...",
main_window.save_database,
shortcut=QKeySequence("Ctrl+S"),
icon=icon("file-save"),
),
MenuEntry(
"S&ave angr database as...",
main_window.save_database_as,
shortcut=QKeySequence("Ctrl+Shift+S"),
icon=icon("file-save"),
),
MenuEntry("Save patched binary as...", main_window.save_patched_binary_as),
]
self._edit_save()
Expand All @@ -52,7 +62,12 @@ def __init__(self, main_window: MainWindow) -> None:
self.recent_menu = Menu("Load recent")
self.entries.extend(
[
MenuEntry("L&oad a new binary...", main_window.open_file_button, shortcut=QKeySequence("Ctrl+O")),
MenuEntry(
"L&oad a new binary...",
main_window.open_file_button,
shortcut=QKeySequence("Ctrl+O"),
icon=icon("file-open"),
),
*(
[]
if archr is None
Expand All @@ -71,7 +86,12 @@ def __init__(self, main_window: MainWindow) -> None:
),
self.recent_menu,
MenuSeparator(),
MenuEntry("&Load angr database...", main_window.load_database, shortcut=QKeySequence("Ctrl+L")),
MenuEntry(
"&Load angr database...",
main_window.load_database,
shortcut=QKeySequence("Ctrl+L"),
icon=icon("file-open"),
),
*self._save_entries,
MenuSeparator(),
MenuEntry("Load a new &trace...", main_window.load_trace),
Expand Down
5 changes: 3 additions & 2 deletions angrmanagement/ui/toolbars/file_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from PySide6.QtGui import QIcon

from angrmanagement.config import IMG_LOCATION
from angrmanagement.ui.icons import icon

from .toolbar import Toolbar, ToolbarAction

Expand All @@ -24,7 +25,7 @@ def __init__(self, main_window: MainWindow) -> None:

self.actions = [
ToolbarAction(
QIcon(os.path.join(IMG_LOCATION, "toolbar-file-open.ico")),
icon("file-open"),
"Open File",
"Open a new file for analysis",
main_window.open_file_button,
Expand All @@ -36,7 +37,7 @@ def __init__(self, main_window: MainWindow) -> None:
main_window.open_docker_button,
),
ToolbarAction(
QIcon(os.path.join(IMG_LOCATION, "toolbar-file-save.png")),
icon("file-save"),
"Save",
"Save angr database",
main_window.save_database,
Expand Down

0 comments on commit 12239e1

Please sign in to comment.