p = createLastChildNode(c, current, h, ''.join(b)) u.afterInsertNode(p, undoType, undoData) c.updateBodyPane(head, middle, tail, undoType=undoType, oldSel=None, oldYview=oldYview) u.afterChangeGroup(current, undoType=undoType) p.parent().expand() c.redraw(p.parent()) # A bit more convenient than p. c.bodyWantsFocus() # Compatibility g.command_alias('extractSection', extract) g.command_alias('extractPythonMethod', extract) #@+node:ekr.20171123135625.20: *3* def createLastChildNode def createLastChildNode(c, parent, headline, body): '''A helper function for the three extract commands.''' if body: body = body.rstrip() if not body: body = "" p = parent.insertAsLastChild() p.initHeadString(headline) p.setBodyString(body) p.setDirty() c.validateOutline()
h, b, middle = def_h, lines, '' else: h, b, middle = lines[0].strip(), lines[1:], '' u.beforeChangeGroup(current, undoType) undoData = u.beforeInsertNode(current) p = createLastChildNode(c, current, h, ''.join(b)) u.afterInsertNode(p, undoType, undoData) c.updateBodyPane(head, middle, tail, undoType=undoType, oldSel=None, oldYview=oldYview) u.afterChangeGroup(current, undoType=undoType) p.parent().expand() c.redraw(p.parent()) # A bit more convenient than p. c.bodyWantsFocus() # Compatibility g.command_alias('extractSection', extract) g.command_alias('extractPythonMethod', extract) #@+node:ekr.20171123135625.20: *3* def createLastChildNode def createLastChildNode(c, parent, headline, body): '''A helper function for the three extract commands.''' if body: body = body.rstrip() if not body: body = "" p = parent.insertAsLastChild() p.initHeadString(headline) p.setBodyString(body) p.setDirty() c.validateOutline() return p #@+node:ekr.20171123135625.24: *3* def extractDef
parent=parent, treeType='@auto', # was '@clean' # Experimental: attempt to use permissive section ref logic. ) c.raise_error_dialogs(kind='read') # Compatibility: used by unit tests. # importAtFile = importAnyFile # importAtRoot = importAnyFile # importCWEBFiles = importAnyFile # importDerivedFile = importAnyFile # importFlattenedOutline = importAnyFile # importMOREFiles = importAnyFile # importNowebFiles = importAnyFile # importTabFiles = importAnyFile g.command_alias('importAtFile', importAnyFile) g.command_alias('importAtRoot', importAnyFile) g.command_alias('importCWEBFiles', importAnyFile) g.command_alias('importDerivedFile', importAnyFile) g.command_alias('importFlattenedOutline', importAnyFile) g.command_alias('importMOREFiles', importAnyFile) g.command_alias('importNowebFiles', importAnyFile) g.command_alias('importTabFiles', importAnyFile) #@+node:ekr.20031218072017.1623: *3* c_file.new @g.commander_command('new') def new(self, event=None, gui=None): '''Create a new Leo window.''' import leo.core.leoApp as leoApp lm = g.app.loadManager old_c = self # Clean out the update queue so it won't interfere with the new window.
parent=parent, treeType='@auto', # was '@clean' # Experimental: attempt to use permissive section ref logic. ) c.raise_error_dialogs(kind='read') # Compatibility: used by unit tests. # importAtFile = importAnyFile # importAtRoot = importAnyFile # importCWEBFiles = importAnyFile # importDerivedFile = importAnyFile # importFlattenedOutline = importAnyFile # importMOREFiles = importAnyFile # importNowebFiles = importAnyFile # importTabFiles = importAnyFile g.command_alias('importAtFile', importAnyFile) g.command_alias('importAtRoot', importAnyFile) g.command_alias('importCWEBFiles', importAnyFile) g.command_alias('importDerivedFile', importAnyFile) g.command_alias('importFlattenedOutline', importAnyFile) g.command_alias('importMOREFiles', importAnyFile) g.command_alias('importNowebFiles', importAnyFile) g.command_alias('importTabFiles', importAnyFile) #@+node:ekr.20031218072017.1623: *3* c_file.new @g.commander_command('new') def new(self, event=None, gui=None): '''Create a new Leo window.''' lm = g.app.loadManager # Clean out the update queue so it won't interfere with the new window. self.outerUpdate() # Send all log messages to the new frame.