Thank you for the reply.
The problem can be reproduced in PyShell.
I am using wxpython of version 2.7.1 on windows with python2.5.
In one of our GUI application I am using shell.py module of wx.py package
for having interactive window in wx.panel just like how shell.py used in
PyShell.py.
Following is the code.
class ConsolePanel(wx.Panel):
def _init_ctrls(self,prnt,size):
wx.Panel.__init__(self, style=wx.TAB_TRAVERSAL, name='',
parent=prnt, id=wxID_WXCONSOLEPANEL,size =prnt.GetClientSize())
wx.EVT_SIZE(self, self.OnSize)
def __init__(self, parent,size):
self._init_ctrls(parent,size)
self.shell = Shell (parent=self, introText='',pos =
parent.GetClientAreaOrigin(),
size= size,
locals=None,
InterpClass=None,
startupScript=None,
execStartupScript=True)
With the above code I am able to create interactive window.
When I right click on the interactive window, popup menu is showing up and
when I want to cut/delete of history/commands by selecting the same in the
popup menu all history is getting deleted/copied to clipboard and the editor
is becoming blank and not allowing doing anything after that. Prompt is not
shown even after pressing return key. Interactive window will become
operational only after paste/undo the above corresponding operations.
This you can see by running PyShell.py of wx.py package. In that interactive
window, in the popupmenu select all and then select selectall , after that
the editor will become blank and no the operatopn is allowed till either you
do a undo or paste.
This I am comparing with the functionality of pythonwin.exe
interactive window.
I think I've recreated the problem you're talking about here, although
my symptoms don't exactly match yours. I'll rephrase:
cut & paste operations from the context menu act on the entire pyshell
buffer, which can put the input into an invalid state where you can't
type any longer.
Steps to recreate:
1. Open a pyshell and enter a few lines from a session. For example:
10+10
20
1+1
2
2. Select a line of text in the buffer, that includes a prompt. In the
example above, selecting ">>> 10+10" qualifies.
3. Note that you can't type over the selection, and that the paste &
cut commands are disabled in the edit menu.
4. Right click to open the context menu and note that you *can* cut &
paste. If you do so, you will delete the ">>>" prompt in the
backbuffer. Once you've done so, you won't be able to enter input at
the "correct" prompt until you undo the edit. There's some fine line
where you can cut & paste in the backbuffer without affecting the
operation of the shell (after the first non-prompt character in a
line, it seems), but I don't think thats important for fixing it.
2 options for fixing, I'd like feedback on what should be done:
1. I believe that pyshell is using the default context menu for
scintilla. Replacing it with a custom one (as most scintilla based
editors do anyway) would let us redirect the edit menu options through
our own machinery and make the problem go away.
2. Try to make sure that we hook the edit operations to obey the
readonly restrictions on the control.
The second option may be more difficult (I haven't looked at the
code), and I'm not sure if there's any gain. I suppose there might be
an effect with rich input keyboards, or non-keyboard inputs used by
disabled readers, or perhaps on other platforms (this is only tested
under windows, although I'd guess it applies to all platforms).
···
On 6/18/07, Madhubala <madhubalav@infotechsw.com> wrote: