Python Bindings

View: New views
6 Messages — Rating Filter:   Alert me  

Python Bindings

by Fabio Rafael da Rosa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I started working on python support for creating a full IDE for python with anjuta.
I start coding in C, but, I think it's a better idea using python for that.
So, my idea is to create the python bindings and use that for coding the python support inside anjuta .
What do you think about that ?
I know that Seb is working for debugger support with python, so , I'll use his work as a base for what I'm doing...
Surendran contacted me and we are working together on this.


--
Fabio Rafael da Rosa
fabiorafael.rosa@...
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: Python Bindings

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

> I know that Seb is working for debugger support with python, so , I'll
> use his work as a base for what I'm doing...
> Surendran contacted me and we are working together on this.
>
Sounds good!

Regards,
Johanes


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

signature.asc (196 bytes) Download Attachment

Re: Python Bindings

by surendran m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi !

After discussing with Fabio, I thought that I will proceed with the plugin using c/gtk itself for a while until atleast we get a basic working version. Then after that we might have to add the python bindings for the minimal set of API's with which the plugin can work.

So to effect Implementing the automatic indentation in the gtksourceview editor, I have to get all keyboard events and parse them and write methods to handle RET,COLON and TAB , plus another method to handle all these within or without a string. So the starting step for me would be to trap all events.

I started coding like this [1]. Will add a watch in the plugin and the document manager can set the value , when ever it encounters a python file. For now I am just setting the value right after adding the watch itself and later when all the indentation stuff is over , can move the value adding to the document manager.

My current problem is I find that the debug printf statements "a watch has been added" and "value has been added" is working fine. (please check the code here[1]) But the control does not shift to enable_python_indentation mode as its supposed to ! I dunno What I am missing and am stuck up at this.

The whole plugin can be got from here[2]. Its can be built standalone and you can browse the code here[3]

[1] http://rafb.net/p/4FXjrv71.html
[2] svn checkout http://surenscode.googlecode.com/svn/trunk/anjuta-plugins/language-support-python
[3] http://code.google.com/p/surenscode/source/browse


Also If my method of trapping keyboard events wrong, please let me know How to proceed. (But this is how I did it when i was trying it in gedit. There it was Pygtk and so it was a relatively simpler for me ! )
Thanks !

--
regards
Surendran
NIT Trichy

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: Python Bindings

by Abderrahim Kitouni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm also trying to make a language plugin for anjuta, I'll try to help you with
what I know. Anjuta team : please correct me if I'm wrong.

On Mon, 12 May 2008 13:44:11 +0530 suren <surenspost@...> wrote:
> I started coding like this [1]. Will add a watch in the plugin and the
> document manager can set the value , when ever it encounters a python file.
> For now I am just setting the value right after adding the watch itself and
> later when all the indentation stuff is over , can move the value adding to
> the document manager.
You can (and maybe should) add a section like this to your .plugin file :

[Language Support]
Languages=Python
MimeTypes=text/x-python

This way, the language manager will load your plugin whenever it encounters a
python file.
>
> My current problem is I find that the debug printf statements "a watch has
> been added" and "value has been added" is working fine. (please check the
> code here[1]) But the control does not shift to enable_python_indentation
> mode as its supposed to ! I dunno What I am missing and am stuck up at this.
maybe you need to init the GValue before setting it?

Anyway, I think that you're doing it the wrong way : there are Anjuta
interfaces to deal with this, adding a new textview won't help you integrate
your plugin in Anjuta, you should use IAnjutaEditor instead.

I think a language support plugin should do something like this:
* In activate :
  - Connect to the "language-changed" signal of the editor (provided it
implements IAnjutaEditorLanguage).
  - Activate language support features if the actual language is supported
(which it should if we are in activate, but I think an additional check won't
hurt)
* On language-changed :
  - Activate or deactiate language support features.

language-support-cpp-java additionally adds a watch on
"document_manager_current_editor" so that it reinstalls itself for the new
editor.
>
> Also If my method of trapping keyboard events wrong, please let me know How
> to proceed. (But this is how I did it when i was trying it in gedit. There
> it was Pygtk and so it was a relatively simpler for me ! )
> Thanks !
>
I think you can connect to the "char-added" signal of IAnjutaEditor to do this.

Hope this helps,
Abderrahim

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: Python Bindings

by Fabio Rafael da Rosa-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Suren
GTKSourceView already has python bindings ready to use.
So, I think you could start coding the plugin in python, and implement the necessary anjuta API's when necessary.

BTW, I started coding a python console plugin for anjuta . I let you people know when it's ready.

On Mon, May 12, 2008 at 8:20 AM, Abderrahim Kitouni <a.kitouni@...> wrote:
Hi,

I'm also trying to make a language plugin for anjuta, I'll try to help you with
what I know. Anjuta team : please correct me if I'm wrong.

On Mon, 12 May 2008 13:44:11 +0530 suren <surenspost@...> wrote:
> I started coding like this [1]. Will add a watch in the plugin and the
> document manager can set the value , when ever it encounters a python file.
> For now I am just setting the value right after adding the watch itself and
> later when all the indentation stuff is over , can move the value adding to
> the document manager.
You can (and maybe should) add a section like this to your .plugin file :

[Language Support]
Languages=Python
MimeTypes=text/x-python

This way, the language manager will load your plugin whenever it encounters a
python file.
>
> My current problem is I find that the debug printf statements "a watch has
> been added" and "value has been added" is working fine. (please check the
> code here[1]) But the control does not shift to enable_python_indentation
> mode as its supposed to ! I dunno What I am missing and am stuck up at this.
maybe you need to init the GValue before setting it?

Anyway, I think that you're doing it the wrong way : there are Anjuta
interfaces to deal with this, adding a new textview won't help you integrate
your plugin in Anjuta, you should use IAnjutaEditor instead.

I think a language support plugin should do something like this:
* In activate :
 - Connect to the "language-changed" signal of the editor (provided it
implements IAnjutaEditorLanguage).
 - Activate language support features if the actual language is supported
(which it should if we are in activate, but I think an additional check won't
hurt)
* On language-changed :
 - Activate or deactiate language support features.

language-support-cpp-java additionally adds a watch on
"document_manager_current_editor" so that it reinstalls itself for the new
editor.
>
> Also If my method of trapping keyboard events wrong, please let me know How
> to proceed. (But this is how I did it when i was trying it in gedit. There
> it was Pygtk and so it was a relatively simpler for me ! )
> Thanks !
>
I think you can connect to the "char-added" signal of IAnjutaEditor to do this.

Hope this helps,
Abderrahim

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel



--
Fabio Rafael da Rosa
fabiorafael.rosa@...
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel

Re: Python Bindings

by Abderrahim Kitouni-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

> I think a language support plugin should do something like this:
> * In activate :
>   - Connect to the "language-changed" signal of the editor (provided it
> implements IAnjutaEditorLanguage).
>   - Activate language support features if the actual language is supported
> (which it should if we are in activate, but I think an additional check won't
> hurt)
> * On language-changed :
>   - Activate or deactiate language support features.
>
> language-support-cpp-java additionally adds a watch on
> "document_manager_current_editor" so that it reinstalls itself for the new
> editor.

Just figured out that no plugin implements as a primary interface, so the only
way to be get an editor is adding this watch. So the "In activate" should be :
On value added "document_manager_current_editor".


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Anjuta-devel mailing list
Anjuta-devel@...
https://lists.sourceforge.net/lists/listinfo/anjuta-devel
LightInTheBox - Buy quality products at wholesale price!