def parseOnSearchName(self, keyword): self.cleanup() keyword = keyword.lower() for key in _KEYWORDS_LIST: if keyword in key.lower(): win = self.makePanel(key) self.AddPage(win, key) self.setStyle() self.getPage("Intro") wx.CallAfter(self.AdjustSize)
def parseOnSearchName(self, keyword): self.cleanup() keyword = keyword.lower() for key in self.directories: for key2 in self.files[key]: if keyword in key2.lower(): win = self.makePanel(os.path.join(self.root, key, key2)) self.AddPage(win, key2) self.setStyle() wx.CallAfter(self.AdjustSize)
def parseOnSearchPage(self, keyword): self.cleanup() keyword = keyword.lower() for key in _KEYWORDS_LIST: with open(os.path.join(DOC_PATH, key), "r") as f: text = f.read().lower() if keyword in text: win = self.makePanel(key) self.AddPage(win, key) self.setStyle() self.getPage("Intro") wx.CallAfter(self.AdjustSize)
def complete_words_from_str(text, keyword): words = [keyword] keyword = keyword.lower() text_ori = text text = text.replace("`", " ").replace("'", " ").replace(".", " ").replace(", ", " ").replace('"', " ").replace("=", " ").replace("\n", " ").lower() found = text.find(keyword) while found > -1: start = text.rfind(" ", 0, found) end = text.find(" ", found) words.append(text_ori[start:end]) found = text.find(keyword, found + 1) words = " ".join(words) return words
def parseOnSearchPage(self, keyword): self.cleanup() keyword = keyword.lower() for key in self.directories: for key2 in self.files[key]: with open(os.path.join(self.root, key, key2), "r") as f: text = f.read().lower() first = text.find('"""') if first != -1: newline = text.find("\n", first) second = text.find('"""', newline) text = text[newline + 1:second] else: text = "module not documented..." if keyword in text: win = self.makePanel(os.path.join(self.root, key, key2)) self.AddPage(win, key2) self.setStyle() wx.CallAfter(self.AdjustSize)