Re: @file-nosent surprise
On Thu, Jun 19, 2008 at 12:27 PM, Kent Tenney [EMAIL PROTECTED] wrote: It is your expectations, not Leo, that are faulty. Leo can never read @nosent nodes: Why not? Because there are no sentinels in the file! Without sentinels, your options are: 1. Use @auto to get the file. 2. Use the Read File Into Node command. 3. Use one of the plugins that read files or folders. See the plugins in Plugins--Nodes... in leoPlugins.leo. I would like Leo to just place the file contents into the node in the case of @nosent for an existing file. Yes, that could be done. The logic would be similar to the logic for empty (or almost empty) @auto nodes. you use @auto to read nodes not containing sentinels. Can I supress the chunking of the file? (I want the entire file in the body) That is similar to the at_view.py plugin. Here is the docstring: '''A plugin that supports [EMAIL PROTECTED], [EMAIL PROTECTED] and [EMAIL PROTECTED] nodes. - Selecting a headline containing [EMAIL PROTECTED] appends the contents of the clipboard to the end of the body pane. - Double clicking the icon box of a node whose headline contains [EMAIL PROTECTED] path-to-file`` places the contents of the file in the body pane. - Double clicking the icon box of a node whose headline contains [EMAIL PROTECTED] path-to-file`` places the contents of the file in the body pane, with all sentinels removed. This plugin also accumulates the effect of all [EMAIL PROTECTED] nodes. ''' And here is the docstring for the textnode.py plugin: '''The @text node is for embedding text files in a leo node that won't be saved with the leo file, and won't contain any sentinel leo comments. Children of @text nodes are not saved with the derived file, though they will stay in the outline. When a outline is first loaded any @text nodes are filled with the contents of the text files on disk. To refresh the contents of an @text node, double click on the heading icon. ''' It's not clear to me why @file and @auto can originate on the file system, but @nosent cannot. Again, sentinels, or lack of them, are the key. Edward --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups leo-editor group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~--~~~~--~~--~--~---
Re: @file-nosent surprise
Because you can never have too many @file flavors ;-) I'll point out there's a plugin that adds a @text node which maybe does closer to what Kent was expecting. When you double click on something it reads the file, writes the file on outline save, I think. On Fri, 20 Jun 2008 09:03:35 -0700 (PDT) Edward K. Ream [EMAIL PROTECTED] wrote: On Jun 20, 9:04 am, Kent Tenney [EMAIL PROTECTED] wrote: Why would Leo look for sentinels in the disk file when encountering a @nosent node? By definition there are no sentinels, so I'd expect the lack of them to be expected by Leo. Kent, you are confused. Leo isn't looking for sentinels, but Leo can't read the @nosent outline without them. Thus, Leo *can not* read the @nosent file: all the info must be in the outline. What you are expecting, I suppose, is for @nosent to be equivalent to @auto. But they are very different. With @nosent, *you* can organize the outline as you like. With @auto, you get exactly what the import code gives you, and no more. Anyway, the trunk contains logic for @nosent similar to @auto. Leo will not write an @nosent node if it contains less than 10 characters and has no descendants. This should prevent unwanted writes. Edward --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups leo-editor group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~--~~~~--~~--~--~---
Re: @file-nosent surprise
Turns out @menuat is completely unintrusive, if you don't count the new @settings node type list entries. Here's the diff... shall I merge w. trunk? Cheers -Terry 36c36 'popup', # New in Leo 4.4.8. --- 'menuat', 'popup', # New in Leo 4.4.8. 78c78 --- 'menuat': self.doMenuat, 429a430 g.es_print('Using menus from',c.shortFileName(),color='blue') 675a677,782 [EMAIL PROTECTED]:tbrown.20080514112857.124:doMenuat def doMenuat (self,p,kind,name,val): if g.app.config.menusList: g.es_print(Patching menu tree: + name) # get the patch fragment patch = [] if p.hasChildren(): # self.doMenus(p.copy().firstChild(),kind,name,val,storeIn=patch) self.doItems(p.copy(),patch) self.dumpMenuTree(patch) # setup parts = name.split() if len(parts) != 3: parts.append('subtree') targetPath,mode,source = parts if not targetPath.startswith('/'): targetPath = '/'+targetPath ans = self.patchMenuTree(g.app.config.menusList, targetPath) if ans: g.es_print(Patching (+mode+' '+source+) at +targetPath) list_, idx = ans if mode not in ('copy', 'cut'): if source != 'clipboard': use = patch # [0][1] else: if isinstance(self.clipBoard, list): use = self.clipBoard else: use = [self.clipBoard] g.es_print(str(use)) if mode == 'replace': list_[idx] = use.pop(0) while use: idx += 1 list_.insert(idx, use.pop(0)) elif mode == 'before': while use: list_.insert(idx, use.pop()) elif mode == 'after': while use: list_.insert(idx+1, use.pop()) elif mode == 'cut': self.clipBoard = list_[idx] del list_[idx] elif mode == 'copy': self.clipBoard = list_[idx] g.es_print(str(self.clipBoard)) else: # append list_.extend(use) else: g.es_print(ERROR: didn't find menu path + targetPath) else: g.es_print(ERROR: @menuat found but no menu tree to patch) [EMAIL PROTECTED]:tbrown.20080514180046.9:getName def getName(self, val, val2=None): if val2 and val2.strip(): val = val2 val = val.split('\n',1)[0] for i in *.- \t\n: val = val.replace(i,'') return val.lower() [EMAIL PROTECTED] [EMAIL PROTECTED]:tbrown.20080514180046.9:getName [EMAIL PROTECTED]:tbrown.20080514180046.2:dumpMenuTree def dumpMenuTree (self,aList,level=0,path=''): for z in aList: kind,val,val2 = z if kind == '@item': name = self.getName(val, val2) g.es_print('%s %s (%s) [%s]' % (''*(level+0), val, val2, path+'/'+name)) else: name = self.getName(kind.replace('@menu ','')) g.es_print('%s %s... [%s]' % (''*(level), kind, path+'/'+name)) self.dumpMenuTree(val,level+1,path=path+'/'+name) [EMAIL PROTECTED]:tbrown.20080514180046.2:dumpMenuTree [EMAIL PROTECTED]:tbrown.20080514180046.8:patchMenuTree def patchMenuTree(self, orig, targetPath, path=''): for n,z in enumerate(orig): kind,val,val2 = z if kind == '@item': name = self.getName(val, val2) curPath = path+'/'+name if curPath == targetPath: g.es_print('Found '+targetPath) return orig, n else: name = self.getName(kind.replace('@menu ','')) curPath = path+'/'+name if curPath == targetPath: g.es_print('Found '+targetPath) return orig, n ans = self.patchMenuTree(val, targetPath, path=path+'/'+name) if ans: return ans return None [EMAIL PROTECTED]:tbrown.20080514180046.8:patchMenuTree [EMAIL PROTECTED]:tbrown.20080514112857.124:doMenuat --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups leo-editor group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this
Re: @file-nosent surprise
On Fri, Jun 20, 2008 at 1:07 PM, Terry Brown [EMAIL PROTECTED] wrote: On Fri, 20 Jun 2008 12:40:42 -0500 Kent Tenney [EMAIL PROTECTED] wrote: Any ETA on merging the leo-menuat branch with the trunk? I want both --one-config and menu config cascading. I'll merge it if Edward says it's ok to do so. The current version is actually less intrusive into the core than the first version, which passed a lot of keyword arguments into things. I don't actually use it myself, only wrote it because Edward told me not to :-) :-] http://longrun.zwiki.org/Quotes Cheers -Terry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups leo-editor group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~--~~~~--~~--~--~---
Re: @file-nosent surprise
On Wed, Jun 18, 2008 at 3:49 PM, Kent Tenney [EMAIL PROTECTED] wrote: I just created a node @file-nosent buildout/README.txt (README.txt is a rst file) the file buildout/README.txt exists, I expected it to be loaded into the body of the @file-nosent node, It is your expectations, not Leo, that are faulty. Leo can never read @nosent nodes: you use @auto to read nodes not containing sentinels. but the file on disk was overwritten by the empty body when I saved the Leo file. This is as expected. I then selected File - Read/Write - Read @file nodes and was told the selected tree contained no @file nodes That's because there are no @file nodes. I then changed @file-nosent to @file buildout/README.txt and got reading: @file buildout/README.txt Bad @+leo sentinel in: buildout/README.txt can not read 3.x derived file buildout/README.txt you may upgrade these file using Leo 4.0 through 4.4.x exception executing command File /home/ktenney/lib/bzr/leo-editor/leo/core/leoAtFile.py, line 614, in readOpenFile at.completeLastDirectives(lines,lastLines) UnboundLocalError: local variable 'lastLines' referenced before assignment This fix is on the trunk. Edward --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups leo-editor group. To post to this group, send email to leo-editor@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~--~~~~--~~--~--~---