<?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[Tracking Undo&#x2F;Redo-History for the custom attributes]]></title><description><![CDATA[<p dir="auto">Hey Guys,<br />
I have a class, with a list as a custom attribute:</p>
<pre><code class="language-Python">from mojo.events import EditingTool, installTool

class MyTool(EditingTool):
    def __init__(self):
        super().__init__()
        self.specialPoints = [] # My Custom Attribute
</code></pre>
<p dir="auto">This attribute will contain set of points that should be selected by a user.<br />
At some point this class adds selected points to this list</p>
<pre><code class="language-Python">def additionContextualMenuItems(self):
    return [("Create Special Point", self.createSpecialPoint)]

def createSpecialPoint(self, sender):
    g = CurrentGlyph()
    for p in g.selection:
        self.specialPoints.append(p)

</code></pre>
<p dir="auto">Is there any way to track this action, so If the user will use Undo/Redo, the points will be deleted form the list or re-added to the list in the right order? Also this Undo/Redo should still track other actions of course.</p>
<p dir="auto">I think I should use <code>didUndo()</code>, but how?</p>
<p dir="auto">I was thinking of tracking changes by adding the labels, but changes in the labels are not tracked by history related events.</p>
<p dir="auto">Thanks in advance for the help!</p>
]]></description><link>https://forum.robofont.com/topic/553/tracking-undo-redo-history-for-the-custom-attributes</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 20:54:48 GMT</lastBuildDate><atom:link href="https://forum.robofont.com/topic/553.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Dec 2018 21:46:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tracking Undo&#x2F;Redo-History for the custom attributes on Sun, 16 Dec 2018 08:53:15 GMT]]></title><description><![CDATA[<p dir="auto">Hey Guys,<br />
I have a class, with a list as a custom attribute:</p>
<pre><code class="language-Python">from mojo.events import EditingTool, installTool

class MyTool(EditingTool):
    def __init__(self):
        super().__init__()
        self.specialPoints = [] # My Custom Attribute
</code></pre>
<p dir="auto">This attribute will contain set of points that should be selected by a user.<br />
At some point this class adds selected points to this list</p>
<pre><code class="language-Python">def additionContextualMenuItems(self):
    return [("Create Special Point", self.createSpecialPoint)]

def createSpecialPoint(self, sender):
    g = CurrentGlyph()
    for p in g.selection:
        self.specialPoints.append(p)

</code></pre>
<p dir="auto">Is there any way to track this action, so If the user will use Undo/Redo, the points will be deleted form the list or re-added to the list in the right order? Also this Undo/Redo should still track other actions of course.</p>
<p dir="auto">I think I should use <code>didUndo()</code>, but how?</p>
<p dir="auto">I was thinking of tracking changes by adding the labels, but changes in the labels are not tracked by history related events.</p>
<p dir="auto">Thanks in advance for the help!</p>
]]></description><link>https://forum.robofont.com/post/1913</link><guid isPermaLink="true">https://forum.robofont.com/post/1913</guid><dc:creator><![CDATA[RafaŁ Buchner]]></dc:creator><pubDate>Sun, 16 Dec 2018 08:53:15 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking Undo&#x2F;Redo-History for the custom attributes on Mon, 17 Dec 2018 15:48:41 GMT]]></title><description><![CDATA[<p dir="auto">you have to wrap your actions inside:</p>
<pre><code class="language-python">glyph.prepareUndo("Moved By 100, 100")
glyph.moveBy((100, 100)
glyph.performUndo()
</code></pre>
<p dir="auto">see <a href="http://robofont.com/documentation/building-tools/api/fontParts/rglyph/#RGlyph.performUndo" rel="nofollow">RGlyph.performUndo</a></p>
<p dir="auto">in the next release (RF3.2) you can use:</p>
<pre><code class="language-python">with glyph.Undo("Moved By 100, 100")
    glyph.moveBy((100, 100)
</code></pre>
]]></description><link>https://forum.robofont.com/post/1916</link><guid isPermaLink="true">https://forum.robofont.com/post/1916</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Mon, 17 Dec 2018 15:48:41 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking Undo&#x2F;Redo-History for the custom attributes on Mon, 17 Dec 2018 19:15:53 GMT]]></title><description><![CDATA[<p dir="auto">a new version of Undo looks really nice. Unfortunately, It doesn't work in my case.<br />
This action is not connected with a glyph or a font, so I cannot track it with prepare/performUndo.<br />
I will maybe try to use a font.lib dictionary, although I don't know if it can be tracked. I will keep you posted if it worked</p>
]]></description><link>https://forum.robofont.com/post/1919</link><guid isPermaLink="true">https://forum.robofont.com/post/1919</guid><dc:creator><![CDATA[RafaŁ Buchner]]></dc:creator><pubDate>Mon, 17 Dec 2018 19:15:53 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking Undo&#x2F;Redo-History for the custom attributes on Mon, 17 Dec 2018 19:34:25 GMT]]></title><description><![CDATA[<p dir="auto">store your data in the <code>glyph.lib</code> if you want undo powers</p>
]]></description><link>https://forum.robofont.com/post/1920</link><guid isPermaLink="true">https://forum.robofont.com/post/1920</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Mon, 17 Dec 2018 19:34:25 GMT</pubDate></item><item><title><![CDATA[Reply to Tracking Undo&#x2F;Redo-History for the custom attributes on Mon, 17 Dec 2018 19:35:29 GMT]]></title><description><![CDATA[<p dir="auto">the <code>font.lib</code> is also possible but then its hard to have the global undo manager focus. The current undo manager is connected to the current glyph.</p>
<p dir="auto">good luck!</p>
]]></description><link>https://forum.robofont.com/post/1921</link><guid isPermaLink="true">https://forum.robofont.com/post/1921</guid><dc:creator><![CDATA[frederik]]></dc:creator><pubDate>Mon, 17 Dec 2018 19:35:29 GMT</pubDate></item></channel></rss>