I'd like that too... I really miss Vim when I'm working in NodeBox.
Great Bill, lets join hands in doing so, it really shouldnt be hard. I do think that console is a somewhat misleading name for the module that is currently there. embedding would be more appropriate, right? Tom, Frederik, any pointers to where we should start and how we could do so in an elegant manner would be great! Thanks.
The window is tied into big chunks of the source, since it registers all sorts of mouse clicks and drags.
The big one to start from is the gui.mac module, available here:
http://dev.nodebox.net/browser/nodebox/trunk/src/nodebox/gui/mac/__init__.py
A good example of a window is the FullscreenWindow/FullscreenView, since that takes contains all necessary hooks for setting up a new window.
Then, look at the runFullscreen_ method to see how to set up a script and run it.
The reason why we have so many functions (runScript_, _runScript, fastRun, runScriptFast_, cleanRun, prepareRun) is because of the different modes you can run a NodeBox script in. You can run it once, run it as an animation, export a script to a QuickTime movie or PDF, use the value ladder to drag a number while the script is running an animation, ... This is something you'll have to plod through, I'm afraid, although the code in Console.py will help you.
http://dev.nodebox.net/browser/nodebox/trunk/src/nodebox/console.py
Those two source combined will help you on your way of decoupling the window. If, in the meantime, you can find a better way to structure all the run methods, I would be most grateful :)
Looking forward to your progress,
Frederik
module rather than console
Posted by jelle feringa on Apr 04, 2008Hi,
What I haven't been able to figure out form the console page is how to use nodebox as a module. I am somewhat puzzled by the module, since its designed to be nested in another program. I'm looking for a way to use nodebox without the editor ( gotta love pydev ;'). So rather than
from nodebox.util.QTSupport import Movie
I would like to do something like:
from nodebox.util.Canvas import window
where the window would simple return a (borderless? fullscreen? fps? ) window (what _were_ you thinking?), adapted to the size of the canvas. it would be awesome to be able to test things in Ipython for example. Also, for those who enjoy -i for one- coding in an IDE, this would be the most natural way of working I suppose. actually I'm surprised this isn't yet supported, or am I _seriously_ overlooking something?
cheers,
-jelle