yanxiaoyong的个人博客分享 http://blog.sciencenet.cn/u/yanxiaoyong 在路上……

博文

Call Tips for Python in Geany

已有 17538 次阅读 2012-4-3 17:03 |个人分类:Python|系统分类:科研笔记| Python, Geany, plugin, calltips

2012/4/5 Update

1. Add icon to autocomplate list. 
        Legend--var;  --method/function;  --class;  --module
2. Show tips both on editor window and in message window.
        Since some objects' tips are too long to show completely in editor window, I let them show partly on editor window and wholly in message window.

Please download the new version here: calltips4py.1.2.tar.gz





_____________________________________________________________

2012/4/4 Update

Today I rewrite this plugin and now it can show tips with key pressing automatically (see figs bellow). The new package can be downloaded here: calltips4py.1.1.tar.gz .

Notice, this plugin can't work in MS Windows!



————————————————————————————————————————————————

2012/4/3  Ver. 1.0

Geany is a wonderful text editor and I use it to write Python, C and LaTeX now. When I edit LaTeX, GeanyLaTeX plugin can help me do many things. But when I write Python, Geany seemed just an editor:(

I'm not a skillful programmer (in fact I'm not a programmer at all:), so I really need tips on how to use numerous functions/classes/attributes of numerous modules when I writing Python code. But sadly, Geany doesn't provide such function (for me, Python tips based on tags in Geany are almost useless).

Recently I find VIM has an excellent Python calltips plugin (pythoncomplete.vim), which written in Python. I also find that another text editor, Editra, provides Python calltips function by modifying the interface of pythoncomplete.vim (see here). Why can not we do same thing for Geany? So, after writing some code with Geany plugin API and making mini modification of pythoncomplete.vim, I have my own Python calltips plugin now!

You can download the plugin (including source code) here, decompress and copy it to Geany's extra plugin path. Then, load it and specify a shortcut key for it. Now, you can press the key to call tips for Python in Geany. The tips will show in Geany's message window - although this seems not very compatible, it's enough for me. Of cause, anyone is permitted to modify the plugin's source code to make it more powerful or flexible - if you do that, don't forget to send me a copy:)

_______________________________________________


Geany是linux下不错的一个文本编辑器(当然windows下也可以用,它是跨平台的)。我现在用这个小东西作我的大部分工作:编程(Python和C)以及写论文(用LaTeX)。


Geany为LaTeX提供了不错的插件支持,但对Python却没有。对我这样的二把刀coder来说,没有像Wing IDE那样的代码提示功能,我还真写不了几行代码 —— 脑容量太小,记不住那么多函数和参数啊!总翻手册让人烦,索性自己整一个代码提示功能。


上网找了一圈,发现Editra这个编辑器用的是VIM编辑器的代码提示功能(只不过改了一下接口),我就照猫画虎也把VIM的代码拷过来改成Geany的接口让Geany用(恩,开源的东西就是好啊:)。测试了一段时间,我自己觉得还挺稳定,基本能满足我的要求了,因此就发上来共享一下,希望能对用Geany写Python的朋友有帮助。


如果你觉得不好用,可以自己再接着改,C和Python的代码都在这个包里了(点我)。其实我想作成像Wing IDE那样随着键盘输入"."、"(" 后自动弹出提示并补全,这样是最理想的。但我估计会比较花时间,这段也忙,就懒得弄了。以后有时间可以考虑。要是谁有兴趣先整出来了,记得发给我一份啊:)


2012-4-4 更新:


今天又改进了一下,现在可以随键盘动作自动弹出提示了!新的包在这里: calltips4py.1.1.tar.gz 。


原来Geany使用的是Scintilla开源库,而Scintilla本身就带着SHOWTIPS功能,简单调用一下就行了(今天看了《Scintilla开源库使用指南》这篇博文才知道的)。


当然功能还可以继续改进,但我懒得弄了,现在已经足够我自己用了:)

________________________________________________________________


2012-4-5 更新:


今天忍不住又更新了一下(囧)。主要是在自动完成的列表里加了图标,这样可以更方便的提示符号是变量还是方法还是类还是包。另外,把信息窗口又加回来了,因为有些函数的文档实在太长了,都显示在编辑窗口会把整个屏幕都盖住(还不一定能显示全)。我现在只在屏幕上显示一部分,全部的信息在信息窗口里显示,这样更灵活一些。

新的包在这里: calltips4py.1.2.tar.gz

_____________________________________________________


注意:一定要把包解压后放在Geany的扩展插件路径下!不然不会弹出提示滴!

另外,目前这个插件还不能在Windows下工作(Windows下的Python IDE有很多,自己挑一个吧)。






https://blog.sciencenet.cn/blog-404069-554934.html

上一篇:也不知道谁和谁会死磕……
下一篇:让latex2rtf支持中文
收藏 IP: 121.28.69.*| 热度|

0

发表评论 评论 (5 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-3-29 16:06

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部