<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Hi Eric,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Thank you for help, it works perfectly.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Best,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Dominik<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Eric Pettersen <pett@cgl.ucsf.edu><br>
<b>Sent:</b> Tuesday, February 21, 2023 10:35 PM<br>
<b>To:</b> Dominik Sordyl <dsordyl@iimcb.gov.pl><br>
<b>Cc:</b> chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu><br>
<b>Subject:</b> Re: [chimerax-users] Custom Toolbar Button</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">Hi Dominik,
<div class=""><span class="x_Apple-tab-span" style="white-space:pre"></span>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:</div>
<div class=""><br class="">
</div>
<div class=""> <Providers manager="toolbar"><br class="">
<Provider tab="Extras" section="Selection" hidden="true" name="selection inspector"<br class="">
display_name="Inspect" icon="magnifying-glass.png" description="Inspect current selection"/><br class="">
</Providers><br class="">
<br class="">
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:</div>
<div class=""><br class="">
</div>
<div class=""> @staticmethod<br class="">
def run_provider(session, name, mgr, **kw):<br class="">
from chimerax.core.commands import run<br class="">
run(session, "ui tool show 'Selection Inspector'")<br class="">
<div><br class="">
</div>
<div>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:</div>
<div><br class="">
</div>
<div>
<ul class="x_MailOutline">
<li class=""><i class="">name</i><span class="" style="font-style:normal"> — the "name" attribute value you registered in your Provider tag</span></li><li class=""><i class="">mgr</i><span class="" style="font-style:normal"> — the toolbar manager instance,
</span><i class="">i.e.</i><span class="" style="font-style:normal"> session.toolbar</span></li><li class=""><i class="">kw</i><span class="" style="font-style:normal"> — a dictionary whoso only key is "display_name" </span>with the same value as per your Provider tag</li></ul>
<div class=""><br class="">
</div>
<div class="">
<div class="">--Eric</div>
<div class=""><br class="">
</div>
<div class=""><span class="x_Apple-tab-span" style="white-space:pre"></span>Eric Pettersen</div>
<div class=""><span class="x_Apple-tab-span" style="white-space:pre"></span>UCSF Computer Graphics Lab</div>
</div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">
<div class="">On Feb 20, 2023, at 5:56 AM, Dominik Sordyl via ChimeraX-users <<a href="mailto:chimerax-users@cgl.ucsf.edu" class="">chimerax-users@cgl.ucsf.edu</a>> wrote:</div>
<br class="x_Apple-interchange-newline">
<div class="">
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
Hi,</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
Is there a possibility to add a button to the "File" section on the toolbar?</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
<br class="">
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
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.</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
<br class="">
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
Best,</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; background-color:rgb(255,255,255)">
Dominik<br class="">
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">ChimeraX-users
mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="mailto:ChimeraX-users@cgl.ucsf.edu" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">ChimeraX-users@cgl.ucsf.edu</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">Manage
subscription:</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</body>
</html>