Edward and Terry, thank you both for warm welcome :)

Terry, you are right, the problem with zooming is caused by incompatibility 
between PyQt4 and PyQt5, so it is easy to fix by checking Qt version with 
isQt5 variable from leo.core.leoQt. But the problem with layout is a bit 
different. After checking several pydot packages from PyPi, I came to 
conclusion that the problem indeed occurs only with the version of the 
package, that I have installed, pydot (1.2.3). Here is the part of 
parse_dot_data() method from dot_parser module that Leo's graphcanvas.py 
supports:

tokens = graphparser.parseString(data)
if len(tokens) == 1:
    return tokens[0]
else:
    return [g for g in tokens]

It can be found in the latest versions of all other pydot packages, that I 
have checked, specifically:

pydot3 (1.0.9): https://pypi.python.org/pypi/pydot3
pydot3k (1.0.17): https://pypi.python.org/pypi/pydot3k
pydot-ng (1.0.0): https://pypi.python.org/pypi/pydot-ng
pydotplus (2.0.2): https://pypi.python.org/pypi/pydotplus
pydot_modern (1.0.29): https://pypi.python.org/pypi/pydot_modern

Similar code was a part of the package that I use, pydot 
(https://pypi.python.org/pypi/pydot), but starting with version 1.2.0, it 
was changed to:

tokens = graphparser.parseString(s)
return list(tokens)

Which means that it will always be a list. But Leo's layout() method of 
graphcanvasController from graphcanvas.py assumes it will always be a 
single Dot object. This issue can be easily fixed by checking, whether the 
object returned from pydot.graph_from_dot_file() is iterable or not, 
perphaps like this:

G = pydot.graph_from_dot_file(tempName.name)

try:
    G = G[0]
except TypeError:
    pass


If you don't mind, I would like to try and commit my changes using git and 
GitHub - it will be a new experience for me! But I don't know, whether I 
should do 2 separate pull requests or a single one with both fixes. How 
should I proceed?

-- 
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.

Reply via email to