<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm working on an extension that I'm hooking into the toolbar of the glyph window.</p>
<p dir="auto">For now I have subclassed <code>BaseEventTool</code>, which adds one button to the bar of drawing tools on the left.<br />
Since my extension performs a one-time operation, it's somewhat unsatisfactory and odd that the tool stays selected after the operation has been performed, and I manually have to select another/the tool I was using previously.</p>
<p dir="auto">What I'd want is to have it as a tool that behaves basically like the RemoveOverlap tool: One single button, it does what it does, and the current drwaing/editing tool remains selected/active during the operation.</p>
<p dir="auto">I can't seem to get my head round if this can be done for an extension at all, or what tool to subclass.</p>
<p dir="auto">Maybe I was looking at it too long but not hard enough, but any lead in the right direction would be much appreciated.</p>
<p dir="auto">thanks,<br />
franz</p>
]]></description><link>https://forum.robofont.com/topic/192/build-single-one-time-operation-tool-button-in-glyph-window-like-removeoverlap</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 11:47:27 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/192.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 13 Oct 2012 08:31:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Tue, 02 Jan 2018 17:19:04 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I'm working on an extension that I'm hooking into the toolbar of the glyph window.</p>
<p dir="auto">For now I have subclassed <code>BaseEventTool</code>, which adds one button to the bar of drawing tools on the left.<br />
Since my extension performs a one-time operation, it's somewhat unsatisfactory and odd that the tool stays selected after the operation has been performed, and I manually have to select another/the tool I was using previously.</p>
<p dir="auto">What I'd want is to have it as a tool that behaves basically like the RemoveOverlap tool: One single button, it does what it does, and the current drwaing/editing tool remains selected/active during the operation.</p>
<p dir="auto">I can't seem to get my head round if this can be done for an extension at all, or what tool to subclass.</p>
<p dir="auto">Maybe I was looking at it too long but not hard enough, but any lead in the right direction would be much appreciated.</p>
<p dir="auto">thanks,<br />
franz</p>
]]></description><link>https://forum.robofont.com/post/192</link><guid isPermaLink="true">https://forum.robofont.com/post/192</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Tue, 02 Jan 2018 17:19:04 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Sat, 13 Oct 2012 09:30:26 GMT]]></title><description><![CDATA[<p dir="auto">You can add your script to the scripting folder see <a href="http://doc.robofont.com/documentation/workspace/preferences/python/" rel="nofollow">http://doc.robofont.com/documentation/workspace/preferences/python/</a> and assign a short key.<br />
Or make an observer to a key down and perform an action when the user hit a key.<br />
Or if you know enough about vanilla you could add it to the glyph window: observe when a glyph window opens and add/insert your button in the toolbar.</p>
<p dir="auto">good luck</p>
]]></description><link>https://forum.robofont.com/post/869</link><guid isPermaLink="true">https://forum.robofont.com/post/869</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Sat, 13 Oct 2012 09:30:26 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Tue, 02 Jan 2018 17:20:02 GMT]]></title><description><![CDATA[<p dir="auto">Ouch, i was hoping it was a tad easier than that.<br />
Many thanks Frederik, I will give it a try.<br />
So my extension would need to live as an object independent from <code>BaseEventTool</code>, observe if a glyph win opens and then add an <code>NSButton</code> object to it, correct?</p>
]]></description><link>https://forum.robofont.com/post/871</link><guid isPermaLink="true">https://forum.robofont.com/post/871</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Tue, 02 Jan 2018 17:20:02 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Wed, 10 Jul 2019 21:42:48 GMT]]></title><description><![CDATA[<pre><code class="language-python">from mojo.events import addObserver

class test:
    
    def __init__(self):
        addObserver(self, "myCallback", "glyphWindowDidOpen")

    def myCallback(self, info):
        print(info["window"])
        print(info["glyph"])
        print("a new glyph window did open")

test()
</code></pre>
<p dir="auto">and use vanilla to add a toolbar item see <a href="http://code.typesupply.com/browser/packages/vanilla/trunk/Lib/vanilla/vanillaWindows.py#L449" rel="nofollow">http://code.typesupply.com/browser/packages/vanilla/trunk/Lib/vanilla/vanillaWindows.py#L449</a></p>
<p dir="auto">good luck</p>
]]></description><link>https://forum.robofont.com/post/875</link><guid isPermaLink="true">https://forum.robofont.com/post/875</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Wed, 10 Jul 2019 21:42:48 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Tue, 02 Jan 2018 17:22:57 GMT]]></title><description><![CDATA[<p dir="auto">Hi Frederik,</p>
<p dir="auto">again many thanks, esp. for the link to the vanilla docu.</p>
<p dir="auto">Now I got the observer working, I have the button and the actual functionality, but I can't seem to get hold of the window properly to perform all the additional steps to add a toolbar item:</p>
<pre><code class="language-python">def glyphWindowDidOpenCallback(self,info):
        gwin = info["window"]
        nswin = gwin.getNSWindow() # or whatever I try here…
</code></pre>
<p dir="auto">… gives me:</p>
<pre><code class="language-console">AttributeError: 'DoodleGlyphWindow' object has no attribute 'getNSWindow'
</code></pre>
<p dir="auto">(or whatever I try to get from the window)</p>
<p dir="auto">I feel it's just a simple but crucial bit I'm missing here, any leads come greatly appreciated!</p>
<p dir="auto">Franz</p>
<p dir="auto">p.s. ain't it funny that the actual functionality mostly comes easy peasy, hooking the thing in the UI doesn't exactly… :-/</p>
]]></description><link>https://forum.robofont.com/post/876</link><guid isPermaLink="true">https://forum.robofont.com/post/876</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Tue, 02 Jan 2018 17:22:57 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Tue, 02 Jan 2018 17:23:17 GMT]]></title><description><![CDATA[<p dir="auto">use</p>
<pre><code class="language-python">## this returns the vanilla window object
info["window"].window()
</code></pre>
]]></description><link>https://forum.robofont.com/post/878</link><guid isPermaLink="true">https://forum.robofont.com/post/878</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Tue, 02 Jan 2018 17:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Mon, 15 Oct 2012 07:42:04 GMT]]></title><description><![CDATA[<p dir="auto">Aarghh. Facepalm. I owe you a beer.</p>
]]></description><link>https://forum.robofont.com/post/881</link><guid isPermaLink="true">https://forum.robofont.com/post/881</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Mon, 15 Oct 2012 07:42:04 GMT</pubDate></item><item><title><![CDATA[Reply to Build single one-time operation tool&#x2F;button in glyph window, like RemoveOverlap on Tue, 02 Jan 2018 17:24:23 GMT]]></title><description><![CDATA[<p dir="auto">For now, I haven't found a way to directly insert my toolbarItem into the toolbar as I couldn't get <code>insertItemWithItemIdentifier:()atIndex:()</code> to work in the context of my script/extension, but probably I'm just being daft here.</p>
<p dir="auto">So currently I read all the items in the glyph window toolbar, add my item, and use vanilla's <code>addToolbar</code> method to replace the toolbar. That's looking good so far, all the previously present items are there, glyph tools work, and my item shows up (not as a button yet, that's lined up next). RemoveOverlap in the replaced toolbar crashes right now when clicked (I guess I'm somehow breaking the delegate or something), but I hope to get that sorted, too.</p>
]]></description><link>https://forum.robofont.com/post/886</link><guid isPermaLink="true">https://forum.robofont.com/post/886</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Tue, 02 Jan 2018 17:24:23 GMT</pubDate></item></channel></rss>