Re: How to trace Leo Core?

2019-09-29 Thread Brian Theado
Edward can speak to the built-in leo traces, but there are also other
options.

I mentioned in the thread at
https://groups.google.com/forum/#!topic/leo-editor/r6ktpQNWySk, about using
the python trace module for debugging python applications, but I no longer
recommend using it because it is too difficult to filter out noise. Since
then I've discovered https://github.com/ionelmc/python-hunter and it is
excellent. You can filter exactly which modules do and don't get traced and
the colorized output looks nice.

Depending on what pattern of modules you pick to trace you will still get a
firehose of information. You can either fine-tune your python-hunter
queries more or just save the trace output to a file which you can search
through.

But sometimes the approach Edward advocates in the above thread of
modifying the code yourself and adding traces and using clones will be
better. It's wise to heed his caution about signal to noise ratio :-).

Here is an example python hunter trace I've run on leo (after pip install
hunter):

PYTHONHUNTER="module='leo.core.leoApp'" HOME=$HOME/tmp/blank
../pyqt-3.7-venv/bin/python launchLeo.py ~/tmp/new.leo


Here are some more example trace queries I've used:

PYTHONHUNTER="module_in=['leo.core.leoApp', 'leo.core.leoNodes']"
PYTHONHUNTER="~Q(kind='line'),module_in=['leo.core.leoApp',
'leo.core.leoNodes']"
PYTHONHUNTER="Q(module_startswith='leo')"


Here, I redirect to the pager program 'less' and do it in such a way as to
not lose the color. By using less, I can search through the results
(leo-bridge-test.py is just a file I was using to learn about leo bridge).

PYTHONHUNTER="Q(module_startswith='leo'),action=CallPrinter(force_colors=True)"
HOME=$HOME/tmp/blank ../pyqt-3.7-venv/bin/python  leo-bridge-test.py 2>&1 |
less -R


Not sure this is really what you are after, but I thought I'd share in case
in helps.

Brian


On Sun, Sep 29, 2019 at 3:43 PM Viktor Ransmayr 
wrote:

> Hello Edward,
>
> I tried to find out, if I can enable 'auditing/ tracing' for Leo in order
> to 'visualize' the run-time behavior of Leo Core ...
>
> I started with something, that I thought should/ would be an easy starting
> point: I tried to audit/ trace what happens, when Leo opens an empty
> outline in a PyVE using:
>
> * (Leo) PS C:\Users\Viktor\PyVE\PyPI\Leo\Lib\site-packages\leo\core>
> ./runLeo.py --trace=plugins ~/empty.leo
>
> The result (Log-001) was not that helpfull. - Am I missing something?
>
> With kind regards,
>
> Viktor
>
> ---
>
> 
>
> Leo Log Window
> Leo 6.0-final
> Python 3.7.4, PyQt version 5.13.0
> Windows 10 AMD64 (build 10.0.18362) SP0
> current dir: C:/Users/Viktor/PyVE/PyPI/Leo/Lib/site-packages/leo/core
> load dir: C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/core
> global config dir:
> C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/config
> home dir: C:/Users/Viktor
> reading settings in
> C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/config/leoSettings.leo
> reading settings in C:/Users/Viktor/.leo/myLeoSettings.leo
> loadOnePlugin: loaded: leo.plugins.plugins_menu
> loadOnePlugin: loaded: leo.plugins.mod_scripting
> loadOnePlugin: loaded: leo.plugins.viewrendered
>
> 
>
> --
> 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/c89b189a-5aec-48d8-b312-65cba932a850%40googlegroups.com
> 
> .
>

-- 
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/CAO5X8Cwg065h3NW1_XLs10ALJMaAzmm9Wf%3DJyqOchfON9Cd5Ng%40mail.gmail.com.


Re: Is there a command to get a Vnode by its gnx? (Newbie scripting question)

2019-09-29 Thread Robert Cholette
Many thanks! 

On Sunday, September 29, 2019 at 3:40:36 PM UTC-4, Robert Cholette wrote:
>
> Trying to find a command (in commander) to directly get a Vnode but I seem 
> to only see stuff (getter/setters) to get positions 
> Anyone can shed a light on this?
>

-- 
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/7e6a3414-8d5d-40f8-bc44-50c2c6018a42%40googlegroups.com.


Re: Is there a command to get a Vnode by its gnx? (Newbie scripting question)

2019-09-29 Thread vitalije
v = c.fileCommands.gnxDict.get(gnx)



On Sunday, September 29, 2019 at 9:40:36 PM UTC+2, Robert Cholette wrote:
>
> Trying to find a command (in commander) to directly get a Vnode but I seem 
> to only see stuff (getter/setters) to get positions 
> Anyone can shed a light on this?
>

-- 
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/286ae750-0546-4cda-8a70-b7afe7b9bdef%40googlegroups.com.


How to trace Leo Core?

2019-09-29 Thread Viktor Ransmayr
Hello Edward,

I tried to find out, if I can enable 'auditing/ tracing' for Leo in order 
to 'visualize' the run-time behavior of Leo Core ...

I started with something, that I thought should/ would be an easy starting 
point: I tried to audit/ trace what happens, when Leo opens an empty 
outline in a PyVE using:

* (Leo) PS C:\Users\Viktor\PyVE\PyPI\Leo\Lib\site-packages\leo\core> 
./runLeo.py --trace=plugins ~/empty.leo

The result (Log-001) was not that helpfull. - Am I missing something?

With kind regards,

Viktor

---



Leo Log Window
Leo 6.0-final
Python 3.7.4, PyQt version 5.13.0
Windows 10 AMD64 (build 10.0.18362) SP0
current dir: C:/Users/Viktor/PyVE/PyPI/Leo/Lib/site-packages/leo/core
load dir: C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/core
global config dir: 
C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/config
home dir: C:/Users/Viktor
reading settings in 
C:/Users/Viktor/PyVE/PyPI/Leo/lib/site-packages/leo/config/leoSettings.leo
reading settings in C:/Users/Viktor/.leo/myLeoSettings.leo
loadOnePlugin: loaded: leo.plugins.plugins_menu
loadOnePlugin: loaded: leo.plugins.mod_scripting
loadOnePlugin: loaded: leo.plugins.viewrendered



-- 
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/c89b189a-5aec-48d8-b312-65cba932a850%40googlegroups.com.


Is there a command to get a Vnode by its gnx? (Newbie scripting question)

2019-09-29 Thread Robert Cholette
Trying to find a command (in commander) to directly get a Vnode but I seem 
to only see stuff (getter/setters) to get positions 
Anyone can shed a light on this?

-- 
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/984eb3a6-4480-4633-bb4f-f43250deb106%40googlegroups.com.


Re: For devs: the new "delegated" label

2019-09-29 Thread vitalije


On Sunday, September 29, 2019 at 12:43:57 PM UTC+2, Edward K. Ream wrote:
>
>
>  The settings were put there as the result of specific requests. 
>
I am not very convinced that is the case. I think they sometimes are put 
just because you or any other developer thought they might be useful. For 
example, I just published new plugin. Nobody asked me for this. I put it 
there because I thought it might be useful to someone. I might be wrong as 
well. I was thinking of putting new settings like: `@string 
history-tracer-file-list`, `@string history-tracer-executable` and `@int 
history-tracer-port`. In the end I decided to only use the last one. Nobody 
asked for any of them. It was just my guess that they might be useful. I 
believe there were many similar examples in Leo's history.
 

> Lot's of people may use Leo to edit .php files. They may not be reading 
> Leo's forums, and yet they could still be using those settings.
>
 

> I would still like to delegate this to you. If you are willing, please 
> investigate having zooms support all related settings.
>
> Edward
>
 
I remember that I have tried two or more times in the past to fix this 
issue. I don't remember very well the details but I do remember that I 
bumped every time in the roadblock which required some very ugly hacks and 
I abandoned it every time with the strong feeling that nobody really uses 
this feature, and even if someone does use this feature, it is very hard 
for me to understand why? What would anyone get through this feature. I 
really doubt that other editors have similar feature. 

If I ever get really bored and in need of some detective investigation 
work, I might try to solve it just for sport. But it is highly unlikely to 
happen. If some user shows up with a very good explanation why this feature 
might be necessary, I would reconsider putting an effort to solve this 
issue again. As I said before, I am pretty sure nobody uses this feature. 
If they did, this issue would be reported many times by now. 

In effect, a viable feature like (Ctrl+wheel zoom), which is supported by 
almost every application today, is currently broken in Leo, and the only 
reason it is broken is some leftover settings in official leoSettings.leo 
and a few paragraphs somewhere in the Leo's documentation. Your decision to 
support some potential users who might be still using this feature goes 
against many actual users (and especially new users) who are using zoom and 
writes programs in PHP.  Why wouldn't you rather have more compassion to 
those real users, than to some potentially existing users? Let's remove 
this feature and wait to see if someone is going to notice that it is 
missing and report an issue.

By the way, in one of your recent commits you wrote:

>  Removed *weird* redundant, non-functional code in at.precheck


That removal  made my Leo totally broken. When I finished my new plugin and 
wished to push it, I had to update my repository. When I opened 
leoPlugins.leo after update, and added my plugin there, I could not write 
the external file. Leo persistently reported that my file is not written 
because of errors, but no other explanation was given. I checked and 
rechecked several times looking for some orphan node or anything similar 
but there was no obvious reason why Leo should refuse to write this file. I 
had to run it in debugger, step by step, to find that my file is not 
written because the path it should be written is not equal to the path from 
which it was read. However, no such explanation was given, nor I as a user 
was asked if I am sure that path is correct and that the file should be 
saved to the new path. The problem was in my using symlinks. The both paths 
resolve to the same file, but they are different if compared as strings. 
This change is most likely connected with your recent changes of 
g.os_path_... methods for security reasons. I believe you removed this 
"*weird* redundant, non-functional code in at.precheck" because recently 
Leo started to ask too often for permission to write file with no obvious 
reason. I think I had noticed that too, but didn't pay too much attention. 
I've fixed this issue and it also fixed issue: #1282 at the same time. 

My point is: you are sometimes too careful not to make an inconvenience to 
some unknown invisible group of users (who might as well be nonexistent), 
and at the same time (unintentionally of course) you brake some of the 
Leo's elementary functions for real visible users. I really don't blame you 
for this. It could easily happen to anyone. But what if it happen? We 
survived it. It was an inconvenience but nothing too dramatic. Then why not 
take a risk and make some small inconvenience to those invisible and 
perhaps only fictional users in order to make something work for the real 
and visible ones? If they are not fictional, they will raise their voices 
and we will know they exist. After all Leo is distributed under MIT license 
which explicitly 

Re: New plugin history_tracer

2019-09-29 Thread Edward K. Ream
On Sat, Sep 28, 2019 at 1:22 PM vitalije  wrote:

> I finally got around to pack and publish my new plugin history_tracer.
>

Many thanks for this.  I have just created #1358
 to memorialize your
contribution.  This will ensure that link to all issues in the 6.1 release
notes will include your work.

I've bookmarked this email and added history_tracer.py to my local
leoSettings.leo file.  I'll take a look at it soon.

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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS201NAdukehLfFz6Yc4u1zQrN2BEzzAdmD8yFi04gMw2w%40mail.gmail.com.


Re: For devs: the new "delegated" label

2019-09-29 Thread Edward K. Ream
On Sat, Sep 28, 2019 at 6:54 AM vitalije  wrote:

> Regarding #490  I
> think that I made my position clear: the support for font settings per
> language should be removed. OTOH, Edward you explicitly wrote:
>
>>  I'm concerned about removing settings. How do you propose to allow
>> per-language settings?
>
>
> I propose to remove per-language settings. Whoever uses this settings
> can't use Ctrl- zoom. I am almost sure nobody uses those settings
> and in leoSettings.leo there are just settings for php and forth.
>

How can you be sure that nobody uses those settings?  The settings were put
there as the result of specific requests. Lot's of people may use Leo to
edit .php files. They may not be reading Leo's forums, and yet they could
still be using those settings.

So, anyone who uses Leo to edit php files suffers from this bug. If there
> is anyone who uses Leo to write in forth language, the same bug bites again.
>

I see.

The only reasonable solution (IMHO) is to drop the support for font
> settings per language. Or at least to remove those settings from
> leoSettings.leo. In that case issue 490 will go away for PHP programmers,
> but we'll be waiting for someone else to try to customize font per language
> according to the official documentation, and then to report the same issue
> again. I think Terry was the one who wrote the code that allows Ctrl-wheel
> zoom and it seems to me that fixing this code to honor font-per-language
> settings will be very difficult and most likely will hurt the overall
> performance.
>

Thanks for this history.


> The code would have to look up all per language font settings and to
> change them on every zoom in/out (number of languages Leo supports  x
> number of possible font settings[1,2,3,4] x font[family, weight, slant,
> size]). It is something not very like worth doing.
>

Zooms happen rarely.  Imo, it would be best to keep the present settings,
and do the work of supporting them when zooming.  Zooming might then take
an extra millisecond or so.  Imo, keeping existing settings is far more
important than saving this time.

If you still want to delegate this issue to me, I will remove the support
> for font per language setting.
>

I would still like to delegate this to you. If you are willing, please
investigate having zooms support all related settings.

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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS0%3D-F8BDm8V74kf3%2BxmXG7%3Djf9F3L8Kz_iBVpgM_M%3DukA%40mail.gmail.com.