
Hi Eric, Thank you for help, it works perfectly. Best, Dominik ________________________________ From: Eric Pettersen <pett@cgl.ucsf.edu> Sent: Tuesday, February 21, 2023 10:35 PM To: Dominik Sordyl <dsordyl@iimcb.gov.pl> Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Subject: Re: [chimerax-users] Custom Toolbar Button Hi Dominik, I don't think you can put a button directly in the Home tab, but you can start it in another section and then configure it into the Home tab (by right clicking on the toolbar and choosing "Settings..." in the popup menu). You need to have a Provider section in your bundle's bundle_info.xml (or pyproject.toml) file to alert the toolbar manager to the existence of your button. As an example, here's that section for the Selection Inspector button: <Providers manager="toolbar"> <Provider tab="Extras" section="Selection" hidden="true" name="selection inspector" display_name="Inspect" icon="magnifying-glass.png" description="Inspect current selection"/> </Providers> Since the Selection Inspector only wants to show up as part of the Home tab, it puts itself in a hidden "Extras" tab. You can figure buttons from these "hidden" tabs, so you could do the same thing. I think the rest of the atrributes//values are reasonably self-explanatory. Now, your bundle's __init__.py has to have code to handle the toolbar manager asking your bundle to react to your button being clicked. Here's what the Selection Inspector has: @staticmethod def run_provider(session, name, mgr, **kw): from chimerax.core.commands import run run(session, "ui tool show 'Selection Inspector'") Since the only manager that the Selection Inspector talks to is the toolbar manager, and the only button it has registered with the toolbar manager is "Inspect", it doesn't bother looking at its arguments -- it just brings up the Selection Inspector tool. So you can probably do the same thing, but for reference the arguments you will receive from the toolbar manager are: * name — the "name" attribute value you registered in your Provider tag * mgr — the toolbar manager instance, i.e. session.toolbar * kw — a dictionary whoso only key is "display_name" with the same value as per your Provider tag --Eric Eric Pettersen UCSF Computer Graphics Lab On Feb 20, 2023, at 5:56 AM, Dominik Sordyl via ChimeraX-users <chimerax-users@cgl.ucsf.edu<mailto:chimerax-users@cgl.ucsf.edu>> wrote: Hi, Is there a possibility to add a button to the "File" section on the toolbar? I have installed custom plugin and it can be run from Tools --> General section, but I am wondering if there is a way to add a shortcut button to the toolbar. Best, Dominik _______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu<mailto:ChimeraX-users@cgl.ucsf.edu> Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users