Skip to content

Use one icon set for the toolbar and tabs - #57

Open
r0ny123 wants to merge 20 commits into
familiary:mainfrom
r0ny123:lucide-icons
Open

r0ny123 wants to merge 20 commits into
familiary:mainfrom
r0ny123:lucide-icons

Conversation

@r0ny123

@r0ny123 r0ny123 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

The toolbar and tab icons came from different sets, so they never quite matched in size or weight. Two tabs even shared the same puzzle icon. This swaps them for one set, Lucide, and uses the YARA mark from YARA-X for the YARA string button instead of the yen-looking sign.

I tried to pick icons that say what each button does:

  • satellite dish for fetching the match result
  • blocks for Block Scope
  • compare arrows for Function Scope
  • a tree for Function Overview
  • a bar chart for the match summary

The toolbar is also 24 px in both apps now. IDA was drawing it at 32 px, so it looked a lot bigger there than in Binja.

The new Ghidra plugin loads the same files, so its toolbar, tabs and window icon get the new icons too, tinted for the theme. I checked them in Ghidra 12.2 in Flat Dark and Flat Light (screenshot in the comments below).

Here's every icon before and after, in both themes:

Each toolbar and tab icon before and after, on dark and light backgrounds

How it looks in IDA 9.4 and Binja 6.0

Toolbars, top to bottom: IDA before, IDA after, Binja before, Binja after.

MCRIT toolbar in IDA and Binary Ninja, before and after

IDA, before on the left:

MCRIT panel in IDA 9.4, before and after

Binja, before on the left:

MCRIT sidebar in Binary Ninja 6.0, before and after

Lucide is ISC and YARA-X is BSD-3-Clause, so both are fine to ship here. Their licence texts are in icons/NOTICE.md.

Note

This sits on top of #56, since it uses the icon tinting from there. Once #56 is merged, the diff here shrinks to just the icon commit.

If any pick doesn't feel right, tell me which one and I'll swap it.

After installing, the plugin points at http://127.0.0.1:8000/ and
nothing inside IDA or Binary Ninja said where to change that.

There's now a Settings button on the toolbar, a "Change..." link on the
server line, and a Settings entry in the menus. In IDA it opens the
Plugin Settings Manager on mcrit-ida when ida-settings-editor is
installed, and otherwise a small form for the server, token, username
and timeout. In Binary Ninja it opens Settings on the MCRIT group.
Closing the settings, or saving the form, reconnects without reopening
the plugin. A new server only takes over while the plugin holds nothing
from the old one; otherwise it says to reopen.

The toolbar and tab icons now use the theme's text colour, so they show
up on dark themes.
The new waker test stubs the IDA modules itself, so it needs ida_expr, which IdaBackend now imports.
The toolbar and tab icons came from different sets with different weights,
and two tabs shared the same puzzle icon. They now come from Lucide, with the
YARA mark from YARA-X for the YARA string button, rendered to 48 px on Lucide's
24-unit grid at 2x so the strokes stay crisp at 24 and 16 px.

The toolbar icon size is set to 24 px: the hosts' styles picked 32 px in IDA
and 24 px in Binary Ninja, so the same toolbar looked bigger in IDA.

icons/NOTICE.md carries the credits and licence texts (ISC for Lucide,
BSD-3-Clause for YARA-X).
main added the Ghidra frontend, which has no Settings button, so the hint
after a failed connection check now names each frontend's own place to set
the server: Ghidra's is Tool Options > MCRIT.
main's Ghidra frontend still pointed at puzzle.png and flag-triangle.png,
which this branch removes.

@danielplohmann danielplohmann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and the icon key in the description made it easy to review. Every icon the code references exists, flag-triangle.png and puzzle.png are referenced nowhere any more, the IDA ZIP ships the new PNGs and icons/NOTICE.md, and the Lucide ISC and YARA-X BSD-3 texts match upstream (NOTICE inside the ZIP covers BSD-3's binary clause). Nothing depended on IDA's 32 px toolbar. Gates green: ruff, 399 tests, sync scripts. Mergeable once #56 is in.

Ghidra, since you could not see it there:

  • The icons are invisible on a dark Ghidra theme. load_icon in mcrit_plugin/ghidra/ui/components.py shows the raw PNG, and all new icons are pure black on transparent, so the toolbar and tab icons disappear on Flat Dark. Not a regression (the old ones were black too), and #56's tint is Qt only. Rather than shipping dark and light variants, I'd tint at load, the same way #56 does in Qt: draw the glyph in UIManager.getColor("Label.foreground") onto a BufferedImage with an SRC_IN composite, then scale. All icons are one-colour outlines, so one file set keeps working for every theme, including high contrast. A sketch:

    from java.awt import AlphaComposite, Image
    from java.awt.image import BufferedImage
    from javax.swing import ImageIcon, UIManager
    
    source = ImageIcon(str(path)).getImage()
    width, height = source.getWidth(None), source.getHeight(None)
    tinted = BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)
    graphics = tinted.createGraphics()
    graphics.drawImage(source, 0, 0, None)
    graphics.setComposite(AlphaComposite.SrcIn)
    graphics.setColor(UIManager.getColor("Label.foreground"))
    graphics.fillRect(0, 0, width, height)
    graphics.dispose()
    return ImageIcon(tinted.getScaledInstance(size, size, Image.SCALE_SMOOTH))

    mcrit.png should probably keep its colours, so a tint=True parameter for the toolbar and tab icons only. Happy to take this as a Ghidra follow-up after merge if you prefer; I can check it in a dark theme with the GUI runner.

  • Toolbar size: MainPanel loads the toolbar icons at load_icon's default 20 px, a 2.4x reduction of the 48 px sources that smears Lucide's 2 px strokes. load_icon(icons + icon, 24) matches IDA and Binary Ninja and is a clean 2x.

Smaller things:

  • A missing icon fails silently everywhere: load_icon returns None and the button stays blank, QIcon on a missing path is empty, and none of the GUI runners looks at icons. A pytest that collects the icon names used in code (ICON_FILE_PATH + "...", _toolbarIcon("..."), icon_file = "...", MainPanel's tool("...")) and asserts each exists in icons/ would catch a rename.
  • The set is not quite one yet: McritSession.icon still uses relationship.png (it shows as the IDA form's window icon), LocalInfoWidget.icon uses scan.png but nothing reads it, and upload.png is unused. Dropping the unused two and switching the session icon would leave NOTICE.md covering everything except mcrit.png; a line saying that one is the project's own would close it.
  • Optional: one line in the README's License section pointing at icons/NOTICE.md.

🤖 Generated with Claude Code

Comment thread CHANGELOG.md Resolved
A request still running when the server changed stored its answer from the
old server: the upload's sample id, a matching result, function matches and
entries. Every request now pins the client and a server generation and drops
an answer whose server was replaced meanwhile, including the block-hash and
remote-function lookups the widgets cache.

The generation only moves with the server, so a token, username or timeout
change no longer throws away answers from the same server. While a new server
waits for a reopen, the session keeps the current server's token and username
too; only the timeout applies at once.

The toolbar and tab icons are tinted again when the palette or style changes,
so a theme switch while MCRIT is open recolors them.

IDA registers the Settings menu action once per process and finds the current
database's plugmod through a weak reference; tying it to a plugmod let a late
__del__ remove the next database's entry.

The changelog scopes the new entries to IDA and Binary Ninja, and Ghidra's
hint names Edit > Tool Options > MCRIT.
Ghidra showed the black PNGs as they are, so the toolbar and tab icons
disappeared on its dark themes. load_icon can now draw the glyph in the
theme's label colour, the way the Qt frontends tint theirs; the logo keeps
its colours. The Ghidra toolbar loads its icons at 24 px like IDA and Binary
Ninja, a clean half of the 48 px files instead of 20 px.

The IDA form's window icon is the MCRIT logo instead of relationship.png,
and the unused scan.png and upload.png are gone, so icons/NOTICE.md covers
every file but the project's own logo. A test checks that every icon the code
names exists and that every shipped icon is used.
@r0ny123

r0ny123 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks! Took all of it in 6487082:

  • Ghidra now tints the toolbar and tab icons at load, pretty much your sketch (tint=True), and the logo keeps its colours. The toolbar loads at 24 px too.
  • New test: every icon the code names has to exist in icons/, and every file there has to be used.
  • The IDA window icon is the MCRIT logo now, scan.png, upload.png and relationship.png are gone, NOTICE.md says the logo is ours, and the README's License section points at NOTICE.md.

I got Ghidra 12.2 running here, so I checked it in Flat Dark and Flat Light (MCRIT window right after it connects):

MCRIT window in Ghidra 12.2, Flat Dark and Flat Light

The icons are tinted once when the window opens, so switching Ghidra's theme while MCRIT is open keeps the old colour until it's reopened.

An answer could still slip in between the switch's check for held data and
its new client: the check runs on the UI thread while a worker stores its
answer. The check and the new client now happen under one lock, and every
request stores its answer under it too (_storing), so the switch sees the
stored answer and waits, or the answer sees the switch and is dropped.

The default-server hint asks about the session's server; with a switch
waiting, the settings hold the new one. When IDA's settings window opens but
cannot be found to watch, the status line says to reopen MCRIT to apply a
changed connection. The connection form also turns down a URL without a host
or with a port that is not a number up to 65535.

Tests cover the remote-function lookup, decode the results they store instead
of passing through a decoding error, and check that a stale connection check
really reached its result.
mcrit.png is a one-colour glyph like the rest, so Ghidra's window icon was
black on Flat Dark; load_icon now tints every icon it loads. The changelog
entry is about IDA and Binary Ninja, and the unreleased Ghidra plugin's own
entry describes its icons, which are tinted when the window opens rather
than again on a theme change. NOTICE.md names cloud-upload as Feather's
upload-cloud, so the MIT part covers it.
@r0ny123

r0ny123 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Small correction to my last comment: mcrit.png turned out to be a one-colour glyph like the rest, so it was still black on Flat Dark. load_icon now tints every icon, the logo included (8400b98). I also moved the Ghidra part out of the general changelog entry into the Ghidra plugin's own entry, since that plugin isn't released yet.

The earlier test only showed the switch side: removing the lock from
_storing left it passing. The session now refuses writes made without the
lock, for every request that stores an answer. The client-before-generation
write order is commented again, since _pinConnection reads both without the
lock.
Turning live tracking on queries the function the cursor is on, so the
Function Scope table could fill with that function's matches before the
jump to the target was handled; the run then failed its check that the
cursor move reached the Function Scope. It now waits until the table shows
the target function.
Moving either out of the lock left the tests green; now each has a test that
fails when it is.
Block Scope cached its lookups after they all returned, outside the
lock. On a function's first block query the cache was still empty, so a
server switch could go ahead in between and the new session ended up
with block matches from the old server.

The Qt widget and the Ghidra panel now pin one connection for all their
lookups and hand the results to McritInterface.storeBlockMatches, which
writes them inside _storing and drops them if the server changed.
The first synthetic press on a tab header can land before the docked
MCRIT window takes input, which timed out once on CI. Press again up to
three times; a click that doesn't work at all still fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants