예제 #1
0
 def rescanForMajorModeChange(self):
     """Call the MajorModeMatcherDriver to determine the major mode
     
     This uses the current text of the major mode as the header text, rather
     than having the MajorModeMatcherDriver load bytes from the URL.
     """
     # header must be in bytes, not unicode
     header = self.GetText().encode('utf-8')
     newcls = MajorModeMatcherDriver.match(self.buffer, header=header)
     return newcls
예제 #2
0
 def rescanForMajorModeChange(self):
     """Call the MajorModeMatcherDriver to determine the major mode
     
     This uses the current text of the major mode as the header text, rather
     than having the MajorModeMatcherDriver load bytes from the URL.
     """
     # header must be in bytes, not unicode
     header = self.GetText().encode('utf-8')
     newcls = MajorModeMatcherDriver.match(self.buffer, header=header)
     return newcls
예제 #3
0
파일: macro.py 프로젝트: zendbit/peppy
 def findKeywordHierarchy(self):
     """Return a list of keywords representing the major mode subclassing
     hierarchy of the current major mode.
     """
     mode_classes = MajorModeMatcherDriver.findActiveModes()
     mode_classes.reverse()
     keywords = []
     
     # Put the major mode first
     keywords.append(mode_classes.pop(0).keyword)
     
     mode_classes.sort(cmp=lambda a,b: cmp(a.keyword, b.keyword))
     for cls in mode_classes:
         keywords.append(cls.keyword)
     return keywords
예제 #4
0
    def getActiveModesAndNames(self):
        modes = []
        names = []
        for mode in MajorModeMatcherDriver.iterActiveModes():
            modes.append(mode)
            names.append(mode.keyword)
        order = [(n, m) for n, m in zip(names, modes)]
        order.sort()

        # NOTE: interestingly, zip is its own unzip!
        n, m = zip(*order)
        names = ["All Major Modes"]
        names.extend(n)
        modes = [None]
        modes.extend(m)
        dprint(modes)
        dprint(names)
        return modes, names
예제 #5
0
파일: keyboard.py 프로젝트: betsegaw/peppy
 def getActiveModesAndNames(self):
     modes = []
     names = []
     for mode in MajorModeMatcherDriver.iterActiveModes():
         modes.append(mode)
         names.append(mode.keyword)
     order = [(n, m) for n, m in zip(names, modes)]
     order.sort()
     
     # NOTE: interestingly, zip is its own unzip!
     n, m = zip(*order)
     names = ["All Major Modes"]
     names.extend(n)
     modes = [None]
     modes.extend(m)
     dprint(modes)
     dprint(names)
     return modes, names