4 Applied a series of enhancments by Franz Steinaeusler, Adi Sieker, and
 
   5 Sebastian Haase, up until their 7-31-2005 version.  (Their next
 
   6 version broke some existing functionality, and added some confusing
 
   7 hacks, and I didn't feel that the incremental gains were worth the
 
   8 loss at that point so I stopped at 7-31-2005.)
 
  10 Their changes include the following:
 
  12 * The Autocomplete and Calltip windows can now be opened manually with
 
  13   Ctrl-Space and Ctrl-Shift-Space.
 
  15 * In the stand alone PyCrust app the various option settings, window
 
  16   size and position, and etc. are saved and restored at the next run.
 
  18 * Added a help dialog bound to the F1 key that shows the key bindings.
 
  20 * Added a new text completion function that suggests words from the
 
  21   history.  Bound to Shift-Return.
 
  23 * F11 will toggle the maximized state of the frame.
 
  25 * switched to Bind() from wx.EVT_*().
 
  27 * Display of line numbers can be toggled.
 
  29 * F12 toggles a "free edit" mode of the shell buffer.  This mode is
 
  30   useful, for example, if you would like to remove some output or
 
  31   errors or etc. from the buffer before doing a copy/paste.  The free
 
  32   edit mode is designated by the use of a red, non-flashing caret.
 
  34 * Ctrl-Shift-F will fold/unfold (hide/show) the selected lines.
 
  38 On top of these changes I (Robin Dunn) added the following:
 
  40 * General code cleanup and fixes.
 
  42 * Use wx.StandardPaths to determine the location of the config files.
 
  44 * Remove Orbtech attributions from the UI, they've been there long
 
  47 * Use wx.SP_LIVE_UPDATE on crust and filling windows.
 
  49 * Extended the saving of the config info and other new features to the
 
  50   PyShell app too.  Additionally, other apps that embed a PyCrust or a
 
  51   PyShell can pass their own wx.Config object and have the Py code
 
  52   save/restore its settings to/from there.
 
  54 * All of the classes with config info get an opportunity to save/load
 
  55   their own settings instead of putting all the save/load code in one
 
  56   place that then has to reach all over the place to do anything.
 
  58 * Enable editing of the startup python code, which will either be the
 
  59   file pointed to by PYTHONSTARTUP or a file in the config dir if
 
  60   PYTHONSTARTUP is not set in the environment.
 
  62 * Added an option to skip the running of the startup code when 
 
  63   PyShell or PyCrust starts.
 
  65 * PyCrust adds a pp(item) function to the shell's namespace that
 
  66   pretty prints the item in the Display tab of the notebook.  Added
 
  67   code to raise that tab when pp() is called.
 
  69 * Added an option for whether to insert text for function parameters
 
  70   when popping up the call tip.
 
  72 * Added Find and Find-Next functions that use the wx.FindReplaceDialog.
 
  79 0.9.4 (1/25/2004 to //2004)
 
  80 ------------------------------
 
  82 Removed wxd decorators in favor of new SWIG-generated docstrings.
 
  84 Removed docs tabs from crust interface:
 
  88 Fixed Calltip tab refresh problem on Windows.
 
  90 shell.autoCompleteAutoHide added with default of False.
 
  92 Changed default namespace of Shell to __main__.__dict__, instead of an
 
  96 0.9.3 (9/25/2003 to 1/24/2004)
 
  97 ------------------------------
 
  99 Fun and games with dynamic renaming.  Details of any other changes
 
 100 were lost in the confusion.  I'll try to do better in the future.
 
 103 0.9.2 (5/3/2003 to 9/25/2003)
 
 104 -----------------------------
 
 106 Changed to the new prefix-less "wx" package::
 
 112     from wxPython import wx
 
 114 Fixed typo in ``PyWrap.py``::
 
 116     if __name__ == '__main__':
 
 121     if __name__ == '__main__':
 
 124 Added pretty-print Display tab to Crust, based on suggestion from
 
 127 Improved ``Can*`` checks in ``EditWindow``, since STC is too lenient,
 
 128 particularly when it is set to read-only but returns True for
 
 129 CanPaste() (seems like an STC bug to me)::
 
 132         """Return True if text is selected and can be copied."""
 
 133         return self.GetSelectionStart() != self.GetSelectionEnd()
 
 136         """Return True if text is selected and can be cut."""
 
 137         return self.CanCopy() and self.CanEdit()
 
 140         """Return True if editing should succeed."""
 
 141         return not self.GetReadOnly()
 
 144         """Return True if pasting should succeed."""
 
 145         return stc.StyledTextCtrl.CanPaste(self) and self.CanEdit()
 
 148 0.9.1 (3/21/2003 to 5/2/2003)
 
 149 -----------------------------
 
 151 PyCrust is dead!  Long live Py!
 
 153 * Renamed ``PyCrust`` package to ``py``.
 
 154 * Moved code to wxPython's CVS repository.
 
 156 Fixed bug in ``introspect.py`` on introspecting objects occurring
 
 157 immediately after a secondary prompt, like this::
 
 160     >>> for n in range(3):
 
 161     ...     l.  <-- failed to popup autocomplete list
 
 163 Added documentation files:
 
 167 * wxPythonPackage.txt
 
 168 * wxPythonExamples.txt
 
 170 Added PyAlaMode and PyAlaCarte code editors.
 
 172 Major refactoring to support ``editor`` and ``shell`` from the same
 
 175 Renamed program files:
 
 177 * ``PyCrustApp.py`` to ``PyCrust.py``
 
 178 * ``PyFillingApp.py`` to ``PyFilling.py``
 
 179 * ``PyShellApp.py`` to ``PyShell.py``
 
 180 * ``wrap.py`` to ``PyWrap.py``
 
 182 Removed disabling of autocomplete for lists of 2000 items or more.
 
 183 The current implementation of wxSTC can now handle lists this big.
 
 185 Improved handling of ``sys.path`` to mimic the standard Python shell.
 
 188 0.9 (2/27/2003 to 3/20/2003)
 
 189 ----------------------------
 
 191 Added fontIncrease, fontDecrease, fontDefault signals, receivers and
 
 194     Ctrl+]            Increase font size.
 
 195     Ctrl+[            Decrease font size.
 
 196     Ctrl+=            Default font size.
 
 198 Continued enhancement of the decorator capability to provide better
 
 199 documentation and docstrings for wxPython classes and functions.
 
 201 Introduced new tabbed interface:
 
 210 ``Filling.tree`` now expands tuples as well as lists.  (It should have
 
 211 done this all along, I just never noticed this omission before.)
 
 213 Added this True/False test to all modules::
 
 221 Added ``wxd`` directory with decoration classes.
 
 224 0.8.2 (1/5/2003 to 2/26/2003)
 
 225 -----------------------------
 
 227 Wrapped ``sys.ps1``, ``sys.ps2``, and ``sys.ps3`` in ``str()``.
 
 228 (Thanks, Kieran Holland.)
 
 230 Fixed minor things found by PyChecker.
 
 232 Changed locals to use ``__main__.__dict__`` and added code to clean up
 
 233 the namespace, making it as close to the regular Python environment as
 
 234 possible.  This solves the problem of pickling and unpickling
 
 235 instances of classes defined in the shell.
 
 237 Made ``shell.PasteAndRun()`` a little more forgiving when it finds a
 
 238 ps2 prompt line with no trailing space, such when you copy code from a
 
 241 Improved autocomplete behavior by adding these to shell::
 
 243     self.AutoCompSetAutoHide(False)
 
 244     self.AutoCompStops(' .,;:([)]}\'"\\<>%^&+-=*/|`')
 
 246 Added ``decor`` directory, ``decorator.py``, ``stcDecor.py``, and
 
 247 ``stcConstants.py``.  These all serve the purpose of adding docstrings
 
 248 to existing wxPython classes, in particular the ``wxStyledTextCtrl``.
 
 250 Added ``wrap.py``, a command line utility for running a wxPython app
 
 251 with additional runtime-tools loaded, such as PyCrust (the only tool
 
 254 Flushed the clipboard Cut/Copy operations so that selections will
 
 255 exist in the clipboard even after PyCrust has been closed.
 
 257 Improved the suppression of docstrings for simple data types appearing
 
 258 in the namespace viewer.
 
 260 Better handling of autocompletion with numeric types; no
 
 261 autocompletion when typing a dot after an integer.  If the
 
 262 autocompletion is desired, type a space before the dot::
 
 266 More Filling!!! The namespace tree is now dynamically updated.
 
 269 0.8.1 (12/20/2002 to 12/25/2002)
 
 270 --------------------------------
 
 272 Improved keyboard handling with Autocomplete active.  You can now use
 
 273 Enter as well as Tab to select an item from the list.
 
 275 Disabled autocomplete for lists of 2000 items or more.  The current
 
 276 implementation of wxSTC can't handle lists this big.
 
 278 Changed ``filling`` to always display docstrings for objects.  This is
 
 279 useful for objects whose docstrings have been decorated, rather than
 
 280 coming directly from the source code.  (Hmmm.  Sounds like someone is
 
 281 doing some decorating.  I wonder where that would be helpful? <wink>)
 
 283 Fixed handling of icon.  Added ``images.py`` file.
 
 286 0.8 (10/29/2002 to 12/16/2002)
 
 287 ------------------------------
 
 289 Added "help" to startup banner info.
 
 291 Made all ``wx`` and ``stc`` imports explicit.  No more ``import *``.
 
 293 Replaced use of the ``wx`` module's ``true`` and ``false`` with
 
 294 Python's ``True`` and ``False``.
 
 296 Changed ``introspect.getRoot()`` to use ``tokenize`` module.  This
 
 297 does a slightly better job than the previous parsing routine and the
 
 300 Improved handling of whitespace and empty types during introspection.
 
 302 Fixed cut/copy clipboard problem under Linux.  (Robin Dunn rocks!!!)
 
 304 Added shell.about() which works like this::
 
 309     Interpreter Revision: 1.15
 
 310     Python Version: 2.2.2
 
 311     wxPython Version: 2.3.3.1
 
 314 Added copy plus and paste plus to shell menu.
 
 316 Moved shell menu from ``shell.py`` to ``shellmenu.py``.
 
 318 Added ``sys.stdin.readlines()`` support.
 
 320 Added ``time.sleep()`` in ``readline()`` and ``OnIdle()`` event
 
 321 handler to free up the CPU.
 
 324 0.7.2 (2/22/2002 to 8/27/2002)
 
 325 ------------------------------
 
 327 Tweaked ``getAttributeNames()`` to pick up a few more attributes::
 
 329     '__bases__', '__class__', '__dict__', '__name__', 'func_closure',
 
 330     'func_code', 'func_defaults', 'func_dict', 'func_doc',
 
 331     'func_globals', 'func_name'
 
 333 Added a tests directory and unit tests.
 
 335 Improved support for empty types in the shell: ``[]``, ``()`` and
 
 336 ``{}`` as far as when call tips and autocompletion are available.
 
 338 Added support for the other triple string - ``''''''``.
 
 340 Refactored ``introspect.py`` to improve testability.
 
 342 Improved call tips for unbound methods by leaving the "self"
 
 343 parameter, since unbound methods require an instance be passed.
 
 345 Fixed call tip bug where a tip was displayed when a "(" was typed
 
 346 after an object that wasn't callable.
 
 348 Fixed ``getAllAttributeNames`` when ``str(object)`` fails.
 
 350 Added brace highlighting.  (Thank you, Kevin Altis.)
 
 352 Fixed problem displaying unicode objects in ``PyFilling``.
 
 354 Changed how ``filling.py`` checks for expandable objects.  Lists are
 
 355 now expandable objects.
 
 357 Made the key handling more robust when there is an active text
 
 358 selection that includes text prior to the last primary prompt.  Thanks
 
 359 to Raul Cota for pointing this out.
 
 361 Fixed wxSTC problem with brace highlighting and non-us keyboards.
 
 362 (Thank you for the patch, Jean-Michel Fauth.)
 
 364 Added ``busy = wxBusyCursor()`` to key points in ``shell`` and
 
 367 Added ``OnCloseWindow`` handler to ``ShellFrame`` and ``CrustFrame``.
 
 369 Default to ``SetWrapMode(1)`` for shell and namespace viewer.
 
 371 Added ``shell.wrap()`` and ``shell.zoom()``.
 
 373 Added autoCompleteKeys hooks for Raul Cota.
 
 375 Cleaned up various little key handling bugs.
 
 377 Changed input methods to get values from shell, rather than dialog
 
 378 boxes.  Renamed ``readIn`` to ``readline`` and ``readRaw`` to
 
 382 0.7.1 (12/12/2001 to 2/21/2002)
 
 383 -------------------------------
 
 385 Fixed ``OnChar()`` issues effecting European keyboards, as reported by
 
 388 Fixed ``introspect.py`` issue with xmlrpc objects reported by Kevin
 
 391 Fixed some introspect/PyFilling issues with regard to Python 2.2.
 
 393 Fixed font background color as reported by Keith J. Farmer.  (Thanks)
 
 395 Fixed problem with call tips and autocompletion inside multiline
 
 396 commands as report by Kevin Altis.
 
 398 Improved ``OnKeyDown`` handling of cut/copy/paste operations based on
 
 399 feedback from Syver Enstad.  (Thanks)
 
 401 Added a ``shell.help()`` method to display some help info.
 
 403 Changed sort of items in the namespace viewer to case insensitive.
 
 405 Changed ``attributes.sort(lambda x, y: cmp(x.upper(), y.upper()))`` in
 
 406 advance of an upcoming fix to an autocompletion matching bug in wxSTC.
 
 408 Improved support for ZODB by allowing namespace drilldown into BTrees.
 
 410 Added ``shell.PasteAndRun()`` to support pasting multiple commands into
 
 411 the shell from the clipboard.  Ctrl+Shift+V or v.
 
 413 Enter now always processes a command (or copies down a previous one.)
 
 414 To insert a line break, press Ctrl+Enter.
 
 416 Escape key clears the current, unexecuted command.
 
 418 History retrieval changed to replace current command.  Added new keys
 
 419 to insert from history - Shift+Up and Shift+Down.
 
 421 Better call tips on objects with ``__call__`` methods.
 
 423 Improved call tip positioning calculation.
 
 426 0.7 (10/15/2001 to 12/11/2001)
 
 427 ------------------------------
 
 429 Changed how command history retrieval functions work.  Added Alt-P,
 
 430 Alt-N as keybindings for Retrieve-Previous, Retrieve-Next.
 
 432 Added full support for multi-line commands, similar to IDLE.
 
 434 Changed ``introspect.getAttributeNames()`` to do a case insensitive
 
 437 Changed Cut/Copy/Paste to deal with prompts intelligently.  Cut and
 
 438 Copy remove all prompts.  Paste can handle prompted or not-prompted
 
 441 Added ``CopyWithPrompts()`` method attached to Ctrl-Shift-C for those
 
 442 times when you really do want all the prompts left intact.
 
 444 Improved handling of the shell's read-only zone.
 
 446 Changed ``CrustFrame.__init__`` parameter spec to include all
 
 447 parameters allowed by a ``wxFrame``.
 
 449 Changed ``FillingText`` to be read-only.
 
 451 Renamed ``PyCrust.py`` to ``PyCrustApp.py`` to eliminate
 
 452 package/module name conflicts that kept you from doing ``from PyCrust
 
 453 import shell`` inside files located in the ``PyCrust`` directory.
 
 455 Renamed ``PyFilling.py`` to ``PyFillingApp.py`` and ``PyShell.py`` to
 
 456 ``PyShellApp.py`` to maintain consistency.
 
 458 Removed the ``__date__`` property from all modules.
 
 460 Fixed bug in ``introspect.getCallTip()``, reported by Kevin Altis.
 
 463 0.6.1 (9/19/2001 to 10/12/2001)
 
 464 -------------------------------
 
 466 Changed ``Shell.run()`` to always position to the end of existing
 
 467 text, as suggested by Raul Cota.
 
 469 Changed ``introspect.getAllAttributeNames()`` to break circular
 
 470 references in ``object.__class__``, which occurs in Zope/ZODB
 
 473 Changed ``filling.FillingTree.getChildren()`` to introspect extension
 
 476 Fixed minor bugs in ``introspect.getCallTip()`` that were interfering
 
 477 with call tips for Zope/ZODB extension class methods.
 
 479 In preparation for wxPython 2.3.2, added code to fix a font sizing
 
 480 problem.  Versions of wxPython prior to 2.3.2 had a sizing bug on Win
 
 481 platform where the font was 2 points larger than what was specified.
 
 483 Added a hack to ``introspect.getAllAttributeNames()`` to "wake up"
 
 484 ZODB objects that are asleep - in a "ghost" state.  Otherwise it
 
 485 returns incomplete info.
 
 488 0.6 (8/21/2001 to 9/12/2001)
 
 489 ----------------------------
 
 491 Added ``PyFilling.py`` and ``filling.py``.
 
 493 ``PyShell.py`` and ``PyFilling.py`` can now be run standalone, as well
 
 496 Added ``crust.py`` and moved some code from ``PyCrust.py`` to it.
 
 498 Added command history retrieval features submitted by Richie Hindle.
 
 500 Changed ``shell.write()`` to replace line endings with OS-specific
 
 501 endings.  Changed ``shell.py`` and ``interpreter.py`` to use
 
 502 ``os.linesep`` in strings having hardcoded line endings.
 
 504 Added ``shell.redirectStdin()``, ``shell.redirectStdout()`` and
 
 505 ``shell.redirectStderr()`` to allow the surrounding app to toggle
 
 506 requests that the specified ``sys.std*`` be redirected to the shell.
 
 507 These can also be run from within the shell itself, of course.
 
 509 The shell now adds the current working directory "." to the search
 
 512     sys.path.insert(0, os.curdir)
 
 514 Added support for distutils installations.
 
 517 0.5.4 (8/17/2001 to 8/20/2001)
 
 518 ------------------------------
 
 520 Changed default font size under Linux to::
 
 525 Changed ``Shell`` to expect a parameter referencing an Interpreter
 
 526 class, rather than an intepreter instance, to facilitate subclassing
 
 527 of Interpreter, which effectively broke when the Editor class was
 
 530 Fixed ``PyCrustAlaCarte.py``, which had been broken by previous
 
 533 Created ``InterpreterAlaCarte`` class as an example for use in the
 
 536 Split ``PyCrust.py`` into ``PyCrust.py`` and ``PyShell.py`` in
 
 537 anticipation of ``PyFilling.py``.
 
 543 Added patch to ``PyCrust.py`` to fix wxPython bug::
 
 545     wxID_SELECTALL = NewId() # This *should* be defined by wxPython.
 
 548 0.5.2 (8/14/2001 to 8/15/2001)
 
 549 ------------------------------
 
 551 Shortened module names by dropping "PyCrust" as a prefix.
 
 553 Changed ``version`` to ``VERSION`` in ``version`` module.
 
 555 Added Options menu to PyCrust application.
 
 557 Eliminated the Editor class (and editor module) by merging with Shell.
 
 558 This means that Shell "is a" wxStyledTextCtrl rather than "has a".
 
 559 There just wasn't enough non-gui code to justify the separation.
 
 560 Plus, Shell will be much easier for gui toolkits/designers to deal
 
 564 0.5.1 (8/10/2001 to 8/14/2001)
 
 565 ------------------------------
 
 567 Added ``introspect`` module.
 
 569 Moved some functionality from ``PyCrustInterp`` to ``introspect``.
 
 571 Changed ``introspect.getRoot()`` to no longer remove whitespace from
 
 572 the command.  This was a remnant of a previous approach that, when
 
 573 left as part of the current approach, turned out to be a really bad
 
 576 Changed ``introspect.getRoot()`` to allow commands of ``''``, ``""``,
 
 577 ``""""""``, ``[]``, ``()``, and ``{}`` to pass through.  This allows
 
 578 you to type them, followed by a dot, and get autocomplete options on
 
 581 Changed ``introspect.getRoot()`` to identify some situations where
 
 582 strings shouldn't be considered roots.  For example::
 
 584     >>> import PyCrust  # To illustrate the potential problem.
 
 585     >>> len('PyCrust.py')
 
 587 Typing the dot at the end of "PyCrust" in the second line above should
 
 588 NOT result in an autocompletion list because "PyCrust" is part of a
 
 589 string in this context, not a reference to the PyCrust module object.
 
 590 Similar reasoning applies to call tips.  For example::
 
 594 Typing the left paren at the end of "dir" should NOT result in a call
 
 597 Both features now behave properly in the examples given.  However,
 
 598 there is still the case where whitespace precedes the potential root
 
 599 and that is NOT handled properly.  For example::
 
 601     >>> len('this is a dir(')
 
 605     >>> len('This is PyCrust.py')
 
 607 More code needs to be written to handle more complex situations.
 
 609 Added ``locals=None`` parameter to ``Shell.__init__()``.
 
 611 Added support for magic attribute retrieval.  Users can change this
 
 614     >>> shell.editor.autoCompleteIncludeMagic = 0
 
 616 Added the ability to set filters on auto completion to exclude
 
 617 attributes prefixed with a single or double underscore.  Users can
 
 618 exclude one or the other or both with::
 
 620     >>> shell.editor.autoCompleteExcludeSingle = 1
 
 621     >>> shell.editor.autoCompleteExcludeDouble = 1
 
 627 Mostly just a final version change before creating a release.
 
 630 0.4 (8/4/2001 to 8/7/2001)
 
 631 --------------------------
 
 633 Changed version/revision handling.
 
 638 0.3 (8/2/2001 to 8/3/2001)
 
 639 --------------------------
 
 641 Removed lots of cruft.
 
 643 Added lots of docstrings.
 
 645 Imported to CVS repository at SourceForge.
 
 650 0.2 (7/30/2001 to 8/2/2001)
 
 651 ---------------------------
 
 653 Renamed several files.
 
 655 Added command autocompletion.
 
 657 Added menus to PyCrust.py: File, Edit and Help.
 
 659 Added sample applications: ``PyCrustAlaCarte.py``,
 
 660 ``PyCrustAlaMode.py``, and ``PyCrustMinimus.py``.
 
 663 0.1 (7/1/2001 to 7/19/2001)
 
 664 ---------------------------
 
 666 Added basic syntax coloring much like Boa.
 
 668 Added read-only logging much like IDLE.
 
 670 Can retrieve a previous command by putting the cursor back on that
 
 671 line and hitting enter.
 
 673 Stdin and raw_input operate properly so you can now do ``help()`` and
 
 674 ``license()`` without hanging.
 
 676 Redefined "quit", "exit", and "close" to display a better-than-nothing
 
 679 Home key honors the prompt.
 
 681 Created SourceForge account, but nothing was posted.
 
 684 In the beginning, there was pie... (7/1/2001)
 
 685 ---------------------------------------------
 
 687 Blame it all on IDLE, Boa and PythonWin.  I was using all three, got
 
 688 frustrated with their dissimilarities, and began to let everyone know
 
 689 how I felt.  At the same time, Scintilla looked like an interesting
 
 690 tool to build a shell around.  And while I didn't receive much in the
 
 691 way of positive feedback, let alone encouragement, I just couldn't let
 
 692 go of the idea of a Scintilla-based Python shell.  Then the PythonCard
 
 693 project got to the point where they were talking about including a
 
 694 shell in their development environment.  That was all the incentive I
 
 695 needed.  PyCrust had to happen...