Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)
Get the programming languages description string from the given
language id. If no corresponding language is found the plain text
description is returned.
@param lang_id: Language Identifier ID
@note: requires that all languages are defined in ID_LANG_NAME, LANG_NAME
       pairs to work properly.

        def GetDescriptionFromId(lang_id):
    """Get the programming languages description string from the given
    language id. If no corresponding language is found the plain text
    description is returned.
    @param lang_id: Language Identifier ID
    @note: requires that all languages are defined in ID_LANG_NAME, LANG_NAME
           pairs to work properly.

    """
    rval = LANG_TXT
    # Guard against async code that may be modifying globals
    globs = dict(globals())
    for key, val in globs.iteritems():
        if val == lang_id and key.startswith('ID_LANG'):
            rval = globs.get(key[3:], LANG_TXT)
            break
    return rval
        


src/e/d/Editra-0.7.20/src/ed_statbar.py   Editra(Download)
import ed_msg
import ed_menu
from syntax.synglob import GetDescriptionFromId
from eclib import ProgressStatusBar, EncodingDialog
from extern.decorlib import anythread
                         ed_glob.SB_ENCODING)
            wx.CallAfter(self.__SetStatusText,
                         GetDescriptionFromId(cbuff.GetLangId()),
                         ed_glob.SB_LEXER)
 

src/e/d/Editra-0.7.20/tests/unittests/testSynGlob.py   Editra(Download)
    def testGetDescriptionFromId(self):
        """Test GetDescriptionFromId"""
        desc = synglob.GetDescriptionFromId(synglob.ID_LANG_PYTHON)
        self.assertEquals(desc, synglob.LANG_PYTHON)
 
        desc = synglob.GetDescriptionFromId(synglob.ID_LANG_JAVA)
        self.assertEquals(desc, synglob.LANG_JAVA)
 
        # Test that some unknown id's always return Plain Text
        desc = synglob.GetDescriptionFromId(0)
        self.assertEquals(desc, synglob.LANG_TXT)
 
        desc = synglob.GetDescriptionFromId(100)
        self.assertEquals(desc, synglob.LANG_TXT)