P.s. my email's [email protected], can't work out why this email last hides 
my address. 


On March 11, 2017 7:53:30 PM CST, 'Terry Brown' via leo-editor 
<[email protected]> wrote:
>On Sat, 11 Mar 2017 12:46:32 -0800 (PST)
>Pavel Balashov <[email protected]> wrote:
>
>> Hello,
>> 
>> recently I have started to use Leo editor for outlining my university
>
>> projects and I like it a lot. Also I was really excited about one of
>> its plugins, graphcanvas.py, and its ability to automatically layout
>> nodes in the graph. I had several problems with this plugin, but was
>> able to fix them by modifing the code a bit.
>
>Hi Pavel,
>
>Thanks for this work.  I know the graphcanvas.py tries to support two
>layout libraries, one of which has received more attention than the
>other... sounds like you've rounded off some rough edges.
>
>Contribution wise there are a couple of options.  If you know about git
>and / or GitHub, or you want to learn about them, you could fork Leo on
>GitHub and make a pull request for your changes.
>
>If you don't want to go that route, you can send your modified code to
>me and I can merge it in, I've done most of the work on the
>graphcanvas.py plugin.
>
>Probably the only thing that will need a bit of review is maintaining
>compatibility with both PyQt 4.x and 5.x (as well as Python 2 and 3,
>although that's less likely to be an issue).
>
>Thanks again for the interest and the contribution.
>
>Cheers -Terry
>
>> 1) Leo crashed after choosing any type of layout
>> 
>> I have installed a pydot package (this one: 
>> https://pypi.python.org/pypi/pydot, version 1.2.3) via pip and
>> confirmend that it worked with my Python 3.5.2 installation.
>> 
>> But when I tried to apply PyDot "neato" layout, Leo crashed with the 
>> following exception:
>> 
>> Traceback (most recent call last):
>>   File "/home/nodex/Software/Leo/leo/plugins/graphcanvas.py", line
>> 725, in <lambda>
>>     ('neato', lambda: self.layout('neato')),
>>   File "/home/nodex/Software/Leo/leo/plugins/graphcanvas.py", line
>> 798, in layout
>>     x,y,width,height = map(float, G.get_bb().strip('"').split(','))
>> AttributeError: 'list' object has no attribute 'get_bb'
>> 
>> It is line 798 in the graphcanvas.py file. I have some experience
>> with debugging Python projects, so after some time I found out why
>> G.get_bb() caused Leo to crash - during execution of that line,
>> variable G is a list of Dot objects (more specifically, it contains a
>> single Dot object), so it is impossible to invoke get_bb() from it.
>> So I have modified that line:
>> 
>> # G.get_bb() -> G[0].get_bb()
>> x,y,width,height = map(float, G[0].get_bb().strip('"').split(','))
>> 
>> Also another choice forced me to change line 790 because of the same
>> reason:
>> 
>> # G.get_node() -> G[0].get_node()
>> lst = G[0].get_node(''.join(['"', i.gnx, '"']))
>> 
>> This changes fixed both problems.
>> 
>> This problem may be caused by my choice of pydot package (there are
>> several other pydot packages in PyPi).
>> 
>> 2) Leo crashed after holding Ctrl and scrolling up (zooming) in the
>> Graph pane
>> 
>> Traceback (most recent call last):
>>   File "/home/nodex/Software/Leo/leo/plugins/graphcanvas.py", line
>> 209, in wheelEvent
>>     scale = 1.+0.1*(event.delta() / 120)
>> AttributeError: 'QWheelEvent' object has no attribute 'delta'
>> 
>> It is line 209 in the graphcanvas.py file. After some debugging and 
>> googling I have found out, that I am using PyQt 5.5.1 and in Qt 5
>> delta() method of QWheelEvent class is depracated and replaced by
>> angleDelta() method.
>> 
>> PyQt4.8: http://doc.qt.io/qt-4.8/qwheelevent.html#delta
>> PyQt5: http://doc.qt.io/qt-5/qwheelevent.html#angleDelta
>> 
>> So I have changed this line:
>> 
>> # event.delta() -> event.angleDelta().y()
>> scale = 1. + 0.1 * (event.angleDelta().y() / 120)
>> 
>> And that fixed the zooming problem.
>> 
>> If these changes are ok, then I would like to contribute them to the 
>> project. But I have never contributed to any open source projects, so
>> if someone could guide me through this process, I would really
>> appreciate it :)
>
>-- 
>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 post to this group, send email to [email protected].
>Visit this group at https://groups.google.com/group/leo-editor.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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 post to this group, send email to [email protected].
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