Re: crash reading LeoDocs.leo

2017-02-17 Thread lewis
Thanks, the links are now safe.

BTW In the docs and webpage at

http://leoeditor.com/tutorial-scripting.html


Contents

   - Writing Leo scripts in Python *(<-- This line is effectively 
   redundant)*
   
   
  - Hello world 
  
  - Predefined symbols: c, g and p 
  

  - Positions and vnodes 
  
  - Generators 
  - Capturing positions 
  
  - wrappers vs. widgets 
  
  - Summary 
   
There is already a Contents heading and the link 
"http://leoeditor.com/tutorial-scripting.html#writing-leo-scripts-in-python; 
is a link to the page you are on.

Lewis

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: crash reading LeoDocs.leo

2017-02-17 Thread Edward K. Ream
On Thursday, February 16, 2017 at 9:51:40 AM UTC-6, Edward K. Ream wrote:
>
> ​​
> ​On Thu, Feb 16, 2017 at 4:32 AM, lewis  wrote:
>
> ​> ​
> I managed to hard crash Leo
> ​...In a viewrendered window I clicked on [a url]​. 
>
> P. S. Leo catches all exceptions when executing commands, but clicking a 
> url calls a callback. For *this* bug it suffices to have g.openUrlOnClick 
> catch all exceptions. The potential exists for similar problems in other 
> callbacks. A code review is needed.
>

Aha: All callbacks should be protected by a new *@g.callback* decorator.  
This decorator will wrap the callback in a try/except Exception statement. 
This is the easy way to ensure that the callback will never be able to 
raise an uncaught exception.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: crash reading LeoDocs.leo

2017-02-16 Thread Edward K. Ream
​​
​On Thu, Feb 16, 2017 at 4:32 AM, lewis  wrote:

​> ​
I managed to hard crash Leo
​...In a viewrendered window I clicked on [a url]​.

My apologies for this. Rev cbc0b03 fixes the problem and ensures that Leo
can never again exit unexpected in exactly the same way.

Edward

P. S. Leo catches all exceptions when executing commands, but clicking a
url calls a callback. For *this* bug it suffices to have g.openUrlOnClick
catch all exceptions. The potential exists for similar problems in other
callbacks. A code review is needed.

P. P. S. I use the term "hard crash" to mean that Leo has somehow caused
the Python interpreter itself to crash. This can happen by passing the
wrong args to Qt. In this case, the effect is the same, but the cause is
just an uncaught Python exception.

EKR

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


crash reading LeoDocs.leo

2017-02-16 Thread lewis
I managed to hard crash Leo - opened LeoDocs.leo at #Tutorials-->@rst 
html\tutorial-scripting.html
In a viewrendered window I clicked on the links 'cheatsheet.html#scripting' 
or 'cheatsheet.html' or '#scripting-leo-with-python' i.e.


*Further study: The scripting portion of Leo's cheat sheet Contents* 
Scripting Leo with Python *

Clicking on these links causes Leo to crash [Python has stopped working 
[Close program]]


Here is the log from console:
Leo Log Window
Leo 5.4, build 20170216031031, Thu Feb 16 03:10:31 CST 2017
Git repo info: branch = master, commit = eb3a6ed70061
Python 3.6.0, PyQt version 5.8.0
Windows 10 AMD64 (build 10.0.14393) SP0

reading settings in N:\git\leo-editor\leo\doc\LeoDocs.leo
Traceback (most recent call last):
  File "N:\git\leo-editor\leo\plugins\viewrendered.py", line 1119, in 
handleClick
g.openUrlOnClick(event, url=url)
  File "N:\git\leo-editor\leo\core\leoGlobals.py", line 6691, in 
openUrlOnClick
if not w.hasSelection():
AttributeError: 'QTextBrowser' object has no attribute 'hasSelection'


Regards
Lewis

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.