| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # The options of a widget are described by the following attributes | 
					
						
							|  |  |  | # of the Pack and Widget dialogs: | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Dialog.current: {name: value} | 
					
						
							|  |  |  | # -- changes during Widget's lifetime | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Dialog.options: {name: (default, klass)} | 
					
						
							|  |  |  | # -- depends on widget class only | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Dialog.classes: {klass: (v0, v1, v2, ...) | 'boolean' | 'other'} | 
					
						
							|  |  |  | # -- totally static, though different between PackDialog and WidgetDialog | 
					
						
							|  |  |  | #    (but even that could be unified) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-04 18:53:28 +00:00
										 |  |  | from tkinter import * | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | class Option: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     varclass = StringVar            # May be overridden | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __init__(self, dialog, option): | 
					
						
							|  |  |  |         self.dialog = dialog | 
					
						
							|  |  |  |         self.option = option | 
					
						
							|  |  |  |         self.master = dialog.top | 
					
						
							|  |  |  |         self.default, self.klass = dialog.options[option] | 
					
						
							|  |  |  |         self.var = self.varclass(self.master) | 
					
						
							|  |  |  |         self.frame = Frame(self.master) | 
					
						
							|  |  |  |         self.frame.pack(fill=X) | 
					
						
							|  |  |  |         self.label = Label(self.frame, text=(option + ":")) | 
					
						
							|  |  |  |         self.label.pack(side=LEFT) | 
					
						
							|  |  |  |         self.update() | 
					
						
							|  |  |  |         self.addoption() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): | 
					
						
							|  |  |  |         self.dialog.refresh() | 
					
						
							|  |  |  |         self.update() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def update(self): | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             self.current = self.dialog.current[self.option] | 
					
						
							|  |  |  |         except KeyError: | 
					
						
							|  |  |  |             self.current = self.default | 
					
						
							|  |  |  |         self.var.set(self.current) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def set(self, e=None):          # Should be overridden | 
					
						
							|  |  |  |         pass | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | class BooleanOption(Option): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     varclass = BooleanVar | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def addoption(self): | 
					
						
							|  |  |  |         self.button = Checkbutton(self.frame, | 
					
						
							|  |  |  |                                  text='on/off', | 
					
						
							|  |  |  |                                  onvalue=1, | 
					
						
							|  |  |  |                                  offvalue=0, | 
					
						
							|  |  |  |                                  variable=self.var, | 
					
						
							|  |  |  |                                  relief=RAISED, | 
					
						
							|  |  |  |                                  borderwidth=2, | 
					
						
							|  |  |  |                                  command=self.set) | 
					
						
							|  |  |  |         self.button.pack(side=RIGHT) | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | class EnumOption(Option): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def addoption(self): | 
					
						
							|  |  |  |         self.button = Menubutton(self.frame, | 
					
						
							|  |  |  |                                  textvariable=self.var, | 
					
						
							|  |  |  |                                  relief=RAISED, borderwidth=2) | 
					
						
							|  |  |  |         self.button.pack(side=RIGHT) | 
					
						
							|  |  |  |         self.menu = Menu(self.button) | 
					
						
							|  |  |  |         self.button['menu'] = self.menu | 
					
						
							|  |  |  |         for v in self.dialog.classes[self.klass]: | 
					
						
							|  |  |  |             self.menu.add_radiobutton( | 
					
						
							|  |  |  |                 label=v, | 
					
						
							|  |  |  |                 variable=self.var, | 
					
						
							|  |  |  |                 value=v, | 
					
						
							|  |  |  |                 command=self.set) | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | class StringOption(Option): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def addoption(self): | 
					
						
							|  |  |  |         self.entry = Entry(self.frame, | 
					
						
							|  |  |  |                            textvariable=self.var, | 
					
						
							|  |  |  |                            width=10, | 
					
						
							|  |  |  |                            relief=SUNKEN, | 
					
						
							|  |  |  |                            borderwidth=2) | 
					
						
							|  |  |  |         self.entry.pack(side=RIGHT, fill=X, expand=1) | 
					
						
							|  |  |  |         self.entry.bind('<Return>', self.set) | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | class ReadonlyOption(Option): | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def addoption(self): | 
					
						
							|  |  |  |         self.label = Label(self.frame, textvariable=self.var, | 
					
						
							|  |  |  |                            anchor=E) | 
					
						
							|  |  |  |         self.label.pack(side=RIGHT) | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | class Dialog: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def __init__(self, master): | 
					
						
							|  |  |  |         self.master = master | 
					
						
							|  |  |  |         self.fixclasses() | 
					
						
							|  |  |  |         self.refresh() | 
					
						
							|  |  |  |         self.top = Toplevel(self.master) | 
					
						
							|  |  |  |         self.top.title(self.__class__.__name__) | 
					
						
							|  |  |  |         self.top.minsize(1, 1) | 
					
						
							|  |  |  |         self.addchoices() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): pass         # Must override | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def fixclasses(self): pass      # May override | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def addchoices(self): | 
					
						
							|  |  |  |         self.choices = {} | 
					
						
							|  |  |  |         list = [] | 
					
						
							| 
									
										
										
										
											2007-08-06 21:07:53 +00:00
										 |  |  |         for k, dc in self.options.items(): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |             list.append((k, dc)) | 
					
						
							|  |  |  |         list.sort() | 
					
						
							|  |  |  |         for k, (d, c) in list: | 
					
						
							|  |  |  |             try: | 
					
						
							|  |  |  |                 cl = self.classes[c] | 
					
						
							|  |  |  |             except KeyError: | 
					
						
							|  |  |  |                 cl = 'unknown' | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  |             if type(cl) is tuple: | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                 cl = self.enumoption | 
					
						
							|  |  |  |             elif cl == 'boolean': | 
					
						
							|  |  |  |                 cl = self.booleanoption | 
					
						
							|  |  |  |             elif cl == 'readonly': | 
					
						
							|  |  |  |                 cl = self.readonlyoption | 
					
						
							|  |  |  |             else: | 
					
						
							|  |  |  |                 cl = self.stringoption | 
					
						
							|  |  |  |             self.choices[k] = cl(self, k) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Must override: | 
					
						
							|  |  |  |     options = {} | 
					
						
							|  |  |  |     classes = {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # May override: | 
					
						
							|  |  |  |     booleanoption = BooleanOption | 
					
						
							|  |  |  |     stringoption = StringOption | 
					
						
							|  |  |  |     enumoption = EnumOption | 
					
						
							|  |  |  |     readonlyoption = ReadonlyOption | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | class PackDialog(Dialog): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def __init__(self, widget): | 
					
						
							|  |  |  |         self.widget = widget | 
					
						
							|  |  |  |         Dialog.__init__(self, widget) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): | 
					
						
							|  |  |  |         self.current = self.widget.info() | 
					
						
							|  |  |  |         self.current['.class'] = self.widget.winfo_class() | 
					
						
							|  |  |  |         self.current['.name'] = self.widget._w | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class packoption: # Mix-in class | 
					
						
							|  |  |  |         def set(self, e=None): | 
					
						
							|  |  |  |             self.current = self.var.get() | 
					
						
							|  |  |  |             try: | 
					
						
							| 
									
										
										
										
											2006-03-17 08:00:19 +00:00
										 |  |  |                 self.dialog.widget.pack(**{self.option: self.current}) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |             except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |                 print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                 self.refresh() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class booleanoption(packoption, BooleanOption): pass | 
					
						
							|  |  |  |     class enumoption(packoption, EnumOption): pass | 
					
						
							|  |  |  |     class stringoption(packoption, StringOption): pass | 
					
						
							|  |  |  |     class readonlyoption(packoption, ReadonlyOption): pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |             '.class': (None, 'Class'), | 
					
						
							|  |  |  |             '.name': (None, 'Name'), | 
					
						
							|  |  |  |             'after': (None, 'Widget'), | 
					
						
							|  |  |  |             'anchor': ('center', 'Anchor'), | 
					
						
							|  |  |  |             'before': (None, 'Widget'), | 
					
						
							|  |  |  |             'expand': ('no', 'Boolean'), | 
					
						
							|  |  |  |             'fill': ('none', 'Fill'), | 
					
						
							|  |  |  |             'in': (None, 'Widget'), | 
					
						
							|  |  |  |             'ipadx': (0, 'Pad'), | 
					
						
							|  |  |  |             'ipady': (0, 'Pad'), | 
					
						
							|  |  |  |             'padx': (0, 'Pad'), | 
					
						
							|  |  |  |             'pady': (0, 'Pad'), | 
					
						
							|  |  |  |             'side': ('top', 'Side'), | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     classes = { | 
					
						
							|  |  |  |             'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER), | 
					
						
							|  |  |  |             'Boolean': 'boolean', | 
					
						
							|  |  |  |             'Class': 'readonly', | 
					
						
							|  |  |  |             'Expand': 'boolean', | 
					
						
							|  |  |  |             'Fill': (NONE, X, Y, BOTH), | 
					
						
							|  |  |  |             'Name': 'readonly', | 
					
						
							|  |  |  |             'Pad': 'pixel', | 
					
						
							|  |  |  |             'Side': (TOP, RIGHT, BOTTOM, LEFT), | 
					
						
							|  |  |  |             'Widget': 'readonly', | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | class RemotePackDialog(PackDialog): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def __init__(self, master, app, widget): | 
					
						
							|  |  |  |         self.master = master | 
					
						
							|  |  |  |         self.app = app | 
					
						
							|  |  |  |         self.widget = widget | 
					
						
							|  |  |  |         self.refresh() | 
					
						
							|  |  |  |         self.top = Toplevel(self.master) | 
					
						
							|  |  |  |         self.top.title(self.app + ' PackDialog') | 
					
						
							|  |  |  |         self.top.minsize(1, 1) | 
					
						
							|  |  |  |         self.addchoices() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             words = self.master.tk.splitlist( | 
					
						
							|  |  |  |                     self.master.send(self.app, | 
					
						
							|  |  |  |                                      'pack', | 
					
						
							|  |  |  |                                      'info', | 
					
						
							|  |  |  |                                      self.widget)) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |         except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |             print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |             return | 
					
						
							|  |  |  |         dict = {} | 
					
						
							|  |  |  |         for i in range(0, len(words), 2): | 
					
						
							|  |  |  |             key = words[i][1:] | 
					
						
							|  |  |  |             value = words[i+1] | 
					
						
							|  |  |  |             dict[key] = value | 
					
						
							|  |  |  |         dict['.class'] = self.master.send(self.app, | 
					
						
							|  |  |  |                                           'winfo', | 
					
						
							|  |  |  |                                           'class', | 
					
						
							|  |  |  |                                           self.widget) | 
					
						
							|  |  |  |         dict['.name'] = self.widget | 
					
						
							|  |  |  |         self.current = dict | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class remotepackoption: # Mix-in class | 
					
						
							|  |  |  |         def set(self, e=None): | 
					
						
							|  |  |  |             self.current = self.var.get() | 
					
						
							|  |  |  |             try: | 
					
						
							|  |  |  |                 self.dialog.master.send( | 
					
						
							|  |  |  |                         self.dialog.app, | 
					
						
							|  |  |  |                         'pack', | 
					
						
							|  |  |  |                         'config', | 
					
						
							|  |  |  |                         self.dialog.widget, | 
					
						
							|  |  |  |                         '-'+self.option, | 
					
						
							|  |  |  |                         self.dialog.master.tk.merge( | 
					
						
							|  |  |  |                                 self.current)) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |             except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |                 print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                 self.refresh() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class booleanoption(remotepackoption, BooleanOption): pass | 
					
						
							|  |  |  |     class enumoption(remotepackoption, EnumOption): pass | 
					
						
							|  |  |  |     class stringoption(remotepackoption, StringOption): pass | 
					
						
							|  |  |  |     class readonlyoption(remotepackoption, ReadonlyOption): pass | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 15:53:26 +00:00
										 |  |  | class WidgetDialog(Dialog): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def __init__(self, widget): | 
					
						
							|  |  |  |         self.widget = widget | 
					
						
							|  |  |  |         self.klass = widget.winfo_class() | 
					
						
							|  |  |  |         Dialog.__init__(self, widget) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def fixclasses(self): | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |         if self.klass in self.addclasses: | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |             classes = {} | 
					
						
							|  |  |  |             for c in (self.classes, | 
					
						
							|  |  |  |                       self.addclasses[self.klass]): | 
					
						
							| 
									
										
										
										
											2007-08-06 21:07:53 +00:00
										 |  |  |                 for k in c.keys(): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                     classes[k] = c[k] | 
					
						
							|  |  |  |             self.classes = classes | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): | 
					
						
							|  |  |  |         self.configuration = self.widget.config() | 
					
						
							|  |  |  |         self.update() | 
					
						
							|  |  |  |         self.current['.class'] = self.widget.winfo_class() | 
					
						
							|  |  |  |         self.current['.name'] = self.widget._w | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def update(self): | 
					
						
							|  |  |  |         self.current = {} | 
					
						
							|  |  |  |         self.options = {} | 
					
						
							| 
									
										
										
										
											2007-08-06 21:07:53 +00:00
										 |  |  |         for k, v in self.configuration.items(): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |             if len(v) > 4: | 
					
						
							|  |  |  |                 self.current[k] = v[4] | 
					
						
							|  |  |  |                 self.options[k] = v[3], v[2] # default, klass | 
					
						
							|  |  |  |         self.options['.class'] = (None, 'Class') | 
					
						
							|  |  |  |         self.options['.name'] = (None, 'Name') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class widgetoption: # Mix-in class | 
					
						
							|  |  |  |         def set(self, e=None): | 
					
						
							|  |  |  |             self.current = self.var.get() | 
					
						
							|  |  |  |             try: | 
					
						
							|  |  |  |                 self.dialog.widget[self.option] = self.current | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |             except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |                 print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                 self.refresh() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class booleanoption(widgetoption, BooleanOption): pass | 
					
						
							|  |  |  |     class enumoption(widgetoption, EnumOption): pass | 
					
						
							|  |  |  |     class stringoption(widgetoption, StringOption): pass | 
					
						
							|  |  |  |     class readonlyoption(widgetoption, ReadonlyOption): pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Universal classes | 
					
						
							|  |  |  |     classes = { | 
					
						
							|  |  |  |             'Anchor': (N, NE, E, SE, S, SW, W, NW, CENTER), | 
					
						
							|  |  |  |             'Aspect': 'integer', | 
					
						
							|  |  |  |             'Background': 'color', | 
					
						
							|  |  |  |             'Bitmap': 'bitmap', | 
					
						
							|  |  |  |             'BorderWidth': 'pixel', | 
					
						
							|  |  |  |             'Class': 'readonly', | 
					
						
							|  |  |  |             'CloseEnough': 'double', | 
					
						
							|  |  |  |             'Command': 'command', | 
					
						
							|  |  |  |             'Confine': 'boolean', | 
					
						
							|  |  |  |             'Cursor': 'cursor', | 
					
						
							|  |  |  |             'CursorWidth': 'pixel', | 
					
						
							|  |  |  |             'DisabledForeground': 'color', | 
					
						
							|  |  |  |             'ExportSelection': 'boolean', | 
					
						
							|  |  |  |             'Font': 'font', | 
					
						
							|  |  |  |             'Foreground': 'color', | 
					
						
							|  |  |  |             'From': 'integer', | 
					
						
							|  |  |  |             'Geometry': 'geometry', | 
					
						
							|  |  |  |             'Height': 'pixel', | 
					
						
							|  |  |  |             'InsertWidth': 'time', | 
					
						
							|  |  |  |             'Justify': (LEFT, CENTER, RIGHT), | 
					
						
							|  |  |  |             'Label': 'string', | 
					
						
							|  |  |  |             'Length': 'pixel', | 
					
						
							|  |  |  |             'MenuName': 'widget', | 
					
						
							|  |  |  |             'Name': 'readonly', | 
					
						
							|  |  |  |             'OffTime': 'time', | 
					
						
							|  |  |  |             'OnTime': 'time', | 
					
						
							|  |  |  |             'Orient': (HORIZONTAL, VERTICAL), | 
					
						
							|  |  |  |             'Pad': 'pixel', | 
					
						
							|  |  |  |             'Relief': (RAISED, SUNKEN, FLAT, RIDGE, GROOVE), | 
					
						
							|  |  |  |             'RepeatDelay': 'time', | 
					
						
							|  |  |  |             'RepeatInterval': 'time', | 
					
						
							|  |  |  |             'ScrollCommand': 'command', | 
					
						
							|  |  |  |             'ScrollIncrement': 'pixel', | 
					
						
							|  |  |  |             'ScrollRegion': 'rectangle', | 
					
						
							|  |  |  |             'ShowValue': 'boolean', | 
					
						
							|  |  |  |             'SetGrid': 'boolean', | 
					
						
							|  |  |  |             'Sliderforeground': 'color', | 
					
						
							|  |  |  |             'SliderLength': 'pixel', | 
					
						
							|  |  |  |             'Text': 'string', | 
					
						
							|  |  |  |             'TickInterval': 'integer', | 
					
						
							|  |  |  |             'To': 'integer', | 
					
						
							|  |  |  |             'Underline': 'index', | 
					
						
							|  |  |  |             'Variable': 'variable', | 
					
						
							|  |  |  |             'Value': 'string', | 
					
						
							|  |  |  |             'Width': 'pixel', | 
					
						
							|  |  |  |             'Wrap': (NONE, CHAR, WORD), | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Classes that (may) differ per widget type | 
					
						
							|  |  |  |     _tristate = {'State': (NORMAL, ACTIVE, DISABLED)} | 
					
						
							|  |  |  |     _bistate = {'State': (NORMAL, DISABLED)} | 
					
						
							|  |  |  |     addclasses = { | 
					
						
							|  |  |  |             'Button': _tristate, | 
					
						
							|  |  |  |             'Radiobutton': _tristate, | 
					
						
							|  |  |  |             'Checkbutton': _tristate, | 
					
						
							|  |  |  |             'Entry': _bistate, | 
					
						
							|  |  |  |             'Text': _bistate, | 
					
						
							|  |  |  |             'Menubutton': _tristate, | 
					
						
							|  |  |  |             'Slider': _bistate, | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											1994-07-12 16:37:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 16:37:21 +00:00
										 |  |  | class RemoteWidgetDialog(WidgetDialog): | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     def __init__(self, master, app, widget): | 
					
						
							|  |  |  |         self.app = app | 
					
						
							|  |  |  |         self.widget = widget | 
					
						
							|  |  |  |         self.klass = master.send(self.app, | 
					
						
							|  |  |  |                                  'winfo', | 
					
						
							|  |  |  |                                  'class', | 
					
						
							|  |  |  |                                  self.widget) | 
					
						
							|  |  |  |         Dialog.__init__(self, master) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def refresh(self): | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             items = self.master.tk.splitlist( | 
					
						
							|  |  |  |                     self.master.send(self.app, | 
					
						
							|  |  |  |                                      self.widget, | 
					
						
							|  |  |  |                                      'config')) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |         except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |             print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |             return | 
					
						
							|  |  |  |         dict = {} | 
					
						
							|  |  |  |         for item in items: | 
					
						
							|  |  |  |             words = self.master.tk.splitlist(item) | 
					
						
							|  |  |  |             key = words[0][1:] | 
					
						
							|  |  |  |             value = (key,) + words[1:] | 
					
						
							|  |  |  |             dict[key] = value | 
					
						
							|  |  |  |         self.configuration = dict | 
					
						
							|  |  |  |         self.update() | 
					
						
							|  |  |  |         self.current['.class'] = self.klass | 
					
						
							|  |  |  |         self.current['.name'] = self.widget | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class remotewidgetoption: # Mix-in class | 
					
						
							|  |  |  |         def set(self, e=None): | 
					
						
							|  |  |  |             self.current = self.var.get() | 
					
						
							|  |  |  |             try: | 
					
						
							|  |  |  |                 self.dialog.master.send( | 
					
						
							|  |  |  |                         self.dialog.app, | 
					
						
							|  |  |  |                         self.dialog.widget, | 
					
						
							|  |  |  |                         'config', | 
					
						
							|  |  |  |                         '-'+self.option, | 
					
						
							|  |  |  |                         self.current) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |             except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |                 print(msg) | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |                 self.refresh() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class booleanoption(remotewidgetoption, BooleanOption): pass | 
					
						
							|  |  |  |     class enumoption(remotewidgetoption, EnumOption): pass | 
					
						
							|  |  |  |     class stringoption(remotewidgetoption, StringOption): pass | 
					
						
							|  |  |  |     class readonlyoption(remotewidgetoption, ReadonlyOption): pass | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | def test(): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     import sys | 
					
						
							|  |  |  |     root = Tk() | 
					
						
							|  |  |  |     root.minsize(1, 1) | 
					
						
							|  |  |  |     if sys.argv[1:]: | 
					
						
							|  |  |  |         remotetest(root, sys.argv[1]) | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         frame = Frame(root, name='frame') | 
					
						
							|  |  |  |         frame.pack(expand=1, fill=BOTH) | 
					
						
							|  |  |  |         button = Button(frame, name='button', text='button') | 
					
						
							|  |  |  |         button.pack(expand=1) | 
					
						
							|  |  |  |         canvas = Canvas(frame, name='canvas') | 
					
						
							|  |  |  |         canvas.pack() | 
					
						
							|  |  |  |         fpd = PackDialog(frame) | 
					
						
							|  |  |  |         fwd = WidgetDialog(frame) | 
					
						
							|  |  |  |         bpd = PackDialog(button) | 
					
						
							|  |  |  |         bwd = WidgetDialog(button) | 
					
						
							|  |  |  |         cpd = PackDialog(canvas) | 
					
						
							|  |  |  |         cwd = WidgetDialog(canvas) | 
					
						
							|  |  |  |     root.mainloop() | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-13 12:56:10 +00:00
										 |  |  | def remotetest(root, app): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     from listtree import listtree | 
					
						
							|  |  |  |     list = listtree(root, app) | 
					
						
							|  |  |  |     list.bind('<Any-Double-1>', opendialogs) | 
					
						
							|  |  |  |     list.app = app                  # Pass it on to handler | 
					
						
							| 
									
										
										
										
											1994-07-13 12:56:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def opendialogs(e): | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |     list = e.widget | 
					
						
							|  |  |  |     sel = list.curselection() | 
					
						
							|  |  |  |     for i in sel: | 
					
						
							|  |  |  |         item = list.get(i) | 
					
						
							| 
									
										
											  
											
												Merged revisions 85820,85823,85825,85840,85843-85845,85849-85851,85855,85867,85875,85907-85908,85911,85914 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
........
  r85820 | georg.brandl | 2010-10-24 16:20:22 +0200 (So, 24 Okt 2010) | 1 line
  Remove usage of exception indexing.
........
  r85823 | georg.brandl | 2010-10-24 16:32:45 +0200 (So, 24 Okt 2010) | 1 line
  Fix style.
........
  r85825 | georg.brandl | 2010-10-24 17:16:02 +0200 (So, 24 Okt 2010) | 1 line
  Add documentation about the default warnings filters.
........
  r85840 | georg.brandl | 2010-10-25 19:50:20 +0200 (Mo, 25 Okt 2010) | 1 line
  #3018: tkinter demo fixes for py3k.
........
  r85843 | georg.brandl | 2010-10-26 08:59:23 +0200 (Di, 26 Okt 2010) | 1 line
  Markup fix.
........
  r85844 | georg.brandl | 2010-10-26 12:39:14 +0200 (Di, 26 Okt 2010) | 1 line
  Work a bit more on tkinter demos.
........
  r85845 | georg.brandl | 2010-10-26 12:42:16 +0200 (Di, 26 Okt 2010) | 1 line
  faqwiz is removed.
........
  r85849 | georg.brandl | 2010-10-26 21:31:06 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85850 | georg.brandl | 2010-10-26 21:58:11 +0200 (Di, 26 Okt 2010) | 1 line
  #10200: typo.
........
  r85851 | georg.brandl | 2010-10-26 22:12:37 +0200 (Di, 26 Okt 2010) | 1 line
  Fix import.
........
  r85855 | georg.brandl | 2010-10-27 09:21:54 +0200 (Mi, 27 Okt 2010) | 1 line
  Encoding fix.
........
  r85867 | georg.brandl | 2010-10-27 22:01:51 +0200 (Mi, 27 Okt 2010) | 1 line
  Add David.
........
  r85875 | georg.brandl | 2010-10-28 10:38:30 +0200 (Do, 28 Okt 2010) | 1 line
  Fix bytes/str issues in get-remote-certificate.py.
........
  r85907 | georg.brandl | 2010-10-29 06:54:13 +0200 (Fr, 29 Okt 2010) | 1 line
  #10222: fix for overzealous AIX compiler.
........
  r85908 | georg.brandl | 2010-10-29 07:22:17 +0200 (Fr, 29 Okt 2010) | 1 line
  send_bytes obviously needs bytes...
........
  r85911 | georg.brandl | 2010-10-29 07:36:28 +0200 (Fr, 29 Okt 2010) | 1 line
  Fix markup error and update false positive entries from "make suspicious".
........
  r85914 | georg.brandl | 2010-10-29 08:17:38 +0200 (Fr, 29 Okt 2010) | 1 line
  (?:...) is a non-capturing, but still grouping construct.
........
											
										 
											2010-11-26 08:59:40 +00:00
										 |  |  |         widget = item.split()[0] | 
					
						
							| 
									
										
										
										
											2004-07-18 06:16:08 +00:00
										 |  |  |         RemoteWidgetDialog(list, list.app, widget) | 
					
						
							|  |  |  |         if widget == '.': continue | 
					
						
							|  |  |  |         try: | 
					
						
							|  |  |  |             RemotePackDialog(list, list.app, widget) | 
					
						
							| 
									
										
										
										
											2007-01-10 16:19:56 +00:00
										 |  |  |         except TclError as msg: | 
					
						
							| 
									
										
										
										
											2007-07-17 20:59:35 +00:00
										 |  |  |             print(msg) | 
					
						
							| 
									
										
										
										
											1994-07-13 12:56:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1994-07-12 08:58:25 +00:00
										 |  |  | test() |