def doShowMarked(self): self.clear() c = self.c pl = leoNodes.PosList() for p in c.all_positions(): if p.isMarked(): pl.append(p.copy()) self.addHeadlineMatches(pl)
def find_h(self, regex, nodes, flags=re.IGNORECASE): """ Return list (a PosList) of all nodes where zero or more characters at the beginning of the headline match regex """ pat = re.compile(regex, flags) res = leoNodes.PosList() for p in nodes: m = re.match(pat, p.h) if m: pc = p.copy() pc.mo = m res.append(pc) return res
def find_h(self, regex, nodes, flags=re.IGNORECASE): """ Return list (a PosList) of all nodes where zero or more characters at the beginning of the headline match regex """ res = leoNodes.PosList() try: pat = re.compile(regex, flags) except Exception: return res for p in nodes: m = re.match(pat, p.h) if m: # #2012: Don't inject pc.mo. pc = p.copy() res.append(pc) return res
def find_b(self, regex, nodes, flags=re.IGNORECASE | re.MULTILINE): """ Return list (a PosList) of all nodes whose body matches regex one or more times. """ res = leoNodes.PosList() try: pat = re.compile(regex, flags) except Exception: return res for p in nodes: m = re.finditer(pat, p.b) t1, t2 = itertools.tee(m, 2) try: t1.__next__() except StopIteration: continue pc = p.copy() pc.matchiter = t2 res.append(pc) return res
def doNodeHistory(self): nh = leoNodes.PosList(po[0] for po in self.c.nodeHistory.beadList) nh.reverse() self.clear() self.addHeadlineMatches(nh)
def getSelectedPositions(self): items = self.getSelectedItems() pl = leoNodes.PosList(self.item2position(it) for it in items) return pl