Here are two utility commands/scripts I use that help with this kind of thing.
1) get_plugins -- Show all plugins with their their docstrings. 2) Create Outline From Clipboard -- With a copied node or entire outline in the clipboard, create a new outline from it. Run *get_plugins * with CTRL-B to install its commands. Run the *Create Outline From Clipboard* node with CTRL-B when you have a node or outline in the clipboard to create a new outline with that node. It's convenient for making small outlines to share, like this attached one. In the output from *get_plugins* we can find this bit: nav_qt.py Adds "Back" and "Forward" buttons (Qt only). Creates "back" and "forward" buttons on button bar. These navigate the node history. ... It's a whole lot easier than pawing through LeoPyRef to try to find out what they do. On Wednesday, March 23, 2022 at 4:13:23 PM UTC-4 jkn wrote: > On Wednesday, March 23, 2022 at 8:01:58 PM UTC gates...@gmail.com wrote: > >> On Wed, Mar 23, 2022 at 3:29 PM jkn <jkn...@nicorp.f9.co.uk> wrote: >> >>> >>>> >>> Bl**dy hell, I remember now, there used to be forward and back arrows on >>> the toolbar, didn't there? Why do I no longer see them?? >>> >>> >> I think they're part of the nav_qt.py (or similarly named) plugin. Might >> not have it in @enabled-plugins :) >> > > Thank you - somewhat amusingly I see in the plugins directory on this > machine (my main one, for a long time), > I have a nav_qt.pyc file from 2016! > > I guess I lost the plugin during some period of leo unuse around that > time, and didn't re-enable it, > nor remember about the buttons, when I later updated things. > > How I've been suffering for the last 5+ years... > > J^n > > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/b4c82f02-c006-4598-9572-0e7e528d1c10n%40googlegroups.com.
<?xml version="1.0" encoding="utf-8"?> <!-- Created by Leo: http://leoeditor.com/leo_toc.html --> <leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1" > <leo_header file_format="2"/> <globals/> <preferences/> <find_panel_settings/> <vnodes> <v t="tom.20220313132552.1"><vh>get_plugins</vh> <v t="tom.20220313160135.1"><vh>find_python_files</vh></v> <v t="tom.20220313160152.1"><vh>get_docstr</vh></v> </v> <v t="tom.20220323161750.1"><vh>Create Outline From Clipboard</vh></v> </vnodes> <tnodes> <t tx="tom.20220313132552.1">@language python from os import listdir from textwrap import wrap @g.command('show-plugins-doc-clip') def show_plugins_doc_clip(event=None, useclip = True): """List all plugins and their docstrings. Output to the clipboard. """ plugins_dir=g.os_path_join(g.app.leoDir,'plugins') @others files = find_python_files(plugins_dir) entries = [] for fil in files: pth = g.os_path_join(plugins_dir, fil) with open(pth, encoding = 'utf-8') as f: block = f.read() docstr = get_docstr(block) entries.append(f'{fil:<22} {docstr}') entries_str = '\n'.join(entries) if useclip: g.app.gui.replaceClipboardWith(entries_str) else: tabName = 'List' c.frame.log.clearTab(tabName) g.es(entries_str, tabName = tabName) @g.command('show-plugins-doc') def show_plugins_doc(event=None, useclip = False): """List all plugins and their docstrings. Output to A Log Pane tab named "List". """ show_plugins_doc_clip(event, useclip) </t> <t tx="tom.20220313160135.1">def find_python_files(path): pythons = [] for item in listdir(path): if item.endswith('.py') and '__init__' not in item: pythons.append(item) return pythons </t> <t tx="tom.20220313160152.1">def get_docstr(block, too_long = 5): """Try to find the docstring of a python file. Works even if the docstr is contained in a << named section >>. The docstring is shortened if it contains too many lines, and is rewrapped. Docstring multiline formatting principles: 1. First line is not blank. 2. First line has same indentation as the rest of the body. 3. No more than too_long lines. 4. If clipped, end docstr with ellipsis ('...'). 5. If last line would contain only an ellipsis, move it to the end of the previous line and remove the last (now blank) line. 6. No sentinal lines included. RETURNS: the modified docstring """ start = -1 for quote in '"""', "'''": start = block.find(quote) if start > -1: break if start == -1: return '' start = block.find(quote) + 3 end = start + block[start:].find(quote) doc = block[start:end] if doc == 'None': doc = '' # Formatting for multi-line docstring doclines = [line for line in doc.split('\n') if not line.lstrip().startswith('#@')] if not doclines[0].strip(): doclines = doclines[1:] toolong = len(doclines) > 5 if toolong: doclines = doclines[:4] doclines[0] = doclines[0].lstrip() while not doclines[-1].strip(): doclines.pop(-1) doclines[-1] += ' ...' doc = '\n'.join(doclines) manylines = len(doclines) > 1 if manylines: doc = '\n' + '\n'.join(wrap(doc, width = 65, initial_indent = ' '*4, subsequent_indent = ' '*4)) + '\n' else: doc = doc.strip() return doc </t> <t tx="tom.20220323161750.1">@language python from leo.core.leoFileCommands import FastRead as FR def createOutlineFromclipboard(): """Create a new outline from a string. The clipboard must contain an XML-format Leo outline. """ s = g.app.gui.getTextFromClipboard() # Create new outline c1 = c.new() # Construct tree from outline string fr = FR(c1, c1.fileCommands.gnxDict) v = fr.readFileFromClipboard(s) # Shove new tree into commander of the new outline c1.hiddenRootNode = v p0 = c1.rootPosition() c1.selectPosition(p0) # Highlight root node in tree as if we had clicked on it g.doHook("headclick1", c=c1, p=p0, event=None) c1.setChanged() c1.redraw() createOutlineFromclipboard()</t> </tnodes> </leo_file>