Hello Francesc,

Yes, the do/undo machinery is already capturing this (among other
> events).  If you are only interested in triggering an action on node
> creation,
>

Actually, this was fairly easy to expose.  Attached is a patch that allows
the user to submit a 'hook' function that then gets called anytime the file
is changed.  This is all I needed for what I was doing. Please let me know
what you think!


> IIRC, it is currently not possible to capture the table/array
> modification events, but it should be easy to add support for this (just
> by mimicking the do/undo functionality).
>

I haven't gotten around to really looking at this yet, because the above
satisfies my proof-of-concept.


> If you end with a patch for this, tell me and I'll see if I can
> accommodate it officially.
>

That would be great!

Thanks for all of your help.
Be Well
Anthony


>
> > The motivation for this is to have pytables hook nicely in Traits.
>
> Looks like a nice application.  Luck!
>
> --
> Francesc Alted
>
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
Index: file.py
===================================================================
--- file.py	(revision 4641)
+++ file.py	(working copy)
@@ -1619,7 +1619,7 @@
             "Mark number %d" % mid, new=True)
 
 
-    def enableUndo(self, filters=Filters(complevel=1)):
+    def enableUndo(self, filters=Filters(complevel=1), hook=None):
         """
         Enable the Undo/Redo mechanism.
 
@@ -1715,6 +1715,7 @@
 
         # The Undo/Redo mechanism has been enabled.
         self._undoEnabled = True
+        self.hook = hook
 
 
     def disableUndo(self):
@@ -1851,10 +1852,14 @@
                   "Parameter arg1 or arg2 is too long: (%r, %r)" %  \
                   (arg1, arg2)
         #print "Logging-->", (action, arg1, arg2)
-        self._actionlog.append([(_opToCode[action], arg1, arg2)])
+        log_entry = (_opToCode[action], arg1, arg2)
+        self._actionlog.append([log_entry])
         self._curaction += 1
 
+        if self.hook is not None:
+            self.hook(*log_entry)
 
+
     def _getMarkID(self, mark):
         "Get an integer markid from a mark sequence number or name"
 
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to