Dev post with a lot of code.

Bug during  "Tools > Custom Tools"

If the tool entry as no comment it fails…
Not with the Zim packaged.

Here is a basic stdin custom tool:

$ cat  ~/bin/zim-stdin
#!/bin/bash

tee -a ~/tmp/zim-custom.log | cat -n


nothing happen for now.
the if branch of the don't go to the pipe part.

    def _exec_custom_tool(self, action):
        manager = CustomToolManager()
        tool = manager.get_tool(action.get_name())
        logger.info('Execute custom tool %s', tool.name)
        args = (self.notebook, self.page, self.mainwindow.pageview)
        try:
            *logger.info('custom tool %s', tool['Desktop
Entry'].get('X-Zim-ReplaceSelection'))*
            if tool.isreadonly:
                tool.spawn(args)
            elif tool['Desktop Entry'].get('X-Zim-ReplaceSelection', False):

outputs:
DEBUG: Loading config from: <ConfigFile:
/home/sylvain/.config/zim/customtools/test stdout custom
tool-usercreated.desktop>
INFO: Execute custom tool test stdout custom tool
*INFO: custom tool None*
INFO: Running: ['/home/sylvain/bin/zim-stdin'] (cwd: None)
INFO: Open page: <FileStorePage: Home:e-Bidouilles:Zim:test>
(<FileStorePage: Home:e-Bidouilles:Zim:test>)
DEBUG: Already selected: "(1, 9, 22, 3)"


cat ~/.config/zim/customtools/test\ stdout\ custom\
tool-usercreated.desktop
[Desktop Entry]
Type=X-Zim-CustomTool
Version=1.0
GenericName=
Name=test stdout custom tool
Comment=test stdout custom tool
Exec=
TryExec=
Icon=
MimeType=
Terminal=false
NoDisplay=false
X-Zim-ExecTool=/home/sylvain/bin/zim-stdin
X-Zim-ReadOnly=false
X-Zim-ShowInToolBar=false
X-Zim-ShowInContextMenu=None
*X-Zim-ReplaceSelection=true*

I stop here for now.
_______________________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to     : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp

Reply via email to