Bug 333941 - python_utils pate plugins do not work
Summary: python_utils pate plugins do not work
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 3.13.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-27 02:08 UTC by Riskable
Modified: 2016-09-05 16:36 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This should at least make the plugins functional (22.39 KB, patch)
2014-05-01 08:54 UTC, Alessandro Pisa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Riskable 2014-04-27 02:08:21 UTC
When upgrading to the latest Kubuntu 14.04 from 13.10 all of the 'python_utils' plugins for Kate stopped working.  I tried all sorts of things from removing my kate-related configuration files to re-installing the kate-data package but that didn't work; "Python Utilities" was still missing from the Python Plugins menu in Kate's prefs.  On a whim I tried this:

echo "from .python_utils import *" > /usr/share/kde4/apps/kate/pate/python_utils/__init__.py

...which got "Python Utils" added back to the menu!  It doesn't work though because of the following exception:

kate(6069)/Kate (Plugins): "Traceback (most recent call last):
  File "/usr/share/kde4/apps/kate/pate/python_utils/__init__.py", line 1, in <module>
    from .python_utils import *
  File "/usr/share/kde4/apps/kate/pate/python_utils/python_utils.py", line 30, in <module>
    from python_snippets import *
  File "/usr/share/kde4/apps/kate/pate/python_utils/python_snippets.py", line 53, in <module>
    @kate.action(**KATE_ACTIONS['insertIPDB'])
TypeError: action() got an unexpected keyword argument 'text'
Could not import python_utils"

Not sure what's going on there but it appears that something changed in the plugin API and the 'python_utils' plugins didn't get updated along with that.

Reproducible: Always

Steps to Reproduce:
1. Go to the "Python Plugins" section in Kate's prefs and try to load the "Python Utilities".
Actual Results:  
That option won't be present.

Expected Results:  
One should be able to enable the Python Utilities.

Doing my best to figure it out but I don't know enough about how Python plugins work inside of Kate :(
Comment 1 Alessandro Pisa 2014-04-30 23:28:23 UTC
Thanks for your hints, they lead me to discover more!
There have been changes to the pate decorators and apparently the python_utils code (shipped by kubuntu 14.04 in the kate-data deb) did not get updated.
I think here you can find the original (unmantained) repo of the python_utils:
 - https://github.com/goinnn/Kate-plugins
Now the code should be here:
 - https://projects.kde.org/projects/kde/applications/kate/repository/revisions/23267e27341e46f921d97bd765014bc2552f85f1/show/addons/kate/pate/src/plugins/python_utils

I fixed the plugins manually by:
1) fixing something like a tenth of imports (I made them relative)
2) removing any additional parameter assigned to the kate.action decorator (e.g. @kate.action(**KATE_ACTIONS['parseCode']) -> @kate.action)
3) removing .f from the decorated functions (e.g. checkAll.f -> checkAll)

I would be glad to contribute a proper patch.
Ciao

P.s.: this is the first time I write here, forgive me if I said stupid things :p
Comment 2 Alessandro Pisa 2014-05-01 08:54:39 UTC
Created attachment 86385 [details]
This should at least make the plugins functional
Comment 3 Alex Turbov 2014-06-10 16:33:52 UTC
(In reply to comment #1)
> Thanks for your hints, they lead me to discover more!
> There have been changes to the pate decorators and apparently the
> python_utils code (shipped by kubuntu 14.04 in the kate-data deb) did not
> get updated.

yep. a lot of things has changed in python plugins since kate 3.13

> I think here you can find the original (unmantained) repo of the
> python_utils:
>  - https://github.com/goinnn/Kate-plugins

do not use it! it's completely out of date.

> 
> I fixed the plugins manually by:
> 1) fixing something like a tenth of imports (I made them relative)
good

> 2) removing any additional parameter assigned to the kate.action decorator
> (e.g. @kate.action(**KATE_ACTIONS['parseCode']) -> @kate.action)

since there some actions supposed to be, this patch shuld contain *_ui.rc file…

> 3) removing .f from the decorated functions (e.g. checkAll.f -> checkAll)
> 
> I would be glad to contribute a proper patch.
> Ciao

better to add a review to https://git.reviewboard.kde.org reffering to this "bug".

PS. I wrote "bug", cuz honestly I don't like this set of plugins for a bunch of reasons:
* it reintroduce some ugly snippets while kate already has them builtin (even if not consider more advanced way to do the same (even better) w/ expand Python plugin)
* it had some issues w/ python3 in the past, so personally I never use that tools even for python programming… dunno, if that has been fixed… it seems the author abandon this plugin as well…
Comment 4 Jan Češpivo 2014-06-17 08:55:51 UTC
(In reply to comment #3)
I think it`s bug because this feature is documented (http://docs.kde.org/stable/en/applications/kate/pate.html)
and does not work.
Comment 5 Dan Mac 2014-08-25 15:25:30 UTC
This is also happening for me, on Kubuntu 14.04. I was using 14.04 beta and if my memory serves me correctly, it was working up to and even after release. This is something that has crept in with an update. Tested on three Kubuntu machines, two of which I know used to work, and a fresh install of 14.04.1 which has never worked.

I managed to get the python_utils appearing in the Python Plugins menu by putting an empty __init__.py in /usr/share/kde4/apps/kate/pate/python_utils and I can enable the plugin but when enabled I find no trace of it in the UI. The Python simple console appears broken in the same way, although it appears in the menu already.

Needs some serious attention, this :(
Comment 6 Christoph Cullmann 2015-10-04 11:50:43 UTC
The KDE 4.x based version is no longer under active development and for KF5 we even have no Pate available due to nobody stepping up to do the necessary Python bindings for KF5. Therefore Pate bugs are no longer relevant here, if we get a new Pate version for KF5 up and running, it won't resemble the old variant anyway.