Commit Graph

811 Commits

Author SHA1 Message Date
Guido van Rossum bbaba85402 Tim Peters again:
The new version (attached) is fast enough all the time in every real module
I have <whew!>.  You can make it slow by, e.g., creating an open list with
5,000 90-character identifiers (+ trailing comma) each on its own line, then
adding an item to the end -- but that still consumes less than a second on
my P5-166.  Response time in real code appears instantaneous.

Fixed some bugs.

New feature:  when hitting ENTER and the cursor is beyond the line's leading
indentation, whitespace is removed on both sides of the cursor; before
whitespace was removed only on the left; e.g., assuming the cursor is
between the comma and the space:

def something(arg1, arg2):
                   ^ cursor to the left of here, and hit ENTER
               arg2):   # new line used to end up here
              arg2):    # but now lines up the way you expect

New hack:  AutoIndent has grown a context_use_ps1 Boolean config option,
defaulting to 0 (false) and set to 1 (only) by PyShell.  Reason:  handling
the fancy stuff requires looking backward for a parsing synch point; ps1
lines are the only sensible thing to look for in a shell window, but are a
bad thing to look for in a file window (ps1 lines show up in my module
docstrings often).  PythonWin's shell should set this true too.

Persistent problem:  strings containing def/class can still screw things up
completely.  No improvement.  Simplest workaround is on the user's head, and
consists of inserting e.g.

def _(): pass

(or any other def/class) after the end of the multiline string that's
screwing them up.  This is especially irksome because IDLE's syntax coloring
is *not* confused, so when this happens the colors don't match the
indentation behavior they see.
1999-06-01 19:55:34 +00:00
Guido van Rossum a6be3870b3 Tim Peters again:
[Tim, after adding some bracket smarts to AutoIndent.py]
> ...
> What it can't possibly do without reparsing large gobs of text is
> suggest a reasonable indent level after you've *closed* a bracket
> left open on some previous line.
> ...

The attached can, and actually fast enough to use -- most of the time.  The
code is tricky beyond belief to achieve that, but it works so far; e.g.,

        return len(string.expandtabs(str[self.stmt_start :
                                         ^ indents to caret
                                         i],
                                     ^ indents to caret
                                     self.tabwidth)) + 1
    ^ indents to caret

It's about as smart as pymode now, wrt both bracket and backslash
continuation rules.  It does require reparsing large gobs of text, and if it
happens to find something that looks like a "def" or "class" or sys.ps1
buried in a multiline string, but didn't suck up enough preceding text to
see the start of the string, it's completely hosed.  I can't repair that --
it's just too slow to reparse from the start of the file all the time.

AutoIndent has grown a new num_context_lines tuple attribute that controls
how far to look back, and-- like other params --this could/should be made
user-overridable at startup and per-file on the fly.
1999-06-01 19:52:34 +00:00
Guido van Rossum 8113cdc3a8 New file by Tim Peters:
One new file in the attached, PyParse.py.  The LineStudier (whatever it was
called <wink>) class was removed from AutoIndent; PyParse subsumes its
functionality.
1999-06-01 19:49:21 +00:00
Guido van Rossum d93f739556 Tim Peters keeps revising this module (more to come):
Removed "New tabwidth" menu binding.

Added "a tab means how many spaces?" dialog to block tabify and untabify.  I
think prompting for this is good now:  they're usually at-most-once-per-file
commands, and IDLE can't let them change tabwidth from the Tk default
anymore, so IDLE can no longer presume to have any idea what a tab means.

Irony:  for the purpose of keeping comments aligned via tabs, Tk's
non-default approach is much nicer than the Emacs/Notepad/Codewright/vi/etc
approach.
1999-06-01 19:47:56 +00:00
Guido van Rossum 74311b2c27 1. Catch NameError on import (could be raised by case mismatch on Windows).
2. No longer need to reset pyclbr cache and show watch cursor when calling
   ClassBrowser -- the ClassBrowser takes care of pyclbr and the TreeWidget
   takes care of the watch cursor.
3. Reset the focus to the current window after error message about class
   browser on buffer without filename.
1999-06-01 18:27:14 +00:00
Guido van Rossum 292dd2d1af Missed a few. 1999-06-01 18:23:19 +00:00
Guido van Rossum ec9cca776a Rewritten based on TreeWidget.py 1999-06-01 18:21:31 +00:00
Guido van Rossum 1ff48ec852 Object browser, based on TreeWidget.py. 1999-06-01 18:20:56 +00:00
Guido van Rossum 7419f4b290 Tree widget done right. 1999-06-01 18:19:17 +00:00
Guido van Rossum d3a518b661 As yet unused code for tool tips. 1999-06-01 18:19:02 +00:00
Guido van Rossum ee03611a8d Ensure sys.argv[0] is the script name on Run Script. 1999-06-01 18:18:27 +00:00
Guido van Rossum 96cf271be9 Move zoom height functionality to separate function. 1999-06-01 18:17:02 +00:00
Guido van Rossum 32465f4148 A few icons used by ../TreeWidget.py and its callers. 1999-06-01 15:04:51 +00:00
Guido van Rossum 8234dfcccb New version by Tim Peters improves block opening test. 1999-06-01 15:03:30 +00:00
Barry Warsaw a20fdcdd14 Eugene Dvurechenski <jno@glas.net> says:
there is "su" top level domain still maintained in ex-USSR.  at
    least "*.msk.su" zone (Moscow, USSR) is still in use.
1999-05-26 04:02:18 +00:00
Guido van Rossum b6f8cf123e Rename History to IdleHistory.
Add isatty() to pseudo files.
1999-05-21 04:46:17 +00:00
Guido van Rossum 945507edf6 Make initial stack viewer wider 1999-05-21 04:45:45 +00:00
Guido van Rossum 2092b439be New wishes 1999-05-21 04:45:20 +00:00
Guido van Rossum def2c96718 Much improved autoindent and handling of tabs,
by Tim Peters.
1999-05-21 04:38:27 +00:00
Guido van Rossum 318a70d976 Tim Peters writes:
I'm still unsure, but couldn't stand the virtual event trickery so tried a
different sin (adding undo_block_start/stop methods to the Text instance in
EditorWindow.py).  Like it or not, it's efficient and works <wink>.  Better
idea?

Give the attached a whirl.  Even if you hate the implementation, I think
you'll like the results.  Think I caught all the "block edit" cmds,
including Format Paragraph, plus subtler ones involving smart indents and
backspacing.
1999-05-03 15:49:52 +00:00
Guido van Rossum 2d6a568a0f Tim Peters writes:
[W]hile trying to dope out how redirection works, stumbled into two
possible glitches.  In the first, it doesn't appear to make sense to try to
rename a command that's already been destroyed; in the second, the name
"previous" doesn't really bring to mind "ignore the previous value" <wink>.
1999-05-03 15:38:56 +00:00
Barry Warsaw 85460a58f8 updates for latest release 1999-05-01 16:27:23 +00:00
Guido van Rossum 7238401488 Support for using idle as a package. 1999-04-30 19:39:25 +00:00
Guido van Rossum 78608120de Avoid listing files more than once (e.g. foomodule.so has two hits:
once for foo + module.so, once for foomodule + .so).
1999-04-30 15:14:05 +00:00
Barry Warsaw a4b055ff89 Add a scale widget and command line options to set the output volume.
Bump version number 1.0
1999-04-28 19:32:46 +00:00
Barry Warsaw 3369927322 Use the much nicer tkFileDialog for loading color name database files
(thanks Fred!)
1999-04-27 19:51:55 +00:00
Barry Warsaw a853adc110 Document that for askcolor(), databasefile and wantspec can now be set
on every invocation, instead of just the first.
1999-04-27 18:57:00 +00:00
Barry Warsaw 80d83e38ab askcolor(): databasefile and wantspec can now be set on every
invocation, instead of just the first.
1999-04-27 18:56:35 +00:00
Barry Warsaw 9af697b85d Implement dynamic external Viewer discovery.
PyncheWidget.__init__(): Add the extrapath argument which can be used
to pass in additional directories to search for Viewers.
1999-04-27 18:55:48 +00:00
Barry Warsaw f3ebf90d2c Add a module global variable ADDTOVIEW to conform to dynamic viewer
lookup protocol.
1999-04-27 18:54:12 +00:00
Barry Warsaw 2095b2fe14 Added docstring describing Viewer interface.
set_colordb(): Call Viewers' colordb_changed() method if they have
them.  Notifies them of changes to the color name database.
1999-04-27 18:53:29 +00:00
Barry Warsaw b61a28e240 add a comment 1999-04-27 18:43:47 +00:00
Barry Warsaw 7b2812211a When selecting a radio button in the TextViewer (to change a specific
text widget attribute), the color the attribute currently has is set
in the main widget.
1999-04-27 15:56:53 +00:00
Barry Warsaw f5e98572e5 Change Black/White button labels to not include the arrow 1999-04-27 15:56:02 +00:00
Barry Warsaw 74109a149e Describe namedcolors.txt 1999-04-26 23:50:04 +00:00
Barry Warsaw 3e9c75d3f2 An alternative Netscape database 1999-04-26 23:49:23 +00:00
Barry Warsaw a25223faf4 Describe how to load a new database 1999-04-26 23:48:17 +00:00
Barry Warsaw 821d8b73e8 Describe the Color database files 1999-04-26 23:46:25 +00:00
Barry Warsaw 6e7f6ea756 Put the 'File' menu on the menubar even when modal, so users can get
to the 'load palette' entry.   Just don't put the quit button on
there.
1999-04-26 23:36:47 +00:00
Barry Warsaw 3f01c724fd Tim Peter's sister's 140 named colors that NS and MSIE understand
(with some controversy surrounding AliceBlue :-)
1999-04-26 23:27:38 +00:00
Barry Warsaw a04988a8dd The "Web-safe" colors (all #rrggbb style) 1999-04-26 23:26:43 +00:00
Barry Warsaw 375b11635b The HTML 4.0 guaranteed colors. 1999-04-26 23:26:23 +00:00
Barry Warsaw d515a7ea3d Set the version number to 1.0 -- I think it's stable enough 1999-04-26 23:18:07 +00:00
Barry Warsaw 0604d72318 Lots of changes to support loading alternative color name database.
You can switch database by just loading the new one; the list window
and nearest colors adapt to the new database.

Some reorganizing of code.  Also, the name of the database file is
stored in the ~/.pynche pickle.  If it can't be loaded, fallbacks are
used.
1999-04-26 23:17:16 +00:00
Guido van Rossum 0ec1493d0b Some changes (maybe not enough?) to make it work on Windows with local
file URLs.
1999-04-26 23:11:46 +00:00
Guido van Rossum 26c2cb4bd1 Tim Peters strikes again:
Ho ho ho -- that's trickier than it sounded!  The colorizer is working with
"line.col" strings instead of Text marks, and the absolute coordinates of
the point of interest can change across the self.update call (voice of
baffled experience, when two quick backspaces no longer fooled it, but a
backspace followed by a quick ENTER did <wink>).

Anyway, the attached appears to do the trick.  CPU usage goes way up when
typing quickly into a long triple-quoted string, but the latency is fine for
me (a relatively fast typist on a relatively slow machine).  Most of the
changes here are left over from reducing the # of vrbl names to help me
reason about the logic better; I hope the code is a *little* easier to
1999-04-26 22:20:38 +00:00
Barry Warsaw c2aadcd96a Added /usr/lib/X11/rgb.txt in front of X/rgb.txt for Linuxers 1999-04-23 16:24:00 +00:00
Guido van Rossum 9dd52099fa Provide full arguments to __import__ so it works in packagized IDLE. 1999-04-23 14:01:25 +00:00
Guido van Rossum 06b787bdd1 Bunch of updates necessary due to recent changes; added docs for File
menu, command line and color preferences.
1999-04-22 23:20:17 +00:00
Guido van Rossum dc7bfc44a2 Remove obsolete 'script' menu. 1999-04-22 23:09:23 +00:00
Guido van Rossum 4c6d0c7382 Several wishes fulfilled. 1999-04-22 22:32:32 +00:00
Guido van Rossum 70f6d99753 Moved classes OnDemandOutputWindow and PseudoFile here,
from ScriptBinding.py where they are no longer needed.
1999-04-22 22:28:42 +00:00
Guido van Rossum 1f3de5d7b9 Mostly rewritten. Instead of the old Run module and Debug module,
there are two new commands:

Import module (F5) imports or reloads the module and also adds its
name to the __main__ namespace.  This gets executed in the PyShell
window under control of its debug settings.

Run script (Control-F5) is similar but executes the contents of the
file directly in the __main__ namespace.
1999-04-22 22:27:40 +00:00
Guido van Rossum 27f550cdd5 Nits: document use of $IDLESTARTUP; display idle version 1999-04-22 20:56:23 +00:00
Guido van Rossum e1e1488319 New version to celebrate new command line 1999-04-22 20:50:52 +00:00
Guido van Rossum 3d0ff00c08 Added flush(), for completeness. 1999-04-22 20:50:33 +00:00
Guido van Rossum eeb88076e7 A lot of changes to make the command line more useful. You can now do:
idle.py -e file ...    -- to edit files
  idle.py script arg ... -- to run a script
  idle.py -c cmd arg ... -- to run a command
Other options, see also the usage message (also new!) for more details:
  -d       -- enable debugger
  -s       -- run $IDLESTARTUP or $PYTHONSTARTUP
  -t title -- set Python Shell window's title
sys.argv is set accordingly, unless -e is used.
sys.path is absolutized, and all relevant paths are inserted into it.

Other changes:
- the environment in which commands are executed is now the __main__ module
- explicitly save sys.stdout etc., don't restore from sys.__stdout__
- new interpreter methods execsource(), execfile(), stuffsource()
- a few small nits
1999-04-22 20:49:35 +00:00
Guido van Rossum 9f5362bfa6 Some more TODO items. Made up my mind about command line args,
Run/Import, __main__.
1999-04-22 14:07:33 +00:00
Guido van Rossum e62e76c383 Super-elegant patch by Tim Peters that speeds up colorization
dramatically (up to 15 times he claims).  Works by reading more than
one line at a time, up to 100-line chunks (starting with one line and
then doubling up to the limit).  On a typical machine (e.g. Tim's
P5-166) this doesn't reduce interactive responsiveness in a noticeable
way.
1999-04-22 13:38:40 +00:00
Guido van Rossum da4b25e0d9 Patch by Tim Peters to speed up colorizing of big multiline strings. 1999-04-21 15:49:34 +00:00
Guido van Rossum 79d4398c30 For an event 'foo-bar', the corresponding method must be called
foo_bar_event().  Therefore, fix the references to zoom_height() in
the example.
1999-04-20 17:32:52 +00:00
Guido van Rossum a670d0c97b Restored the original IDLE color scheme. 1999-04-20 15:58:29 +00:00
Guido van Rossum 7de697597e Color preferences code by Loren Luke (massaged by me somewhat) 1999-04-20 15:45:30 +00:00
Guido van Rossum cfb819ee51 Patch by Mark Favas: it fixes the search engine behaviour where an
unsuccessful search wraps around and re-searches that part of the file
between the start of the search and the end of the file - only really
an issue for very large files, but... (also removes a redundant
m.span() call).
1999-04-20 15:00:00 +00:00
Guido van Rossum 0a2818fe5b A few wishes are now fulfilled. 1999-04-19 16:26:02 +00:00
Guido van Rossum 17c516eacb Tim Peters implements some of my wishes:
o Makes the tab key intelligently insert spaces when appropriate (see Help
list banter twixt David Ascher and me; idea stolen from every other editor
on earth <wink>).

o newline_and_indent_event trims trailing whitespace on the old line (pymode
and Codewright).

o newline_and_indent_event no longer fooled by trailing whitespace or
comment after ":" (pymode, PTUI).

o newline_and_indent_event now reduces the new line's indentation after
return, break, continue, raise and pass stmts (pymode).

The last two are easy to fool in the presence of strings & continuations,
but pymode requires Emacs's high-powered C parsing functions to avoid that
in finite time.
1999-04-19 16:23:15 +00:00
Guido van Rossum dcb0a57874 Avoid totally empty files. 1999-04-10 14:00:28 +00:00
Guido van Rossum d68a4bd56c Use re instead of regex.
Don't rewrite the file in place.
(Reported by Andy Dustman.)
1999-04-09 14:56:35 +00:00
Guido van Rossum 21ad59f1ee # TODO entries changed 1999-04-08 20:28:42 +00:00
Guido van Rossum 00b6d0f224 New change log. 1999-04-07 18:43:22 +00:00
Guido van Rossum a2ca434cfc New version. 1999-04-07 18:41:59 +00:00
Guido van Rossum a99c5db3aa Version bump awaiting impending new release.
(Not much has changed :-( )
1999-04-07 18:27:29 +00:00
Guido van Rossum bd3bdde70b For reasons I dare not explain, this script should always execute
main() when imported (in other words, it is not usable as a module).
1999-04-02 22:18:25 +00:00
Guido van Rossum 825df2a14d At Tim Peters' recommendation, add a dummy flush() method to PseudoFile. 1999-03-29 14:52:28 +00:00
Guido van Rossum 02ef28b9a9 Tim Peters writes:
I should have waited overnight <wink/sigh>.  Nothing wrong with the one I
sent, but I couldn't resist going on to add new -r1 / -r2 cmdline options
for recreating the original files from ndiff's output.  That's attached, if
you're game!  Us Windows guys don't usually have a sed sitting around
<wink>.
1999-03-28 17:55:32 +00:00
Guido van Rossum a3433e89eb Tim Peters writes:
Attached is a cleaned-up version of ndiff (added useful module
docstring, now echo'ed in case of cmd line mistake); added -q option
to suppress initial file identification lines; + other minor cleanups,
& a slightly faster match engine.
1999-03-27 13:34:01 +00:00
Fred Drake b091134e70 During display, if EPIPE is raised, it's probably because a pager was
killed.  Discard the error in that case, but propogate it otherwise.
1999-03-26 22:36:00 +00:00
Barry Warsaw ecb1a65f63 Helpwin.__init__(): The text widget should get focus. 1999-03-26 16:11:40 +00:00
Barry Warsaw 61ba0721db Removed unnecessary import `from PyncheWidget import PyncheWidget' 1999-03-26 15:59:51 +00:00
Guido van Rossum 545006259d Added Samuel Bayer's new webchecker.
Unfortunately his code breaks wcgui.py in a way that's not easy
to fix.  I expect that this is a temporary situation --
eventually Sam's changes will be merged back in.
(The changes add a -t option to specify exceptions to the -x
option, and explicit checking for #foo style fragment ids.)
1999-03-24 19:09:00 +00:00
Guido van Rossum c7e7c60756 New mixin class that defines cmp and hash that use
the ob_itself pointer.  This allows (when using the mixin)
different Python objects pointing to the same C object and
behaving well as dictionary keys.

Or so sez Jack Jansen...
1999-03-15 16:37:54 +00:00
Guido van Rossum 7039f50828 Bug submitted by Wayne Knowles, who writes:
Under Windows, python freeze.py -o hello hello.py
   creates all the correct files in the hello subdirectory, but the
   Makefile has the directory prefix in it for frozen_extensions.c
   nmake fails because it tries to locate hello/frozen_extensions.c

(His fix adds a call to os.path.basename() in the appropriate place.)
1999-03-12 22:07:05 +00:00
Guido van Rossum dd58416f39 Don't crash when sys.path contains an empty string. 1999-03-11 23:21:23 +00:00
Guido van Rossum 49c7bc416e This file was never supposed to be part of IDLE. 1999-03-11 16:51:23 +00:00
Guido van Rossum b62e877631 - Don't crash in the case where a superclass is a string instead of a
pyclbr.Class object; this can happen when the superclass is
unrecognizable (to pyclbr), e.g. when module renaming is used.

- Show a watch cursor when calling pyclbr (since it may take a while
recursively parsing imported modules!).
1999-03-11 16:37:13 +00:00
Guido van Rossum d6e8713f81 Add PathBrowser to File module 1999-03-10 05:18:02 +00:00
Guido van Rossum a917af7fc7 "Path browser" - 4 scrolled lists displaying:
directories on sys.path
    modules in selected directory
    classes in selected module
    methods of selected class

Sinlge clicking in a directory, module or class item updates the next
column with info about the selected item.  Double clicking in a
module, class or method item opens the file (and selects the clicked
item if it is a class or method).

I guess eventually I should be using a tree widget for this, but the
ones I've seen don't work well enough, so for now I use the old
Smalltalk or NeXT style multi-column hierarchical browser.
1999-03-10 05:17:28 +00:00
Guido van Rossum dc424be5af New utility: multiple scrolled lists in parallel 1999-03-10 05:13:29 +00:00
Guido van Rossum ac1cb16efb - White background.
- Display "(None)" (or text of your choosing) when empty.
- Don't set the focus.
1999-03-10 05:10:49 +00:00
Guido van Rossum d2cd6f8c93 Small change by Jack Jansen.
Test for self.returntype behaving like OSErr rather than being it.
1999-03-09 16:05:26 +00:00
Guido van Rossum b0f99a62d7 Comment out confusing write call. 1999-02-18 14:22:05 +00:00
Guido van Rossum a89b98f4c0 News in 0.3. 1999-02-17 22:47:41 +00:00
Guido van Rossum dce019ed79 Bump version to 0.3. 1999-02-17 17:37:24 +00:00
Guido van Rossum 8f2918f4fa After all, we don't need to call the callbacks ourselves! 1999-02-17 17:34:58 +00:00
Guido van Rossum be5f2f1cb5 When deleting, call the callbacks *after* deleting the window from our list! 1999-02-17 17:34:25 +00:00
Guido van Rossum c4f752f803 Fix up the Windows menu via the new callback mechanism instead of
depending on menu post commands (which don't work when the menu is
torn off).
1999-02-17 17:20:50 +00:00
Guido van Rossum 5437ddfa36 Support callbacks to patch up Windows menus everywhere. 1999-02-17 17:19:37 +00:00
Guido van Rossum a79a93ff73 Oh, why not. Checking in the Emacs-generated change log. 1999-02-17 16:20:08 +00:00
Guido van Rossum a0d5d700e0 # Accidentally checked in a test version of this file with a bogus
# "import fooblurg" :-)
1999-02-16 23:05:46 +00:00
Guido van Rossum 9ea32898db Only pop up the stack viewer when requested in the Debug menu. 1999-02-16 22:34:17 +00:00