RE: [PyCrust] bug in OnKeyDown
Brought to you by:
pobrien
From: Patrick K. O'B. <po...@or...> - 2002-05-29 16:22:26
|
[Raul Cota] > > One thing I didn't like from pyCrust was that I couldnt do the following > in a line of code: > shift+home+backspace to delete a whole line Right now the Escape key will clear everything back to the last ps1 prompt. I'll look into supporting shift+home+backspace or adding the patch you give below. > The reason is that the backspace doesn't get processed if the cursor is > at the beginning of the line. When I went to the code to adapt it to my > needs I realized that the following gets processed without problems: > > >>> t = 6 > >>> r = 5 > >>> y > > If I select with the mouse from the "t" to the end of the "y" and then I > press whatever key (backspace, delete, etcetera) all the code up to the > "t" gets deleted, because after the selection, the cursor is in a valid > position (right after the "y"). And of course a nice crash occurs right > after. This is a bug in PyCrust. It should not allow you to delete any complete commands that have been sent to the interpreter, except by using shell.clear() to clear the screen. > This is how I fixed it for myself: I like when bugs come with a fix. Thanks. ;-) [fix snipped] > It seems to work fine but perhaps there are few redundant "if" > comparisons. Thanks a lot. I'll take a look at this when I've got some free time. > BTW: I'm not sure what's going on here.... > if I run this > sys.stdin.readline() > > I get a dialog box requesting an input line. Where does it come from??? > the wxStyledTextCtrl?? shell.py redefines stdin as: def readIn(self): """Replacement for stdin.""" prompt = 'Please enter your response:' dialog = wxTextEntryDialog(None, prompt, \ 'Input Dialog (Standard)', '') try: if dialog.ShowModal() == wxID_OK: text = dialog.GetValue() self.write(text + os.linesep) return text finally: dialog.Destroy() return '' > The reason is that I have some code that works like this: > interface.ProcessCommandStream(stdin, stdout, stdout) > > how do I call it, by keeping the wxStyledTestCtrl as stdin?? That should still work. But having the shell's wxSTC as stdin is not available at this point. Boa does it that way and at some point I'll add that option as well. Does the current dialog box for input not work for you for some reason? --- Patrick K. O'Brien Orbtech |