Tal Einat | 1 Feb 2007 23:22
Picon
Gravatar

EditorWindow.set_close_hook

Hi all,

I've recently checked out ways to have IDLE do something upon closing a window. Turns out the there is a beginning of such a mechanism in EditorWindow: the set_close_hook method. However, this method simply sets the instance's close_hook attribute, which means that setting it again will override the original hook. Specifically, EditorWindow sets the close_hook to FileList.close_edit(self), which removes the window from the FileList. This means that overriding the close_hook could (and would) cause bugs (in FileList)!

The simplest solution AFAIK is to have a list of hooks and allow adding and removing hooks. Upon closing, the hooks are called in the reverse order of which they were added ( i.e. last added is called first).

Another solution would be to allow setting a new hook, and have a flag stating whether the old hook should be called after the new one is done.

Obviously more comprehensive solutions exist but I don't think we need something more complex.

Thoughts? Ideas?

- Tal

_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
phil jones | 4 Feb 2007 08:42
Picon
Gravatar

hi, newbie questions

Hi everyone,

I just joined the list and wanted to say hello.

My name's phil jones and I've been writing in Python for about 3 years
and am still looking for the right editor / development environment
for me to work with Python. I use IDLE about half the time I write
Python. There are things I like about it and things that drive me
crazy. Sometimes I dream about writing an IDE of my own or
contributing to, or adapting an existing one. So I figured I should
join the list.

I have several questions :

1) the first is obviously, what's going on with IDLE? Couldn't find
much documentation or discussion about it on the web (in terms of
documentation or tutorials for people coding it), nor does it seem to
have changed much over the last couple of releases of Python. How is
it considered? An acceptable editor to get started, but serious Python
programmers graduate to a "real IDE" (if so, which one?). The main
*free* Python development environment? Or something which people here
are planning to grow much further? How many people are actively
involved in IDLE development at the moment?

2) The main thing that drives me crazy with IDLE and makes it pretty
much unusuable for me is this. I like to develop with two files open,
one with the code I'm working on and a second with unit tests.
Obviously the unit-test file is the one I want to run and I import the
other file into it. It seems like IDLE only does this import once, so
that if I run the unit test, find a bug, fix the bug in the other file
and re-run the unit tests (by hitting F5), IDLE doesn't notice that
the code changed. So I then have to execute my program from the
windows command line instead of hitting F5.

Is this really how IDLE behaves? Or am I just doing something wrong /
stpid and there's a way to get the behavior I want in IDLE?

3) One of the things I like about IDLE is that it's in Tk and standard
in the Python distro, so you can be sure it's there. I've been
developing a program with an editor-like GUI and I decided to use Tk /
Tix rather than something based on another GUI layer, because of this.
I thought I might be able to re-use bits of IDLE for it, and even
contribute some stuff back to IDLE. However, when I upgraded to Python
2.5 my code just stopped working - with an error message saying that
Python can't find and include Tix. Anyone know what's up with that? I
thought Tix was part of standard Python? Did it break? Did IDLE also
have problems with the upgrade to 2.5?

4) I'm guess I'm also looking for people here who know what's going on
in with Tk, Tix and Tkinter. Tk is pretty basic, is it still being
developed? Is there any work going on on Tix or any Python GUI
frameworks which sit on top of Tk?

Obviously there's GTk and wxPython and the OS native libraries which
seem to be prefered by most Python projects. But I'm really interested
in the "batteries-included" story for Python.

cheers

phil jones

http://www.synaesmedia.net
BBands | 7 Feb 2007 21:34
Picon

IDLE suggestions

You asked for some feature suggestions, so here goes.

The ability to send code to the shell for execution. Send current
line, send selection... (high priority)

Use IPython as the shell. (medium priority)

Tabbed documents. (medium priority)

Projects, so that a group of related files would open at the same
time. (medium priority)

Code folding. (low priority)

Automatic paren/bracket matching. (medium priority)

Thanks for considering these ideas and thanks for IDLE,

      jab
--

-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.
Michael Haubenwallner | 8 Feb 2007 09:46
Picon
Gravatar

Re: SearchBar - Have fun searching in IDLE!

Tal Einat wrote:
> Thanks for the suggestions! Updated files attached.

Thanks, works great now.

On an aside: searching Google for idle extensions is not an easy thing.

Do you know of a listing of available extensions or even a repository to 
download from ?
If not, should there be one ?
- wiki.python.org could have a page with a list of links
- code.google.com/hosting could host such a repo

How could we ease the process of installing an idle extension ?
I see no problem to just make the extension a package and put it in the 
python path (site-packages).
Then we would need to change idlelib.configHandler.IdleConf to accept 
the package path besides the idleDir and userDir config options.
This lets us eggify an extension and use ez_install for download and 
installation.

Your comments are welcome.
Michael

--

-- 
http://zope.org/Members/d2m
http://planetzope.org
Tal Einat | 8 Feb 2007 10:20
Picon
Gravatar

Re: SearchBar - Have fun searching in IDLE!

On 2/8/07, Michael Haubenwallner <michael <at> d2m.at> wrote:

On an aside: searching Google for idle extensions is not an easy thing.

Do you know of a listing of available extensions or even a repository to
download from ?
 
AFAIK there is none.

 
If not, should there be one ?
- wiki.python.org could have a page with a list of links
- code.google.com/hosting could host such a repo
 
I believe there should be one, once the selection is sizeable (as it is starting to become) and installation ease is improved...

 
How could we ease the process of installing an idle extension ?
I see no problem to just make the extension a package and put it in the
python path (site-packages).
Then we would need to change idlelib.configHandler.IdleConf to accept
the package path besides the idleDir and userDir config options.
This lets us eggify an extension and use ez_install for download and
installation.
 
This is a very good idea! A few points which need to be resolved first:
  1. Even if we could get idleConf to work like this, we would still need a way for IDLE to know about extensions. Currently extensions are "registered" by them adding an entry in config-extensions. How would we do this otherwise?
  2. Currently user config is in a single config-extensions file. How would we manage user configuration with each extension being a separate module?

Regarding #2, I think we could still have user config in a single config-extensions file, where config for all extensions is stored.

_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
Ronald Oussoren | 8 Feb 2007 10:35
Picon

Re: SearchBar - Have fun searching in IDLE!


On 8 Feb, 2007, at 10:20, Tal Einat wrote:

On 2/8/07, Michael Haubenwallner <michael <at> d2m.at> wrote:

On an aside: searching Google for idle extensions is not an easy thing.

Do you know of a listing of available extensions or even a repository to
download from ?
 
AFAIK there is none.

 
If not, should there be one ?
- wiki.python.org could have a page with a list of links
- code.google.com/hosting could host such a repo
 
I believe there should be one, once the selection is sizeable (as it is starting to become) and installation ease is improved...

The cheeseshop is another option and is used by a number of the web frameworks. If you ask nicely the cheeseshop maintainer could even add a classifier/category for IDLE extensions.


 
How could we ease the process of installing an idle extension ?
I see no problem to just make the extension a package and put it in the
python path (site-packages).
Then we would need to change idlelib.configHandler.IdleConf to accept
the package path besides the idleDir and userDir config options.
This lets us eggify an extension and use ez_install for download and
installation.
 
This is a very good idea! A few points which need to be resolved first:
  1. Even if we could get idleConf to work like this, we would still need a way for IDLE to know about extensions. Currently extensions are "registered" by them adding an entry in config-extensions. How would we do this otherwise?

Setuptools entry-points are one option for this. Another option is installing all plugins in a special magic pacage and load all modules in that package.
  1. Currently user config is in a single config-extensions file. How would we manage user configuration with each extension being a separate module?

Regarding #2, I think we could still have user config in a single config-extensions file, where config for all extensions is stored

_______________________________________________
IDLE-dev mailing list

_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
Tal Einat | 8 Feb 2007 11:41
Picon
Gravatar

Re: IDLE suggestions

On 2/7/07, BBands <bbands <at> gmail.com> wrote:

You asked for some feature suggestions, so here goes.

The ability to send code to the shell for execution. Send current
line, send selection... (high priority)

For a line or selection -  what is the great benefit over a simple copy + paste? The only thing I can think of is removing empty lines, which is required whenever pasting into the interpreter. Such an option for IDLE's shell - removing blank lines (and perhaps also prompt characters) from pasted code - would be useful.

Thinking about this some more, there is also an issue with tabs/spaces when copying code between the shell and editor windows. This has recently been mentioned in the new ShowMeDo video on IDLE (in the latest Python For Newbies series). This could be solved by converting tabs/spaces as appropriate upon pasting of code.

The question is how to add this functionality in the least confusing manner. I don't think these things should happen automagically upon a normal paste. Perhaps a separate "paste code" option in the Edit menu?

Use IPython as the shell. (medium priority)

Hmm, this is an interesting suggestion. I've heard the rave about IPython but haven't gotten to using it yet. I'm not sure how easy (or possible) such integration would be, since IPython is textual, and we would need to wrap GUI around it. On the other hand, the developers say it's intended for integration into Python programs.

Also I'm wary about such a step. IDLE is the easy to use and learn because it doesn't pack on tons of complex features. IPython is said to be very feature rich - I'm not sure if we want to use such a complex interpreter, since it could confuse new users.

Tabbed documents. (medium priority)

Work on this is under way.

Projects, so that a group of related files would open at the same
time. (medium priority)

I think we're currently against this - too complicated for new users! I could see this added to IDLE only in addition to its current edit-one-file functionality, and not as the default behavior. I'd really hate to see an IDLE tutorial beginning with "First of all let's start a project...", since all IDLE tutorials should start with "Ok, here's the interpreter, let's play around!" :)

Seeing how this would be a difficult feature to implement, I think some more interest in such a feature is required before it's considered. I haven't heard this as a major feature request from most IDLE users.

Code folding. (low priority)

Though I know some IDLEers are against this, I think this is a good idea for an extension.

I'm thinking of making such an extension, based on the Squeezer extension, using Tk text widget tags with the "elide" tag to hide text. The only really tricky part I can think of is integrating this nicely with the search, which would have to be able to search (or not) inside folded code, and show the results. This would seem to require automatic unfolding/refolding of code.

How is this done in other IDEs which support code folding?

Automatic paren/bracket matching. (medium priority)

This is already implemented in the ParenMatch extension - or do you mean something else?



Thanks for the suggestions!

- Tal
_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
Michael Foord | 8 Feb 2007 12:04
Picon
Favicon
Gravatar

Re: SearchBar - Have fun searching in IDLE!

Ronald Oussoren wrote:
> [snip..]
>
>>
>>  
>>
>>     How could we ease the process of installing an idle extension ?
>>     I see no problem to just make the extension a package and put it
>>     in the
>>     python path (site-packages).
>>     Then we would need to change idlelib.configHandler.IdleConf to accept
>>     the package path besides the idleDir and userDir config options.
>>     This lets us eggify an extension and use ez_install for download and
>>     installation.
>>
>>  
>> This is a very good idea! A few points which need to be resolved first:
>>
>>    1. Even if we could get idleConf to work like this, we would still
>>       need a way for IDLE to know about extensions. Currently
>>       extensions are "registered" by them adding an entry in
>>       config-extensions. How would we do this otherwise?
>>
>
> Setuptools entry-points are one option for this. Another option is 
> installing all plugins in a special magic pacage and load all modules 
> in that package.
That's the approach we use for Firedrop.  There is still a config file 
to edit to enable extensions. You might not want all available 
extensions available by default unless you are going to provide a GUI 
for enabling / disabling. (Requiring a restart after changing these 
options would be fine I guess.)

Fuzzyman
http://www.voidspace.org.uk/python/articles.shtml

>>   1.
>>
>>
>>    2. Currently user config is in a single config-extensions file.
>>       How would we manage user configuration with each extension
>>       being a separate module?
>>
>> Regarding #2, I think we could still have user config in a single 
>> config-extensions file, where config for all extensions is stored
>>
>> _______________________________________________
>> IDLE-dev mailing list
>> IDLE-dev <at> python.org <mailto: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
>   
Tal Einat | 8 Feb 2007 15:48
Picon
Gravatar

Re: hi, newbie questions

On 2/4/07, phil jones <interstar <at> gmail.com> wrote:

Hi everyone,

I just joined the list and wanted to say hello.

My name's phil jones and I've been writing in Python for about 3 years
and am still looking for the right editor / development environment
for me to work with Python. I use IDLE about half the time I write
Python. There are things I like about it and things that drive me
crazy. Sometimes I dream about writing an IDE of my own or
contributing to, or adapting an existing one. So I figured I should
join the list.

Great! Welcome!

I have several questions :

1) the first is obviously, what's going on with IDLE? Couldn't find
much documentation or discussion about it on the web (in terms of
documentation or tutorials for people coding it), nor does it seem to
have changed much over the last couple of releases of Python. How is
it considered? An acceptable editor to get started, but serious Python
programmers graduate to a "real IDE" (if so, which one?). The main
*free* Python development environment? Or something which people here
are planning to grow much further? How many people are actively
involved in IDLE development at the moment?

I think the general perception of IDLE is pretty much your first guess - a simple IDE, easy to learn so good for starters, serious coder later embrace more complex/comprehensive/feature-rich IDEs.

I wouldn't say it's the main free Python IDE, with SPE, PyDev and others to be found.

I also wouldn't say that it's something which is planned to grow much further, unfortunately. I think there's still a lot to do, since IDLE is not as good starting point for beginners as it could be - too many ugly bumps, an incomplete debugging module, and missing basic features neing the reasons.

In my opinion, which I have been trying to "push" for the past two years, IDLE is an awesome Python shell, which comes with a nice, simple editor, which integrates well with the shell. It's definitely great for learning and teaching Python, but IMO it's good for much more than that.


2) The main thing that drives me crazy with IDLE and makes it pretty
much unusuable for me is this. I like to develop with two files open,
one with the code I'm working on and a second with unit tests.
Obviously the unit-test file is the one I want to run and I import the
other file into it. It seems like IDLE only does this import once, so
that if I run the unit test, find a bug, fix the bug in the other file
and re-run the unit tests (by hitting F5), IDLE doesn't notice that
the code changed. So I then have to execute my program from the
windows command line instead of hitting F5.

Is this really how IDLE behaves? Or am I just doing something wrong /
stpid and there's a way to get the behavior I want in IDLE?

You're not doing much wrong - this is one of the "ugly bumps" I mentioned earlier. You're running IDLE without a subprocess - if you would run IDLE with a subprocess, this issue would be resolved. (it would work since the shell would be restarted each time you hit F5)

If you run IDLE from the Start Menu on Windows, or run it without the -n flag on Unix/Linux/..., IDLE will run with a subprocess. On the other hand, when you use "Edit with IDLE" from the Windows Explorer context menu, or run IDLE with the -n flag, IDLE runs without a subprocess, and so the shell cannot be restarted.

I have a patch which will finally resolve this issue posted on SourceForge, but it's not getting enough attention... I'm hoping to get it into Python2.6 though.

3) One of the things I like about IDLE is that it's in Tk and standard
in the Python distro, so you can be sure it's there. I've been
developing a program with an editor-like GUI and I decided to use Tk /
Tix rather than something based on another GUI layer, because of this.
I thought I might be able to re-use bits of IDLE for it, and even
contribute some stuff back to IDLE. However, when I upgraded to Python
2.5 my code just stopped working - with an error message saying that
Python can't find and include Tix. Anyone know what's up with that? I
thought Tix was part of standard Python? Did it break? Did IDLE also
have problems with the upgrade to 2.5?

IDLE had no problems with the upgrade to 2.5. Perhaps this is because IDLE uses only Tkinter, no Tix.

Sorry, I don't know much about Tix...

4) I'm guess I'm also looking for people here who know what's going on
in with Tk, Tix and Tkinter. Tk is pretty basic, is it still being
developed? Is there any work going on on Tix or any Python GUI
frameworks which sit on top of Tk?

Hasn't been under serious development for years, but maybe there's some hope left for it yet...

Check out Tcl/Tk's website:  http://www.tcl.tk/

Also check out the Tile project, which aims to allow Tk GUI to look like most common GUI frameworks (Windows classic and WinXP to name a few)

Obviously there's GTk and wxPython and the OS native libraries which
seem to be prefered by most Python projects. But I'm really interested
in the "batteries-included" story for Python.
cheers

phil jones
_______________________________________________
IDLE-dev mailing list
IDLE-dev <at> python.org
http://mail.python.org/mailman/listinfo/idle-dev
BBands | 8 Feb 2007 19:40
Picon

Re: IDLE suggestions

Tal and IDLErs,

Upon reflection I completely agree with the philosophy of keeping IDLE
simple and easy for newbes to use.

So, in reply to Tal's replies:

I have had trouble with cut and paste to the shell where I wanted to
paste a function or multiple lines. If your paste code idea allows
that, it will be good for me. (I don't use tabs in Python.)

IPyhton is really neat, but in keeping with the keep-it-simple idea
perhaps you should forget or backburner this idea.

Let me know when it's ready and I'll help test tabbed docs.

Instead of projects might save/restore a workspace be an idea?

Code folding would be nice, an alternative for IDLE might be something
like what Mark Hammond implemented in PythonWin, two views on the same
file via a movable horizontal bar.

As for paren matching, as of Python 2.5, IDLE 1.2 it is not working as
I would expect on xp. For example, I would expect the pair of
parens/brackets to change color when the cursor hits one. Right now
the first one or two of panen completions get greyed, after that
nothing else happens though ctrl-0 works. If you let me know how it is
intended to work I'll test it and post a field report.

Thanks for all you work on IDLE,

    jab
--

-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

Gmane