Kaydet (Commit) 6655e4bc authored tarafından Kurt B. Kaiser's avatar Kurt B. Kaiser

Whitespace Normalization

üst 9532298c
......@@ -37,7 +37,7 @@ class CallTip:
# This command is only needed and available on Tk >= 8.4.0 for OSX
# Without it, call tips intrude on the typing process by grabbing
# the focus.
tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w,
tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w,
"help", "noActivates")
except TclError:
pass
......
......@@ -81,10 +81,10 @@ class CallTips:
while i and str[i-1] in idchars:
i -= 1
return str[i:]
def fetch_tip(self, name):
"""Return the argument list and docstring of a function or class
"""Return the argument list and docstring of a function or class
If there is a Python subprocess, get the calltip there. Otherwise,
either fetch_tip() is running in the subprocess itself or it was called
in an IDLE EditorWindow before any script had been run.
......@@ -93,7 +93,7 @@ class CallTips:
two unrelated modules are being edited some calltips in the current
module may be inoperative if the module was not the last to run.
"""
"""
try:
rpcclt = self.editwin.flist.pyshell.interp.rpcclt
except:
......@@ -211,7 +211,7 @@ if __name__=='__main__':
print "%d of %d tests failed" % (len(failed), len(tests))
tc = TC()
tests = (t1, t2, t3, t4, t5, t6,
tests = (t1, t2, t3, t4, t5, t6,
TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6)
test(tests)
......@@ -52,7 +52,7 @@ class ColorDelegator(Delegator):
if cnf:
apply(self.tag_configure, (tag,), cnf)
self.tag_raise('sel')
def LoadTagDefs(self):
theme = idleConf.GetOption('main','Theme','name')
self.tagdefs = {
......@@ -67,7 +67,7 @@ class ColorDelegator(Delegator):
# The following is used by ReplaceDialog:
"hit": idleConf.GetHighlight(theme, "hit"),
}
if DEBUG: print 'tagdefs',tagdefs
def insert(self, index, chars, tags=None):
......
......@@ -15,17 +15,17 @@ class Idb(bdb.Bdb):
def user_line(self, frame):
co_filename = frame.f_code.co_filename
co_name = frame.f_code.co_name
co_name = frame.f_code.co_name
## print>>sys.__stderr__, "*function: ", frame.f_code.co_name
## print>>sys.__stderr__, "*file: ", frame.f_code.co_filename
## print>>sys.__stderr__, "*file: ", frame.f_code.co_filename
## print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno
## print>>sys.__stderr__, "*name: ", co_name
## print>>sys.__stderr__, "*function: ", frame.f_locals.get(co_name,None)
try:
# XXX 12 Dec 2002 CGT TO DO: Find way to get a reference to the
# XXX currently running function. If the function has an
# XXX currently running function. If the function has an
# attribute called "DebuggerStepThrough", prevent the debugger
# from stepping through Idle code. The following doesn't work
# in instance methods. Hard coded some workarounds.
......@@ -75,7 +75,7 @@ class Debugger:
self.frame = None
self.make_gui()
self.interacting = 0
def run(self, *args):
try:
self.interacting = 1
......
......@@ -111,7 +111,7 @@ class EditorWindow:
text.bind("<<untabify-region>>",self.untabify_region_event)
text.bind("<<toggle-tabs>>",self.toggle_tabs_event)
text.bind("<<change-indentwidth>>",self.change_indentwidth_event)
if flist:
flist.inversedict[self] = key
if key:
......@@ -186,7 +186,7 @@ class EditorWindow:
if self.extensions.has_key('AutoIndent'):
self.extensions['AutoIndent'].set_indentation_params(
self.ispythonsource(filename))
def set_status_bar(self):
self.status_bar = self.MultiStatusBar(self.top)
self.status_bar.set_label('column', 'Col: ?', side=RIGHT)
......@@ -273,21 +273,21 @@ class EditorWindow:
def about_dialog(self, event=None):
aboutDialog.AboutDialog(self.top,'About IDLEfork')
def config_dialog(self, event=None):
configDialog.ConfigDialog(self.top,'Settings')
def good_advice(self, event=None):
tkMessageBox.showinfo('Advice', "Don't Panic!", master=self.text)
def view_readme(self, event=None):
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'README.txt')
textView.TextViewer(self.top,'IDLEfork - README',fn)
textView.TextViewer(self.top,'IDLEfork - README',fn)
def help_dialog(self, event=None):
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt')
textView.TextViewer(self.top,'Help',fn)
textView.TextViewer(self.top,'Help',fn)
help_url = "http://www.python.org/doc/current/"
if sys.platform[:3] == "win":
fn = os.path.dirname(__file__)
......@@ -469,7 +469,7 @@ class EditorWindow:
self.per.removefilter(self.color)
self.color = None
self.per.insertfilter(self.undo)
def ResetColorizer(self):
"Update the colour theme if it is changed"
# Called from configDialog.py
......@@ -478,7 +478,7 @@ class EditorWindow:
self.per.insertfilter(self.color)
def ResetFont(self):
"Update the text widgets' font if it is changed"
"Update the text widgets' font if it is changed"
# Called from configDialog.py
fontWeight='normal'
if idleConf.GetOption('main','EditorWindow','font-bold',type='bool'):
......@@ -535,15 +535,15 @@ class EditorWindow:
self.menuExtraHelp.add_command(label=menuItem[0],
command=self.__DisplayExtraHelpCallback(menuItem[1]))
else: #no extra help items
if hasattr(self,'menuExtraHelp'):
helpMenu.delete(cascadeIndex-1)
if hasattr(self,'menuExtraHelp'):
helpMenu.delete(cascadeIndex-1)
del(self.menuExtraHelp)
def __DisplayExtraHelpCallback(self,helpFile):
def DisplayExtraHelp(helpFile=helpFile):
self.display_docs(helpFile)
return DisplayExtraHelp
def UpdateRecentFilesList(self,newFile=None):
"Load or update the recent files list, and menu if required"
rfList=[]
......@@ -553,7 +553,7 @@ class EditorWindow:
rfList=RFfile.readlines()
finally:
RFfile.close()
if newFile:
if newFile:
newFile=os.path.abspath(newFile)+'\n'
if newFile in rfList:
rfList.remove(newFile)
......@@ -567,7 +567,7 @@ class EditorWindow:
for instance in self.top.instanceDict.keys():
menu = instance.menuRecentFiles
menu.delete(1,END)
i = 0 ; ul = 0; ullen = len(ullist)
i = 0 ; ul = 0; ullen = len(ullist)
for file in rfList:
fileName=file[0:-1]
callback = instance.__RecentFileCallback(fileName)
......@@ -577,13 +577,13 @@ class EditorWindow:
command=callback,
underline=ul)
i += 1
def __CleanRecentFiles(self,rfList):
origRfList=rfList[:]
count=0
nonFiles=[]
for path in rfList:
if not os.path.exists(path[0:-1]):
if not os.path.exists(path[0:-1]):
nonFiles.append(count)
count=count+1
if nonFiles:
......@@ -599,12 +599,12 @@ class EditorWindow:
finally:
RFfile.close()
return rfList
def __RecentFileCallback(self,fileName):
def OpenRecentFile(fileName=fileName):
self.io.open(editFile=fileName)
return OpenRecentFile
def saved_change_hook(self):
short = self.short_title()
long = self.long_title()
......@@ -672,7 +672,7 @@ class EditorWindow:
def maybesave(self):
if self.io:
if not self.get_saved():
if self.top.state()!='normal':
if self.top.state()!='normal':
self.top.deiconify()
self.top.lower()
self.top.lift()
......
......@@ -103,7 +103,7 @@ class IOBinding:
self.save_a_copy)
self.fileencoding = None
self.__id_print = self.text.bind("<<print-window>>", self.print_window)
def close(self):
# Undo command bindings
self.text.unbind("<<open-window-from-file>>", self.__id_open)
......@@ -366,7 +366,7 @@ class IOBinding:
"# -*- coding: %s -*- \nto your file" % enc,
master = self.text)
return chars
def fixlastline(self):
c = self.text.get("end-2c")
if c != '\n':
......@@ -403,10 +403,10 @@ class IOBinding:
output = "Printing command: %s\n" % repr(command) + output
tkMessageBox.showerror("Print status", output, master=self.text)
else: #no printing for this platform
message="Printing is not enabled for this platform: %s" % platform
message="Printing is not enabled for this platform: %s" % platform
tkMessageBox.showinfo("Print status", message, master=self.text)
return "break"
opendialog = None
savedialog = None
......
......@@ -146,10 +146,3 @@ class OnDemandOutputWindow:
# def flush(self):
# pass
......@@ -62,7 +62,7 @@ def extended_linecache_checkcache(orig_checkcache=linecache.checkcache):
save[filename] = cache[filename]
orig_checkcache()
cache.update(save)
# Patch linecache.checkcache():
linecache.checkcache = extended_linecache_checkcache
......@@ -194,7 +194,7 @@ class PyShellEditorWindow(EditorWindow):
lines = open(self.breakpointPath,"r").readlines()
for line in lines:
if line.startswith(filename + '='):
breakpoint_linenumbers = eval(line[len(filename)+1:])
breakpoint_linenumbers = eval(line[len(filename)+1:])
for breakpoint_linenumber in breakpoint_linenumbers:
self.set_breakpoint(breakpoint_linenumber)
......@@ -226,7 +226,7 @@ class PyShellEditorWindow(EditorWindow):
"Extend base method - clear breaks when module is closed"
self.clear_file_breaks()
EditorWindow._close(self)
class PyShellFileList(FileList):
"Extend base class: file list when a shell is present"
......@@ -246,7 +246,7 @@ class PyShellFileList(FileList):
class ModifiedColorDelegator(ColorDelegator):
"Extend base class: colorizer for the shell window itself"
def __init__(self):
ColorDelegator.__init__(self)
self.LoadTagDefs()
......@@ -255,7 +255,7 @@ class ModifiedColorDelegator(ColorDelegator):
self.tag_remove("TODO", "1.0", "iomark")
self.tag_add("SYNC", "1.0", "iomark")
ColorDelegator.recolorize_main(self)
def LoadTagDefs(self):
ColorDelegator.LoadTagDefs(self)
theme = idleConf.GetOption('main','Theme','name')
......@@ -300,7 +300,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
rpcclt = None
rpcpid = None
def spawn_subprocess(self):
def spawn_subprocess(self):
args = self.build_subprocess_arglist()
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
......@@ -312,7 +312,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
# here are the applet architectures tried:
#
# framework applet: sys.executable + -p is correct
# python 2.2 + pure python main applet:
# python 2.2 + pure python main applet:
# sys.executable + -p is correct
# pythonw idle.py: sys.executable + -c is correct
#
......@@ -360,7 +360,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
# close only the subprocess debugger
debug = self.getdebugger()
if debug:
RemoteDebugger.close_subprocess_debugger(self.rpcclt)
RemoteDebugger.close_subprocess_debugger(self.rpcclt)
# kill subprocess, spawn a new one, accept connection
self.rpcclt.close()
self.spawn_subprocess()
......@@ -434,7 +434,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
while tb:
for rpcfile in exclude:
if tb[-1][0].count(rpcfile):
break
break
else:
break
del tb[-1]
......@@ -525,7 +525,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
lines = source.split("\n")
linecache.cache[filename] = len(source)+1, 0, lines, filename
return filename
def showsyntaxerror(self, filename=None):
"""Extend base class method: Add Colorizing
......@@ -587,7 +587,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
"The Python Shell window is already executing a command; "
"please wait until it is finished.",
master=self.tkconsole.text)
def runcommand(self, code):
"Run the code without invoking the debugger"
# The code better not raise an exception!
......@@ -1075,10 +1075,10 @@ class PseudoFile:
usage_msg = """\
USAGE: idle [-deis] [-t title] [file]*
USAGE: idle [-deis] [-t title] [file]*
idle [-ds] [-t title] (-c cmd | -r file) [arg]*
idle [-ds] [-t title] - [arg]*
-h print this help message and exit
The following options will override the IDLE 'settings' configuration:
......@@ -1175,7 +1175,7 @@ def main():
if args and args[0] == '-':
cmd = sys.stdin.read()
enable_shell = True
use_subprocess = True
# process sys.argv and sys.path:
......@@ -1202,9 +1202,9 @@ def main():
sys.path.insert(0, dir)
# check the IDLE settings configuration (but command line overrides)
edit_start = idleConf.GetOption('main', 'General',
'editor-on-startup', type='bool')
'editor-on-startup', type='bool')
enable_edit = enable_edit or edit_start
enable_shell = enable_shell or not edit_start
enable_shell = enable_shell or not edit_start
# start editor and/or shell windows:
root = Tk(className="Idle")
fixwordbreaks(root)
......@@ -1258,7 +1258,7 @@ start. Here are some possible causes of this problem:
3. Personal firewall software is preventing IDLE from using this port
IDLE makes and accepts connections only with this computer, and does not
communicate over the internet in any way. Its use of port 8833 should not
communicate over the internet in any way. Its use of port 8833 should not
be a security risk on a single-user machine.
"""
......
......@@ -121,7 +121,7 @@ class IdbAdapter:
def clear_all_file_breaks(self, filename):
msg = self.idb.clear_all_file_breaks(filename)
return msg
#----------called by a FrameProxy----------
def frame_attr(self, fid, name):
......@@ -366,7 +366,7 @@ def close_remote_debugger(rpcclt):
debugger and RPC link objects. (The second reference to the debugger GUI
is deleted in PyShell.close_remote_debugger().)
"""
"""
close_subprocess_debugger(rpcclt)
rpcclt.unregister(gui_adap_oid)
......@@ -377,4 +377,3 @@ def restart_subprocess_debugger(rpcclt):
idb_adap_oid_ret = rpcclt.remotecall("exec", "start_the_debugger",\
(gui_adap_oid,), {})
assert idb_adap_oid_ret == idb_adap_oid, 'Idb restarted with different oid'
......@@ -99,7 +99,7 @@ class ScriptBinding:
self.errorbox("Syntax error",
"There's an error in your program:\n" + msg)
return False
def colorize_syntax_error(self, msg, lineno, offset):
text = self.editwin.text
pos = "0.0 + %d lines + %d chars" % (lineno-1, offset-1)
......@@ -112,7 +112,7 @@ class ScriptBinding:
else:
text.mark_set("insert", pos + "+1c")
text.see(pos)
def run_script_event(self, event):
"Check syntax, if ok run the script in the shell top level"
filename = self.getfilename()
......
......@@ -10,7 +10,7 @@ class ZoomHeight:
('_Zoom Height', '<<zoom-height>>'),
])
]
def __init__(self, editwin):
self.editwin = editwin
......@@ -33,7 +33,7 @@ def zoom_height(top):
#newy = 24
newy = 0
#newheight = newheight - 96
newheight = newheight - 88
newheight = newheight - 88
if height >= newheight:
newgeom = ""
else:
......
......@@ -10,7 +10,7 @@ import idlever
class AboutDialog(Toplevel):
"""
modal about dialog for idle
"""
"""
def __init__(self,parent,title):
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
......@@ -18,7 +18,7 @@ class AboutDialog(Toplevel):
parent.winfo_rooty()+30))
self.bg="#707070"
self.fg="#ffffff"
self.CreateWidgets()
self.resizable(height=FALSE,width=FALSE)
self.title(title)
......@@ -33,7 +33,7 @@ class AboutDialog(Toplevel):
self.bind('<Return>',self.Ok) #dismiss dialog
self.bind('<Escape>',self.Ok) #dismiss dialog
self.wait_window()
def CreateWidgets(self):
frameMain = Frame(self,borderwidth=2,relief=SUNKEN)
frameButtons = Frame(self)
......@@ -83,7 +83,7 @@ class AboutDialog(Toplevel):
#handle weird tk version num in windoze python >= 1.6 (?!?)
tkVer = `TkVersion`.split('.')
tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:]
if tkVer[len(tkVer)-1] == '':
if tkVer[len(tkVer)-1] == '':
tkVer[len(tkVer)-1] = '0'
tkVer = string.join(tkVer,'.')
labelTkVer = Label(frameBg,text='Tk version: '+
......@@ -105,7 +105,7 @@ class AboutDialog(Toplevel):
def ShowLicense(self):
self.ViewFile('About - License','LICENSE.txt')
def ShowCredits(self):
self.ViewFile('About - Credits','CREDITS.txt')
......@@ -115,7 +115,7 @@ class AboutDialog(Toplevel):
def Ok(self, event=None):
self.destroy()
if __name__ == '__main__':
#test the dialog
root=Tk()
......
"boolcheck - import this module to ensure True, False, bool() builtins exist."
try:
try:
True
except NameError:
import __builtin__
......@@ -7,4 +7,3 @@ except NameError:
__builtin__.False = 0
from operator import truth
__builtin__.bool = truth
This diff is collapsed.
This diff is collapsed.
......@@ -27,7 +27,7 @@ class GetHelpSourceDialog(Toplevel):
self.withdraw() #hide while setting geometry
self.update_idletasks()
#needs to be done here so that the winfo_reqwidth is valid
self.geometry("+%d+%d" %
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
......@@ -63,7 +63,7 @@ class GetHelpSourceDialog(Toplevel):
self.buttonCancel.grid(row=0,column=1,padx=5,pady=5)
def MenuOk(self):
#simple validity check for a sensible
#simple validity check for a sensible
#menu item name
menuOk=1
menu=self.menu.get()
......@@ -80,9 +80,9 @@ class GetHelpSourceDialog(Toplevel):
self.entryMenu.focus_set()
menuOk=0
return menuOk
def PathOk(self):
#simple validity check for menu file path
#simple validity check for menu file path
pathOk=1
path=self.path.get()
path.strip()
......@@ -97,13 +97,13 @@ class GetHelpSourceDialog(Toplevel):
self.entryPath.focus_set()
pathOk=0
return pathOk
def Ok(self, event=None):
if self.MenuOk():
if self.PathOk():
self.result=( self.menu.get().strip(),self.path.get().strip() )
self.result=( self.menu.get().strip(),self.path.get().strip() )
self.destroy()
def Cancel(self, event=None):
self.result=None
self.destroy()
......@@ -117,5 +117,3 @@ if __name__ == '__main__':
print dlg.result
Button(root,text='Dialog',command=run).pack()
root.mainloop()
......@@ -27,7 +27,7 @@ class GetCfgSectionNameDialog(Toplevel):
self.update_idletasks()
#needs to be done here so that the winfo_reqwidth is valid
self.messageInfo.config(width=self.frameMain.winfo_reqwidth())
self.geometry("+%d+%d" %
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
......@@ -56,7 +56,7 @@ class GetCfgSectionNameDialog(Toplevel):
self.buttonCancel.grid(row=0,column=1,padx=5,pady=5)
def NameOk(self):
#simple validity check for a sensible
#simple validity check for a sensible
#ConfigParser file section name
nameOk=1
name=self.name.get()
......@@ -75,12 +75,12 @@ class GetCfgSectionNameDialog(Toplevel):
message='This name is already in use.')
nameOk=0
return nameOk
def Ok(self, event=None):
if self.NameOk():
self.result=self.name.get().strip()
self.destroy()
def Cancel(self, event=None):
self.result=''
self.destroy()
......@@ -95,5 +95,3 @@ if __name__ == '__main__':
print dlg.result
Button(root,text='Dialog',command=run).pack()
root.mainloop()
......@@ -20,12 +20,12 @@ class DynOptionMenu(OptionMenu):
#self.menu=self['menu']
self.variable=variable
self.command=kwargs.get('command')
def SetMenu(self,valueList,value=None):
"""
clear and reload the menu with a new set of options.
valueList - list of new options
value - initial value to set the optionmenu's menubutton to
value - initial value to set the optionmenu's menubutton to
"""
self['menu'].delete(0,'end')
for item in valueList:
......
"""
dialog for building tkinter accelerator key bindings
dialog for building tkinter accelerator key bindings
"""
from Tkinter import *
import tkMessageBox
......@@ -11,7 +11,7 @@ class GetKeysDialog(Toplevel):
action - string, the name of the virtual event these keys will be
mapped to
currentKeys - list, a list of all key sequence lists currently mapped
to virtual events, for overlap checking
to virtual events, for overlap checking
"""
Toplevel.__init__(self, parent)
self.configure(borderwidth=5)
......@@ -36,14 +36,14 @@ class GetKeysDialog(Toplevel):
self.LoadFinalKeyList()
self.withdraw() #hide while setting geometry
self.update_idletasks()
self.geometry("+%d+%d" %
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
self.deiconify() #geometry set, unhide
self.wait_window()
def CreateWidgets(self):
frameMain = Frame(self,borderwidth=2,relief=SUNKEN)
frameMain.pack(side=TOP,expand=TRUE,fill=BOTH)
......@@ -143,19 +143,19 @@ class GetKeysDialog(Toplevel):
self.ClearKeySeq()
self.buttonLevel.config(text='Advanced Key Binding Entry >>')
self.frameKeySeqBasic.lift()
self.frameControlsBasic.lift()
self.frameControlsBasic.lift()
def FinalKeySelected(self,event):
self.BuildKeyString()
def BuildKeyString(self):
keyList=[]
modifiers=self.GetModifiers()
finalKey=self.listKeysFinal.get(ANCHOR)
if modifiers: modifiers[0]='<'+modifiers[0]
keyList=keyList+modifiers
if finalKey:
if (not modifiers) and (finalKey not
if finalKey:
if (not modifiers) and (finalKey not
in self.alphanumKeys+self.punctuationKeys):
finalKey='<'+self.TranslateKey(finalKey)
else:
......@@ -163,7 +163,7 @@ class GetKeysDialog(Toplevel):
keyList.append(finalKey+'>')
keyStr=string.join(keyList,'-')
self.keyString.set(keyStr)
def GetModifiers(self):
modList = [variable.get() for variable in self.modifier_vars]
return filter(None, modList)
......@@ -174,7 +174,7 @@ class GetKeysDialog(Toplevel):
for variable in self.modifier_vars:
variable.set('')
self.keyString.set('')
def LoadFinalKeyList(self):
#these tuples are also available for use in validity checks
self.functionKeys=('F1','F2','F2','F4','F5','F6','F7','F8','F9',
......@@ -190,7 +190,7 @@ class GetKeysDialog(Toplevel):
self.whitespaceKeys+self.editKeys+self.moveKeys)
apply(self.listKeysFinal.insert,
(END,)+keys)
def TranslateKey(self,key):
#translate from key list value to tkinter key-id
translateDict={'~':'asciitilde','!':'exclam','@':'at','#':'numbersign',
......@@ -206,16 +206,16 @@ class GetKeysDialog(Toplevel):
key=translateDict[key]
key='Key-'+key
return key
def Ok(self, event=None):
if self.KeysOk():
self.result=self.keyString.get()
self.destroy()
def Cancel(self, event=None):
self.result=''
self.destroy()
def KeysOk(self):
#simple validity check
keysOk=1
......@@ -232,13 +232,13 @@ class GetKeysDialog(Toplevel):
tkMessageBox.showerror(title='Key Sequence Error',
message='No final key specified.')
keysOk=0
elif (not modifiers) and (finalKey in
elif (not modifiers) and (finalKey in
self.alphanumKeys+self.punctuationKeys):
#modifier required
tkMessageBox.showerror(title='Key Sequence Error',
message='No modifier key(s) specified.')
keysOk=0
elif (modifiers==['Shift']) and (finalKey not
elif (modifiers==['Shift']) and (finalKey not
in self.functionKeys+('Tab',)):
#shift alone is only a useful modifier with a function key
tkMessageBox.showerror(title='Key Sequence Error',
......@@ -250,7 +250,7 @@ class GetKeysDialog(Toplevel):
message='This key combination is already in use.')
keysOk=0
return keysOk
if __name__ == '__main__':
#test the dialog
root=Tk()
......
......@@ -3,8 +3,8 @@
Installation:
see the install_IDLE target in python/dist/src/Mac/OSX/Makefile
Usage:
Usage:
1. Double clicking IDLE icon will open IDLE.
2. Dropping file on IDLE icon will open that file in IDLE.
......@@ -26,7 +26,7 @@ except NameError:
__file__ = sys.argv[0]
idlelib = join(split(__file__)[0], 'idlelib')
if isdir(idlelib):
sys.path.append(idlelib)
sys.path.append(idlelib)
# see if we are being asked to execute the subprocess code
if '-p' in sys.argv:
......
......@@ -56,7 +56,7 @@ def pickle_code(co):
# def pickle_function(fn):
# assert isinstance(fn, type.FunctionType)
# return `fn`
copy_reg.pickle(types.CodeType, pickle_code, unpickle_code)
# copy_reg.pickle(types.FunctionType, pickle_function, unpickle_function)
......@@ -75,13 +75,13 @@ class RPCServer(SocketServer.TCPServer):
def server_activate(self):
"""Override TCPServer method, connect() instead of listen()
Due to the reversed connection, self.server_address is actually the
address of the Idle Client to which we are connecting.
"""
self.socket.connect(self.server_address)
def get_request(self):
"Override TCPServer method, return already connected socket"
return self.socket, self.server_address
......@@ -126,7 +126,7 @@ class SocketIO:
pass
def localcall(self, request):
self.debug("localcall:", request)
self.debug("localcall:", request)
try:
how, (oid, methodname, args, kwargs) = request
except TypeError:
......@@ -174,7 +174,7 @@ class SocketIO:
return ("EXCEPTION", (mod, name, args, tb))
def remotecall(self, oid, methodname, args, kwargs):
self.debug("remotecall:")
self.debug("remotecall:")
seq = self.asynccall(oid, methodname, args, kwargs)
return self.asyncreturn(seq)
......@@ -215,7 +215,7 @@ class SocketIO:
# do the best we can:
raise name, args
if how == "ERROR":
self.debug("decoderesponse: Internal ERROR:", what)
self.debug("decoderesponse: Internal ERROR:", what)
raise RuntimeError, what
raise SystemError, (how, what)
......@@ -359,7 +359,7 @@ class SocketIO:
cv.notify()
self.statelock.release()
continue
#----------------- end class SocketIO --------------------
class RemoteObject:
......@@ -465,7 +465,7 @@ def _getattributes(obj, attributes):
for name in dir(obj):
attr = getattr(obj, name)
if not callable(attr):
attributes[name] = 1
attributes[name] = 1
class MethodProxy:
......@@ -486,14 +486,14 @@ def testServer(addr):
# XXX 25 Jul 02 KBK needs update to use rpc.py register/unregister methods
class RemotePerson:
def __init__(self,name):
self.name = name
self.name = name
def greet(self, name):
print "(someone called greet)"
print "Hello %s, I am %s." % (name, self.name)
print
def getName(self):
print "(someone called getName)"
print
print
return self.name
def greet_this_guy(self, name):
print "(someone called greet_this_guy)"
......@@ -502,7 +502,7 @@ def testServer(addr):
remote_guy.greet("Thomas Edison")
print "Done."
print
person = RemotePerson("Thomas Edison")
svr = RPCServer(addr)
svr.register('thomas', person)
......@@ -526,12 +526,12 @@ def testClient(addr):
thomas.greet("Alexander Bell")
#clt.remotecall("thomas","greet",("Alexander Bell",), {})
print "Done."
print
print
time.sleep(2)
# demonstrates remote server calling local instance
class LocalPerson:
def __init__(self,name):
self.name = name
self.name = name
def greet(self, name):
print "You've greeted me!"
def getName(self):
......@@ -551,5 +551,3 @@ def test():
if __name__ == '__main__':
test()
......@@ -10,23 +10,23 @@ class AlreadyExists(Exception): pass
class PageTab(Frame):
"""
a 'page tab' like framed button
"""
"""
def __init__(self,parent):
Frame.__init__(self, parent,borderwidth=2,relief=RIDGE)
self.button=Radiobutton(self,padx=5,pady=5,takefocus=FALSE,
indicatoron=FALSE,highlightthickness=0,
borderwidth=0,selectcolor=self.cget('bg'))
self.button.pack()
class TabPageSet(Frame):
"""
a set of 'pages' with TabButtons for controlling their display
"""
"""
def __init__(self,parent,pageNames=[],**kw):
"""
pageNames - a list of strings, each string will be the dictionary key
to a page's data, and the name displayed on the page's tab. Should be
specified in desired page order. The first page will be the default
to a page's data, and the name displayed on the page's tab. Should be
specified in desired page order. The first page will be the default
and first active page.
"""
Frame.__init__(self, parent, kw)
......@@ -48,12 +48,12 @@ class TabPageSet(Frame):
else:
raise InvalidTabPage, 'Invalid TabPage Name'
## pop up the active 'tab' only
for page in self.pages.keys():
for page in self.pages.keys():
self.pages[page]['tab'].config(relief=RIDGE)
self.pages[self.GetActivePage()]['tab'].config(relief=RAISED)
## switch page
self.pages[self.GetActivePage()]['page'].lift()
def GetActivePage(self):
return self.activePage.get()
......@@ -67,7 +67,7 @@ class TabPageSet(Frame):
value=pageName)
self.pages[pageName]['tab'].pack(side=LEFT)
self.pages[pageName]['page'].grid(row=1,column=0,sticky=NSEW)
if len(self.pages)==1: # adding first page
if len(self.pages)==1: # adding first page
self.defaultPage=pageName
self.activePage.set(self.defaultPage)
self.ChangePage()
......@@ -83,11 +83,11 @@ class TabPageSet(Frame):
# handle removing last remaining, or default, or active page
if not self.pages: # removed last remaining page
self.defaultPage=''
return
return
if pageName==self.defaultPage: # set a new default page
self.defaultPage=\
self.tabBar.winfo_children()[0].button.cget('text')
if pageName==self.GetActivePage(): # set a new active page
if pageName==self.GetActivePage(): # set a new active page
self.activePage.set(self.defaultPage)
self.ChangePage()
......@@ -111,4 +111,3 @@ if __name__ == '__main__':
entryPgName.pack(padx=5)
tabPage.ChangePage()
root.mainloop()
##---------------------------------------------------------------------------##
##
## idle - simple text view dialog
## idle - simple text view dialog
## elguavas
##
##
##---------------------------------------------------------------------------##
"""
simple text browser for idle
......@@ -13,7 +13,7 @@ import tkMessageBox
class TextViewer(Toplevel):
"""
simple text viewer dialog for idle
"""
"""
def __init__(self,parent,title,fileName):
"""
fileName - string,should be an absoulute filename
......@@ -39,7 +39,7 @@ class TextViewer(Toplevel):
self.LoadTextFile(fileName)
self.textView.config(state=DISABLED)
self.wait_window()
def LoadTextFile(self, fileName):
textFile = None
try:
......@@ -49,7 +49,7 @@ class TextViewer(Toplevel):
message='Unable to load file '+`fileName`+' .')
else:
self.textView.insert(0.0,textFile.read())
def CreateWidgets(self):
frameText = Frame(self)
frameButtons = Frame(self)
......@@ -65,7 +65,7 @@ class TextViewer(Toplevel):
self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH)
frameButtons.pack(side=BOTTOM,fill=X)
frameText.pack(side=TOP,expand=TRUE,fill=BOTH)
def Ok(self, event=None):
self.destroy()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment