[Python-checkins] r74325 - python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py

guilherme.polo python-checkins at python.org
Thu Aug 6 01:56:54 CEST 2009


Author: guilherme.polo
Date: Thu Aug 6 01:56:54 2009
New Revision: 74325
Log:
Blink the PyShell window the first time something is written to stderr (this is reset when shell restarts).
Modified:
 python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py
Modified: python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py
==============================================================================
--- python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py	(original)
+++ python/branches/tk_and_idle_maintenance/Lib/idlelib/PyShell.py	Thu Aug 6 01:56:54 2009
@@ -843,7 +843,7 @@
 self.save_stdin = sys.stdin
 import IOBinding
 self.stdout = PseudoFile(self, "stdout", IOBinding.encoding)
- self.stderr = PseudoFile(self, "stderr", IOBinding.encoding)
+ self.stderr = PseudoStderrFile(self, encoding=IOBinding.encoding)
 self.console = PseudoFile(self, "console", IOBinding.encoding)
 if not use_subprocess:
 sys.stdout = self.stdout
@@ -1187,6 +1187,7 @@
 self.text.see("restart")
 
 def restart_shell(self, event=None):
+ self.stderr.signaled = False
 self.interp.restart_subprocess()
 
 def showprompt(self):
@@ -1242,6 +1243,16 @@
 def isatty(self):
 return True
 
+class PseudoStderrFile(PseudoFile):
+ def __init__(self, shell, tags="stderr", encoding=None):
+ PseudoFile.__init__(self, shell, tags, encoding)
+ self.signaled = False
+
+ def write(self, s):
+ if not self.signaled:
+ self.shell.top.wakeup()
+ self.signaled = True
+ PseudoFile.write(self, s)
 
 usage_msg = """\
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /