diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-24 23:12:47 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-24 23:12:47 (GMT) |
commit | 3c9e7d800919ed8772c791cf6559fb27b6901e14 (patch) | |
tree | 06103dcfa16b13033c289b768700773e3897f350 /Mac | |
parent | f518d6b161fe105a2b342bc5ee3a2a5e5274b1eb (diff) | |
download | cpython-3c9e7d800919ed8772c791cf6559fb27b6901e14.zip cpython-3c9e7d800919ed8772c791cf6559fb27b6901e14.tar.gz cpython-3c9e7d800919ed8772c791cf6559fb27b6901e14.tar.bz2 |
Backport of 1.9-1.11:
- Flush screen buffer upon console.flush() and output.flush().
This fixes bug #511992.
- Changes by Donovan Preston (and a few minor ones by me) to make IDE run under
MachoPython. Mainly making sure we don't call routines that don't exist
and representing pathnames in a os.separator-neutral format.
These shouldn't interfere too much with Just's work on the next generation IDE,
I hope.
- Modified version of patch #496882: echo SimpleStdin readline()
input to stdout.
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Tools/IDE/PyConsole.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Mac/Tools/IDE/PyConsole.py b/Mac/Tools/IDE/PyConsole.py index 2bb109d..23f301b 100644 --- a/Mac/Tools/IDE/PyConsole.py +++ b/Mac/Tools/IDE/PyConsole.py @@ -75,9 +75,11 @@ class ConsoleTextWidget(W.EditText): if char == Wkeys.returnkey: text = self.get()[self._inputstart:selstart] text = string.join(string.split(text, "\r"), "\n") - saveyield = MacOS.EnableAppswitch(0) + if hasattr(MacOS, 'EnableAppswitch'): + saveyield = MacOS.EnableAppswitch(0) self.pyinteractive.executeline(text, self, self._namespace) - MacOS.EnableAppswitch(saveyield) + if hasattr(MacOS, 'EnableAppswitch'): + MacOS.EnableAppswitch(saveyield) selstart, selend = self.getselection() self._inputstart = selstart @@ -106,6 +108,8 @@ class ConsoleTextWidget(W.EditText): self._buf = "" self.ted.WEClearUndo() self.updatescrollbars() + if Qd.QDIsPortBuffered(self._parentwindow.wid): + Qd.QDFlushPortBuffer(self._parentwindow.wid, None) def selection_ok(self): selstart, selend = self.getselection() @@ -275,13 +279,15 @@ class PyOutput: self.w.bind("<activate>", self.activate) def write(self, text): - oldyield = MacOS.EnableAppswitch(-1) + if hasattr(MacOS, 'EnableAppswitch'): + oldyield = MacOS.EnableAppswitch(-1) try: self._buf = self._buf + text if '\n' in self._buf: self.flush() finally: - MacOS.EnableAppswitch(oldyield) + if hasattr(MacOS, 'EnableAppswitch'): + MacOS.EnableAppswitch(oldyield) def flush(self): self.show() @@ -294,6 +300,8 @@ class PyOutput: self._buf = "" self.w.outputtext.updatescrollbars() self.w.outputtext.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 1) + if Qd.QDIsPortBuffered(self.w.wid): + Qd.QDFlushPortBuffer(self.w.wid, None) def show(self): if self.closed: @@ -354,7 +362,9 @@ class SimpleStdin: rv = EasyDialogs.AskString(prompt) if rv is None: return "" - return rv + '\n' + rv = rv + "\n" # readline should include line terminator + sys.stdout.write(rv) # echo user's reply + return rv def installconsole(defaultshow = 1): |