> 1. how do I choose an object that is repeated, thus for example:
> If i have two 1H axes in a spectrum the isotope list given
> chooseObject in objects will be roughly say '[<Isotope 1H>, <Isotope
> 1H>, <Isotope 13H>] now chooseObject will return the chosen object
> without any information about its position in the list... so which
> <Isotope 1H> do I have...
This is where user-defined labels come in. If say you are choosing
spectrum axes, you can choose from the dataSource.dataDims, which will be
unique, by using a label that combines dimension number, isotope codes and
whatever.
> 2. what are all the extra arguments to chooseObject ... key=None,
> labels=None, objectName=None, I get objectName, but the rest gets pretty
> involved
"key" is currently for the non-table way of selecting arbitrary objects,
which includes a command line mode (no Tk). This is so that by typing
input you can specify which object you want. So for selecting an
experiment you could use a friendly name string for the key rather than a
serial number.
"labels" are effectively extra human readable columns for the object
selection tables. Labels are passed in as a dict keyed by the name of the
label for a list of values (one for each object). For example if I wanted
to select resonances from a table I could make a labels dict with key
"Name" that contains an ordered list of names for each of the resonances.
Thus, I don't have to just rely upon the uninformative resonances' serial
number as I would get a nice Name column.
> 3. is there a set of requirements for objects passed to chooseObject, do
> they have to be ccpn objects, or can they be objects with a particular
> duck type?
They have to be CCPN objects because of the way that table columns are
autogenerated using the API metaclasses and because of the parent-child
class paths that are used to locate objects.
In general the object selection mechanism of the ArgumentServer class is
an inelegant, but simple and very general of selecting data model objects.
Great for small scripts and macros, but if you're after refinement I'd
have a go at making custom popups or sub-classing existing ones. Also, the
memops.gui widgets have no CCPN requirement.
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- -------
-------------------------------------------------------------------------------
|