mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	back in harness on new config system
This commit is contained in:
		
							parent
							
								
									72f8213ba4
								
							
						
					
					
						commit
						3b55a891a1
					
				
					 4 changed files with 53 additions and 34 deletions
				
			
		|  | @ -50,6 +50,11 @@ | ||||||
|    ('!_Debugger', '<<toggle-debugger>>'), |    ('!_Debugger', '<<toggle-debugger>>'), | ||||||
|    ('!_Auto-open stack viewer', '<<toggle-jit-stack-viewer>>' ), |    ('!_Auto-open stack viewer', '<<toggle-jit-stack-viewer>>' ), | ||||||
|   ]), |   ]), | ||||||
|  | # ('settings', [ | ||||||
|  | #   ('_Configure Idle...', '<<open-config-dialog>>'), | ||||||
|  | #   None, | ||||||
|  | #   ('Revert to _Default Settings', '<<revert-all-settings>>'), | ||||||
|  | #  ]), | ||||||
|  ('help', [ |  ('help', [ | ||||||
|    ('_IDLE Help...', '<<help>>'), |    ('_IDLE Help...', '<<help>>'), | ||||||
|    ('Python _Documentation...', '<<python-docs>>'), |    ('Python _Documentation...', '<<python-docs>>'), | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
| import idlever | import idlever | ||||||
| import WindowList | import WindowList | ||||||
| from IdleConf import idleconf | from IdleConf import idleconf | ||||||
| import aboutDialog, textView | import aboutDialog, textView, configDialog | ||||||
| 
 | 
 | ||||||
| # The default tab setting for a Text widget, in average-width characters. | # The default tab setting for a Text widget, in average-width characters. | ||||||
| TK_TABWIDTH_DEFAULT = 8 | TK_TABWIDTH_DEFAULT = 8 | ||||||
|  | @ -123,6 +123,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): | ||||||
|         text.bind("<<view-readme>>", self.view_readme) |         text.bind("<<view-readme>>", self.view_readme) | ||||||
|         text.bind("<<python-docs>>", self.python_docs) |         text.bind("<<python-docs>>", self.python_docs) | ||||||
|         text.bind("<<about-idle>>", self.about_dialog) |         text.bind("<<about-idle>>", self.about_dialog) | ||||||
|  |         text.bind("<<open-config-dialog>>", self.config_dialog) | ||||||
|         text.bind("<<open-module>>", self.open_module) |         text.bind("<<open-module>>", self.open_module) | ||||||
|         text.bind("<<do-nothing>>", lambda event: "break") |         text.bind("<<do-nothing>>", lambda event: "break") | ||||||
|         text.bind("<<select-all>>", self.select_all) |         text.bind("<<select-all>>", self.select_all) | ||||||
|  | @ -220,6 +221,7 @@ def wakeup(self): | ||||||
|         ("edit", "_Edit"), |         ("edit", "_Edit"), | ||||||
|         ("format", "F_ormat"), |         ("format", "F_ormat"), | ||||||
|         ("run", "_Run"), |         ("run", "_Run"), | ||||||
|  |         #("settings", "_Settings"), | ||||||
|         ("windows", "_Windows"), |         ("windows", "_Windows"), | ||||||
|         ("help", "_Help"), |         ("help", "_Help"), | ||||||
|     ] |     ] | ||||||
|  | @ -278,6 +280,9 @@ def command(text=self.text, eventname=eventname): | ||||||
|     def about_dialog(self, event=None): |     def about_dialog(self, event=None): | ||||||
|         aboutDialog.AboutDialog(self.top,'About IDLEfork') |         aboutDialog.AboutDialog(self.top,'About IDLEfork') | ||||||
|          |          | ||||||
|  |     def config_dialog(self, event=None): | ||||||
|  |         configDialog.ConfigDialog(self.top,'Settings') | ||||||
|  |          | ||||||
|     def good_advice(self, event=None): |     def good_advice(self, event=None): | ||||||
|         tkMessageBox.showinfo('Advice', "Don't Panic!", master=self.text) |         tkMessageBox.showinfo('Advice', "Don't Panic!", master=self.text) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -328,7 +328,7 @@ class PyShell(OutputWindow): | ||||||
| 
 | 
 | ||||||
|     # Override menu bar specs |     # Override menu bar specs | ||||||
|     menu_specs = PyShellEditorWindow.menu_specs[:] |     menu_specs = PyShellEditorWindow.menu_specs[:] | ||||||
|     menu_specs.insert(len(menu_specs)-2, ("debug", "_Debug")) |     menu_specs.insert(len(menu_specs)-3, ("debug", "_Debug")) | ||||||
| 
 | 
 | ||||||
|     # New classes |     # New classes | ||||||
|     from IdleHistory import History |     from IdleHistory import History | ||||||
|  |  | ||||||
|  | @ -17,10 +17,7 @@ class ConfigDialog(Toplevel): | ||||||
|     """ |     """ | ||||||
|     configuration dialog for idle |     configuration dialog for idle | ||||||
|     """  |     """  | ||||||
|     def __init__(self,parent,title,configDict): |     def __init__(self,parent,title): | ||||||
|         """ |  | ||||||
|         configDict - dictionary of configuration items |  | ||||||
|         """ |  | ||||||
|         Toplevel.__init__(self, parent) |         Toplevel.__init__(self, parent) | ||||||
|         self.configure(borderwidth=5) |         self.configure(borderwidth=5) | ||||||
|         self.geometry("+%d+%d" % (parent.winfo_rootx()+20, |         self.geometry("+%d+%d" % (parent.winfo_rootx()+20, | ||||||
|  | @ -160,6 +157,18 @@ def SetHighlightTarget(self): | ||||||
|             self.radioFg.config(state=NORMAL) |             self.radioFg.config(state=NORMAL) | ||||||
|             self.radioBg.config(state=NORMAL) |             self.radioBg.config(state=NORMAL) | ||||||
|             self.fgHilite.set(1) #default to setting foreground attribute |             self.fgHilite.set(1) #default to setting foreground attribute | ||||||
|  |         self.SetColourSample() | ||||||
|  |      | ||||||
|  |     def SetColourSampleBinding(self,*args): | ||||||
|  |         self.SetColourSample() | ||||||
|  |          | ||||||
|  |     def SetColourSample(self): | ||||||
|  |         #set the colour smaple area | ||||||
|  |         tag=self.themeElements[self.highlightTarget.get()][0] | ||||||
|  |         if self.fgHilite.get(): plane='foreground' | ||||||
|  |         else: plane='background' | ||||||
|  |         colour=self.textHighlightSample.tag_cget(tag,plane) | ||||||
|  |         self.frameColourSet.config(bg=colour) | ||||||
|      |      | ||||||
|     def CreateWidgets(self): |     def CreateWidgets(self): | ||||||
|         self.framePages = Frame(self) |         self.framePages = Frame(self) | ||||||
|  | @ -175,7 +184,7 @@ def CreateWidgets(self): | ||||||
|         self.buttonCancel = Button(frameActionButtons,text='Cancel', |         self.buttonCancel = Button(frameActionButtons,text='Cancel', | ||||||
|                 command=self.Cancel,takefocus=FALSE) |                 command=self.Cancel,takefocus=FALSE) | ||||||
|         #page buttons |         #page buttons | ||||||
|         self.pageNum=IntVar() |         self.pageNum=IntVar(self) | ||||||
|         self.pageNum.set(0) |         self.pageNum.set(0) | ||||||
|         pageButtonNames=('Fonts/Tabs','Highlighting','Keys','General') |         pageButtonNames=('Fonts/Tabs','Highlighting','Keys','General') | ||||||
|         self.pageButtons=[] |         self.pageButtons=[] | ||||||
|  | @ -211,11 +220,11 @@ def CreateWidgets(self): | ||||||
|          |          | ||||||
|     def CreatePageFontTab(self): |     def CreatePageFontTab(self): | ||||||
|         #tkVars |         #tkVars | ||||||
|         self.fontSize=StringVar() |         self.fontSize=StringVar(self) | ||||||
|         self.fontBold=StringVar() |         self.fontBold=StringVar(self) | ||||||
|         self.spaceNum=IntVar() |         self.spaceNum=IntVar(self) | ||||||
|         self.tabCols=IntVar() |         self.tabCols=IntVar(self) | ||||||
|         self.indentType=IntVar()  |         self.indentType=IntVar(self)  | ||||||
|         self.editFont=tkFont.Font(self,('courier',12,'normal')) |         self.editFont=tkFont.Font(self,('courier',12,'normal')) | ||||||
|         ##widget creation |         ##widget creation | ||||||
|         #body frame |         #body frame | ||||||
|  | @ -295,13 +304,13 @@ def CreatePageFontTab(self): | ||||||
|         return frame |         return frame | ||||||
| 
 | 
 | ||||||
|     def CreatePageHighlight(self): |     def CreatePageHighlight(self): | ||||||
|         self.builtinTheme=StringVar() |         self.builtinTheme=StringVar(self) | ||||||
|         self.customTheme=StringVar() |         self.customTheme=StringVar(self) | ||||||
|         self.fgHilite=IntVar() |         self.fgHilite=IntVar(self) | ||||||
|         self.colour=StringVar() |         self.colour=StringVar(self) | ||||||
|         self.fontName=StringVar() |         self.fontName=StringVar(self) | ||||||
|         self.themeIsBuiltin=IntVar()  |         self.themeIsBuiltin=IntVar(self)  | ||||||
|         self.highlightTarget=StringVar() |         self.highlightTarget=StringVar(self) | ||||||
|         self.highlightTarget.trace_variable('w',self.SetHighlightTargetBinding) |         self.highlightTarget.trace_variable('w',self.SetHighlightTargetBinding) | ||||||
|         ##widget creation |         ##widget creation | ||||||
|         #body frame |         #body frame | ||||||
|  | @ -340,9 +349,9 @@ def CreatePageHighlight(self): | ||||||
|         self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet, |         self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet, | ||||||
|             self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding |             self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding | ||||||
|         self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite, |         self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite, | ||||||
|             value=1,text='Foreground')#,command=self.SetFgBg |             value=1,text='Foreground',command=self.SetColourSampleBinding) | ||||||
|         self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite, |         self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite, | ||||||
|             value=0,text='Background')#,command=self.SetFgBg |             value=0,text='Background',command=self.SetColourSampleBinding) | ||||||
|         self.fgHilite.set(1) |         self.fgHilite.set(1) | ||||||
|         buttonSaveCustomTheme=Button(frameCustom,  |         buttonSaveCustomTheme=Button(frameCustom,  | ||||||
|             text='Save as a Custom Theme') |             text='Save as a Custom Theme') | ||||||
|  | @ -385,14 +394,14 @@ def CreatePageHighlight(self): | ||||||
| 
 | 
 | ||||||
|     def CreatePageKeys(self): |     def CreatePageKeys(self): | ||||||
|         #tkVars |         #tkVars | ||||||
|         self.bindingTarget=StringVar() |         self.bindingTarget=StringVar(self) | ||||||
|         self.builtinKeys=StringVar() |         self.builtinKeys=StringVar(self) | ||||||
|         self.customKeys=StringVar() |         self.customKeys=StringVar(self) | ||||||
|         self.keyChars=StringVar() |         self.keyChars=StringVar(self) | ||||||
|         self.keyCtrl=StringVar() |         self.keyCtrl=StringVar(self) | ||||||
|         self.keyAlt=StringVar() |         self.keyAlt=StringVar(self) | ||||||
|         self.keyShift=StringVar() |         self.keyShift=StringVar(self) | ||||||
|         self.keysAreDefault=IntVar()  |         self.keysAreDefault=IntVar(self)  | ||||||
|         ##widget creation |         ##widget creation | ||||||
|         #body frame |         #body frame | ||||||
|         frame=Frame(self.framePages,borderwidth=2,relief=RAISED) |         frame=Frame(self.framePages,borderwidth=2,relief=RAISED) | ||||||
|  | @ -460,10 +469,10 @@ def CreatePageKeys(self): | ||||||
| 
 | 
 | ||||||
|     def CreatePageGeneral(self): |     def CreatePageGeneral(self): | ||||||
|         #tkVars         |         #tkVars         | ||||||
|         self.runType=IntVar()        |         self.runType=IntVar(self)        | ||||||
|         self.winWidth=StringVar()        |         self.winWidth=StringVar(self)        | ||||||
|         self.winHeight=StringVar() |         self.winHeight=StringVar(self) | ||||||
|         self.extState=IntVar()        |         self.extState=IntVar(self)        | ||||||
|         #widget creation |         #widget creation | ||||||
|         #body |         #body | ||||||
|         frame=Frame(self.framePages,borderwidth=2,relief=RAISED) |         frame=Frame(self.framePages,borderwidth=2,relief=RAISED) | ||||||
|  | @ -663,5 +672,5 @@ def SaveConfigs(self): | ||||||
|     #test the dialog |     #test the dialog | ||||||
|     root=Tk() |     root=Tk() | ||||||
|     Button(root,text='Dialog', |     Button(root,text='Dialog', | ||||||
|             command=lambda:ConfigDialog(root,'Settings',None)).pack() |             command=lambda:ConfigDialog(root,'Settings')).pack() | ||||||
|     root.mainloop() |     root.mainloop() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Steven M. Gava
						Steven M. Gava