annotate Lib/idlelib/configDialog.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents dc3d24824b60
children df378e44ba9a 1fd0f5697b40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1 """IDLE Configuration Dialog: support user customization of IDLE by GUI
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
2
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
3 Customize font faces, sizes, and colorization attributes. Set indentation
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
4 defaults. Customize keybindings. Colorization and keybindings can be
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
5 saved as user defined sets. Select startup options including shell/editor
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
6 and default window size. Define additional help sources.
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
7
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
8 Note that tab width in IDLE is currently fixed at eight due to Tk issues.
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
9 Refer to comments in EditorWindow autoindent code for details.
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
10
18899
0132af63506b some new dialogs and support files for new about and configuration implementations
Steven M. Gava <elguavas@python.net>
parents:
diff changeset
11 """
47183
b53604fad54b Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents: 47101
diff changeset
12 from Tkinter import *
b53604fad54b Tkinter rename reversal: remove tkinter package, adapt imports and docs.
Georg Brandl <georg@python.org>
parents: 47101
diff changeset
13 import tkMessageBox, tkColorChooser, tkFont
45468
1d84bf5f9478 Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents: 45367
diff changeset
14 import string
18899
0132af63506b some new dialogs and support files for new about and configuration implementations
Steven M. Gava <elguavas@python.net>
parents:
diff changeset
15
20052
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
16 from configHandler import idleConf
20684
433ae4838703 further work on loading config dialog values from the config files
Steven M. Gava <elguavas@python.net>
parents: 20628
diff changeset
17 from dynOptionMenuWidget import DynOptionMenu
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
18 from tabbedpages import TabbedPageSet
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
19 from keybindingDialog import GetKeysDialog
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
20 from configSectionNameDialog import GetCfgSectionNameDialog
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
21 from configHelpSourceEdit import GetHelpSourceDialog
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
22 import macosxSupport
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
23
18899
0132af63506b some new dialogs and support files for new about and configuration implementations
Steven M. Gava <elguavas@python.net>
parents:
diff changeset
24 class ConfigDialog(Toplevel):
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
25
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
26 def __init__(self,parent,title):
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
27 Toplevel.__init__(self, parent)
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
28 self.wm_withdraw()
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
29
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
30 self.configure(borderwidth=5)
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
31 self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
32 parent.winfo_rooty()+30))
35276
4adbd331d335 Fix all wrong instances of "it's".
Georg Brandl <georg@python.org>
parents: 34520
diff changeset
33 #Theme Elements. Each theme element key is its display name.
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
34 #The first value of the tuple is the sample area tag name.
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
35 #The second value is the display name list sort index.
21623
be8697c70e7c further development of highlighting and editor preference handling,
Steven M. Gava <elguavas@python.net>
parents: 21232
diff changeset
36 self.themeElements={'Normal Text':('normal','00'),
be8697c70e7c further development of highlighting and editor preference handling,
Steven M. Gava <elguavas@python.net>
parents: 21232
diff changeset
37 'Python Keywords':('keyword','01'),
be8697c70e7c further development of highlighting and editor preference handling,
Steven M. Gava <elguavas@python.net>
parents: 21232
diff changeset
38 'Python Definitions':('definition','02'),
31625
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
39 'Python Builtins':('builtin', '03'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
40 'Python Comments':('comment','04'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
41 'Python Strings':('string','05'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
42 'Selected Text':('hilite','06'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
43 'Found Text':('hit','07'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
44 'Cursor':('cursor','08'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
45 'Error Text':('error','09'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
46 'Shell Normal Text':('console','10'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
47 'Shell Stdout Text':('stdout','11'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
48 'Shell Stderr Text':('stderr','12'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
49 }
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
50 self.ResetChangedItems() #load initial values in changed items dict
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
51 self.CreateWidgets()
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
52 self.resizable(height=FALSE,width=FALSE)
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
53 self.transient(parent)
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
54 self.grab_set()
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
55 self.protocol("WM_DELETE_WINDOW", self.Cancel)
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
56 self.parent = parent
21232
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
57 self.tabPages.focus_set()
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
58 #key bindings for this dialog
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
59 #self.bind('<Escape>',self.Cancel) #dismiss dialog, no save
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
60 #self.bind('<Alt-a>',self.Apply) #apply changes, save
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
61 #self.bind('<F1>',self.Help) #context help
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
62 self.LoadConfigs()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
63 self.AttachVarCallbacks() #avoid callbacks during LoadConfigs
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
64
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
65 self.wm_deiconify()
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
66 self.wait_window()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
67
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
68 def CreateWidgets(self):
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
69 self.tabPages = TabbedPageSet(self,
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
70 page_names=['Fonts/Tabs','Highlighting','Keys','General'])
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
71 frameActionButtons = Frame(self,pady=2)
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
72 #action buttons
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
73 if macosxSupport.runningAsOSXApp():
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
74 # Changing the default padding on OSX results in unreadable
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
75 # text in the buttons
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
76 paddingArgs={}
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
77 else:
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
78 paddingArgs={'padx':6, 'pady':3}
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
79
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
80 self.buttonHelp = Button(frameActionButtons,text='Help',
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
81 command=self.Help,takefocus=FALSE,
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
82 **paddingArgs)
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
83 self.buttonOk = Button(frameActionButtons,text='Ok',
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
84 command=self.Ok,takefocus=FALSE,
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
85 **paddingArgs)
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
86 self.buttonApply = Button(frameActionButtons,text='Apply',
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
87 command=self.Apply,takefocus=FALSE,
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
88 **paddingArgs)
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
89 self.buttonCancel = Button(frameActionButtons,text='Cancel',
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
90 command=self.Cancel,takefocus=FALSE,
52014
dc3d24824b60 Merged revisions 70176 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47183
diff changeset
91 **paddingArgs)
21232
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
92 self.CreatePageFontTab()
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
93 self.CreatePageHighlight()
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
94 self.CreatePageKeys()
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
95 self.CreatePageGeneral()
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
96 self.buttonHelp.pack(side=RIGHT,padx=5)
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
97 self.buttonOk.pack(side=LEFT,padx=5)
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
98 self.buttonApply.pack(side=LEFT,padx=5)
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
99 self.buttonCancel.pack(side=LEFT,padx=5)
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
100 frameActionButtons.pack(side=BOTTOM)
44381
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
101 Frame(self, height=2, borderwidth=0).pack(side=BOTTOM)
21232
4930198f92db changes to use new tabpages classes
Steven M. Gava <elguavas@python.net>
parents: 21035
diff changeset
102 self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
103
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
104 def CreatePageFontTab(self):
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
105 #tkVars
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
106 self.fontSize=StringVar(self)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
107 self.fontBold=BooleanVar(self)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
108 self.fontName=StringVar(self)
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
109 self.spaceNum=IntVar(self)
29269
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
110 self.editFont=tkFont.Font(self,('courier',10,'normal'))
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
111 ##widget creation
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
112 #body frame
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
113 frame=self.tabPages.pages['Fonts/Tabs'].frame
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
114 #body section frames
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
115 frameFont=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
116 text=' Base Editor Font ')
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
117 frameIndent=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
118 text=' Indentation Width ')
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
119 #frameFont
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
120 frameFontName=Frame(frameFont)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
121 frameFontParam=Frame(frameFont)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
122 labelFontNameTitle=Label(frameFontName,justify=LEFT,
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
123 text='Font Face :')
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
124 self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE,
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
125 exportselection=FALSE)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
126 self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease)
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
127 scrollFont=Scrollbar(frameFontName)
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
128 scrollFont.config(command=self.listFontName.yview)
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
129 self.listFontName.config(yscrollcommand=scrollFont.set)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
130 labelFontSizeTitle=Label(frameFontParam,text='Size :')
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
131 self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None,
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
132 command=self.SetFontSample)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
133 checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold,
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
134 onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample)
20052
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
135 frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1)
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
136 self.labelFontSample=Label(frameFontSample,
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
137 text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]',
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
138 justify=LEFT,font=self.editFont)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
139 #frameIndent
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
140 frameIndentSize=Frame(frameIndent)
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
141 labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT,
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
142 text='Python Standard: 4 Spaces!')
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
143 self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum,
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
144 orient='horizontal',
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
145 tickinterval=2, from_=2, to=16)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
146 #widget packing
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
147 #body
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
148 frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
149 frameIndent.pack(side=LEFT,padx=5,pady=5,fill=Y)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
150 #frameFont
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
151 frameFontName.pack(side=TOP,padx=5,pady=5,fill=X)
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
152 frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
153 labelFontNameTitle.pack(side=TOP,anchor=W)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
154 self.listFontName.pack(side=LEFT,expand=TRUE,fill=X)
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
155 scrollFont.pack(side=LEFT,fill=Y)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
156 labelFontSizeTitle.pack(side=LEFT,anchor=W)
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
157 self.optMenuFontSize.pack(side=LEFT,anchor=W)
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
158 checkFontBold.pack(side=LEFT,anchor=W,padx=20)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
159 frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
19173
f0db345621ba repair posix fonts fix
Steven M. Gava <elguavas@python.net>
parents: 19050
diff changeset
160 self.labelFontSample.pack(expand=TRUE,fill=BOTH)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
161 #frameIndent
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
162 frameIndentSize.pack(side=TOP,fill=X)
19002
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
163 labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5)
2ae37cfb189f began font / indentation page
Steven M. Gava <elguavas@python.net>
parents: 18993
diff changeset
164 self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
165 return frame
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
166
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
167 def CreatePageHighlight(self):
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
168 self.builtinTheme=StringVar(self)
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
169 self.customTheme=StringVar(self)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
170 self.fgHilite=BooleanVar(self)
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
171 self.colour=StringVar(self)
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
172 self.fontName=StringVar(self)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
173 self.themeIsBuiltin=BooleanVar(self)
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
174 self.highlightTarget=StringVar(self)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
175 ##widget creation
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
176 #body frame
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
177 frame=self.tabPages.pages['Highlighting'].frame
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
178 #body section frames
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
179 frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
180 text=' Custom Highlighting ')
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
181 frameTheme=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
182 text=' Highlighting Theme ')
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
183 #frameCustom
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
184 self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1,
22111
c494084dc6d8 First work on making config changes dynamic,
Steven M. Gava <elguavas@python.net>
parents: 21975
diff changeset
185 font=('courier',12,''),cursor='hand2',width=21,height=10,
c494084dc6d8 First work on making config changes dynamic,
Steven M. Gava <elguavas@python.net>
parents: 21975
diff changeset
186 takefocus=FALSE,highlightthickness=0,wrap=NONE)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
187 text=self.textHighlightSample
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
188 text.bind('<Double-Button-1>',lambda e: 'break')
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
189 text.bind('<B1-Motion>',lambda e: 'break')
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
190 textAndTags=(('#you can click here','comment'),('\n','normal'),
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
191 ('#to choose items','comment'),('\n','normal'),('def','keyword'),
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
192 (' ','normal'),('func','definition'),('(param):','normal'),
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
193 ('\n ','normal'),('"""string"""','string'),('\n var0 = ','normal'),
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
194 ("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'),
31625
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
195 ('\n var2 = ','normal'),("'found'",'hit'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
196 ('\n var3 = ','normal'),('list', 'builtin'), ('(','normal'),
1b02c77cdcfe Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
Kurt B. Kaiser <kbk@shore.net>
parents: 31515
diff changeset
197 ('None', 'builtin'),(')\n\n','normal'),
20864
8957341f98f8 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20858
diff changeset
198 (' error ','error'),(' ','normal'),('cursor |','cursor'),
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
199 ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'),
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
200 (' ','normal'),('stderr','stderr'),('\n','normal'))
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
201 for txTa in textAndTags:
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
202 text.insert(END,txTa[0],txTa[1])
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
203 for element in self.themeElements.keys():
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
204 text.tag_bind(self.themeElements[element][0],'<ButtonPress-1>',
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
205 lambda event,elem=element: event.widget.winfo_toplevel()
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
206 .highlightTarget.set(elem))
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
207 text.config(state=DISABLED)
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
208 self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1)
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
209 frameFgBg=Frame(frameCustom)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
210 buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :',
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
211 command=self.GetColour,highlightthickness=0)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
212 self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet,
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
213 self.highlightTarget,None,highlightthickness=0)#,command=self.SetHighlightTargetBinding
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
214 self.radioFg=Radiobutton(frameFgBg,variable=self.fgHilite,
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
215 value=1,text='Foreground',command=self.SetColourSampleBinding)
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
216 self.radioBg=Radiobutton(frameFgBg,variable=self.fgHilite,
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
217 value=0,text='Background',command=self.SetColourSampleBinding)
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
218 self.fgHilite.set(1)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
219 buttonSaveCustomTheme=Button(frameCustom,
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
220 text='Save as New Custom Theme',command=self.SaveAsNewTheme)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
221 #frameTheme
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
222 labelTypeTitle=Label(frameTheme,text='Select : ')
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
223 self.radioThemeBuiltin=Radiobutton(frameTheme,variable=self.themeIsBuiltin,
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
224 value=1,command=self.SetThemeType,text='a Built-in Theme')
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
225 self.radioThemeCustom=Radiobutton(frameTheme,variable=self.themeIsBuiltin,
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
226 value=0,command=self.SetThemeType,text='a Custom Theme')
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
227 self.optMenuThemeBuiltin=DynOptionMenu(frameTheme,
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
228 self.builtinTheme,None,command=None)
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
229 self.optMenuThemeCustom=DynOptionMenu(frameTheme,
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
230 self.customTheme,None,command=None)
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
231 self.buttonDeleteCustomTheme=Button(frameTheme,text='Delete Custom Theme',
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
232 command=self.DeleteCustomTheme)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
233 ##widget packing
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
234 #body
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
235 frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
236 frameTheme.pack(side=LEFT,padx=5,pady=5,fill=Y)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
237 #frameCustom
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
238 self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X)
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
239 frameFgBg.pack(side=TOP,padx=5,pady=0)
20856
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
240 self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,
8cf1d9266911 more work to support new config system
Steven M. Gava <elguavas@python.net>
parents: 20736
diff changeset
241 fill=BOTH)
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
242 buttonSetColour.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=4)
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
243 self.optMenuHighlightTarget.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=3)
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
244 self.radioFg.pack(side=LEFT,anchor=E)
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
245 self.radioBg.pack(side=RIGHT,anchor=W)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
246 buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
247 #frameTheme
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
248 labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5)
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
249 self.radioThemeBuiltin.pack(side=TOP,anchor=W,padx=5)
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
250 self.radioThemeCustom.pack(side=TOP,anchor=W,padx=5,pady=2)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
251 self.optMenuThemeBuiltin.pack(side=TOP,fill=X,padx=5,pady=5)
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
252 self.optMenuThemeCustom.pack(side=TOP,fill=X,anchor=W,padx=5,pady=5)
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
253 self.buttonDeleteCustomTheme.pack(side=TOP,fill=X,padx=5,pady=5)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
254 return frame
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
255
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
256 def CreatePageKeys(self):
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
257 #tkVars
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
258 self.bindingTarget=StringVar(self)
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
259 self.builtinKeys=StringVar(self)
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
260 self.customKeys=StringVar(self)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
261 self.keysAreBuiltin=BooleanVar(self)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
262 self.keyBinding=StringVar(self)
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
263 ##widget creation
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
264 #body frame
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
265 frame=self.tabPages.pages['Keys'].frame
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
266 #body section frames
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
267 frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
268 text=' Custom Key Bindings ')
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
269 frameKeySets=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
270 text=' Key Set ')
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
271 #frameCustom
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
272 frameTarget=Frame(frameCustom)
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
273 labelTargetTitle=Label(frameTarget,text='Action - Key(s)')
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
274 scrollTargetY=Scrollbar(frameTarget)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
275 scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL)
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
276 self.listBindings=Listbox(frameTarget,takefocus=FALSE,
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
277 exportselection=FALSE)
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
278 self.listBindings.bind('<ButtonRelease-1>',self.KeyBindingSelected)
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
279 scrollTargetY.config(command=self.listBindings.yview)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
280 scrollTargetX.config(command=self.listBindings.xview)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
281 self.listBindings.config(yscrollcommand=scrollTargetY.set)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
282 self.listBindings.config(xscrollcommand=scrollTargetX.set)
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
283 self.buttonNewKeys=Button(frameCustom,text='Get New Keys for Selection',
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
284 command=self.GetNewKeys,state=DISABLED)
44381
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
285 #frameKeySets
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
286 frames = [Frame(frameKeySets, padx=2, pady=2, borderwidth=0)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
287 for i in range(2)]
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
288 self.radioKeysBuiltin=Radiobutton(frames[0],variable=self.keysAreBuiltin,
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
289 value=1,command=self.SetKeysType,text='Use a Built-in Key Set')
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
290 self.radioKeysCustom=Radiobutton(frames[0],variable=self.keysAreBuiltin,
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
291 value=0,command=self.SetKeysType,text='Use a Custom Key Set')
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
292 self.optMenuKeysBuiltin=DynOptionMenu(frames[0],
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
293 self.builtinKeys,None,command=None)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
294 self.optMenuKeysCustom=DynOptionMenu(frames[0],
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
295 self.customKeys,None,command=None)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
296 self.buttonDeleteCustomKeys=Button(frames[1],text='Delete Custom Key Set',
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
297 command=self.DeleteCustomKeys)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
298 buttonSaveCustomKeys=Button(frames[1],
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
299 text='Save as New Custom Key Set',command=self.SaveAsNewKeySet)
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
300 ##widget packing
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
301 #body
44381
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
302 frameCustom.pack(side=BOTTOM,padx=5,pady=5,expand=TRUE,fill=BOTH)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
303 frameKeySets.pack(side=BOTTOM,padx=5,pady=5,fill=BOTH)
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
304 #frameCustom
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
305 self.buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5)
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
306 frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
307 #frame target
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
308 frameTarget.columnconfigure(0,weight=1)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
309 frameTarget.rowconfigure(1,weight=1)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
310 labelTargetTitle.grid(row=0,column=0,columnspan=2,sticky=W)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
311 self.listBindings.grid(row=1,column=0,sticky=NSEW)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
312 scrollTargetY.grid(row=1,column=1,sticky=NS)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
313 scrollTargetX.grid(row=2,column=0,sticky=EW)
18993
b0aaf780bca6 further work on keybinding page
Steven M. Gava <elguavas@python.net>
parents: 18953
diff changeset
314 #frameKeySets
44381
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
315 self.radioKeysBuiltin.grid(row=0, column=0, sticky=W+NS)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
316 self.radioKeysCustom.grid(row=1, column=0, sticky=W+NS)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
317 self.optMenuKeysBuiltin.grid(row=0, column=1, sticky=NSEW)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
318 self.optMenuKeysCustom.grid(row=1, column=1, sticky=NSEW)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
319 self.buttonDeleteCustomKeys.pack(side=LEFT,fill=X,expand=True,padx=2)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
320 buttonSaveCustomKeys.pack(side=LEFT,fill=X,expand=True,padx=2)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
321 frames[0].pack(side=TOP, fill=BOTH, expand=True)
eb695c591e70 Configure Dialog: improved layout for keybinding. Patch 1457 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 43711
diff changeset
322 frames[1].pack(side=TOP, fill=X, expand=True, pady=2)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
323 return frame
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
324
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
325 def CreatePageGeneral(self):
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
326 #tkVars
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
327 self.winWidth=StringVar(self)
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
328 self.winHeight=StringVar(self)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
329 self.paraWidth=StringVar(self)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
330 self.startupEdit=IntVar(self)
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
331 self.autoSave=IntVar(self)
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
332 self.encoding=StringVar(self)
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
333 self.userHelpBrowser=BooleanVar(self)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
334 self.helpBrowser=StringVar(self)
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
335 #widget creation
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
336 #body
43711
a5dd278b0c1f check in Tal Einat's update to tabpage.py
Kurt B. Kaiser <kbk@shore.net>
parents: 43519
diff changeset
337 frame=self.tabPages.pages['General'].frame
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
338 #body section frames
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
339 frameRun=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
340 text=' Startup Preferences ')
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
341 frameSave=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
342 text=' Autosave Preferences ')
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
343 frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
344 frameParaSize=Frame(frame,borderwidth=2,relief=GROOVE)
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
345 frameEncoding=Frame(frame,borderwidth=2,relief=GROOVE)
43463
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
346 frameHelp=LabelFrame(frame,borderwidth=2,relief=GROOVE,
176b6131b0ba configDialog cleanup. Patch 1730217 Tal Einat.
Kurt B. Kaiser <kbk@shore.net>
parents: 35891
diff changeset
347 text=' Additional Help Sources ')
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
348 #frameRun
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
349 labelRunChoiceTitle=Label(frameRun,text='At Startup')
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
350 radioStartupEdit=Radiobutton(frameRun,variable=self.startupEdit,
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
351 value=1,command=self.SetKeysType,text="Open Edit Window")
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
352 radioStartupShell=Radiobutton(frameRun,variable=self.startupEdit,
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
353 value=0,command=self.SetKeysType,text='Open Shell Window')
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
354 #frameSave
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
355 labelRunSaveTitle=Label(frameSave,text='At Start of Run (F5) ')
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
356 radioSaveAsk=Radiobutton(frameSave,variable=self.autoSave,
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
357 value=0,command=self.SetKeysType,text="Prompt to Save")
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
358 radioSaveAuto=Radiobutton(frameSave,variable=self.autoSave,
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
359 value=1,command=self.SetKeysType,text='No Prompt')
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
360 #frameWinSize
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
361 labelWinSizeTitle=Label(frameWinSize,text='Initial Window Size'+
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
362 ' (in characters)')
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
363 labelWinWidthTitle=Label(frameWinSize,text='Width')
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
364 entryWinWidth=Entry(frameWinSize,textvariable=self.winWidth,
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
365 width=3)
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
366 labelWinHeightTitle=Label(frameWinSize,text='Height')
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
367 entryWinHeight=Entry(frameWinSize,textvariable=self.winHeight,
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
368 width=3)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
369 #paragraphFormatWidth
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
370 labelParaWidthTitle=Label(frameParaSize,text='Paragraph reformat'+
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
371 ' width (in characters)')
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
372 entryParaWidth=Entry(frameParaSize,textvariable=self.paraWidth,
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
373 width=3)
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
374 #frameEncoding
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
375 labelEncodingTitle=Label(frameEncoding,text="Default Source Encoding")
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
376 radioEncLocale=Radiobutton(frameEncoding,variable=self.encoding,
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
377 value="locale",text="Locale-defined")
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
378 radioEncUTF8=Radiobutton(frameEncoding,variable=self.encoding,
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
379 value="utf-8",text="UTF-8")
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
380 radioEncNone=Radiobutton(frameEncoding,variable=self.encoding,
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
381 value="none",text="None")
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
382 #frameHelp
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
383 frameHelpList=Frame(frameHelp)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
384 frameHelpListButtons=Frame(frameHelpList)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
385 scrollHelpList=Scrollbar(frameHelpList)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
386 self.listHelp=Listbox(frameHelpList,height=5,takefocus=FALSE,
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
387 exportselection=FALSE)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
388 scrollHelpList.config(command=self.listHelp.yview)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
389 self.listHelp.config(yscrollcommand=scrollHelpList.set)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
390 self.listHelp.bind('<ButtonRelease-1>',self.HelpSourceSelected)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
391 self.buttonHelpListEdit=Button(frameHelpListButtons,text='Edit',
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
392 state=DISABLED,width=8,command=self.HelpListItemEdit)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
393 self.buttonHelpListAdd=Button(frameHelpListButtons,text='Add',
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
394 width=8,command=self.HelpListItemAdd)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
395 self.buttonHelpListRemove=Button(frameHelpListButtons,text='Remove',
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
396 state=DISABLED,width=8,command=self.HelpListItemRemove)
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
397 #widget packing
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
398 #body
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
399 frameRun.pack(side=TOP,padx=5,pady=5,fill=X)
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
400 frameSave.pack(side=TOP,padx=5,pady=5,fill=X)
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
401 frameWinSize.pack(side=TOP,padx=5,pady=5,fill=X)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
402 frameParaSize.pack(side=TOP,padx=5,pady=5,fill=X)
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
403 frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X)
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
404 frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
405 #frameRun
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
406 labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
407 radioStartupShell.pack(side=RIGHT,anchor=W,padx=5,pady=5)
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
408 radioStartupEdit.pack(side=RIGHT,anchor=W,padx=5,pady=5)
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
409 #frameSave
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
410 labelRunSaveTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
411 radioSaveAuto.pack(side=RIGHT,anchor=W,padx=5,pady=5)
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
412 radioSaveAsk.pack(side=RIGHT,anchor=W,padx=5,pady=5)
19022
bad408c7d9d7 more fleshing out, this time primarily the 'general' page
Steven M. Gava <elguavas@python.net>
parents: 19002
diff changeset
413 #frameWinSize
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
414 labelWinSizeTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
415 entryWinHeight.pack(side=RIGHT,anchor=E,padx=10,pady=5)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
416 labelWinHeightTitle.pack(side=RIGHT,anchor=E,pady=5)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
417 entryWinWidth.pack(side=RIGHT,anchor=E,padx=10,pady=5)
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
418 labelWinWidthTitle.pack(side=RIGHT,anchor=E,pady=5)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
419 #paragraphFormatWidth
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
420 labelParaWidthTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
421 entryParaWidth.pack(side=RIGHT,anchor=E,padx=10,pady=5)
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
422 #frameEncoding
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
423 labelEncodingTitle.pack(side=LEFT,anchor=W,padx=5,pady=5)
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
424 radioEncNone.pack(side=RIGHT,anchor=E,pady=5)
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
425 radioEncUTF8.pack(side=RIGHT,anchor=E,pady=5)
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
426 radioEncLocale.pack(side=RIGHT,anchor=E,pady=5)
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
427 #frameHelp
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
428 frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
429 frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
430 scrollHelpList.pack(side=RIGHT,anchor=W,fill=Y)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
431 self.listHelp.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
432 self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
433 self.buttonHelpListAdd.pack(side=TOP,anchor=W)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
434 self.buttonHelpListRemove.pack(side=TOP,anchor=W,pady=5)
18953
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
435 return frame
48e0fb055c33 further work on config dialog, particularly highligthing config
Steven M. Gava <elguavas@python.net>
parents: 18906
diff changeset
436
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
437 def AttachVarCallbacks(self):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
438 self.fontSize.trace_variable('w',self.VarChanged_fontSize)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
439 self.fontName.trace_variable('w',self.VarChanged_fontName)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
440 self.fontBold.trace_variable('w',self.VarChanged_fontBold)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
441 self.spaceNum.trace_variable('w',self.VarChanged_spaceNum)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
442 self.colour.trace_variable('w',self.VarChanged_colour)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
443 self.builtinTheme.trace_variable('w',self.VarChanged_builtinTheme)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
444 self.customTheme.trace_variable('w',self.VarChanged_customTheme)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
445 self.themeIsBuiltin.trace_variable('w',self.VarChanged_themeIsBuiltin)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
446 self.highlightTarget.trace_variable('w',self.VarChanged_highlightTarget)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
447 self.keyBinding.trace_variable('w',self.VarChanged_keyBinding)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
448 self.builtinKeys.trace_variable('w',self.VarChanged_builtinKeys)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
449 self.customKeys.trace_variable('w',self.VarChanged_customKeys)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
450 self.keysAreBuiltin.trace_variable('w',self.VarChanged_keysAreBuiltin)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
451 self.winWidth.trace_variable('w',self.VarChanged_winWidth)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
452 self.winHeight.trace_variable('w',self.VarChanged_winHeight)
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
453 self.paraWidth.trace_variable('w',self.VarChanged_paraWidth)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
454 self.startupEdit.trace_variable('w',self.VarChanged_startupEdit)
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
455 self.autoSave.trace_variable('w',self.VarChanged_autoSave)
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
456 self.encoding.trace_variable('w',self.VarChanged_encoding)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
457
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
458 def VarChanged_fontSize(self,*params):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
459 value=self.fontSize.get()
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
460 self.AddChangedItem('main','EditorWindow','font-size',value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
461
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
462 def VarChanged_fontName(self,*params):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
463 value=self.fontName.get()
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
464 self.AddChangedItem('main','EditorWindow','font',value)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
465
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
466 def VarChanged_fontBold(self,*params):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
467 value=self.fontBold.get()
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
468 self.AddChangedItem('main','EditorWindow','font-bold',value)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
469
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
470 def VarChanged_spaceNum(self,*params):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
471 value=self.spaceNum.get()
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
472 self.AddChangedItem('main','Indent','num-spaces',value)
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
473
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
474 def VarChanged_colour(self,*params):
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
475 self.OnNewColourSet()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
476
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
477 def VarChanged_builtinTheme(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
478 value=self.builtinTheme.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
479 self.AddChangedItem('main','Theme','name',value)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
480 self.PaintThemeSample()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
481
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
482 def VarChanged_customTheme(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
483 value=self.customTheme.get()
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
484 if value != '- no custom themes -':
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
485 self.AddChangedItem('main','Theme','name',value)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
486 self.PaintThemeSample()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
487
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
488 def VarChanged_themeIsBuiltin(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
489 value=self.themeIsBuiltin.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
490 self.AddChangedItem('main','Theme','default',value)
22127
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
491 if value:
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
492 self.VarChanged_builtinTheme()
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
493 else:
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
494 self.VarChanged_customTheme()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
495
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
496 def VarChanged_highlightTarget(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
497 self.SetHighlightTarget()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
498
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
499 def VarChanged_keyBinding(self,*params):
21777
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
500 value=self.keyBinding.get()
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
501 keySet=self.customKeys.get()
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
502 event=self.listBindings.get(ANCHOR).split()[0]
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
503 if idleConf.IsCoreBinding(event):
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
504 #this is a core keybinding
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
505 self.AddChangedItem('keys',keySet,event,value)
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
506 else: #this is an extension key binding
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
507 extName=idleConf.GetExtnNameForEvent(event)
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
508 extKeybindSection=extName+'_cfgBindings'
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
509 self.AddChangedItem('extensions',extKeybindSection,event,value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
510
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
511 def VarChanged_builtinKeys(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
512 value=self.builtinKeys.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
513 self.AddChangedItem('main','Keys','name',value)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
514 self.LoadKeysList(value)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
515
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
516 def VarChanged_customKeys(self,*params):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
517 value=self.customKeys.get()
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
518 if value != '- no custom keys -':
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
519 self.AddChangedItem('main','Keys','name',value)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
520 self.LoadKeysList(value)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
521
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
522 def VarChanged_keysAreBuiltin(self,*params):
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
523 value=self.keysAreBuiltin.get()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
524 self.AddChangedItem('main','Keys','default',value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
525 if value:
22127
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
526 self.VarChanged_builtinKeys()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
527 else:
22127
5994440e5dd5 further work on new config system
Steven M. Gava <elguavas@python.net>
parents: 22111
diff changeset
528 self.VarChanged_customKeys()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
529
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
530 def VarChanged_winWidth(self,*params):
21777
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
531 value=self.winWidth.get()
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
532 self.AddChangedItem('main','EditorWindow','width',value)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
533
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
534 def VarChanged_winHeight(self,*params):
21777
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
535 value=self.winHeight.get()
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
536 self.AddChangedItem('main','EditorWindow','height',value)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
537
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
538 def VarChanged_paraWidth(self,*params):
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
539 value=self.paraWidth.get()
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
540 self.AddChangedItem('main','FormatParagraph','paragraph',value)
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
541
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
542 def VarChanged_startupEdit(self,*params):
21777
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
543 value=self.startupEdit.get()
633e64564edf more on config saving
Steven M. Gava <elguavas@python.net>
parents: 21776
diff changeset
544 self.AddChangedItem('main','General','editor-on-startup',value)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
545
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
546 def VarChanged_autoSave(self,*params):
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
547 value=self.autoSave.get()
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
548 self.AddChangedItem('main','General','autosave',value)
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
549
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
550 def VarChanged_encoding(self,*params):
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
551 value=self.encoding.get()
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
552 self.AddChangedItem('main','EditorWindow','encoding',value)
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
553
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
554 def ResetChangedItems(self):
22111
c494084dc6d8 First work on making config changes dynamic,
Steven M. Gava <elguavas@python.net>
parents: 21975
diff changeset
555 #When any config item is changed in this dialog, an entry
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
556 #should be made in the relevant section (config type) of this
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
557 #dictionary. The key should be the config file section name and the
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
558 #value a dictionary, whose key:value pairs are item=value pairs for
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
559 #that config file section.
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
560 self.changedItems={'main':{},'highlight':{},'keys':{},'extensions':{}}
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
561
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
562 def AddChangedItem(self,type,section,item,value):
21835
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
563 value=str(value) #make sure we use a string
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
564 if not self.changedItems[type].has_key(section):
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
565 self.changedItems[type][section]={}
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
566 self.changedItems[type][section][item]=value
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
567
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
568 def GetDefaultItems(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
569 dItems={'main':{},'highlight':{},'keys':{},'extensions':{}}
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
570 for configType in dItems.keys():
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
571 sections=idleConf.GetSectionList('default',configType)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
572 for section in sections:
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
573 dItems[configType][section]={}
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
574 options=idleConf.defaultCfg[configType].GetOptionList(section)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
575 for option in options:
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
576 dItems[configType][section][option]=(
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
577 idleConf.defaultCfg[configType].Get(section,option))
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
578 return dItems
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
579
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
580 def SetThemeType(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
581 if self.themeIsBuiltin.get():
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
582 self.optMenuThemeBuiltin.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
583 self.optMenuThemeCustom.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
584 self.buttonDeleteCustomTheme.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
585 else:
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
586 self.optMenuThemeBuiltin.config(state=DISABLED)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
587 self.radioThemeCustom.config(state=NORMAL)
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
588 self.optMenuThemeCustom.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
589 self.buttonDeleteCustomTheme.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
590
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
591 def SetKeysType(self):
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
592 if self.keysAreBuiltin.get():
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
593 self.optMenuKeysBuiltin.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
594 self.optMenuKeysCustom.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
595 self.buttonDeleteCustomKeys.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
596 else:
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
597 self.optMenuKeysBuiltin.config(state=DISABLED)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
598 self.radioKeysCustom.config(state=NORMAL)
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
599 self.optMenuKeysCustom.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
600 self.buttonDeleteCustomKeys.config(state=NORMAL)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
601
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
602 def GetNewKeys(self):
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
603 listIndex=self.listBindings.index(ANCHOR)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
604 binding=self.listBindings.get(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
605 bindName=binding.split()[0] #first part, up to first space
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
606 if self.keysAreBuiltin.get():
21909
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
607 currentKeySetName=self.builtinKeys.get()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
608 else:
21909
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
609 currentKeySetName=self.customKeys.get()
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
610 currentBindings=idleConf.GetCurrentKeySet()
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
611 if currentKeySetName in self.changedItems['keys'].keys(): #unsaved changes
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
612 keySetChanges=self.changedItems['keys'][currentKeySetName]
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
613 for event in keySetChanges.keys():
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
614 currentBindings[event]=keySetChanges[event].split()
7c30cb17c2f6 improvement to keybinding re-use check
Steven M. Gava <elguavas@python.net>
parents: 21908
diff changeset
615 currentKeySequences=currentBindings.values()
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
616 newKeys=GetKeysDialog(self,'Get New Keys',bindName,
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
617 currentKeySequences).result
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
618 if newKeys: #new keys were specified
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
619 if self.keysAreBuiltin.get(): #current key set is a built-in
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
620 message=('Your changes will be saved as a new Custom Key Set. '+
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
621 'Enter a name for your new Custom Key Set below.')
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
622 newKeySet=self.GetNewKeysName(message)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
623 if not newKeySet: #user cancelled custom key set creation
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
624 self.listBindings.select_set(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
625 self.listBindings.select_anchor(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
626 return
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
627 else: #create new custom key set based on previously active key set
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
628 self.CreateNewKeySet(newKeySet)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
629 self.listBindings.delete(listIndex)
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
630 self.listBindings.insert(listIndex,bindName+' - '+newKeys)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
631 self.listBindings.select_set(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
632 self.listBindings.select_anchor(listIndex)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
633 self.keyBinding.set(newKeys)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
634 else:
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
635 self.listBindings.select_set(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
636 self.listBindings.select_anchor(listIndex)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
637
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
638 def GetNewKeysName(self,message):
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
639 usedNames=(idleConf.GetSectionList('user','keys')+
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
640 idleConf.GetSectionList('default','keys'))
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
641 newKeySet=GetCfgSectionNameDialog(self,'New Custom Key Set',
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
642 message,usedNames).result
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
643 return newKeySet
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
644
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
645 def SaveAsNewKeySet(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
646 newKeysName=self.GetNewKeysName('New Key Set Name:')
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
647 if newKeysName:
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
648 self.CreateNewKeySet(newKeysName)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
649
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
650 def KeyBindingSelected(self,event):
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
651 self.buttonNewKeys.config(state=NORMAL)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
652
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
653 def CreateNewKeySet(self,newKeySetName):
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
654 #creates new custom key set based on the previously active key set,
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
655 #and makes the new key set active
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
656 if self.keysAreBuiltin.get():
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
657 prevKeySetName=self.builtinKeys.get()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
658 else:
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
659 prevKeySetName=self.customKeys.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
660 prevKeys=idleConf.GetCoreKeys(prevKeySetName)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
661 newKeys={}
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
662 for event in prevKeys.keys(): #add key set to changed items
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
663 eventName=event[2:-2] #trim off the angle brackets
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
664 binding=string.join(prevKeys[event])
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
665 newKeys[eventName]=binding
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
666 #handle any unsaved changes to prev key set
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
667 if prevKeySetName in self.changedItems['keys'].keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
668 keySetChanges=self.changedItems['keys'][prevKeySetName]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
669 for event in keySetChanges.keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
670 newKeys[event]=keySetChanges[event]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
671 #save the new theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
672 self.SaveNewKeySet(newKeySetName,newKeys)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
673 #change gui over to the new key set
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
674 customKeyList=idleConf.GetSectionList('user','keys')
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
675 customKeyList.sort()
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
676 self.optMenuKeysCustom.SetMenu(customKeyList,newKeySetName)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
677 self.keysAreBuiltin.set(0)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
678 self.SetKeysType()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
679
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
680 def LoadKeysList(self,keySetName):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
681 reselect=0
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
682 newKeySet=0
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
683 if self.listBindings.curselection():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
684 reselect=1
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
685 listIndex=self.listBindings.index(ANCHOR)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
686 keySet=idleConf.GetKeySet(keySetName)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
687 bindNames=keySet.keys()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
688 bindNames.sort()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
689 self.listBindings.delete(0,END)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
690 for bindName in bindNames:
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
691 key=string.join(keySet[bindName]) #make key(s) into a string
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
692 bindName=bindName[2:-2] #trim off the angle brackets
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
693 if keySetName in self.changedItems['keys'].keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
694 #handle any unsaved changes to this key set
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
695 if bindName in self.changedItems['keys'][keySetName].keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
696 key=self.changedItems['keys'][keySetName][bindName]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
697 self.listBindings.insert(END, bindName+' - '+key)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
698 if reselect:
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
699 self.listBindings.see(listIndex)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
700 self.listBindings.select_set(listIndex)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
701 self.listBindings.select_anchor(listIndex)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
702
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
703 def DeleteCustomKeys(self):
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
704 keySetName=self.customKeys.get()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
705 if not tkMessageBox.askyesno('Delete Key Set','Are you sure you wish '+
31515
71a294bd7950 Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents: 29794
diff changeset
706 'to delete the key set %r ?' % (keySetName),
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
707 parent=self):
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
708 return
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
709 #remove key set from config
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
710 idleConf.userCfg['keys'].remove_section(keySetName)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
711 if self.changedItems['keys'].has_key(keySetName):
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
712 del(self.changedItems['keys'][keySetName])
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
713 #write changes
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
714 idleConf.userCfg['keys'].Save()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
715 #reload user key set list
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
716 itemList=idleConf.GetSectionList('user','keys')
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
717 itemList.sort()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
718 if not itemList:
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
719 self.radioKeysCustom.config(state=DISABLED)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
720 self.optMenuKeysCustom.SetMenu(itemList,'- no custom keys -')
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
721 else:
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
722 self.optMenuKeysCustom.SetMenu(itemList,itemList[0])
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
723 #revert to default key set
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
724 self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys','default'))
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
725 self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys','name'))
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
726 #user can't back out of these changes, they must be applied now
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
727 self.Apply()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
728 self.SetKeysType()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
729
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
730 def DeleteCustomTheme(self):
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
731 themeName=self.customTheme.get()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
732 if not tkMessageBox.askyesno('Delete Theme','Are you sure you wish '+
31515
71a294bd7950 Replace backticks with repr() or "%r"
Walter Dörwald <walter@livinglogic.de>
parents: 29794
diff changeset
733 'to delete the theme %r ?' % (themeName,),
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
734 parent=self):
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
735 return
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
736 #remove theme from config
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
737 idleConf.userCfg['highlight'].remove_section(themeName)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
738 if self.changedItems['highlight'].has_key(themeName):
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
739 del(self.changedItems['highlight'][themeName])
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
740 #write changes
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
741 idleConf.userCfg['highlight'].Save()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
742 #reload user theme list
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
743 itemList=idleConf.GetSectionList('user','highlight')
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
744 itemList.sort()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
745 if not itemList:
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
746 self.radioThemeCustom.config(state=DISABLED)
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
747 self.optMenuThemeCustom.SetMenu(itemList,'- no custom themes -')
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
748 else:
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
749 self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
750 #revert to default theme
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
751 self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme','default'))
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
752 self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme','name'))
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
753 #user can't back out of these changes, they must be applied now
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
754 self.Apply()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
755 self.SetThemeType()
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
756
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
757 def GetColour(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
758 target=self.highlightTarget.get()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
759 prevColour=self.frameColourSet.cget('bg')
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
760 rgbTuplet, colourString = tkColorChooser.askcolor(parent=self,
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
761 title='Pick new colour for : '+target,initialcolor=prevColour)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
762 if colourString and (colourString!=prevColour):
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
763 #user didn't cancel, and they chose a new colour
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
764 if self.themeIsBuiltin.get(): #current theme is a built-in
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
765 message=('Your changes will be saved as a new Custom Theme. '+
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
766 'Enter a name for your new Custom Theme below.')
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
767 newTheme=self.GetNewThemeName(message)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
768 if not newTheme: #user cancelled custom theme creation
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
769 return
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
770 else: #create new custom theme based on previously active theme
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
771 self.CreateNewTheme(newTheme)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
772 self.colour.set(colourString)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
773 else: #current theme is user defined
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
774 self.colour.set(colourString)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
775
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
776 def OnNewColourSet(self):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
777 newColour=self.colour.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
778 self.frameColourSet.config(bg=newColour)#set sample
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
779 if self.fgHilite.get(): plane='foreground'
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
780 else: plane='background'
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
781 sampleElement=self.themeElements[self.highlightTarget.get()][0]
29794
94e5d1b8f696 SF patch #768187: replace apply(f, args, kwds) with f(*args, **kwds)
Raymond Hettinger <python@rcn.com>
parents: 29269
diff changeset
782 self.textHighlightSample.tag_config(sampleElement, **{plane:newColour})
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
783 theme=self.customTheme.get()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
784 themeElement=sampleElement+'-'+plane
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
785 self.AddChangedItem('highlight',theme,themeElement,newColour)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
786
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
787 def GetNewThemeName(self,message):
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
788 usedNames=(idleConf.GetSectionList('user','highlight')+
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
789 idleConf.GetSectionList('default','highlight'))
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
790 newTheme=GetCfgSectionNameDialog(self,'New Custom Theme',
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
791 message,usedNames).result
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
792 return newTheme
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
793
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
794 def SaveAsNewTheme(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
795 newThemeName=self.GetNewThemeName('New Theme Name:')
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
796 if newThemeName:
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
797 self.CreateNewTheme(newThemeName)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
798
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
799 def CreateNewTheme(self,newThemeName):
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
800 #creates new custom theme based on the previously active theme,
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
801 #and makes the new theme active
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
802 if self.themeIsBuiltin.get():
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
803 themeType='default'
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
804 themeName=self.builtinTheme.get()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
805 else:
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
806 themeType='user'
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
807 themeName=self.customTheme.get()
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
808 newTheme=idleConf.GetThemeDict(themeType,themeName)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
809 #apply any of the old theme's unsaved changes to the new theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
810 if themeName in self.changedItems['highlight'].keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
811 themeChanges=self.changedItems['highlight'][themeName]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
812 for element in themeChanges.keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
813 newTheme[element]=themeChanges[element]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
814 #save the new theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
815 self.SaveNewTheme(newThemeName,newTheme)
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
816 #change gui over to the new theme
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
817 customThemeList=idleConf.GetSectionList('user','highlight')
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
818 customThemeList.sort()
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
819 self.optMenuThemeCustom.SetMenu(customThemeList,newThemeName)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
820 self.themeIsBuiltin.set(0)
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
821 self.SetThemeType()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
822
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
823 def OnListFontButtonRelease(self,event):
29269
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
824 font = self.listFontName.get(ANCHOR)
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
825 self.fontName.set(font.lower())
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
826 self.SetFontSample()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
827
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
828 def SetFontSample(self,event=None):
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
829 fontName=self.fontName.get()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
830 if self.fontBold.get():
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
831 fontWeight=tkFont.BOLD
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
832 else:
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
833 fontWeight=tkFont.NORMAL
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
834 self.editFont.config(size=self.fontSize.get(),
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
835 weight=fontWeight,family=fontName)
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
836
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
837 def SetHighlightTarget(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
838 if self.highlightTarget.get()=='Cursor': #bg not possible
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
839 self.radioFg.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
840 self.radioBg.config(state=DISABLED)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
841 self.fgHilite.set(1)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
842 else: #both fg and bg can be set
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
843 self.radioFg.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
844 self.radioBg.config(state=NORMAL)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
845 self.fgHilite.set(1)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
846 self.SetColourSample()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
847
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
848 def SetColourSampleBinding(self,*args):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
849 self.SetColourSample()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
850
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
851 def SetColourSample(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
852 #set the colour smaple area
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
853 tag=self.themeElements[self.highlightTarget.get()][0]
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
854 if self.fgHilite.get(): plane='foreground'
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
855 else: plane='background'
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
856 colour=self.textHighlightSample.tag_cget(tag,plane)
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
857 self.frameColourSet.config(bg=colour)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
858
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
859 def PaintThemeSample(self):
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
860 if self.themeIsBuiltin.get(): #a default theme
20864
8957341f98f8 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20858
diff changeset
861 theme=self.builtinTheme.get()
8957341f98f8 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20858
diff changeset
862 else: #a user theme
8957341f98f8 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20858
diff changeset
863 theme=self.customTheme.get()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
864 for elementTitle in self.themeElements.keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
865 element=self.themeElements[elementTitle][0]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
866 colours=idleConf.GetHighlight(theme,element)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
867 if element=='cursor': #cursor sample needs special painting
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
868 colours['background']=idleConf.GetHighlight(theme,
21627
051f3b65ddab loading core keybindings via new config system plus
Steven M. Gava <elguavas@python.net>
parents: 21623
diff changeset
869 'normal', fgBg='bg')
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
870 #handle any unsaved changes to this theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
871 if theme in self.changedItems['highlight'].keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
872 themeDict=self.changedItems['highlight'][theme]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
873 if themeDict.has_key(element+'-foreground'):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
874 colours['foreground']=themeDict[element+'-foreground']
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
875 if themeDict.has_key(element+'-background'):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
876 colours['background']=themeDict[element+'-background']
29794
94e5d1b8f696 SF patch #768187: replace apply(f, args, kwds) with f(*args, **kwds)
Raymond Hettinger <python@rcn.com>
parents: 29269
diff changeset
877 self.textHighlightSample.tag_config(element, **colours)
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
878 self.SetColourSample()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
879
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
880 def HelpSourceSelected(self,event):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
881 self.SetHelpListButtonStates()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
882
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
883 def SetHelpListButtonStates(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
884 if self.listHelp.size()<1: #no entries in list
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
885 self.buttonHelpListEdit.config(state=DISABLED)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
886 self.buttonHelpListRemove.config(state=DISABLED)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
887 else: #there are some entries
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
888 if self.listHelp.curselection(): #there currently is a selection
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
889 self.buttonHelpListEdit.config(state=NORMAL)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
890 self.buttonHelpListRemove.config(state=NORMAL)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
891 else: #there currently is not a selection
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
892 self.buttonHelpListEdit.config(state=DISABLED)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
893 self.buttonHelpListRemove.config(state=DISABLED)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
894
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
895 def HelpListItemAdd(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
896 helpSource=GetHelpSourceDialog(self,'New Help Source').result
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
897 if helpSource:
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
898 self.userHelpList.append( (helpSource[0],helpSource[1]) )
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
899 self.listHelp.insert(END,helpSource[0])
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
900 self.UpdateUserHelpChangedItems()
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
901 self.SetHelpListButtonStates()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
902
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
903 def HelpListItemEdit(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
904 itemIndex=self.listHelp.index(ANCHOR)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
905 helpSource=self.userHelpList[itemIndex]
22600
0c5c64b75d5d further work on new config system;
Steven M. Gava <elguavas@python.net>
parents: 22363
diff changeset
906 newHelpSource=GetHelpSourceDialog(self,'Edit Help Source',
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
907 menuItem=helpSource[0],filePath=helpSource[1]).result
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
908 if (not newHelpSource) or (newHelpSource==helpSource):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
909 return #no changes
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
910 self.userHelpList[itemIndex]=newHelpSource
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
911 self.listHelp.delete(itemIndex)
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
912 self.listHelp.insert(itemIndex,newHelpSource[0])
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
913 self.UpdateUserHelpChangedItems()
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
914 self.SetHelpListButtonStates()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
915
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
916 def HelpListItemRemove(self):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
917 itemIndex=self.listHelp.index(ANCHOR)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
918 del(self.userHelpList[itemIndex])
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
919 self.listHelp.delete(itemIndex)
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
920 self.UpdateUserHelpChangedItems()
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
921 self.SetHelpListButtonStates()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
922
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
923 def UpdateUserHelpChangedItems(self):
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
924 "Clear and rebuild the HelpFiles section in self.changedItems"
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
925 self.changedItems['main']['HelpFiles'] = {}
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
926 for num in range(1,len(self.userHelpList)+1):
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
927 self.AddChangedItem('main','HelpFiles',str(num),
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
928 string.join(self.userHelpList[num-1][:2],';'))
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
929
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
930 def LoadFontCfg(self):
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
931 ##base editor font selection list
20052
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
932 fonts=list(tkFont.families(self))
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
933 fonts.sort()
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
934 for font in fonts:
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
935 self.listFontName.insert(END,font)
20684
433ae4838703 further work on loading config dialog values from the config files
Steven M. Gava <elguavas@python.net>
parents: 20628
diff changeset
936 configuredFont=idleConf.GetOption('main','EditorWindow','font',
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
937 default='courier')
29269
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
938 lc_configuredFont = configuredFont.lower()
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
939 self.fontName.set(lc_configuredFont)
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
940 lc_fonts = [s.lower() for s in fonts]
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
941 if lc_configuredFont in lc_fonts:
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
942 currentFontIndex = lc_fonts.index(lc_configuredFont)
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
943 self.listFontName.see(currentFontIndex)
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
944 self.listFontName.select_set(currentFontIndex)
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
945 self.listFontName.select_anchor(currentFontIndex)
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
946 ##font size dropdown
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
947 fontSize=idleConf.GetOption('main','EditorWindow','font-size',
29269
c56338e087ca 1. SF Bug 661676
Kurt B. Kaiser <kbk@shore.net>
parents: 29266
diff changeset
948 default='10')
26009
029e75ffe750 [ 629984 ] Smaller font sizes not supported
Chui Tey <chui.tey@advdata.com.au>
parents: 25264
diff changeset
949 self.optMenuFontSize.SetMenu(('7','8','9','10','11','12','13','14',
20684
433ae4838703 further work on loading config dialog values from the config files
Steven M. Gava <elguavas@python.net>
parents: 20628
diff changeset
950 '16','18','20','22'),fontSize )
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
951 ##fontWeight
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
952 self.fontBold.set(idleConf.GetOption('main','EditorWindow',
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
953 'font-bold',default=0,type='bool'))
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
954 ##font sample
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
955 self.SetFontSample()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
956
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
957 def LoadTabCfg(self):
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
958 ##indent sizes
20684
433ae4838703 further work on loading config dialog values from the config files
Steven M. Gava <elguavas@python.net>
parents: 20628
diff changeset
959 spaceNum=idleConf.GetOption('main','Indent','num-spaces',
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
960 default=4,type='int')
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
961 self.spaceNum.set(spaceNum)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
962
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
963 def LoadThemeCfg(self):
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
964 ##current theme type radiobutton
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
965 self.themeIsBuiltin.set(idleConf.GetOption('main','Theme','default',
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
966 type='bool',default=1))
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
967 ##currently set theme
21623
be8697c70e7c further development of highlighting and editor preference handling,
Steven M. Gava <elguavas@python.net>
parents: 21232
diff changeset
968 currentOption=idleConf.CurrentTheme()
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
969 ##load available theme option menus
20866
ebbdc38eb11c new config implementation
Steven M. Gava <elguavas@python.net>
parents: 20864
diff changeset
970 if self.themeIsBuiltin.get(): #default theme selected
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
971 itemList=idleConf.GetSectionList('default','highlight')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
972 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
973 self.optMenuThemeBuiltin.SetMenu(itemList,currentOption)
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
974 itemList=idleConf.GetSectionList('user','highlight')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
975 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
976 if not itemList:
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
977 self.radioThemeCustom.config(state=DISABLED)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
978 self.customTheme.set('- no custom themes -')
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
979 else:
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
980 self.optMenuThemeCustom.SetMenu(itemList,itemList[0])
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
981 else: #user theme selected
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
982 itemList=idleConf.GetSectionList('user','highlight')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
983 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
984 self.optMenuThemeCustom.SetMenu(itemList,currentOption)
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
985 itemList=idleConf.GetSectionList('default','highlight')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
986 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
987 self.optMenuThemeBuiltin.SetMenu(itemList,itemList[0])
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
988 self.SetThemeType()
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
989 ##load theme element option menu
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
990 themeNames=self.themeElements.keys()
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
991 themeNames.sort(self.__ThemeNameIndexCompare)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
992 self.optMenuHighlightTarget.SetMenu(themeNames,themeNames[0])
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
993 self.PaintThemeSample()
21627
051f3b65ddab loading core keybindings via new config system plus
Steven M. Gava <elguavas@python.net>
parents: 21623
diff changeset
994 self.SetHighlightTarget()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
995
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
996 def __ThemeNameIndexCompare(self,a,b):
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
997 if self.themeElements[a][1]<self.themeElements[b][1]: return -1
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
998 elif self.themeElements[a][1]==self.themeElements[b][1]: return 0
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
999 else: return 1
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1000
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
1001 def LoadKeyCfg(self):
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1002 ##current keys type radiobutton
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1003 self.keysAreBuiltin.set(idleConf.GetOption('main','Keys','default',
21776
9bec183fefff further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21767
diff changeset
1004 type='bool',default=1))
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1005 ##currently set keys
21623
be8697c70e7c further development of highlighting and editor preference handling,
Steven M. Gava <elguavas@python.net>
parents: 21232
diff changeset
1006 currentOption=idleConf.CurrentKeys()
20736
a7884e7eecc9 more loading from cfg files
Steven M. Gava <elguavas@python.net>
parents: 20735
diff changeset
1007 ##load available keyset option menus
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1008 if self.keysAreBuiltin.get(): #default theme selected
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1009 itemList=idleConf.GetSectionList('default','keys')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
1010 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1011 self.optMenuKeysBuiltin.SetMenu(itemList,currentOption)
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1012 itemList=idleConf.GetSectionList('user','keys')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
1013 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1014 if not itemList:
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1015 self.radioKeysCustom.config(state=DISABLED)
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1016 self.customKeys.set('- no custom keys -')
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1017 else:
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1018 self.optMenuKeysCustom.SetMenu(itemList,itemList[0])
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
1019 else: #user key set selected
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1020 itemList=idleConf.GetSectionList('user','keys')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
1021 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1022 self.optMenuKeysCustom.SetMenu(itemList,currentOption)
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1023 itemList=idleConf.GetSectionList('default','keys')
21798
03a2ba74179b further work on saving configs
Steven M. Gava <elguavas@python.net>
parents: 21777
diff changeset
1024 itemList.sort()
20735
faa2726dea37 more of config dialog reading from files
Steven M. Gava <elguavas@python.net>
parents: 20684
diff changeset
1025 self.optMenuKeysBuiltin.SetMenu(itemList,itemList[0])
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1026 self.SetKeysType()
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
1027 ##load keyset element list
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1028 keySetName=idleConf.CurrentKeys()
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1029 self.LoadKeysList(keySetName)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1030
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
1031 def LoadGeneralCfg(self):
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1032 #startup state
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1033 self.startupEdit.set(idleConf.GetOption('main','General',
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1034 'editor-on-startup',default=1,type='bool'))
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
1035 #autosave state
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
1036 self.autoSave.set(idleConf.GetOption('main', 'General', 'autosave',
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
1037 default=0, type='bool'))
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
1038 #initial window size
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1039 self.winWidth.set(idleConf.GetOption('main','EditorWindow','width'))
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
1040 self.winHeight.set(idleConf.GetOption('main','EditorWindow','height'))
32241
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
1041 #initial paragraph reformat size
b9345c355f04 SF patch #961387: Make IDLE's paragraph reformatting width configurable
Raymond Hettinger <python@rcn.com>
parents: 31895
diff changeset
1042 self.paraWidth.set(idleConf.GetOption('main','FormatParagraph','paragraph'))
29060
9835b41133ac [ SF 710733 - Martin v. Loewis] Improving source encoding dialog
Kurt B. Kaiser <kbk@shore.net>
parents: 27245
diff changeset
1043 # default source encoding
29266
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
1044 self.encoding.set(idleConf.GetOption('main', 'EditorWindow',
d23e9320d350 Bruce Sherwood RFE/Patch
Kurt B. Kaiser <kbk@shore.net>
parents: 29060
diff changeset
1045 'encoding', default='none'))
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
1046 # additional help sources
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
1047 self.userHelpList = idleConf.GetAllExtraHelpSourcesList()
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
1048 for helpItem in self.userHelpList:
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
1049 self.listHelp.insert(END,helpItem[0])
21875
7faf0fddf7e6 further work on config system and config saving
Steven M. Gava <elguavas@python.net>
parents: 21854
diff changeset
1050 self.SetHelpListButtonStates()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1051
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1052 def LoadConfigs(self):
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1053 """
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1054 load configuration from default and user config files and populate
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1055 the widgets on the config dialog pages.
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1056 """
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1057 ### fonts / tabs page
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1058 self.LoadFontCfg()
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1059 self.LoadTabCfg()
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1060 ### highlighting page
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
1061 self.LoadThemeCfg()
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1062 ### keys page
20858
24105e989f17 further config system work
Steven M. Gava <elguavas@python.net>
parents: 20856
diff changeset
1063 self.LoadKeyCfg()
20628
1598588ef1ad font/tabs config dialog page now reads its data from the config file
Steven M. Gava <elguavas@python.net>
parents: 20052
diff changeset
1064 ### general page
21762
a1b0658293a7 keybinding configuration
Steven M. Gava <elguavas@python.net>
parents: 21627
diff changeset
1065 self.LoadGeneralCfg()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1066
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1067 def SaveNewKeySet(self,keySetName,keySet):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1068 """
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1069 save a newly created core key set.
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1070 keySetName - string, the name of the new key set
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1071 keySet - dictionary containing the new key set
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1072 """
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1073 if not idleConf.userCfg['keys'].has_section(keySetName):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1074 idleConf.userCfg['keys'].add_section(keySetName)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1075 for event in keySet.keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1076 value=keySet[event]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1077 idleConf.userCfg['keys'].SetOption(keySetName,event,value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1078
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1079 def SaveNewTheme(self,themeName,theme):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1080 """
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1081 save a newly created theme.
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1082 themeName - string, the name of the new theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1083 theme - dictionary containing the new theme
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1084 """
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1085 if not idleConf.userCfg['highlight'].has_section(themeName):
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1086 idleConf.userCfg['highlight'].add_section(themeName)
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1087 for element in theme.keys():
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1088 value=theme[element]
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1089 idleConf.userCfg['highlight'].SetOption(themeName,element,value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1090
21835
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1091 def SetUserValue(self,configType,section,item,value):
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1092 if idleConf.defaultCfg[configType].has_option(section,item):
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1093 if idleConf.defaultCfg[configType].Get(section,item)==value:
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1094 #the setting equals a default setting, remove it from user cfg
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1095 return idleConf.userCfg[configType].RemoveOption(section,item)
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1096 #if we got here set the option
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1097 return idleConf.userCfg[configType].SetOption(section,item,value)
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1098
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1099 def SaveAllChangedConfigs(self):
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1100 "Save configuration changes to the user config file."
22600
0c5c64b75d5d further work on new config system;
Steven M. Gava <elguavas@python.net>
parents: 22363
diff changeset
1101 idleConf.userCfg['main'].Save()
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1102 for configType in self.changedItems.keys():
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1103 cfgTypeHasChanges = False
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1104 for section in self.changedItems[configType].keys():
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1105 if section == 'HelpFiles':
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1106 #this section gets completely replaced
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1107 idleConf.userCfg['main'].remove_section('HelpFiles')
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
1108 cfgTypeHasChanges = True
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1109 for item in self.changedItems[configType][section].keys():
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1110 value = self.changedItems[configType][section][item]
21835
f379bc0c5e3f further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21798
diff changeset
1111 if self.SetUserValue(configType,section,item,value):
27204
0a035f9299a9 M configDialog.py
Kurt B. Kaiser <kbk@shore.net>
parents: 26959
diff changeset
1112 cfgTypeHasChanges = True
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1113 if cfgTypeHasChanges:
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1114 idleConf.userCfg[configType].Save()
33995
b871b94f07b6 Saving a Keyset w/o making changes (by using the "Save as New Custom Key Set"
Kurt B. Kaiser <kbk@shore.net>
parents: 32241
diff changeset
1115 for configType in ['keys', 'highlight']:
b871b94f07b6 Saving a Keyset w/o making changes (by using the "Save as New Custom Key Set"
Kurt B. Kaiser <kbk@shore.net>
parents: 32241
diff changeset
1116 # save these even if unchanged!
b871b94f07b6 Saving a Keyset w/o making changes (by using the "Save as New Custom Key Set"
Kurt B. Kaiser <kbk@shore.net>
parents: 32241
diff changeset
1117 idleConf.userCfg[configType].Save()
21854
c433de17c158 more work on configuration saving
Steven M. Gava <elguavas@python.net>
parents: 21835
diff changeset
1118 self.ResetChangedItems() #clear the changed items dict
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1119
35891
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1120 def DeactivateCurrentConfig(self):
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1121 #Before a config is saved, some cleanup of current
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1122 #config must be done - remove the previous keybindings
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1123 winInstances=self.parent.instance_dict.keys()
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1124 for instance in winInstances:
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1125 instance.RemoveKeybindings()
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1126
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
1127 def ActivateConfigChanges(self):
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
1128 "Dynamically apply configuration changes"
31895
c56ea60cb3bf M EditorWindow.py
Kurt B. Kaiser <kbk@shore.net>
parents: 31625
diff changeset
1129 winInstances=self.parent.instance_dict.keys()
22111
c494084dc6d8 First work on making config changes dynamic,
Steven M. Gava <elguavas@python.net>
parents: 21975
diff changeset
1130 for instance in winInstances:
c494084dc6d8 First work on making config changes dynamic,
Steven M. Gava <elguavas@python.net>
parents: 21975
diff changeset
1131 instance.ResetColorizer()
22238
ae578c8c6ced further work on dynamic config changes;
Steven M. Gava <elguavas@python.net>
parents: 22128
diff changeset
1132 instance.ResetFont()
34520
5fd506516361 Removed ability to configure tabs indent from Options dialog. This 'feature'
Kurt B. Kaiser <kbk@shore.net>
parents: 33995
diff changeset
1133 instance.set_notabs_indentwidth()
35891
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1134 instance.ApplyKeybindings()
27245
d3ab532b3b6d M Bindings.py
Kurt B. Kaiser <kbk@shore.net>
parents: 27204
diff changeset
1135 instance.reset_help_menu_entries()
26959
b8c72e86a12d Whitespace Normalization
Kurt B. Kaiser <kbk@shore.net>
parents: 26009
diff changeset
1136
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1137 def Cancel(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1138 self.destroy()
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1139
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1140 def Ok(self):
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1141 self.Apply()
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1142 self.destroy()
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1143
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1144 def Apply(self):
35891
8fd46b660e66 Merge IDLE-syntax-branch r39668:41449 into trunk
Kurt B. Kaiser <kbk@shore.net>
parents: 35276
diff changeset
1145 self.DeactivateCurrentConfig()
21906
f881e0618df0 further work on config saving
Steven M. Gava <elguavas@python.net>
parents: 21875
diff changeset
1146 self.SaveAllChangedConfigs()
21975
8e0c3b75eff5 handle user theme and key set deletion
Steven M. Gava <elguavas@python.net>
parents: 21909
diff changeset
1147 self.ActivateConfigChanges()
21767
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1148
8a2cd1c0c135 extension config reading by configDialog and
Steven M. Gava <elguavas@python.net>
parents: 21764
diff changeset
1149 def Help(self):
20052
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
1150 pass
0ee8903d3fed start of new config handling stuff
Steven M. Gava <elguavas@python.net>
parents: 19201
diff changeset
1151
18899
0132af63506b some new dialogs and support files for new about and configuration implementations
Steven M. Gava <elguavas@python.net>
parents:
diff changeset
1152 if __name__ == '__main__':
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
1153 #test the dialog
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
1154 root=Tk()
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
1155 Button(root,text='Dialog',
21035
c4499596b1a4 back in harness on new config system
Steven M. Gava <elguavas@python.net>
parents: 20866
diff changeset
1156 command=lambda:ConfigDialog(root,'Settings')).pack()
31895
c56ea60cb3bf M EditorWindow.py
Kurt B. Kaiser <kbk@shore.net>
parents: 31625
diff changeset
1157 root.instance_dict={}
18906
29104173a072 indentation style changed to match existing source
Steven M. Gava <elguavas@python.net>
parents: 18899
diff changeset
1158 root.mainloop()