Пример #1
0
    def _register_for_readmmp(clas): # staticmethod; name is misleading, but required by other code in this file
        """
        private method called when setting up mmp reading code:
        register this class as a readmmp-helper,
        in whatever way differs for different classes of helpers
        
        [update, bruce 071017: this docstring is misleading,
        since so far this has nothing to do with mmp reading;
        see code comments for details]
        """
        disp_name = clas.mmp_code # we treat this as a unique index; error if not unique, unless classname is the same
        disp_label = clas.disp_label

        #bruce 080324 refactored this:
        allowed_for_atoms = not clas.chunk_only
        ind = _f_add_display_style_code( disp_name, disp_label, allowed_for_atoms )

# old form of above _f_add_display_style_code call, can be removed soon:
##        if disp_name in constants.dispNames:
##            # this is only legal if the classname is the same; in that case, replace things (useful for reload during debugging)
##            assert 0, "reload during debug for display modes is not yet implemented; or, non-unique mmp_code %r" % (disp_name,)
##        assert len(constants.dispNames) == len(constants.dispLabel)
##        constants.dispNames.append(disp_name)
##        constants.dispLabel.append(disp_label)
##        ind = constants.dispNames.index(disp_name) # internal value used by setDisplay
##        if clas.chunk_only:
##            remap_atom_dispdefs[ind] = constants.diDEFAULT # kluge?

        inst = clas(ind)
        _display_mode_handlers[disp_name] = inst
        _display_mode_handlers[ind] = inst #k are both of these needed??
        return
Пример #2
0
    def _register_for_readmmp(clas): # staticmethod; name is misleading, but required by other code in this file
        """
        private method called when setting up mmp reading code:
        register this class as a readmmp-helper,
        in whatever way differs for different classes of helpers

        [update, bruce 071017: this docstring is misleading,
        since so far this has nothing to do with mmp reading;
        see code comments for details]
        """
        disp_name = clas.mmp_code # we treat this as a unique index; error if not unique, unless classname is the same
        disp_label = clas.disp_label

        #bruce 080324 refactored this:
        allowed_for_atoms = not clas.chunk_only
        ind = _f_add_display_style_code( disp_name, disp_label, allowed_for_atoms )
        inst = clas(ind)
        _display_mode_handlers[disp_name] = inst
        _display_mode_handlers[ind] = inst #k are both of these needed??
        return
Пример #3
0
    def _register_for_readmmp(clas): # staticmethod; name is misleading, but required by other code in this file
        """
        private method called when setting up mmp reading code:
        register this class as a readmmp-helper,
        in whatever way differs for different classes of helpers
        
        [update, bruce 071017: this docstring is misleading,
        since so far this has nothing to do with mmp reading;
        see code comments for details]
        """
        disp_name = clas.mmp_code # we treat this as a unique index; error if not unique, unless classname is the same
        disp_label = clas.disp_label

        #bruce 080324 refactored this:
        allowed_for_atoms = not clas.chunk_only
        ind = _f_add_display_style_code( disp_name, disp_label, allowed_for_atoms )
        inst = clas(ind)
        _display_mode_handlers[disp_name] = inst
        _display_mode_handlers[ind] = inst #k are both of these needed??
        return