mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #25173: Replace 'master' with 'parent' in tkinter.messagebox calls.
This associates the message box with the widget and is better for Mac OSX. Patch by Mark Roseman.
This commit is contained in:
		
							parent
							
								
									cbe16aefb8
								
							
						
					
					
						commit
						3be2e54adc
					
				
					 5 changed files with 20 additions and 20 deletions
				
			
		|  | @ -217,7 +217,7 @@ def loadfile(self, filename): | |||
|                 f.seek(0) | ||||
|                 bytes = f.read() | ||||
|         except OSError as msg: | ||||
|             tkMessageBox.showerror("I/O Error", str(msg), master=self.text) | ||||
|             tkMessageBox.showerror("I/O Error", str(msg), parent=self.text) | ||||
|             return False | ||||
|         chars, converted = self._decode(two_lines, bytes) | ||||
|         if chars is None: | ||||
|  | @ -266,7 +266,7 @@ def _decode(self, two_lines, bytes): | |||
|                 title="Error loading the file", | ||||
|                 message="The encoding '%s' is not known to this Python "\ | ||||
|                 "installation. The file may not display correctly" % name, | ||||
|                 master = self.text) | ||||
|                 parent = self.text) | ||||
|             enc = None | ||||
|         except UnicodeDecodeError: | ||||
|             return None, False | ||||
|  | @ -321,7 +321,7 @@ def maybesave(self): | |||
|                   title="Save On Close", | ||||
|                   message=message, | ||||
|                   default=tkMessageBox.YES, | ||||
|                   master=self.text) | ||||
|                   parent=self.text) | ||||
|         if confirm: | ||||
|             reply = "yes" | ||||
|             self.save(None) | ||||
|  | @ -381,7 +381,7 @@ def writefile(self, filename): | |||
|             return True | ||||
|         except OSError as msg: | ||||
|             tkMessageBox.showerror("I/O Error", str(msg), | ||||
|                                    master=self.text) | ||||
|                                    parent=self.text) | ||||
|             return False | ||||
| 
 | ||||
|     def encode(self, chars): | ||||
|  | @ -418,7 +418,7 @@ def encode(self, chars): | |||
|         tkMessageBox.showerror( | ||||
|             "I/O Error", | ||||
|             "%s.\nSaving as UTF-8" % failed, | ||||
|             master = self.text) | ||||
|             parent = self.text) | ||||
|         # Fallback: save as UTF-8, with BOM - ignoring the incorrect | ||||
|         # declared encoding | ||||
|         return BOM_UTF8 + chars.encode("utf-8") | ||||
|  | @ -433,7 +433,7 @@ def print_window(self, event): | |||
|                   title="Print", | ||||
|                   message="Print to Default Printer", | ||||
|                   default=tkMessageBox.OK, | ||||
|                   master=self.text) | ||||
|                   parent=self.text) | ||||
|         if not confirm: | ||||
|             self.text.focus_set() | ||||
|             return "break" | ||||
|  | @ -470,10 +470,10 @@ def print_window(self, event): | |||
|                          status + output | ||||
|             if output: | ||||
|                 output = "Printing command: %s\n" % repr(command) + output | ||||
|                 tkMessageBox.showerror("Print status", output, master=self.text) | ||||
|                 tkMessageBox.showerror("Print status", output, parent=self.text) | ||||
|         else:  #no printing for this platform | ||||
|             message = "Printing is not enabled for this platform: %s" % platform | ||||
|             tkMessageBox.showinfo("Print status", message, master=self.text) | ||||
|             tkMessageBox.showinfo("Print status", message, parent=self.text) | ||||
|         if tempfilename: | ||||
|             os.unlink(tempfilename) | ||||
|         return "break" | ||||
|  | @ -492,7 +492,7 @@ def print_window(self, event): | |||
|     def askopenfile(self): | ||||
|         dir, base = self.defaultfilename("open") | ||||
|         if not self.opendialog: | ||||
|             self.opendialog = tkFileDialog.Open(master=self.text, | ||||
|             self.opendialog = tkFileDialog.Open(parent=self.text, | ||||
|                                                 filetypes=self.filetypes) | ||||
|         filename = self.opendialog.show(initialdir=dir, initialfile=base) | ||||
|         return filename | ||||
|  | @ -513,7 +513,7 @@ def asksavefile(self): | |||
|         dir, base = self.defaultfilename("save") | ||||
|         if not self.savedialog: | ||||
|             self.savedialog = tkFileDialog.SaveAs( | ||||
|                     master=self.text, | ||||
|                     parent=self.text, | ||||
|                     filetypes=self.filetypes, | ||||
|                     defaultextension=self.defaultextension) | ||||
|         filename = self.savedialog.show(initialdir=dir, initialfile=base) | ||||
|  |  | |||
|  | @ -91,7 +91,7 @@ def goto_file_line(self, event=None): | |||
|                     "No special line", | ||||
|                     "The line you point at doesn't look like " | ||||
|                     "a valid file name followed by a line number.", | ||||
|                     master=self.text) | ||||
|                     parent=self.text) | ||||
|                 return | ||||
|         filename, lineno = result | ||||
|         edit = self.flist.open(filename) | ||||
|  |  | |||
|  | @ -774,7 +774,7 @@ def runcode(self, code): | |||
|                     "Exit?", | ||||
|                     "Do you want to exit altogether?", | ||||
|                     default="yes", | ||||
|                     master=self.tkconsole.text): | ||||
|                     parent=self.tkconsole.text): | ||||
|                     raise | ||||
|                 else: | ||||
|                     self.showtraceback() | ||||
|  | @ -812,7 +812,7 @@ def display_port_binding_error(self): | |||
|             "Run IDLE with the -n command line switch to start without a " | ||||
|             "subprocess and refer to Help/IDLE Help 'Running without a " | ||||
|             "subprocess' for further details.", | ||||
|             master=self.tkconsole.text) | ||||
|             parent=self.tkconsole.text) | ||||
| 
 | ||||
|     def display_no_subprocess_error(self): | ||||
|         tkMessageBox.showerror( | ||||
|  | @ -820,14 +820,14 @@ def display_no_subprocess_error(self): | |||
|             "IDLE's subprocess didn't make connection.  Either IDLE can't " | ||||
|             "start a subprocess or personal firewall software is blocking " | ||||
|             "the connection.", | ||||
|             master=self.tkconsole.text) | ||||
|             parent=self.tkconsole.text) | ||||
| 
 | ||||
|     def display_executing_dialog(self): | ||||
|         tkMessageBox.showerror( | ||||
|             "Already executing", | ||||
|             "The Python Shell window is already executing a command; " | ||||
|             "please wait until it is finished.", | ||||
|             master=self.tkconsole.text) | ||||
|             parent=self.tkconsole.text) | ||||
| 
 | ||||
| 
 | ||||
| class PyShell(OutputWindow): | ||||
|  | @ -931,7 +931,7 @@ def toggle_debugger(self, event=None): | |||
|         if self.executing: | ||||
|             tkMessageBox.showerror("Don't debug now", | ||||
|                 "You can only toggle the debugger when idle", | ||||
|                 master=self.text) | ||||
|                 parent=self.text) | ||||
|             self.set_debugger_indicator() | ||||
|             return "break" | ||||
|         else: | ||||
|  | @ -1239,7 +1239,7 @@ def open_stack_viewer(self, event=None): | |||
|             tkMessageBox.showerror("No stack trace", | ||||
|                 "There is no stack trace yet.\n" | ||||
|                 "(sys.last_traceback is not defined)", | ||||
|                 master=self.text) | ||||
|                 parent=self.text) | ||||
|             return | ||||
|         from idlelib.StackViewer import StackBrowser | ||||
|         StackBrowser(self.root, self.flist) | ||||
|  |  | |||
|  | @ -197,10 +197,10 @@ def ask_save_dialog(self): | |||
|         confirm = tkMessageBox.askokcancel(title="Save Before Run or Check", | ||||
|                                            message=msg, | ||||
|                                            default=tkMessageBox.OK, | ||||
|                                            master=self.editwin.text) | ||||
|                                            parent=self.editwin.text) | ||||
|         return confirm | ||||
| 
 | ||||
|     def errorbox(self, title, message): | ||||
|         # XXX This should really be a function of EditorWindow... | ||||
|         tkMessageBox.showerror(title, message, master=self.editwin.text) | ||||
|         tkMessageBox.showerror(title, message, parent=self.editwin.text) | ||||
|         self.editwin.text.focus_set() | ||||
|  |  | |||
|  | @ -174,7 +174,7 @@ def show_socket_error(err, address): | |||
|         tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root) | ||||
|     else: | ||||
|         tkMessageBox.showerror("IDLE Subprocess Error", | ||||
|                                "Socket Error: %s" % err.args[1]) | ||||
|                                "Socket Error: %s" % err.args[1], parent=root) | ||||
|     root.destroy() | ||||
| 
 | ||||
| def print_exception(): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Terry Jan Reedy
						Terry Jan Reedy