Print

Print


> Found a few problems with working with macros.  The Add Macro window seems
> relatively easy to confuse if you're modifying the underlying python and
> trying to reload etc.
> Reload dosn't seem to update consitently (could be
> something to do with intermediate oblect files I guess),

Another possibility (which I have yet to make provision for) is that the
macro has an error in it and the reload failed, but the original function
is known about and is still working code.

> and if you end up with a macro loaded, whose underlying code has been
> removed, it becomes unselectable (always producing a traceback with
> ApiError: could not find function "macroName" in module "filename")
> and so you can't get rid of the handle.

Now on my list of things to fix. :)

> Is there a way of getting individual objects' handles easily without
> going through the argServer? i.e. is there a way of getting say a
> single peak's handle so that one could test/use a function like my
> setPeakHeight(peak) in the python shell?

Not really, unless you know the path through the data model to the object
via keys. Also, you could use parent.findFirstObject() calls.

However, argServer is supposed to make life easier and is going to be
expanded to include things selected graphically.

At the moment you can get the currently mouse-selected peaks with:

 argServer.getCurrentPeaks()

In the future I will develop methods to add macros to the spectrum window
right mouse menu, which will enable you to select individual peaks or a
particular location as input.

Tim

-------------------------------------------------------------------------------
 Dr Tim Stevens                 Email: [log in to unmask]
 Department of Biochemistry            [log in to unmask]
 University of Cambridge        Phone: +44 1223 766022 (office)
 80 Tennis Court Road                  +44 7816 338275 (mobile)
 Old Addenbrooke's Site                +44 1223 364613 (home)
 Cambridge  CB2 1GA             WWWeb: http://www.bio.cam.ac.uk/~tjs23
 United Kingdom                        http://www.pantonia.co.uk
-------------------------------------------------------------------------------
------ +NH3CH(CH(CH3)OH)C(O)NHCH(CH(CH3)CH2CH3)C(O)NHCH(CH2CH2SCH3)CO2- -------
-------------------------------------------------------------------------------