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