Keith R. Fieldhouse | 25 Mar 2007 15:52

Adapting IDLE for different file types

Hello,

I work on a project that uses Python as the basis for a very domain 
specific development environment.

For documentation and training purposes I'd like to use IDLE as the 
initial development tool.  In other words, my "getting started" 
documentation and class exercises for example, would be produced in 
terms of IDLE.

Thus far, this works quite well, IDLE strikes the right balance between 
simplicity, accessibility and capability.

One issue is that our development environment has a number of domain 
specific text files used in the process of developing applications. 
Naturally, IDLE is able to edit these files with no problem.  I would, 
however, now like to add syntax colorization and possibly indentation 
support for these text files.

Has any one done this?  Any thoughts on the proper approach or other 
hints would be greatly appreciated.   If there is some reason that this 
would be a Bad Idea, let me know that as well...

Best regards,

Keith Fieldhouse
Tal Einat | 25 Mar 2007 21:05
Picon
Gravatar

Re: Adapting IDLE for different file types

On 3/25/07, Keith R. Fieldhouse <idle <at> rexmere.com> wrote:

Hello,

I work on a project that uses Python as the basis for a very domain
specific development environment.

For documentation and training purposes I'd like to use IDLE as the
initial development tool.  In other words, my "getting started"
documentation and class exercises for example, would be produced in
terms of IDLE.

Thus far, this works quite well, IDLE strikes the right balance between
simplicity, accessibility and capability.

I'm glad to hear - it means IDLE meets its goals :)

One issue is that our development environment has a number of domain
specific text files used in the process of developing applications.
Naturally, IDLE is able to edit these files with no problem.  I would,
however, now like to add syntax colorization and possibly indentation
support for these text files.

Has any one done this?  Any thoughts on the proper approach or other
hints would be greatly appreciated.   If there is some reason that this
would be a Bad Idea, let me know that as well...

AFAIK and as far as 10 minutes of Google-ing can tell, this hasn't been done. But I don't see any reason why this would be a Bad Idea.

As for thoughts on the proper approach: This could be an IDLE "extension". See idlelib/extend.txt for an introduction to extensions, and check out some of the built-in extensions, like ParenMatch and CodeContext.


For some technical details, check out EditorWindow.py:

        self.per = per = self.Percolator(text)
        if self.ispythonsource(filename):
            self.color = color = self.ColorDelegator ()
            per.insertfilter(color)
        else:
            self.color = None

What your extension should do is call per.insertfilter(custom_colorizer), where custom_colorizer would be your colorizer object. Your colorizer class should inherit Delegator - see Delegator.py. Also see the implementation of ColorDelegator in ColorDelegator.py, for a starting point.


Feel free to bug me with questions, I'd be glad to help :)

- Tal Einat
_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
Liang Zou | 19 Mar 2007 18:58
Picon

A Question about idle

Hi,

 

When I set the new indent width to 2, it won’t be saved. When I open a new window next time, it will reset to 4. I was wondering if I can save the default indent width to 2.

 

I tried to use the set indentation defaults function in the option dialog, but it doesn’t work at all. I’m using idle 1.1.1

 

Thank you very much for your help.

 

Sincerely yours,

Liang Zou

 

 

 

_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
Tal Einat | 1 Apr 2007 00:48
Picon
Gravatar

Re: A Question about idle

There is a bug in the IDLE configuration dialog in the 1.1 versions.
(Why not update to a newer version?)

You can change the value manually in your user config files:
1. Go to the .idlerc directory (~/.idlerc on unix/linux, Documents and Settings\<username>\.idlerc on WinXP)
2. Open config-main.cfg with a text editor (create it if it doesn't exist)
3. Add the following two lines:
[Indent]
num-spaces = 2


I don't have version 1.1.1 handy, but hopefully this should help... let me know if it works out.

- Tal Einat


On 3/19/07, Liang Zou <zoukyle <at> gmail.com> wrote:

Hi,

 

When I set the new indent width to 2, it won't be saved. When I open a new window next time, it will reset to 4. I was wondering if I can save the default indent width to 2.

 

I tried to use the set indentation defaults function in the option dialog, but it doesn't work at all. I'm using idle 1.1.1

 

Thank you very much for your help.

 

Sincerely yours,

Liang Zou

 

 

 


_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev


_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev

Gmane