Newbie question.
When I use the c.k.simulateCommand() method, it does an immediate redraw of the outline. I would like to suppress the redraw until after I am done making changes. I am looking at using position methods to do the same thing so that I control the redraw, but haven't had time to suss it out yet.
Also, I have been doing some stress testing on large, programatically created outlines to see if there are scale limits in Leo. I have found that Leo will crash if I use c.k.simulateCommand() on a large number of nodes in one function.
I don't want to report this formally until I have a chance to dig into it more, so this is just a heads up.
The specific code that I am working on is intended to build a journal with weekly text files. This might be better served using a database, but I have some specific requirements that make Leo and interesting potential solution.....and it provides a great opportunity to learn the ins and outs of the tool.
A code snip follows that illustrates what I am doing. This code does cause Leo to hang, but not at consistent places in the operation, so I assuming that it is a memory problem; perhaps stack space, or garbage collector overflow, or some such.
monthNames = {"01-January","02-February","03-March","04-April","05-May",
"06-June","07-July","08-August","09-September","10-October","11-November","12-December"}
yr = 1960
for np in c.all_positions():
if (c.p.h[:5] == 'Year:'):
yr = int(c.p.h[-4:])
c.k.simulateCommand('goto-next-visible')
if (c.p.h[:5] == 'Year:'):
c.k.simulateCommand('move-outline-right')
if (c.p.h in monthNames):
c.k.simulateCommand('move-outline-right')
c.k.simulateCommand('move-outline-right')
elif (c.p.h[:1] == 'w'):
c.k.simulateCommand('move-outline-right')
c.k.simulateCommand('move-outline-right')
c.k.simulateCommand('move-outline-right')