[wxPython] PyCrust: colours and other remarks

Py 2.2, wxPy 2.3.3pre3, win98SE

About colours in PyCrust

Patrick wrote:
How important is this feature to you, Jean-Michel? I originally postponed
attempting it after Neil said it wouldn't be easy, way back when I first
started working on PyCrust. And now I've gotten so used to the way it
currently works I hardly notice that the output and error messages don't
have their own color scheme. So I'm just curious about how important this

is

for you and why. And while I'm asking, are there any other features you'd
like to see?

Some random remarks:

- First of all, PyCrust is excellent (*****).
- I'm developping using SciTE as editor. But sometimes, I need 'IDLE' for
short python tests; that why I'am mainly using PyShellApp and not PyCrust.
- Just for fun, I changed the colours in shell.py in order to have the same
colours as in IDLE. It is only when I tested my changes, that I realized
the output messages of IDLE were in blue. I found this feature nice, so I
tried to do the same within shell.py. That's the story. But, to answer your
question, I will say this point is not important to me. I don't thing a
'formatter' (pythonwin) is necessary. It just make the code heavier for a
very small gain. I can live with the python lexer.
- I'm happy to see the sys.ps2 prompt is alive in PyCrust.
- I'm happy too, the tabs are replaced by spaces (Guido's style guide).
Thanks to the SetTabWidth(4) and SetUseTabs(0) methods.
- input() and raw_input() use a wxTextEntryDialogs for an user input.
PyCrust beeing a command line shell, inputs are best read from the stc
control instead of coming from a dialog box. I find the boa approach using
a '<<<' prompt better. For those who prefer a dialog box, the shell.ask()
is ready. Dialog boxes are inadequate for commands like >>> help() or >>>
license().
- As a (wx)Python guru, I guess your are not using the 'show auto
completion' too much. If the 'show auto completion' is on, selecting an item
from the completion list using a cr raises a syntax error. Selecting an
item with the mouse works fine. I think using the keyboard in much more
practical than using the mouse. I don't know if this is a PyCrust or a
scintilla problem, but this should be fixed.
- A menu option you may add, line wrapping. It may be usefull for commands
like >>> sys.path or >>> a = range(100); print a . Of course, you may use
the horizontal scrollbar the see the result, but i think line wrapping is is
better. You have instantaneously the output under your eyes and scrolling a
long horizontal line is slow.
  Now I know scitilla a little more, I tested something like
self.SetWrapMode(wxSTC_WRAP_WORD). Infortunately, this is not working
perfectly. Indeed, the lines are wrapped correctly, but after a long output
the shell prompt >>> is no more visible. EnsureCaretVisible() from the
method prompt does not help. Only after a key strike, the prompt become
visilble. I tried different things to force the vertical scrollbar to go to
the bottom, but without success. (By the way, a question, is there in
wxPython something like the vb SendKeys command?)
- I download the latest vesion from CVS before reporting this. Brace
highlighting is great.
- I dont mind you can not edit and save data within PyCrust. PyCrust is an
interactive shell and must remain an interactive shell.
- Finally, I want to mention a point that is a bit apart from the PyCrust
code. Provide a PyCrust.exe for windows users. Why?
  Two weeks ago, I visited my brother that works at the European
Synchrotron Radiation Facility, Grenoble, France. With him and some other
scientists, we were discussing about programming languages. I convince them
to test python. But, what is the best way to learn python? The interactive
interpreter, IDLE. Why do not give PyCrust (PyShellApp) a chance? These
people are interesting in numerical computation not in GUI
application. There will not download wxPython to get PyCrust, but the will
find an interest in PyCrust (PyShellApp).
- PyCrust will be a very good visiting-card for wxPython.

  I hope I have satisfied your curiosity.
  Regards
  Jean-Michel Fauth, Switzerland

Jean-Michel Fauth:

- As a (wx)Python guru, I guess your are not using the 'show auto
completion' too much. If the 'show auto completion' is on, selecting an

item

from the completion list using a cr raises a syntax error. Selecting an
item with the mouse works fine. I think using the keyboard in much more
practical than using the mouse. I don't know if this is a PyCrust or a
scintilla problem, but this should be fixed.

   You should be able to use Tab to select an item from autocompletion.

   Neil

[Jean-Michel Fauth]

- I'm happy to see the sys.ps2 prompt is alive in PyCrust.

I'm thinking about making prompts go away in a future version (to be
replaced by a different visual indicator that isn't text-based). Before I do
that can you tell me what you use sys.ps2 for?

- input() and raw_input() use a wxTextEntryDialogs for an user input.
PyCrust beeing a command line shell, inputs are best read from the stc
control instead of coming from a dialog box. I find the boa
approach using
a '<<<' prompt better. For those who prefer a dialog box, the shell.ask()
is ready. Dialog boxes are inadequate for commands like >>> help() or >>>
license().

I can understand liking the command-line approach better. I decided to try
dialog boxes for a number of reasons. But one day I'll probably add a
command-line option as well. In the mean time, however, the dialogs should
work. I can do >>> help() stuff just fine. In what way do you find the
dialogs inadequate?

- As a (wx)Python guru, I guess your are not using the 'show auto
completion' too much.

Thanks for the compliment, but don't be fooled - I use PyCrust almost every
day and definitely with auto completion turned on. I like having everything
at my fingertips. That's why I wrote PyCrust in the first place. <wink>

If the 'show auto completion' is on,
selecting an item
from the completion list using a cr raises a syntax error.

Half true. Using Return or Enter completes the line without selecting
anything from the auto complete list. If the line that you have typed is
invalid Python code then you'll see a syntax error. You need to use the tab
key to select an item from the list. I think this falls into the
ItsNotaBugItsaFeature category.

Selecting an
item with the mouse works fine. I think using the keyboard in much more
practical than using the mouse. I don't know if this is a PyCrust or a
scintilla problem, but this should be fixed.

Tab is your friend. :wink:

- A menu option you may add, line wrapping. It may be usefull for
commands
like >>> sys.path or >>> a = range(100); print a . Of course, you may use
the horizontal scrollbar the see the result, but i think line
wrapping is is
better. You have instantaneously the output under your eyes and
scrolling a
long horizontal line is slow.

I don't disagree. In fact, I agree completely. When Neil says the Scintilla
wrapping is solid I'll do something with it.

  Now I know scitilla a little more, I tested something like
self.SetWrapMode(wxSTC_WRAP_WORD). Infortunately, this is not working
perfectly. Indeed, the lines are wrapped correctly, but after a
long output
the shell prompt >>> is no more visible. EnsureCaretVisible() from the
method prompt does not help. Only after a key strike, the prompt become
visilble. I tried different things to force the vertical
scrollbar to go to
the bottom, but without success.

If you can get it to work I'll gladly take a patch.

(By the way, a question, is there in
wxPython something like the vb SendKeys command?)

Not sure. What exactly do you want to accomplish?

- I download the latest vesion from CVS before reporting this. Brace
highlighting is great.
- I dont mind you can not edit and save data within PyCrust. PyCrust is an
interactive shell and must remain an interactive shell.

True. But cut/paste/smart-cut/smart-paste go a long way. For example, you
can copy an entire class definition from a python module and paste it into
PyCrust using Ctrl-Shift-V and all the lines will get executed. Now you can
create instances and play with them in the shell, or recall the class
definition from the command history and modify it. Once you have it working,
select it and copy it back to your module.

Try >>> shell.help() in PyCrust to see a list of key bindings.

- Finally, I want to mention a point that is a bit apart from the PyCrust
code. Provide a PyCrust.exe for windows users. Why?
  Two weeks ago, I visited my brother that works at the European
Synchrotron Radiation Facility, Grenoble, France. With him and some other
scientists, we were discussing about programming languages. I
convince them
to test python. But, what is the best way to learn python? The interactive
interpreter, IDLE. Why do not give PyCrust (PyShellApp) a chance? These
people are interesting in numerical computation not in GUI
application. There will not download wxPython to get PyCrust, but the will
find an interest in PyCrust (PyShellApp).
- PyCrust will be a very good visiting-card for wxPython.

That's nice of you to say. Unfortunately, with the limited time I have
available packaging an exe is not high on my list at this point. But some
day...

  I hope I have satisfied your curiosity.

You have. Thank you for the feedback, it is much appreciated.

···

---
Patrick K. O'Brien
Orbtech

Patrick K. O'Brien:

I don't disagree. In fact, I agree completely. When Neil says the

Scintilla

wrapping is solid I'll do something with it.

   Its solid enough in Scintilla 1.46 (it was probably just as good in
1.45 - can't recall) but it will always have lower performance than not
wrapping, especially in a shell where the user can easily write code that
performs a lot of output, perhaps accidentally
for i in range(1000000): print i,

   It would be best to include it as an option so the user can avoid it if
it is perfoming too slowly.

   I have been surprised that no one has yet asked for more visual
indication of wrapped lines. If you use line numbers then only the first
display line of a document line has a line number but other editors provide
more indication such as the (fairly ugly) curly arrows used in the GTK+ text
widget.

   So, when wxSTC is based on at least Scintilla 1.45, add an option to
allow wrapping.

   Neil

   So, when wxSTC is based on at least Scintilla 1.45, add an option to
allow wrapping.

wxPython 2.3.3 has 1.45.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

> So, when wxSTC is based on at least Scintilla 1.45, add an option to
> allow wrapping.
>

wxPython 2.3.3 has 1.45.

   Today I noticed a problem with wrapping on GTK+ not always occurring so
should probably take back my statement that its solid enough.

   Neil

···

From: "Robin Dunn" <robin@alldunn.com>