schrodinger.infra.fix_sip6_enum_access module

Modify enums in SIP 6 to behave like SIP 4 (e.g. allow QComboBox.InsertAlphabetically in addition to QComboBox.InsertPolicy.InsertAlphabetically). Note that the functions in this module are no-ops under Qt 5.

The typical use for this module would be to compile a SIP module to schrodinger.whatever._my_sip_module and then create a that contains:

from ._my_sip_module import * # noqa F403 from schrodinger.infra import fix_sip6_enum_access fix_sip6_enum_access.modify_enum_access(globals(), __name__) del fix_sip6_enum_access

schrodinger.infra.fix_sip6_enum_access.modify_enum_access(namespace_dict: dict, namespace_name: str)

Iterate through the given namespace dictionary and modify the namespace itself as well as all classes and nested namespaces it contains so that enums can be accessed directly through a class/namespace without going through the enum class (e.g. allow for QComboBox.InsertAlphabetically or Qt.AlignLeft in addition to QComboBox.InsertPolicy.InsertAlphabetically or Qt.Alignment.AlignLeft).

  • namespace_dict – The module namespace dictionary to modify. To modify a module, pass in e.g. QtCore.__dict__. To modify a module from within that module, pass in globals().

  • namespace_name – The name of the namespace being modified. If this is a Qt namespace, omit the leading “PyQt6.” or “schrodinger.Qt.”, e.g. use “QtCore” instead of “PyQt6.QtCore”.