Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../idlelib
File: configDialog.py
"""IDLE Configuration Dialog: support user customization of IDLE by GUI
[0] Fix | Delete
[1] Fix | Delete
Customize font faces, sizes, and colorization attributes. Set indentation
[2] Fix | Delete
defaults. Customize keybindings. Colorization and keybindings can be
[3] Fix | Delete
saved as user defined sets. Select startup options including shell/editor
[4] Fix | Delete
and default window size. Define additional help sources.
[5] Fix | Delete
[6] Fix | Delete
Note that tab width in IDLE is currently fixed at eight due to Tk issues.
[7] Fix | Delete
Refer to comments in EditorWindow autoindent code for details.
[8] Fix | Delete
[9] Fix | Delete
"""
[10] Fix | Delete
from Tkinter import *
[11] Fix | Delete
import tkMessageBox, tkColorChooser, tkFont
[12] Fix | Delete
[13] Fix | Delete
from idlelib.configHandler import idleConf
[14] Fix | Delete
from idlelib.dynOptionMenuWidget import DynOptionMenu
[15] Fix | Delete
from idlelib.keybindingDialog import GetKeysDialog
[16] Fix | Delete
from idlelib.configSectionNameDialog import GetCfgSectionNameDialog
[17] Fix | Delete
from idlelib.configHelpSourceEdit import GetHelpSourceDialog
[18] Fix | Delete
from idlelib.tabbedpages import TabbedPageSet
[19] Fix | Delete
from idlelib.textView import view_text
[20] Fix | Delete
from idlelib import macosxSupport
[21] Fix | Delete
[22] Fix | Delete
class ConfigDialog(Toplevel):
[23] Fix | Delete
[24] Fix | Delete
def __init__(self, parent, title='', _htest=False, _utest=False):
[25] Fix | Delete
"""
[26] Fix | Delete
_htest - bool, change box location when running htest
[27] Fix | Delete
_utest - bool, don't wait_window when running unittest
[28] Fix | Delete
"""
[29] Fix | Delete
Toplevel.__init__(self, parent)
[30] Fix | Delete
self.parent = parent
[31] Fix | Delete
if _htest:
[32] Fix | Delete
parent.instance_dict = {}
[33] Fix | Delete
self.wm_withdraw()
[34] Fix | Delete
[35] Fix | Delete
self.configure(borderwidth=5)
[36] Fix | Delete
self.title(title or 'IDLE Preferences')
[37] Fix | Delete
self.geometry(
[38] Fix | Delete
"+%d+%d" % (parent.winfo_rootx() + 20,
[39] Fix | Delete
parent.winfo_rooty() + (30 if not _htest else 150)))
[40] Fix | Delete
#Theme Elements. Each theme element key is its display name.
[41] Fix | Delete
#The first value of the tuple is the sample area tag name.
[42] Fix | Delete
#The second value is the display name list sort index.
[43] Fix | Delete
self.themeElements={
[44] Fix | Delete
'Normal Text': ('normal', '00'),
[45] Fix | Delete
'Python Keywords': ('keyword', '01'),
[46] Fix | Delete
'Python Definitions': ('definition', '02'),
[47] Fix | Delete
'Python Builtins': ('builtin', '03'),
[48] Fix | Delete
'Python Comments': ('comment', '04'),
[49] Fix | Delete
'Python Strings': ('string', '05'),
[50] Fix | Delete
'Selected Text': ('hilite', '06'),
[51] Fix | Delete
'Found Text': ('hit', '07'),
[52] Fix | Delete
'Cursor': ('cursor', '08'),
[53] Fix | Delete
'Editor Breakpoint': ('break', '09'),
[54] Fix | Delete
'Shell Normal Text': ('console', '10'),
[55] Fix | Delete
'Shell Error Text': ('error', '11'),
[56] Fix | Delete
'Shell Stdout Text': ('stdout', '12'),
[57] Fix | Delete
'Shell Stderr Text': ('stderr', '13'),
[58] Fix | Delete
}
[59] Fix | Delete
self.ResetChangedItems() #load initial values in changed items dict
[60] Fix | Delete
self.CreateWidgets()
[61] Fix | Delete
self.resizable(height=FALSE, width=FALSE)
[62] Fix | Delete
self.transient(parent)
[63] Fix | Delete
self.grab_set()
[64] Fix | Delete
self.protocol("WM_DELETE_WINDOW", self.Cancel)
[65] Fix | Delete
self.tabPages.focus_set()
[66] Fix | Delete
#key bindings for this dialog
[67] Fix | Delete
#self.bind('<Escape>', self.Cancel) #dismiss dialog, no save
[68] Fix | Delete
#self.bind('<Alt-a>', self.Apply) #apply changes, save
[69] Fix | Delete
#self.bind('<F1>', self.Help) #context help
[70] Fix | Delete
self.LoadConfigs()
[71] Fix | Delete
self.AttachVarCallbacks() #avoid callbacks during LoadConfigs
[72] Fix | Delete
[73] Fix | Delete
if not _utest:
[74] Fix | Delete
self.wm_deiconify()
[75] Fix | Delete
self.wait_window()
[76] Fix | Delete
[77] Fix | Delete
def CreateWidgets(self):
[78] Fix | Delete
self.tabPages = TabbedPageSet(self,
[79] Fix | Delete
page_names=['Fonts/Tabs', 'Highlighting', 'Keys', 'General',
[80] Fix | Delete
'Extensions'])
[81] Fix | Delete
self.tabPages.pack(side=TOP, expand=TRUE, fill=BOTH)
[82] Fix | Delete
self.CreatePageFontTab()
[83] Fix | Delete
self.CreatePageHighlight()
[84] Fix | Delete
self.CreatePageKeys()
[85] Fix | Delete
self.CreatePageGeneral()
[86] Fix | Delete
self.CreatePageExtensions()
[87] Fix | Delete
self.create_action_buttons().pack(side=BOTTOM)
[88] Fix | Delete
[89] Fix | Delete
def create_action_buttons(self):
[90] Fix | Delete
if macosxSupport.isAquaTk():
[91] Fix | Delete
# Changing the default padding on OSX results in unreadable
[92] Fix | Delete
# text in the buttons
[93] Fix | Delete
paddingArgs = {}
[94] Fix | Delete
else:
[95] Fix | Delete
paddingArgs = {'padx':6, 'pady':3}
[96] Fix | Delete
outer = Frame(self, pady=2)
[97] Fix | Delete
buttons = Frame(outer, pady=2)
[98] Fix | Delete
for txt, cmd in (
[99] Fix | Delete
('Ok', self.Ok),
[100] Fix | Delete
('Apply', self.Apply),
[101] Fix | Delete
('Cancel', self.Cancel),
[102] Fix | Delete
('Help', self.Help)):
[103] Fix | Delete
Button(buttons, text=txt, command=cmd, takefocus=FALSE,
[104] Fix | Delete
**paddingArgs).pack(side=LEFT, padx=5)
[105] Fix | Delete
# add space above buttons
[106] Fix | Delete
Frame(outer, height=2, borderwidth=0).pack(side=TOP)
[107] Fix | Delete
buttons.pack(side=BOTTOM)
[108] Fix | Delete
return outer
[109] Fix | Delete
[110] Fix | Delete
def CreatePageFontTab(self):
[111] Fix | Delete
parent = self.parent
[112] Fix | Delete
self.fontSize = StringVar(parent)
[113] Fix | Delete
self.fontBold = BooleanVar(parent)
[114] Fix | Delete
self.fontName = StringVar(parent)
[115] Fix | Delete
self.spaceNum = IntVar(parent)
[116] Fix | Delete
self.editFont = tkFont.Font(parent, ('courier', 10, 'normal'))
[117] Fix | Delete
[118] Fix | Delete
##widget creation
[119] Fix | Delete
#body frame
[120] Fix | Delete
frame = self.tabPages.pages['Fonts/Tabs'].frame
[121] Fix | Delete
#body section frames
[122] Fix | Delete
frameFont = LabelFrame(
[123] Fix | Delete
frame, borderwidth=2, relief=GROOVE, text=' Base Editor Font ')
[124] Fix | Delete
frameIndent = LabelFrame(
[125] Fix | Delete
frame, borderwidth=2, relief=GROOVE, text=' Indentation Width ')
[126] Fix | Delete
#frameFont
[127] Fix | Delete
frameFontName = Frame(frameFont)
[128] Fix | Delete
frameFontParam = Frame(frameFont)
[129] Fix | Delete
labelFontNameTitle = Label(
[130] Fix | Delete
frameFontName, justify=LEFT, text='Font Face :')
[131] Fix | Delete
self.listFontName = Listbox(
[132] Fix | Delete
frameFontName, height=5, takefocus=FALSE, exportselection=FALSE)
[133] Fix | Delete
self.listFontName.bind(
[134] Fix | Delete
'<ButtonRelease-1>', self.OnListFontButtonRelease)
[135] Fix | Delete
scrollFont = Scrollbar(frameFontName)
[136] Fix | Delete
scrollFont.config(command=self.listFontName.yview)
[137] Fix | Delete
self.listFontName.config(yscrollcommand=scrollFont.set)
[138] Fix | Delete
labelFontSizeTitle = Label(frameFontParam, text='Size :')
[139] Fix | Delete
self.optMenuFontSize = DynOptionMenu(
[140] Fix | Delete
frameFontParam, self.fontSize, None, command=self.SetFontSample)
[141] Fix | Delete
checkFontBold = Checkbutton(
[142] Fix | Delete
frameFontParam, variable=self.fontBold, onvalue=1,
[143] Fix | Delete
offvalue=0, text='Bold', command=self.SetFontSample)
[144] Fix | Delete
frameFontSample = Frame(frameFont, relief=SOLID, borderwidth=1)
[145] Fix | Delete
self.labelFontSample = Label(
[146] Fix | Delete
frameFontSample, justify=LEFT, font=self.editFont,
[147] Fix | Delete
text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]')
[148] Fix | Delete
#frameIndent
[149] Fix | Delete
frameIndentSize = Frame(frameIndent)
[150] Fix | Delete
labelSpaceNumTitle = Label(
[151] Fix | Delete
frameIndentSize, justify=LEFT,
[152] Fix | Delete
text='Python Standard: 4 Spaces!')
[153] Fix | Delete
self.scaleSpaceNum = Scale(
[154] Fix | Delete
frameIndentSize, variable=self.spaceNum,
[155] Fix | Delete
orient='horizontal', tickinterval=2, from_=2, to=16)
[156] Fix | Delete
[157] Fix | Delete
#widget packing
[158] Fix | Delete
#body
[159] Fix | Delete
frameFont.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
[160] Fix | Delete
frameIndent.pack(side=LEFT, padx=5, pady=5, fill=Y)
[161] Fix | Delete
#frameFont
[162] Fix | Delete
frameFontName.pack(side=TOP, padx=5, pady=5, fill=X)
[163] Fix | Delete
frameFontParam.pack(side=TOP, padx=5, pady=5, fill=X)
[164] Fix | Delete
labelFontNameTitle.pack(side=TOP, anchor=W)
[165] Fix | Delete
self.listFontName.pack(side=LEFT, expand=TRUE, fill=X)
[166] Fix | Delete
scrollFont.pack(side=LEFT, fill=Y)
[167] Fix | Delete
labelFontSizeTitle.pack(side=LEFT, anchor=W)
[168] Fix | Delete
self.optMenuFontSize.pack(side=LEFT, anchor=W)
[169] Fix | Delete
checkFontBold.pack(side=LEFT, anchor=W, padx=20)
[170] Fix | Delete
frameFontSample.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
[171] Fix | Delete
self.labelFontSample.pack(expand=TRUE, fill=BOTH)
[172] Fix | Delete
#frameIndent
[173] Fix | Delete
frameIndentSize.pack(side=TOP, fill=X)
[174] Fix | Delete
labelSpaceNumTitle.pack(side=TOP, anchor=W, padx=5)
[175] Fix | Delete
self.scaleSpaceNum.pack(side=TOP, padx=5, fill=X)
[176] Fix | Delete
return frame
[177] Fix | Delete
[178] Fix | Delete
def CreatePageHighlight(self):
[179] Fix | Delete
parent = self.parent
[180] Fix | Delete
self.builtinTheme = StringVar(parent)
[181] Fix | Delete
self.customTheme = StringVar(parent)
[182] Fix | Delete
self.fgHilite = BooleanVar(parent)
[183] Fix | Delete
self.colour = StringVar(parent)
[184] Fix | Delete
self.fontName = StringVar(parent)
[185] Fix | Delete
self.themeIsBuiltin = BooleanVar(parent)
[186] Fix | Delete
self.highlightTarget = StringVar(parent)
[187] Fix | Delete
[188] Fix | Delete
##widget creation
[189] Fix | Delete
#body frame
[190] Fix | Delete
frame = self.tabPages.pages['Highlighting'].frame
[191] Fix | Delete
#body section frames
[192] Fix | Delete
frameCustom = LabelFrame(frame, borderwidth=2, relief=GROOVE,
[193] Fix | Delete
text=' Custom Highlighting ')
[194] Fix | Delete
frameTheme = LabelFrame(frame, borderwidth=2, relief=GROOVE,
[195] Fix | Delete
text=' Highlighting Theme ')
[196] Fix | Delete
#frameCustom
[197] Fix | Delete
self.textHighlightSample=Text(
[198] Fix | Delete
frameCustom, relief=SOLID, borderwidth=1,
[199] Fix | Delete
font=('courier', 12, ''), cursor='hand2', width=21, height=11,
[200] Fix | Delete
takefocus=FALSE, highlightthickness=0, wrap=NONE)
[201] Fix | Delete
text=self.textHighlightSample
[202] Fix | Delete
text.bind('<Double-Button-1>', lambda e: 'break')
[203] Fix | Delete
text.bind('<B1-Motion>', lambda e: 'break')
[204] Fix | Delete
textAndTags=(
[205] Fix | Delete
('#you can click here', 'comment'), ('\n', 'normal'),
[206] Fix | Delete
('#to choose items', 'comment'), ('\n', 'normal'),
[207] Fix | Delete
('def', 'keyword'), (' ', 'normal'),
[208] Fix | Delete
('func', 'definition'), ('(param):\n ', 'normal'),
[209] Fix | Delete
('"""string"""', 'string'), ('\n var0 = ', 'normal'),
[210] Fix | Delete
("'string'", 'string'), ('\n var1 = ', 'normal'),
[211] Fix | Delete
("'selected'", 'hilite'), ('\n var2 = ', 'normal'),
[212] Fix | Delete
("'found'", 'hit'), ('\n var3 = ', 'normal'),
[213] Fix | Delete
('list', 'builtin'), ('(', 'normal'),
[214] Fix | Delete
('None', 'builtin'), (')\n', 'normal'),
[215] Fix | Delete
(' breakpoint("line")', 'break'), ('\n\n', 'normal'),
[216] Fix | Delete
(' error ', 'error'), (' ', 'normal'),
[217] Fix | Delete
('cursor |', 'cursor'), ('\n ', 'normal'),
[218] Fix | Delete
('shell', 'console'), (' ', 'normal'),
[219] Fix | Delete
('stdout', 'stdout'), (' ', 'normal'),
[220] Fix | Delete
('stderr', 'stderr'), ('\n', 'normal'))
[221] Fix | Delete
for txTa in textAndTags:
[222] Fix | Delete
text.insert(END, txTa[0], txTa[1])
[223] Fix | Delete
for element in self.themeElements:
[224] Fix | Delete
def tem(event, elem=element):
[225] Fix | Delete
event.widget.winfo_toplevel().highlightTarget.set(elem)
[226] Fix | Delete
text.tag_bind(
[227] Fix | Delete
self.themeElements[element][0], '<ButtonPress-1>', tem)
[228] Fix | Delete
text.config(state=DISABLED)
[229] Fix | Delete
self.frameColourSet = Frame(frameCustom, relief=SOLID, borderwidth=1)
[230] Fix | Delete
frameFgBg = Frame(frameCustom)
[231] Fix | Delete
buttonSetColour = Button(
[232] Fix | Delete
self.frameColourSet, text='Choose Colour for :',
[233] Fix | Delete
command=self.GetColour, highlightthickness=0)
[234] Fix | Delete
self.optMenuHighlightTarget = DynOptionMenu(
[235] Fix | Delete
self.frameColourSet, self.highlightTarget, None,
[236] Fix | Delete
highlightthickness=0) #, command=self.SetHighlightTargetBinding
[237] Fix | Delete
self.radioFg = Radiobutton(
[238] Fix | Delete
frameFgBg, variable=self.fgHilite, value=1,
[239] Fix | Delete
text='Foreground', command=self.SetColourSampleBinding)
[240] Fix | Delete
self.radioBg=Radiobutton(
[241] Fix | Delete
frameFgBg, variable=self.fgHilite, value=0,
[242] Fix | Delete
text='Background', command=self.SetColourSampleBinding)
[243] Fix | Delete
self.fgHilite.set(1)
[244] Fix | Delete
buttonSaveCustomTheme = Button(
[245] Fix | Delete
frameCustom, text='Save as New Custom Theme',
[246] Fix | Delete
command=self.SaveAsNewTheme)
[247] Fix | Delete
#frameTheme
[248] Fix | Delete
labelTypeTitle = Label(frameTheme, text='Select : ')
[249] Fix | Delete
self.radioThemeBuiltin = Radiobutton(
[250] Fix | Delete
frameTheme, variable=self.themeIsBuiltin, value=1,
[251] Fix | Delete
command=self.SetThemeType, text='a Built-in Theme')
[252] Fix | Delete
self.radioThemeCustom = Radiobutton(
[253] Fix | Delete
frameTheme, variable=self.themeIsBuiltin, value=0,
[254] Fix | Delete
command=self.SetThemeType, text='a Custom Theme')
[255] Fix | Delete
self.optMenuThemeBuiltin = DynOptionMenu(
[256] Fix | Delete
frameTheme, self.builtinTheme, None, command=None)
[257] Fix | Delete
self.optMenuThemeCustom=DynOptionMenu(
[258] Fix | Delete
frameTheme, self.customTheme, None, command=None)
[259] Fix | Delete
self.buttonDeleteCustomTheme=Button(
[260] Fix | Delete
frameTheme, text='Delete Custom Theme',
[261] Fix | Delete
command=self.DeleteCustomTheme)
[262] Fix | Delete
self.new_custom_theme = Label(frameTheme, bd=2)
[263] Fix | Delete
[264] Fix | Delete
##widget packing
[265] Fix | Delete
#body
[266] Fix | Delete
frameCustom.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
[267] Fix | Delete
frameTheme.pack(side=LEFT, padx=5, pady=5, fill=Y)
[268] Fix | Delete
#frameCustom
[269] Fix | Delete
self.frameColourSet.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=X)
[270] Fix | Delete
frameFgBg.pack(side=TOP, padx=5, pady=0)
[271] Fix | Delete
self.textHighlightSample.pack(
[272] Fix | Delete
side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
[273] Fix | Delete
buttonSetColour.pack(side=TOP, expand=TRUE, fill=X, padx=8, pady=4)
[274] Fix | Delete
self.optMenuHighlightTarget.pack(
[275] Fix | Delete
side=TOP, expand=TRUE, fill=X, padx=8, pady=3)
[276] Fix | Delete
self.radioFg.pack(side=LEFT, anchor=E)
[277] Fix | Delete
self.radioBg.pack(side=RIGHT, anchor=W)
[278] Fix | Delete
buttonSaveCustomTheme.pack(side=BOTTOM, fill=X, padx=5, pady=5)
[279] Fix | Delete
#frameTheme
[280] Fix | Delete
labelTypeTitle.pack(side=TOP, anchor=W, padx=5, pady=5)
[281] Fix | Delete
self.radioThemeBuiltin.pack(side=TOP, anchor=W, padx=5)
[282] Fix | Delete
self.radioThemeCustom.pack(side=TOP, anchor=W, padx=5, pady=2)
[283] Fix | Delete
self.optMenuThemeBuiltin.pack(side=TOP, fill=X, padx=5, pady=5)
[284] Fix | Delete
self.optMenuThemeCustom.pack(side=TOP, fill=X, anchor=W, padx=5, pady=5)
[285] Fix | Delete
self.buttonDeleteCustomTheme.pack(side=TOP, fill=X, padx=5, pady=5)
[286] Fix | Delete
self.new_custom_theme.pack(side=TOP, fill=X, pady=5)
[287] Fix | Delete
return frame
[288] Fix | Delete
[289] Fix | Delete
def CreatePageKeys(self):
[290] Fix | Delete
parent = self.parent
[291] Fix | Delete
self.bindingTarget = StringVar(parent)
[292] Fix | Delete
self.builtinKeys = StringVar(parent)
[293] Fix | Delete
self.customKeys = StringVar(parent)
[294] Fix | Delete
self.keysAreBuiltin = BooleanVar(parent)
[295] Fix | Delete
self.keyBinding = StringVar(parent)
[296] Fix | Delete
[297] Fix | Delete
##widget creation
[298] Fix | Delete
#body frame
[299] Fix | Delete
frame = self.tabPages.pages['Keys'].frame
[300] Fix | Delete
#body section frames
[301] Fix | Delete
frameCustom = LabelFrame(
[302] Fix | Delete
frame, borderwidth=2, relief=GROOVE,
[303] Fix | Delete
text=' Custom Key Bindings ')
[304] Fix | Delete
frameKeySets = LabelFrame(
[305] Fix | Delete
frame, borderwidth=2, relief=GROOVE, text=' Key Set ')
[306] Fix | Delete
#frameCustom
[307] Fix | Delete
frameTarget = Frame(frameCustom)
[308] Fix | Delete
labelTargetTitle = Label(frameTarget, text='Action - Key(s)')
[309] Fix | Delete
scrollTargetY = Scrollbar(frameTarget)
[310] Fix | Delete
scrollTargetX = Scrollbar(frameTarget, orient=HORIZONTAL)
[311] Fix | Delete
self.listBindings = Listbox(
[312] Fix | Delete
frameTarget, takefocus=FALSE, exportselection=FALSE)
[313] Fix | Delete
self.listBindings.bind('<ButtonRelease-1>', self.KeyBindingSelected)
[314] Fix | Delete
scrollTargetY.config(command=self.listBindings.yview)
[315] Fix | Delete
scrollTargetX.config(command=self.listBindings.xview)
[316] Fix | Delete
self.listBindings.config(yscrollcommand=scrollTargetY.set)
[317] Fix | Delete
self.listBindings.config(xscrollcommand=scrollTargetX.set)
[318] Fix | Delete
self.buttonNewKeys = Button(
[319] Fix | Delete
frameCustom, text='Get New Keys for Selection',
[320] Fix | Delete
command=self.GetNewKeys, state=DISABLED)
[321] Fix | Delete
#frameKeySets
[322] Fix | Delete
frames = [Frame(frameKeySets, padx=2, pady=2, borderwidth=0)
[323] Fix | Delete
for i in range(2)]
[324] Fix | Delete
self.radioKeysBuiltin = Radiobutton(
[325] Fix | Delete
frames[0], variable=self.keysAreBuiltin, value=1,
[326] Fix | Delete
command=self.SetKeysType, text='Use a Built-in Key Set')
[327] Fix | Delete
self.radioKeysCustom = Radiobutton(
[328] Fix | Delete
frames[0], variable=self.keysAreBuiltin, value=0,
[329] Fix | Delete
command=self.SetKeysType, text='Use a Custom Key Set')
[330] Fix | Delete
self.optMenuKeysBuiltin = DynOptionMenu(
[331] Fix | Delete
frames[0], self.builtinKeys, None, command=None)
[332] Fix | Delete
self.optMenuKeysCustom = DynOptionMenu(
[333] Fix | Delete
frames[0], self.customKeys, None, command=None)
[334] Fix | Delete
self.buttonDeleteCustomKeys = Button(
[335] Fix | Delete
frames[1], text='Delete Custom Key Set',
[336] Fix | Delete
command=self.DeleteCustomKeys)
[337] Fix | Delete
buttonSaveCustomKeys = Button(
[338] Fix | Delete
frames[1], text='Save as New Custom Key Set',
[339] Fix | Delete
command=self.SaveAsNewKeySet)
[340] Fix | Delete
[341] Fix | Delete
##widget packing
[342] Fix | Delete
#body
[343] Fix | Delete
frameCustom.pack(side=BOTTOM, padx=5, pady=5, expand=TRUE, fill=BOTH)
[344] Fix | Delete
frameKeySets.pack(side=BOTTOM, padx=5, pady=5, fill=BOTH)
[345] Fix | Delete
#frameCustom
[346] Fix | Delete
self.buttonNewKeys.pack(side=BOTTOM, fill=X, padx=5, pady=5)
[347] Fix | Delete
frameTarget.pack(side=LEFT, padx=5, pady=5, expand=TRUE, fill=BOTH)
[348] Fix | Delete
#frame target
[349] Fix | Delete
frameTarget.columnconfigure(0, weight=1)
[350] Fix | Delete
frameTarget.rowconfigure(1, weight=1)
[351] Fix | Delete
labelTargetTitle.grid(row=0, column=0, columnspan=2, sticky=W)
[352] Fix | Delete
self.listBindings.grid(row=1, column=0, sticky=NSEW)
[353] Fix | Delete
scrollTargetY.grid(row=1, column=1, sticky=NS)
[354] Fix | Delete
scrollTargetX.grid(row=2, column=0, sticky=EW)
[355] Fix | Delete
#frameKeySets
[356] Fix | Delete
self.radioKeysBuiltin.grid(row=0, column=0, sticky=W+NS)
[357] Fix | Delete
self.radioKeysCustom.grid(row=1, column=0, sticky=W+NS)
[358] Fix | Delete
self.optMenuKeysBuiltin.grid(row=0, column=1, sticky=NSEW)
[359] Fix | Delete
self.optMenuKeysCustom.grid(row=1, column=1, sticky=NSEW)
[360] Fix | Delete
self.buttonDeleteCustomKeys.pack(side=LEFT, fill=X, expand=True, padx=2)
[361] Fix | Delete
buttonSaveCustomKeys.pack(side=LEFT, fill=X, expand=True, padx=2)
[362] Fix | Delete
frames[0].pack(side=TOP, fill=BOTH, expand=True)
[363] Fix | Delete
frames[1].pack(side=TOP, fill=X, expand=True, pady=2)
[364] Fix | Delete
return frame
[365] Fix | Delete
[366] Fix | Delete
def CreatePageGeneral(self):
[367] Fix | Delete
parent = self.parent
[368] Fix | Delete
self.winWidth = StringVar(parent)
[369] Fix | Delete
self.winHeight = StringVar(parent)
[370] Fix | Delete
self.startupEdit = IntVar(parent)
[371] Fix | Delete
self.autoSave = IntVar(parent)
[372] Fix | Delete
self.encoding = StringVar(parent)
[373] Fix | Delete
self.userHelpBrowser = BooleanVar(parent)
[374] Fix | Delete
self.helpBrowser = StringVar(parent)
[375] Fix | Delete
[376] Fix | Delete
#widget creation
[377] Fix | Delete
#body
[378] Fix | Delete
frame = self.tabPages.pages['General'].frame
[379] Fix | Delete
#body section frames
[380] Fix | Delete
frameRun = LabelFrame(frame, borderwidth=2, relief=GROOVE,
[381] Fix | Delete
text=' Startup Preferences ')
[382] Fix | Delete
frameSave = LabelFrame(frame, borderwidth=2, relief=GROOVE,
[383] Fix | Delete
text=' Autosave Preferences ')
[384] Fix | Delete
frameWinSize = Frame(frame, borderwidth=2, relief=GROOVE)
[385] Fix | Delete
frameEncoding = Frame(frame, borderwidth=2, relief=GROOVE)
[386] Fix | Delete
frameHelp = LabelFrame(frame, borderwidth=2, relief=GROOVE,
[387] Fix | Delete
text=' Additional Help Sources ')
[388] Fix | Delete
#frameRun
[389] Fix | Delete
labelRunChoiceTitle = Label(frameRun, text='At Startup')
[390] Fix | Delete
radioStartupEdit = Radiobutton(
[391] Fix | Delete
frameRun, variable=self.startupEdit, value=1,
[392] Fix | Delete
command=self.SetKeysType, text="Open Edit Window")
[393] Fix | Delete
radioStartupShell = Radiobutton(
[394] Fix | Delete
frameRun, variable=self.startupEdit, value=0,
[395] Fix | Delete
command=self.SetKeysType, text='Open Shell Window')
[396] Fix | Delete
#frameSave
[397] Fix | Delete
labelRunSaveTitle = Label(frameSave, text='At Start of Run (F5) ')
[398] Fix | Delete
radioSaveAsk = Radiobutton(
[399] Fix | Delete
frameSave, variable=self.autoSave, value=0,
[400] Fix | Delete
command=self.SetKeysType, text="Prompt to Save")
[401] Fix | Delete
radioSaveAuto = Radiobutton(
[402] Fix | Delete
frameSave, variable=self.autoSave, value=1,
[403] Fix | Delete
command=self.SetKeysType, text='No Prompt')
[404] Fix | Delete
#frameWinSize
[405] Fix | Delete
labelWinSizeTitle = Label(
[406] Fix | Delete
frameWinSize, text='Initial Window Size (in characters)')
[407] Fix | Delete
labelWinWidthTitle = Label(frameWinSize, text='Width')
[408] Fix | Delete
entryWinWidth = Entry(
[409] Fix | Delete
frameWinSize, textvariable=self.winWidth, width=3)
[410] Fix | Delete
labelWinHeightTitle = Label(frameWinSize, text='Height')
[411] Fix | Delete
entryWinHeight = Entry(
[412] Fix | Delete
frameWinSize, textvariable=self.winHeight, width=3)
[413] Fix | Delete
#frameEncoding
[414] Fix | Delete
labelEncodingTitle = Label(
[415] Fix | Delete
frameEncoding, text="Default Source Encoding")
[416] Fix | Delete
radioEncLocale = Radiobutton(
[417] Fix | Delete
frameEncoding, variable=self.encoding,
[418] Fix | Delete
value="locale", text="Locale-defined")
[419] Fix | Delete
radioEncUTF8 = Radiobutton(
[420] Fix | Delete
frameEncoding, variable=self.encoding,
[421] Fix | Delete
value="utf-8", text="UTF-8")
[422] Fix | Delete
radioEncNone = Radiobutton(
[423] Fix | Delete
frameEncoding, variable=self.encoding,
[424] Fix | Delete
value="none", text="None")
[425] Fix | Delete
#frameHelp
[426] Fix | Delete
frameHelpList = Frame(frameHelp)
[427] Fix | Delete
frameHelpListButtons = Frame(frameHelpList)
[428] Fix | Delete
scrollHelpList = Scrollbar(frameHelpList)
[429] Fix | Delete
self.listHelp = Listbox(
[430] Fix | Delete
frameHelpList, height=5, takefocus=FALSE,
[431] Fix | Delete
exportselection=FALSE)
[432] Fix | Delete
scrollHelpList.config(command=self.listHelp.yview)
[433] Fix | Delete
self.listHelp.config(yscrollcommand=scrollHelpList.set)
[434] Fix | Delete
self.listHelp.bind('<ButtonRelease-1>', self.HelpSourceSelected)
[435] Fix | Delete
self.buttonHelpListEdit = Button(
[436] Fix | Delete
frameHelpListButtons, text='Edit', state=DISABLED,
[437] Fix | Delete
width=8, command=self.HelpListItemEdit)
[438] Fix | Delete
self.buttonHelpListAdd = Button(
[439] Fix | Delete
frameHelpListButtons, text='Add',
[440] Fix | Delete
width=8, command=self.HelpListItemAdd)
[441] Fix | Delete
self.buttonHelpListRemove = Button(
[442] Fix | Delete
frameHelpListButtons, text='Remove', state=DISABLED,
[443] Fix | Delete
width=8, command=self.HelpListItemRemove)
[444] Fix | Delete
[445] Fix | Delete
#widget packing
[446] Fix | Delete
#body
[447] Fix | Delete
frameRun.pack(side=TOP, padx=5, pady=5, fill=X)
[448] Fix | Delete
frameSave.pack(side=TOP, padx=5, pady=5, fill=X)
[449] Fix | Delete
frameWinSize.pack(side=TOP, padx=5, pady=5, fill=X)
[450] Fix | Delete
frameEncoding.pack(side=TOP, padx=5, pady=5, fill=X)
[451] Fix | Delete
frameHelp.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
[452] Fix | Delete
#frameRun
[453] Fix | Delete
labelRunChoiceTitle.pack(side=LEFT, anchor=W, padx=5, pady=5)
[454] Fix | Delete
radioStartupShell.pack(side=RIGHT, anchor=W, padx=5, pady=5)
[455] Fix | Delete
radioStartupEdit.pack(side=RIGHT, anchor=W, padx=5, pady=5)
[456] Fix | Delete
#frameSave
[457] Fix | Delete
labelRunSaveTitle.pack(side=LEFT, anchor=W, padx=5, pady=5)
[458] Fix | Delete
radioSaveAuto.pack(side=RIGHT, anchor=W, padx=5, pady=5)
[459] Fix | Delete
radioSaveAsk.pack(side=RIGHT, anchor=W, padx=5, pady=5)
[460] Fix | Delete
#frameWinSize
[461] Fix | Delete
labelWinSizeTitle.pack(side=LEFT, anchor=W, padx=5, pady=5)
[462] Fix | Delete
entryWinHeight.pack(side=RIGHT, anchor=E, padx=10, pady=5)
[463] Fix | Delete
labelWinHeightTitle.pack(side=RIGHT, anchor=E, pady=5)
[464] Fix | Delete
entryWinWidth.pack(side=RIGHT, anchor=E, padx=10, pady=5)
[465] Fix | Delete
labelWinWidthTitle.pack(side=RIGHT, anchor=E, pady=5)
[466] Fix | Delete
#frameEncoding
[467] Fix | Delete
labelEncodingTitle.pack(side=LEFT, anchor=W, padx=5, pady=5)
[468] Fix | Delete
radioEncNone.pack(side=RIGHT, anchor=E, pady=5)
[469] Fix | Delete
radioEncUTF8.pack(side=RIGHT, anchor=E, pady=5)
[470] Fix | Delete
radioEncLocale.pack(side=RIGHT, anchor=E, pady=5)
[471] Fix | Delete
#frameHelp
[472] Fix | Delete
frameHelpListButtons.pack(side=RIGHT, padx=5, pady=5, fill=Y)
[473] Fix | Delete
frameHelpList.pack(side=TOP, padx=5, pady=5, expand=TRUE, fill=BOTH)
[474] Fix | Delete
scrollHelpList.pack(side=RIGHT, anchor=W, fill=Y)
[475] Fix | Delete
self.listHelp.pack(side=LEFT, anchor=E, expand=TRUE, fill=BOTH)
[476] Fix | Delete
self.buttonHelpListEdit.pack(side=TOP, anchor=W, pady=5)
[477] Fix | Delete
self.buttonHelpListAdd.pack(side=TOP, anchor=W)
[478] Fix | Delete
self.buttonHelpListRemove.pack(side=TOP, anchor=W, pady=5)
[479] Fix | Delete
return frame
[480] Fix | Delete
[481] Fix | Delete
def AttachVarCallbacks(self):
[482] Fix | Delete
self.fontSize.trace_variable('w', self.VarChanged_font)
[483] Fix | Delete
self.fontName.trace_variable('w', self.VarChanged_font)
[484] Fix | Delete
self.fontBold.trace_variable('w', self.VarChanged_font)
[485] Fix | Delete
self.spaceNum.trace_variable('w', self.VarChanged_spaceNum)
[486] Fix | Delete
self.colour.trace_variable('w', self.VarChanged_colour)
[487] Fix | Delete
self.builtinTheme.trace_variable('w', self.VarChanged_builtinTheme)
[488] Fix | Delete
self.customTheme.trace_variable('w', self.VarChanged_customTheme)
[489] Fix | Delete
self.themeIsBuiltin.trace_variable('w', self.VarChanged_themeIsBuiltin)
[490] Fix | Delete
self.highlightTarget.trace_variable('w', self.VarChanged_highlightTarget)
[491] Fix | Delete
self.keyBinding.trace_variable('w', self.VarChanged_keyBinding)
[492] Fix | Delete
self.builtinKeys.trace_variable('w', self.VarChanged_builtinKeys)
[493] Fix | Delete
self.customKeys.trace_variable('w', self.VarChanged_customKeys)
[494] Fix | Delete
self.keysAreBuiltin.trace_variable('w', self.VarChanged_keysAreBuiltin)
[495] Fix | Delete
self.winWidth.trace_variable('w', self.VarChanged_winWidth)
[496] Fix | Delete
self.winHeight.trace_variable('w', self.VarChanged_winHeight)
[497] Fix | Delete
self.startupEdit.trace_variable('w', self.VarChanged_startupEdit)
[498] Fix | Delete
self.autoSave.trace_variable('w', self.VarChanged_autoSave)
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function