]> granicus.if.org Git - python/commitdiff
SF 748975 Printing unsaved shell fails
authorKurt B. Kaiser <kbk@shore.net>
Mon, 9 Jun 2003 03:12:42 +0000 (03:12 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Mon, 9 Jun 2003 03:12:42 +0000 (03:12 +0000)
M IOBinding.py

Lib/idlelib/IOBinding.py

index e2077500c1bf76421c9e308e47a82c01c69e6f11..0cc9a5f5a682d2ab4015516cf22a2f0e2c375d3c 100644 (file)
@@ -459,9 +459,12 @@ class IOBinding:
 
     def print_window(self, event):
         tempfilename = None
-        if self.get_saved():
+        saved = self.get_saved()
+        if saved:
             filename = self.filename
-        else:
+        # shell undo is reset after every prompt, looks saved, probably isn't
+        if not saved or filename is None:
+            # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save?
             filename = tempfilename = tempfile.mktemp()
             if not self.writefile(filename):
                 os.unlink(tempfilename)
@@ -479,6 +482,7 @@ class IOBinding:
         if printPlatform:  #we can try to print for this platform
             command = command % filename
             pipe = os.popen(command, "r")
+            # things can get ugly on NT if there is no printer available.
             output = pipe.read().strip()
             status = pipe.close()
             if status: