These Python data classes are used by by CCP4i2 and by compatible pipelines and wrappers. It is the objective that these classes cover all the crystallographic data and that CCP4i2 provides widgets suitable for each data class. The classes are in modules named CCP4Whatever and the classes are named CWhatever (the C is for CCP4 as distinct from Q for Qt). The key fuctionality of each class is:
It is intended that the classes should also provide useful scientific functionality.
All data classes are ultimately derived from CCP4Data.CData. There are 'simple' classes: CBoolean, CFloat, CInt, CString etc. which are derived from CCP4Data.CBaseData. These can be sub-classed but the ues of qualifiers is intended to minimise the need to sub-class. For example CInt has the optional qualifiers min and max which can be define the limits of allowed values. These limits are then used in the CInt.validate() method. For example in Python code qualifiers for CCellLength are set:
class CCellLength(CFloat): QUALIFIERS = { 'min' : 0.0, 'toolTip' : 'Cell length in Angstrom' }
In this example the toolTip shows the other important use of qualifiers: to provide helpful information for the GUI.
'Complex' classes contain other classes - the contents are defined by a CONTENTS statement in the class:
class CCell(CData): CONTENTS = { 'a' : { 'class' : CCellLength }, 'b' : { 'class' : CCellLength }, 'c' : { 'class' : CCellLength }, 'alpha' : { 'class' : CCellAngle }, 'beta' : { 'class' : CCellAngle }, 'gamma' : { 'class' : CCellAngle } }
Nothing else would be required to define a functional CCell class. The CData.build() method will build the required data structure for the class from this definition.
There is also support for lists and tables as CList and CTable which (unlike Python lists) must have all elements of the same data type which can be any CData class other than CList or CTable. These are both derived from CCollection which handles a subItem which is the definition of the type of the elements of the CList or CTable.
CCP4Container.CContainer is a sub-class of CCP4Data.CData that can hold a set of CCP4Data.CData objects that are defined at run time; the definition usually comes from an XML def file. Typically a CContainer will hold all of the data for one pipeline, wrapper or GUI. CContainers can contain other CContainers and it is recommended that the container for a pipeline or wrapper has three sub-containers called 'inputData', 'outputData' and 'parameters' to distinguish the different functions of the data. The content of the def file can be defined most easily using the defEd program.