schrodinger.models.advanced_mappers module

class schrodinger.models.advanced_mappers.ModelBaseClassMapperMixin(*args, **kwargs)

Bases: schrodinger.models.mappers.MapperMixin

A mapper mixin that allows any model class that is a subclass of a specified base class. Unlike a standard MapperMixin, the mapper is re- generated every time a new model is set, and the model_class class variable is updated to the class of the new model.

This allows mappings to vary depending on the characteristics of the model class (for example, values of class attributes, presence or absence of specific params, etc.).

To use, set the model_base_class class variable to the base class of all models that will be used with this mapper.

model_base_class = None
class schrodinger.models.advanced_mappers.MultiModelClassMapperMixin(*args, **kwargs)

Bases: schrodinger.models.mappers.MapperMixin

A mapper mixin that allows multiple model classes. To use, define the model_classes tuple with all the allowable model classes. Then define the usual defineMappings and getSignalsAndSlots methods, which are allowed to branch on self.model_class to specify model class-specific mappings and signal/slot connections.

In use, self.model_class will be set to one of the classes in self.model_classes, depending on what the current model is.

model_classes = ()