On 3/25/07, <b class="gmail_sendername">Keith R. Fieldhouse</b> <<a href="mailto:idle@rexmere.com">idle@rexmere.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I work on a project that uses Python as the basis for a very domain<br>specific development environment.<br><br>For documentation and training purposes I'd like to use IDLE as the<br>initial development tool. In other words, my "getting started"
<br>documentation and class exercises for example, would be produced in<br>terms of IDLE.<br><br>Thus far, this works quite well, IDLE strikes the right balance between<br>simplicity, accessibility and capability.</blockquote>
<div><br>I'm glad to hear - it means IDLE meets its goals :)<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">One issue is that our development environment has a number of domain
<br>specific text files used in the process of developing applications.<br>Naturally, IDLE is able to edit these files with no problem. I would,<br>however, now like to add syntax colorization and possibly indentation<br>
support for these text files.<br><br>Has any one done this? Any thoughts on the proper approach or other<br>hints would be greatly appreciated. If there is some reason that this<br>would be a Bad Idea, let me know that as well...
</blockquote><div><br>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.<br><br>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.
<br><br><br>For some technical details, check out EditorWindow.py:<br><br> self.per = per = self.Percolator(text)<br> if self.ispythonsource(filename):<br> self.color = color = self.ColorDelegator
()<br> per.insertfilter(color)<br> else:<br> self.color = None<br><br>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.<br><br><br></div>Feel free to bug me with questions, I'd be glad to help :)<br><br>- Tal Einat<br></div>