← Back to team overview

zim-wiki team mailing list archive

Re: Custom plugins installation

 

Hi Jakub,

thank you for the update. Please let me summarize my findings (as a Windows 8.1 64 Bit User) so far:


·         I downloaded and installed Graphviz for Windows from http://www.graphviz.org : ok

·         You need to add the Graphviz bin path to the PATH variable, which is mentioned on the download page for Graphviz: ok

·         Double check with Diagram plugin if Graphviz works: ok

·         I installed pydot with easy_install.exe: ok

·         pydot issues:

o   import pydot does not work, therefore you can’t enable the plugin in Zim

o   Found this: http://stackoverflow.com/questions/15951748/pydot-and-graphviz-error-couldnt-import-dot-parser-loading-of-dot-files-will

o   Uninstalled pyparsing and installed older version

o   import pydot works: ok

·         When I start your plugin, I get the same Dialog as for the diagrameditor.: ok

o   Trying to Preview gives following errors:

§  global name ‘pydot’ is not defined --> somehow the import pydot did not work
Did a manual ‘import pydot’ in Python interpreter: ok

§  Added Import pydot to the import statements: ok

·         If I’m not mistaken, you need Graphviz as well. Therefore I suggest to change the check_dependencies method slightly like following:
 @classmethod
  def check_dependencies(klass):
     has_dotcmd = Application(dotcmd).tryexec()
     has_dotmod = True
     try:
        import pydot
     except ImportError:
        has_dotmod = False
     return (has_dotmod and has_dotcmd), \
        [("pydot", has_dotmod, True), ("GraphViz", has_dotcmd, True)]


·         Finally your plugin worked and looks great!

·         I found following issue:

o   If you add a blank line without adding anything (but with a tab), you get an error ‘InvocationException’ --> syntax error in line 10 near ‘[‘
maybe you want to make sure that there is not empty line with a tab

Please find attached the modified version.

Thank you for this very nice plugin!

Regards,
Murat



From: Zim-wiki [mailto:zim-wiki-bounces+murat.gueven=ts.fujitsu.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of NorfCran
Sent: Mittwoch, 8. Juli 2015 00:47
To: Alessandro La Fauci
Cc: zim-wiki@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Zim-wiki] Custom plugins installation

Dear All,
I have tried to adjust the plugin and tested on Window 8.1 and Linux Debian (Jessie) with ZIM-Wiki version 0.63 (source) and Python 2.7. There was an issue with the text variable passed and import of pydot module caused that the plugin was not present on the list since it failed on import. The plugin is available from a BUG page https://bugs.launchpad.net/zim/+bug/1472408 as a file (suggested by Murat Güven<https://launchpad.net/%7Emurat-gueven>), the plugin page has been also updated with a link to the plugin.

It was slightly complicated to install the module pydot on Windows machine, but easy_install utility limited the procedure to few lines:
Firstly I downloaded the installation script of easy_install from https://bootstrap.pypa.io/ez_setup.py and executed with installed python 2.7 compiler. The installation script is described in more details on https://pypi.python.org/pypi/setuptools. Secondly the dydot can be installed by the following command:
C:\Python27\Scripts\easy_install.exe pydot
With Linux it was simple, the Debian repository provides python-pydot package, which can be installed through command:
# apt-get install python-pydot

After all the ZIM-Wiki running from code should provide the treemap plugin on the list of plugins and it should be possible to activate it as far as dependencies are fulfilled.
Hope this helps.
All the best,
Jakub


On 2 July 2015 at 23:13, NorfCran <norfcran@xxxxxxxxx<mailto:norfcran@xxxxxxxxx>> wrote:
Dear Jaap and Alessandro,
I have tried to test the plugin against ZIM versio 0.62 and it failed with the following error:

INFO: This is zim 0.62
DEBUG: Python version is sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0)
...
ERROR: Could not generate image
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/zim/plugins/base/imagegenerator.py", line 338, in generate_image
    imagefile, logfile = self.generator.generate_image(text)
  File "/home/norfcran/.local/share/zim/plugins/treemapeditor.py", line 69, in generate_image
    text = text.split("\n")
AttributeError: 'list' object has no attribute 'split'

On the other other hand ZIM version 0.63 generates the graph image correctly. It seems that the text variable is a string in 0.63 instead of a list in 0.62,
therefore I have changed it to split the text with the up to date version of the plugin suitable for ZIM version 0.63.
Furthermore the plugin depends on python-pydot package.
All the best,
Jakub


On 28 June 2015 at 21:10, Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx<mailto:jaap.karssenberg@xxxxxxxxx>> wrote:
Hi Alessandro,
Sounds like you installed the plugin correctly. The fact that the ".pyc" file is created shows that zim tries to load the plugin. However if it does not show up, there may be an error in the plugin that prevents it from loading.
Try running zim with "zim -D" to get debug output and open the preferences window. The error while loading the plugin should show up there.
Regards,
Jaap

On Wed, Jun 24, 2015 at 10:57 AM, Alessandro La Fauci <alafauci@xxxxxxxx<mailto:alafauci@xxxxxxxx>> wrote:
Dear Zim team,

I would really like to install and use the TreeMap plugin published on this page

https://github.com/jaap-karssenberg/zim-wiki/wiki/Plugins

I saved and put the code in folder ~/.local/share/zim/plugins , the file is saved as "tremapeditor.py". After starting Zim i found another file in the same directory called "tremapeditor.pyc".

Nevertheless the plugin doesn't appear under preferences > plugins, and I can't see any new option in all the other menus.

What should I do to correctly install this plugin.

Thank you in advance

Cheers

A



_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx<mailto:zim-wiki@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx<mailto:zim-wiki@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Attachment: treemapeditor.py
Description: treemapeditor.py


References