def show_files(self, wnd): self.cursel = None dirs = [ selectlist.SelectItem('selectitem', 'selectitem-active', name.replace('&', '&&'), name) for name in self.dirs ] files = [ selectlist.SelectItem('selectitem2', 'selectitem-active', name.replace('&', '&&'), name) for name in self.files ] items = dirs + files if self.filterfunc: items = [item for item in items if self.filterfunc(item.text)] self.update_doc(items)
def set_candidates(self, candidates): self.candidates = [] for c in candidates: caption = ' '.join(c.split()) if not caption: caption = '(...)' if len(caption) > self.MAX_CAPTION_LEN: caption = caption[:self.MAX_CAPTION_LEN] + '...' c = selectlist.SelectItem('selectitem', 'selectitem-active', caption, c) self.candidates.append(c)
def show_breakpoints(self, port): self.port = port breakpoints = self.port.get_breakpoints() breakpoints.sort(key=lambda o: (o.filename, o.lineno)) items = [] for bp in breakpoints: caption = '{bp.filename}:{bp.lineno}'.format(bp=bp) c = selectlist.SelectItem('selectitem', 'selectitem-active', caption, bp) items.append(c) self.update_doc(items)
def set_candidates(self, candidates): ws = re.compile(r'\s') self.candidates = [] for c in candidates: phrase = False caption = c if ws.search(caption): phrase = True caption = ' '.join(caption.split()) if not caption: caption = '(...)' if self.MAX_CAPTION_LEN is not None: if len(caption) > self.MAX_CAPTION_LEN: caption = caption[:self.MAX_CAPTION_LEN] + '...' phrase = True if not self.USE_PHRASE_STYLE or not phrase: c = selectlist.SelectItem( 'selectitem', 'selectitem-active', caption, c) else: c = selectlist.SelectItem( 'selectphrase', 'selectphrase-active', caption, c) self.candidates.append(c)
def set_candidates(self, candidates): self.candidates = [ selectlist.SelectItem( 'selectitem' if c.token != 'namespace' else 'selectitem2', 'selectitem-active', c.dispname, c) for c in candidates ]