Resolver Hacks contains information and code for doing fun and useful things with Resolver One. This site is created and maintained by Michael Foord, not by Resolver Systems. Please read the disclaimer before using any of the code on this site.
So You Want Your IDE Back?

Resolver is a great tool for working with data, particularly because you get access to your spreadsheet object model from Python code.
If you're going to do a lot of Python coding with Resolver, then it might be nice to use your own favourite IDE or code editor (my favourite is Wing).
You can achieve this by creating external Python modules and importing them. The location of your spreadsheet (the .rsl file) is automatically on the path, so you can import from modules in the same directory. The problem with importing is that if you edit the file during a live session then re-importing the module will not load the updated version.
You could use this Import with Reload recipe, but there is also another alternative. You can use the Python built-in function execfile to execute your code. By default this is executed in the current namespace, so replacing a usercode section with a call to execfile will have the same effect:
execfile('pre_constants.py')
However their is a problem with this approach. You can't rely on the current directory from inside user code. Resolver spreadsheets within a single process. This means that if you have several spreadsheets open they will all share a single current working directory. Even worse, using the open file dialog also seems to change the current directory!
Luckily there is a very simple solution. So long as the spreadsheet you are working on has been saved, you have access to the location (full filepath) of the current spreadsheet as the __file__ variable (if the spreadsheet is unsaved this is set to None).
You can replace a section of usercode with an external file (and the editor of your choice) with code like the following:
dirname = os.path.dirname(__file__)
execfile(os.path.join(dirname, 'pre_constants.py'))
At some point we may provide a built-in variable for the directory (__dirname__) and possibly an API for emailing spreadsheet files as archives so that you can keep your spreadsheet and associated code as a single file.
The only downside is that using this technique, Resolver won't know that your code has changed. You can always press F9 to recalculate when needed though.
Last edited Mon Dec 10 14:31:44 2007.

IronPython in Action