MDANSE
MDANSE copied to clipboard
Replace SubclassFactory with a RegisterFactory
Description of work
- Replace
SubclassFactorywith a classicRegisterFactoryto avoid metaclass magic, allow effective ABCs and explicit inclusion (i.e. not includingConverteras anIJoband thus making a non-instantiable object a key) and naming (including multiple names for the same thing). - Add
UCDictclass for case-insensitive dictionary keys. - Add
DummyIJobchild to account forABCworking properly.
PR is broken down since it is a large number of files touched (though small changes):
- First commit implements the factory and UCDict
- Middle commits affect each historic
SubclassFactory - Last commit makes changes necessary for code to function
NB. Converters are registered in both IJob and Converter as was historical.
Fixes Part of the motivation for this is to support a factory-like mechanism for GUI Widgets from Descriptor types.
To test Standard tests should run.
The changes did not affect anything major, as far as I can tell. However, the way the class names have been converted to uppercase characters has been interfering with combo boxes.
So far, I have found the following problems:
- The instrument definitions used to set the q vector generator type to "SphericalLatticeQVectors". As this has been replaced with "SPHERICALLATTICEQVECTORS", the combo box remains set to "CIRCULARLATTICEQVECTORS" when an instrument profile has been selected.
- When a new plot is created, the plotter type used for the plot is "Single", but the combo box shows "GRID". Also, it is possible to switch the plotter type to "TEXT" or "VECTORS", which should normally be disabled.