summaryrefslogtreecommitdiffstats
path: root/Tools/idle
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-01-17 08:48:39 (GMT)
commit70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7 (patch)
treecf47b67db3753288cfd9fa2adc45e7c5cd2f8741 /Tools/idle
parenta88854059309667092000da55d4d5a5804267e9f (diff)
downloadcpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.zip
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.gz
cpython-70c4378dbcfdcbeef6fb3aa348f32ed862fe8eb7.tar.bz2
Whitespace normalization.
Diffstat (limited to 'Tools/idle')
-rw-r--r--Tools/idle/CallTipWindow.py4
-rw-r--r--Tools/idle/CallTips.py6
-rw-r--r--Tools/idle/ClassBrowser.py2
-rw-r--r--Tools/idle/Debugger.py8
-rw-r--r--Tools/idle/Delegator.py1
-rw-r--r--Tools/idle/FileList.py12
-rw-r--r--Tools/idle/FormatParagraph.py4
-rw-r--r--Tools/idle/IdleConf.py27
-rw-r--r--Tools/idle/IdleHistory.py1
-rw-r--r--Tools/idle/MultiScrolledLists.py26
-rw-r--r--Tools/idle/MultiStatusBar.py48
-rw-r--r--Tools/idle/OutputWindow.py8
-rw-r--r--Tools/idle/ParenMatch.py13
-rw-r--r--Tools/idle/PathBrowser.py2
-rw-r--r--Tools/idle/PyShell.py2
-rw-r--r--Tools/idle/RemoteInterp.py11
-rw-r--r--Tools/idle/ScriptBinding.py4
-rw-r--r--Tools/idle/ScrolledList.py2
-rw-r--r--Tools/idle/Separator.py16
-rw-r--r--Tools/idle/StackViewer.py2
-rw-r--r--Tools/idle/ToolTip.py2
-rw-r--r--Tools/idle/WindowList.py2
22 files changed, 99 insertions, 104 deletions
diff --git a/Tools/idle/CallTipWindow.py b/Tools/idle/CallTipWindow.py
index cbeab8c..d253fa5 100644
--- a/Tools/idle/CallTipWindow.py
+++ b/Tools/idle/CallTipWindow.py
@@ -28,7 +28,7 @@ class CallTip:
background="#ffffe0", relief=SOLID, borderwidth=1,
font = self.widget['font'])
label.pack()
-
+
def hidetip(self):
tw = self.tipwindow
self.tipwindow = None
@@ -53,7 +53,7 @@ class container: # Conceptually an editor_window
text.event_add("<<calltip-hide>>", ")")
text.bind("<<calltip-show>>", self.calltip_show)
text.bind("<<calltip-hide>>", self.calltip_hide)
-
+
text.focus_set()
# root.mainloop() # not in idle
diff --git a/Tools/idle/CallTips.py b/Tools/idle/CallTips.py
index 04eccde..7c5f41c 100644
--- a/Tools/idle/CallTips.py
+++ b/Tools/idle/CallTips.py
@@ -45,7 +45,7 @@ class CallTips:
if self.calltip:
self.calltip.hidetip()
self.calltip = None
-
+
def paren_open_event(self, event):
self._remove_calltip_window()
arg_text = get_arg_text(self.get_object_at_cursor())
@@ -91,9 +91,9 @@ class CallTips:
namespace = sys.modules.copy()
namespace.update(__main__.__dict__)
try:
- return eval(word, namespace)
+ return eval(word, namespace)
except:
- pass
+ pass
return None # Can't find an object.
def _find_constructor(class_ob):
diff --git a/Tools/idle/ClassBrowser.py b/Tools/idle/ClassBrowser.py
index f440164..19f3b7e 100644
--- a/Tools/idle/ClassBrowser.py
+++ b/Tools/idle/ClassBrowser.py
@@ -92,7 +92,7 @@ class ModuleBrowserTreeItem(TreeItem):
def IsExpandable(self):
return os.path.normcase(self.file[-3:]) == ".py"
-
+
def listclasses(self):
dir, file = os.path.split(self.file)
name, ext = os.path.splitext(file)
diff --git a/Tools/idle/Debugger.py b/Tools/idle/Debugger.py
index 267d39f..e4591ff 100644
--- a/Tools/idle/Debugger.py
+++ b/Tools/idle/Debugger.py
@@ -17,7 +17,7 @@ class Debugger(bdb.Bdb):
bdb.Bdb.__init__(self)
self.pyshell = pyshell
self.make_gui()
-
+
def canonic(self, filename):
# Canonicalize filename -- called by Bdb
return os.path.normcase(os.path.abspath(filename))
@@ -299,10 +299,10 @@ class Debugger(bdb.Bdb):
import linecache # Import as late as possible
line = linecache.getline(filename, lineno)
if not line:
- return 'That line does not exist!'
+ return 'That line does not exist!'
if not self.breaks.has_key(filename):
- self.breaks[filename] = []
+ self.breaks[filename] = []
list = self.breaks[filename]
if not lineno in list:
- list.append(lineno)
+ list.append(lineno)
bp = bdb.Breakpoint(filename, lineno, temporary, cond)
diff --git a/Tools/idle/Delegator.py b/Tools/idle/Delegator.py
index 3665247..6125591 100644
--- a/Tools/idle/Delegator.py
+++ b/Tools/idle/Delegator.py
@@ -1,4 +1,3 @@
-
class Delegator:
# The cache is only used to be able to change delegates!
diff --git a/Tools/idle/FileList.py b/Tools/idle/FileList.py
index 0791157..db862a1 100644
--- a/Tools/idle/FileList.py
+++ b/Tools/idle/FileList.py
@@ -26,12 +26,12 @@ class FileList:
def goodname(self, filename):
- filename = self.canonize(filename)
- key = os.path.normcase(filename)
- if self.dict.has_key(key):
- edit = self.dict[key]
- filename = edit.io.filename or filename
- return filename
+ filename = self.canonize(filename)
+ key = os.path.normcase(filename)
+ if self.dict.has_key(key):
+ edit = self.dict[key]
+ filename = edit.io.filename or filename
+ return filename
def open(self, filename):
assert filename
diff --git a/Tools/idle/FormatParagraph.py b/Tools/idle/FormatParagraph.py
index 76c52f5..ea18cc0 100644
--- a/Tools/idle/FormatParagraph.py
+++ b/Tools/idle/FormatParagraph.py
@@ -28,10 +28,10 @@ class FormatParagraph:
keydefs = {
'<<format-paragraph>>': ['<Alt-q>'],
}
-
+
unix_keydefs = {
'<<format-paragraph>>': ['<Meta-q>'],
- }
+ }
def __init__(self, editwin):
self.editwin = editwin
diff --git a/Tools/idle/IdleConf.py b/Tools/idle/IdleConf.py
index 36cad51..37f4ef1 100644
--- a/Tools/idle/IdleConf.py
+++ b/Tools/idle/IdleConf.py
@@ -10,24 +10,24 @@ class IdleConfParser(ConfigParser):
builtin_sections = {}
for section in ('EditorWindow', 'Colors'):
builtin_sections[section] = section
-
+
def getcolor(self, sec, name):
"""Return a dictionary with foreground and background colors
The return value is appropriate for passing to Tkinter in, e.g.,
a tag_config call.
"""
- fore = self.getdef(sec, name + "-foreground")
- back = self.getdef(sec, name + "-background")
+ fore = self.getdef(sec, name + "-foreground")
+ back = self.getdef(sec, name + "-background")
return {"foreground": fore,
"background": back}
def getdef(self, sec, options, raw=0, vars=None, default=None):
"""Get an option value for given section or return default"""
- try:
+ try:
return self.get(sec, options, raw, vars)
- except (NoSectionError, NoOptionError):
- return default
+ except (NoSectionError, NoOptionError):
+ return default
def getsection(self, section):
"""Return a SectionConfigParser object"""
@@ -37,10 +37,10 @@ class IdleConfParser(ConfigParser):
exts = []
for sec in self.sections():
if self.builtin_sections.has_key(sec):
- continue
- # enable is a bool, but it may not be defined
- if self.getdef(sec, 'enable') != '0':
- exts.append(sec)
+ continue
+ # enable is a bool, but it may not be defined
+ if self.getdef(sec, 'enable') != '0':
+ exts.append(sec)
return exts
def reload(self):
@@ -69,10 +69,10 @@ class SectionConfigParser:
def getint(self, option):
return self.config.getint(self.section, option)
-
+
def getfloat(self, option):
return self.config.getint(self.section, option)
-
+
def getboolean(self, option):
return self.config.getint(self.section, option)
@@ -98,7 +98,7 @@ def load(dir):
genplatfile = os.path.join(dir, "config-mac.txt")
else:
genplatfile = os.path.join(dir, "config-unix.txt")
-
+
platfile = os.path.join(dir, "config-%s.txt" % sys.platform)
try:
@@ -110,4 +110,3 @@ def load(dir):
os.path.join(homedir, ".idle")))
idleconf = IdleConfParser()
-
diff --git a/Tools/idle/IdleHistory.py b/Tools/idle/IdleHistory.py
index aa41b73..b882c92 100644
--- a/Tools/idle/IdleHistory.py
+++ b/Tools/idle/IdleHistory.py
@@ -86,4 +86,3 @@ class History:
self.text.mark_set("insert", "end-1c")
self.text.insert("insert", s)
self.text.see("insert")
-
diff --git a/Tools/idle/MultiScrolledLists.py b/Tools/idle/MultiScrolledLists.py
index 32f6246..6c140df 100644
--- a/Tools/idle/MultiScrolledLists.py
+++ b/Tools/idle/MultiScrolledLists.py
@@ -10,7 +10,7 @@ from Separator import HSeparator
from ScrolledList import ScrolledList
class MultiScrolledLists:
-
+
def __init__(self, root, nlists=2):
assert nlists >= 1
self.root = root
@@ -51,17 +51,17 @@ class MultiScrolledLists:
self.fill(0)
# XXX one after_idle isn't enough; two are...
top.after_idle(self.call_pack_propagate_1)
-
+
def call_pack_propagate_1(self):
self.top.after_idle(self.call_pack_propagate)
-
+
def call_pack_propagate(self):
for frame in self.frames:
frame.pack_propagate(0)
-
+
def close(self, event=None):
self.top.destroy()
-
+
def settitle(self):
short = self.shorttitle()
long = self.longtitle()
@@ -80,23 +80,23 @@ class MultiScrolledLists:
def longtitle(self):
# override this
return "Multi Scrolled Lists"
-
+
def shorttitle(self):
# override this
return None
-
+
def width(self, i):
# override this
return 20
-
+
def height(self, i):
# override this
return 10
-
+
def subtitle(self, i):
# override this
return "Column %d" % i
-
+
def fill(self, i):
for k in range(i, self.nlists):
self.lists[k].clear()
@@ -105,14 +105,14 @@ class MultiScrolledLists:
l = self.items(i)
for s in l:
list.append(s)
-
+
def on_select(self, index, i):
item = self.lists[i].get(index)
del self.path[i:]
self.path.append(item)
if i+1 < self.nlists:
self.fill(i+1)
-
+
def items(self, i):
# override this
l = []
@@ -122,7 +122,7 @@ class MultiScrolledLists:
s = self.path[i-1] + "." + s
l.append(s)
return l
-
+
def on_double(self, index, i):
pass
diff --git a/Tools/idle/MultiStatusBar.py b/Tools/idle/MultiStatusBar.py
index c11db3e..dd6d041 100644
--- a/Tools/idle/MultiStatusBar.py
+++ b/Tools/idle/MultiStatusBar.py
@@ -1,32 +1,32 @@
from Tkinter import *
class MultiStatusBar(Frame):
-
- def __init__(self, master=None, **kw):
- if master is None:
- master = Tk()
- apply(Frame.__init__, (self, master), kw)
- self.labels = {}
- def set_label(self, name, text='', side=LEFT):
- if not self.labels.has_key(name):
- label = Label(self, bd=1, relief=SUNKEN, anchor=W)
- label.pack(side=side)
- self.labels[name] = label
- else:
- label = self.labels[name]
- label.config(text=text)
+ def __init__(self, master=None, **kw):
+ if master is None:
+ master = Tk()
+ apply(Frame.__init__, (self, master), kw)
+ self.labels = {}
+
+ def set_label(self, name, text='', side=LEFT):
+ if not self.labels.has_key(name):
+ label = Label(self, bd=1, relief=SUNKEN, anchor=W)
+ label.pack(side=side)
+ self.labels[name] = label
+ else:
+ label = self.labels[name]
+ label.config(text=text)
def _test():
- b = Frame()
- c = Text(b)
- c.pack(side=TOP)
- a = MultiStatusBar(b)
- a.set_label("one", "hello")
- a.set_label("two", "world")
- a.pack(side=BOTTOM, fill=X)
- b.pack()
- b.mainloop()
+ b = Frame()
+ c = Text(b)
+ c.pack(side=TOP)
+ a = MultiStatusBar(b)
+ a.set_label("one", "hello")
+ a.set_label("two", "world")
+ a.pack(side=BOTTOM, fill=X)
+ b.pack()
+ b.mainloop()
if __name__ == '__main__':
- _test()
+ _test()
diff --git a/Tools/idle/OutputWindow.py b/Tools/idle/OutputWindow.py
index 0c36a88..3d97362 100644
--- a/Tools/idle/OutputWindow.py
+++ b/Tools/idle/OutputWindow.py
@@ -111,17 +111,17 @@ class OnDemandOutputWindow:
# XXX Should use IdlePrefs.ColorPrefs
"stdout": {"foreground": "blue"},
"stderr": {"foreground": "#007700"},
- }
-
+ }
+
def __init__(self, flist):
self.flist = flist
self.owin = None
-
+
def write(self, s, tags, mark):
if not self.owin:
self.setup()
self.owin.write(s, tags, mark)
-
+
def setup(self):
self.owin = owin = OutputWindow(self.flist)
text = owin.text
diff --git a/Tools/idle/ParenMatch.py b/Tools/idle/ParenMatch.py
index a607e49..17d76c2 100644
--- a/Tools/idle/ParenMatch.py
+++ b/Tools/idle/ParenMatch.py
@@ -20,7 +20,7 @@ class ParenMatch:
"""Highlight matching parentheses
There are three supported style of paren matching, based loosely
- on the Emacs options. The style is select based on the
+ on the Emacs options. The style is select based on the
HILITE_STYLE attribute; it can be changed used the set_style
method.
@@ -43,9 +43,9 @@ class ParenMatch:
to the right of a right paren. I don't know how to do that in Tk,
so I haven't bothered.
"""
-
+
menudefs = []
-
+
keydefs = {
'<<flash-open-paren>>' : ('<KeyRelease-parenright>',
'<KeyRelease-bracketright>',
@@ -146,7 +146,7 @@ class LastOpenBracketFinder:
indentwidth = AutoIndent.indentwidth
tabwidth = AutoIndent.tabwidth
context_use_ps1 = AutoIndent.context_use_ps1
-
+
def __init__(self, editwin):
self.editwin = editwin
self.text = editwin.text
@@ -158,7 +158,7 @@ class LastOpenBracketFinder:
startatindex = `startat` + ".0"
# rawtext needs to contain everything up to the last
# character, which was the close paren. the parser also
- # requires that the last line ends with "\n"
+ # requires that the last line ends with "\n"
rawtext = self.text.get(startatindex, "insert")[:-1] + "\n"
y.set_str(rawtext)
bod = y.find_good_parse_start(
@@ -175,7 +175,7 @@ class LastOpenBracketFinder:
lno = index2line(self.text.index("insert"))
i, buf = self._find_offset_in_buf(lno)
if i is None \
- or keysym_type(buf[i]) != right_keysym_type:
+ or keysym_type(buf[i]) != right_keysym_type:
return None
lines_back = string.count(buf[i:], "\n") - 1
# subtract one for the "\n" added to please the parser
@@ -189,4 +189,3 @@ class LastOpenBracketFinder:
icis=self.editwin.is_char_in_string):
return icis(startindex + "%dc" % offset)
return inner
-
diff --git a/Tools/idle/PathBrowser.py b/Tools/idle/PathBrowser.py
index 7ea2410..86cd270 100644
--- a/Tools/idle/PathBrowser.py
+++ b/Tools/idle/PathBrowser.py
@@ -6,7 +6,7 @@ from TreeWidget import TreeItem
from ClassBrowser import ClassBrowser, ModuleBrowserTreeItem
class PathBrowser(ClassBrowser):
-
+
def __init__(self, flist):
self.init(flist)
diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py
index 06d4f15..86c0f6b 100644
--- a/Tools/idle/PyShell.py
+++ b/Tools/idle/PyShell.py
@@ -124,7 +124,7 @@ class ModifiedColorDelegator(ColorDelegator):
"stderr": cconf.getcolor("stderr"),
"console": cconf.getcolor("console"),
"ERROR": cconf.getcolor("ERROR"),
- None: cconf.getcolor("normal"),
+ None: cconf.getcolor("normal"),
})
diff --git a/Tools/idle/RemoteInterp.py b/Tools/idle/RemoteInterp.py
index 3ad574b..724997c 100644
--- a/Tools/idle/RemoteInterp.py
+++ b/Tools/idle/RemoteInterp.py
@@ -9,7 +9,7 @@ VERBOSE = None
class SocketProtocol:
"""A simple protocol for sending strings across a socket"""
BUF_SIZE = 8192
-
+
def __init__(self, sock):
self.sock = sock
self._buffer = ''
@@ -176,11 +176,11 @@ class CommandProtocol:
def decode_seqno(self, buf):
return struct.unpack("I", buf)[0]
-
+
class StdioRedirector:
"""Redirect sys.std{in,out,err} to a set of file-like objects"""
-
+
def __init__(self, stdin, stdout, stderr):
self.stdin = stdin
self.stdout = stdout
@@ -292,7 +292,7 @@ class RIClient:
self._cmd.dispatch()
except EOFError:
pass
-
+
def handle_stdout(self, buf):
sys.stdout.write(buf)
## sys.stdout.flush()
@@ -339,5 +339,4 @@ if __name__ == "__main__":
startRemoteInterp(id)
else:
file = args[1]
- riExec(id, file)
-
+ riExec(id, file)
diff --git a/Tools/idle/ScriptBinding.py b/Tools/idle/ScriptBinding.py
index e46cb76..b54dfc4 100644
--- a/Tools/idle/ScriptBinding.py
+++ b/Tools/idle/ScriptBinding.py
@@ -34,13 +34,13 @@ To fix case 2, change all tabs to spaces by using Select All followed \
by Untabify Region (both in the Edit menu)."""
class ScriptBinding:
-
+
keydefs = {
'<<check-module>>': ['<Alt-F5>', '<Meta-F5>'],
'<<import-module>>': ['<F5>'],
'<<run-script>>': ['<Control-F5>'],
}
-
+
menudefs = [
('edit', [None,
('Check module', '<<check-module>>'),
diff --git a/Tools/idle/ScrolledList.py b/Tools/idle/ScrolledList.py
index 7fb1c20..92119365 100644
--- a/Tools/idle/ScrolledList.py
+++ b/Tools/idle/ScrolledList.py
@@ -1,7 +1,7 @@
from Tkinter import *
class ScrolledList:
-
+
default = "(None)"
def __init__(self, master, **options):
diff --git a/Tools/idle/Separator.py b/Tools/idle/Separator.py
index 2645e57..7145559 100644
--- a/Tools/idle/Separator.py
+++ b/Tools/idle/Separator.py
@@ -1,7 +1,7 @@
from Tkinter import *
class Separator:
-
+
def __init__(self, master, orient, min=10, thickness=5, bg=None):
self.min = max(1, min)
self.thickness = max(1, thickness)
@@ -10,14 +10,14 @@ class Separator:
self.dim = "width"
self.dir = "x"
self.cursor = "sb_h_double_arrow"
- elif orient in ("v", "vertical"):
- self.side = "top"
- self.dim = "height"
- self.dir = "y"
+ elif orient in ("v", "vertical"):
+ self.side = "top"
+ self.dim = "height"
+ self.dir = "y"
self.cursor = "sb_v_double_arrow"
- else:
- raise ValueError, "Separator: orient should be h or v"
- self.winfo_dim = "winfo_" + self.dim
+ else:
+ raise ValueError, "Separator: orient should be h or v"
+ self.winfo_dim = "winfo_" + self.dim
self.master = master = Frame(master)
master.pack(expand=1, fill="both")
self.f1 = Frame(master)
diff --git a/Tools/idle/StackViewer.py b/Tools/idle/StackViewer.py
index 5b3c87a..ab09db0 100644
--- a/Tools/idle/StackViewer.py
+++ b/Tools/idle/StackViewer.py
@@ -100,7 +100,7 @@ class VariablesTreeItem(ObjectTreeItem):
item = make_objecttreeitem(key + " =", value, setfunction)
sublist.append(item)
return sublist
-
+
def get_stack(t=None, f=None):
if t is None:
t = sys.last_traceback
diff --git a/Tools/idle/ToolTip.py b/Tools/idle/ToolTip.py
index 691f510..eadcdea 100644
--- a/Tools/idle/ToolTip.py
+++ b/Tools/idle/ToolTip.py
@@ -81,7 +81,7 @@ def main():
b.pack()
root.update()
tip = ListboxToolTip(b, ["Hello", "world"])
-
+
# root.mainloop() # not in idle
main()
diff --git a/Tools/idle/WindowList.py b/Tools/idle/WindowList.py
index 6de3e58..7e05a57 100644
--- a/Tools/idle/WindowList.py
+++ b/Tools/idle/WindowList.py
@@ -39,7 +39,7 @@ class WindowList:
def unregister_callback(self, callback):
try:
- self.callbacks.remove(callback)
+ self.callbacks.remove(callback)
except ValueError:
pass