def finishCreate(self): '''Find or make the @chapters and @chapter trash nodes.''' trace = (False or g.trace_startup) and not g.unitTesting if trace: g.es_debug('(cc)') cc, c = self, self.c if cc.findChaptersNode(): if hasattr(c.frame.iconBar, 'createChaptersIcon'): if not cc.tt: cc.tt = c.frame.iconBar.createChaptersIcon() # Create the main chapter cc.chaptersDict['main'] = Chapter(c, cc, 'main') tag = '@chapter' for p in c.all_unique_positions(): h = p.h # if h.startswith(tag) and not h.startswith('@chapters'): if g.match_word(h, 0, tag): tabName = h[len(tag):].strip() if tabName and tabName not in ('main',): if cc.chaptersDict.get(tabName): self.error('duplicate chapter name: %s' % tabName) else: cc.chaptersDict[tabName] = Chapter(c, cc, tabName) # Fix bug: https://github.com/leo-editor/leo-editor/issues/31 cc.initing = False # Always select the main chapter. # It can be alarming to open a small chapter in a large .leo file. cc.selectChapterByName('main', collapse=False)
def finishCreate(self): '''Create the box in the icon area.''' trace = (False or g.trace_startup) and not g.unitTesting if trace: g.es_debug('(cc)') cc = self cc.createIcon() if trace: g.trace('===== ChapterController.finishCreate') cc.setAllChapterNames() # Create all chapters. # Fix bug: https://github.com/leo-editor/leo-editor/issues/31 cc.initing = False cc.selectChapterByName('main', collapse=False)