Thanks for the code. Can't get much simpler than that! I have a more general interest, though - getting the import-file command and file drag-and-drop to work right. The csv matter would be part of that. It seems to me that Leo ought to have separate import commands for MindManager and ordinary tabular .csv files, which will be easy enough to arrange. If the MindManager import command were simply removed, it might bite someone who still uses it.
I think the drag-and-drop code and the import-file code should share as much code as possible. After all, they do the same job except for how Leo gets the path of the file to be imported (and possibly the location to create the imported file - that could be debated). Right now they are very different (and the drag-and-drop code is very complex compared with the import-file code). On Saturday, March 2, 2024 at 6:51:54 AM UTC-5 Edward K. Ream wrote: > On Fri, Mar 1, 2024 at 8:33 PM Thomas Passin <[email protected]> wrote: > >> The process for importing any file delegates .csv files to files exported >> the MindJet's MindManager program. Using it to import ordinary tabular .csv >> data produces unusable results on the samples I tried today. >> > > Thanks for this report. > > This is a confusing topic. Some notes: > > - There is no separate importer for .csv files. > - The import-file command delegates .csv files to the ic.importFreeMind > method, which in turn uses the MindMapImporter command. > > I would like to have Leo be able to import standard .csv files so I would >> like to start a discussion about the subject. >> > > I agree this would be a good idea. It will probably be easy to do. > > It's too late to do this for Leo 6.7.8. In the meantime, you can write a > script that imports directly to text. Here is tested code: > > import os > fn = 'README.md' > path = g.os_path_finalize_join(g.app.loadDir, '..', '..', fn) > contents = g.readFileIntoUnicodeString(path) > last = c.lastTopLevel() > p = last.insertAfter() > p.h = fn > c.importCommands.createOutline(p, ext='.txt', s=contents) > c.redraw(p) > > HTH. > > Edward > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/87c9743b-0c6d-4bb7-b6a6-ba0dc73b8acen%40googlegroups.com.
