[Python-checkins] commit of r41425 - python/branches/IDLE-syntax-branch/Lib/idlelib
kurt.kaiser@python.org
kurt.kaiser at python.org
Sat Nov 12 01:36:08 CET 2005
Author: kurt.kaiser
Date: Sat Nov 12 01:36:07 2005
New Revision: 41425
Modified:
python/branches/IDLE-syntax-branch/Lib/idlelib/AutoComplete.py
python/branches/IDLE-syntax-branch/Lib/idlelib/AutoCompleteWindow.py
python/branches/IDLE-syntax-branch/Lib/idlelib/CallTipWindow.py
python/branches/IDLE-syntax-branch/Lib/idlelib/EditorWindow.py
python/branches/IDLE-syntax-branch/Lib/idlelib/HyperParser.py
python/branches/IDLE-syntax-branch/Lib/idlelib/MultiCall.py
python/branches/IDLE-syntax-branch/Lib/idlelib/ParenMatch.py
python/branches/IDLE-syntax-branch/Lib/idlelib/configDialog.py
Log:
Whitespace Normalization
M idlelib/AutoCompleteWindow.py
M idlelib/AutoComplete.py
M idlelib/HyperParser.py
M idlelib/ParenMatch.py
M idlelib/configDialog.py
M idlelib/EditorWindow.py
M idlelib/CallTipWindow.py
M idlelib/MultiCall.py
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/AutoComplete.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/AutoComplete.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/AutoComplete.py Sat Nov 12 01:36:07 2005
@@ -116,7 +116,7 @@
if self._delayed_completion_id is not None:
self.text.after_cancel(self._delayed_completion_id)
self._delayed_completion_id = None
-
+
hp = HyperParser(self.editwin, "insert")
curline = self.text.get("insert linestart", "insert")
i = j = len(curline)
@@ -159,11 +159,11 @@
mode,
userWantsWin)
return True
-
+
def fetch_completions(self, what, mode):
"""Return a pair of lists of completions for something. The first list
is a sublist of the second. Both are sorted.
-
+
If there is a Python subprocess, get the comp. list there. Otherwise,
either fetch_completions() is running in the subprocess itself or it
was called in an IDLE EditorWindow before any script had been run.
@@ -171,7 +171,7 @@
The subprocess environment is that of the most recently run script. If
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:
@@ -203,7 +203,7 @@
smalll = filter(lambda s: s[:1] != '_', bigl)
except:
return [], []
-
+
elif mode == COMPLETE_FILES:
if what == "":
what = "."
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/AutoCompleteWindow.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/AutoCompleteWindow.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/AutoCompleteWindow.py Sat Nov 12 01:36:07 2005
@@ -102,7 +102,7 @@
self.completions[first][i] == self.completions[last][i]:
i += 1
return self.completions[first][:i]
-
+
def _selection_changed(self):
"""Should be called when the selection of the Listbox has changed.
Updates the Listbox display and calls _change_start."""
@@ -160,7 +160,7 @@
return
self.userwantswindow = userWantsWin
self.lasttypedstart = self.start
-
+
# Put widgets in place
self.autocompletewindow = acw = Toplevel(self.widget)
# Put it in a position so that it is not seen.
@@ -171,7 +171,7 @@
# 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.
- acw.tk.call("::tk::unsupported::MacWindowStyle", "style", acw._w,
+ acw.tk.call("::tk::unsupported::MacWindowStyle", "style", acw._w,
"help", "noActivates")
except TclError:
pass
@@ -185,7 +185,7 @@
scrollbar.config(command=listbox.yview)
scrollbar.pack(side=RIGHT, fill=Y)
listbox.pack(side=LEFT, fill=BOTH, expand=True)
-
+
# Initialize the listbox selection
self.listbox.select_set(self._binary_search(self.start))
self._selection_changed()
@@ -218,7 +218,7 @@
acw.wm_geometry("+%d+%d" % (x + self.widget.winfo_rootx(),
y + self.widget.winfo_rooty() \
-acw.winfo_height()))
-
+
def hide_event(self, event):
if not self.is_active():
@@ -236,7 +236,7 @@
cursel = int(self.listbox.curselection()[0])
self._change_start(self.completions[cursel])
self.hide_window()
-
+
def keypress_event(self, event):
if not self.is_active():
return
@@ -245,7 +245,7 @@
state = event.mc_state
else:
state = 0
-
+
if (len(keysym) == 1 or keysym in ("underscore", "BackSpace")
or (self.mode==AutoComplete.COMPLETE_FILES and keysym in
("period", "minus"))) \
@@ -270,7 +270,7 @@
self.listbox.select_set(self._binary_search(self.start))
self._selection_changed()
return "break"
-
+
elif keysym == "Return" and not state:
# If start is a prefix of the selection, or there was an indication
# that the user used the completion window, put the selected
@@ -391,5 +391,3 @@
self.listbox = None
self.autocompletewindow.destroy()
self.autocompletewindow = None
-
-
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/CallTipWindow.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/CallTipWindow.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/CallTipWindow.py Sat Nov 12 01:36:07 2005
@@ -53,11 +53,11 @@
self.text = text
if self.tipwindow or not self.text:
return
-
+
self.widget.mark_set(MARK_RIGHT, parenright)
self.parenline, self.parencol = map(
int, self.widget.index(parenleft).split("."))
-
+
self.tipwindow = tw = Toplevel(self.widget)
self.position_window()
# XXX 12 Dec 2002 KBK The following command has two effects: It removes
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/EditorWindow.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/EditorWindow.py Sat Nov 12 01:36:07 2005
@@ -1105,7 +1105,7 @@
rawtext = text.get(startatindex, "insert")
y.set_str(rawtext)
y.set_lo(0)
-
+
c = y.get_continuation_type()
if c != PyParse.C_NONE:
# The current stmt hasn't ended yet.
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/HyperParser.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/HyperParser.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/HyperParser.py Sat Nov 12 01:36:07 2005
@@ -18,16 +18,16 @@
"""Initialize the HyperParser to analyze the surroundings of the given
index.
"""
-
+
self.editwin = editwin
self.text = text = editwin.text
parser = PyParse.Parser(editwin.indentwidth, editwin.tabwidth)
-
+
def index2line(index):
return int(float(index))
lno = index2line(text.index(index))
-
+
if not editwin.context_use_ps1:
for context in editwin.num_context_lines:
startat = max(lno - context, 1)
@@ -145,7 +145,7 @@
_id_chars = string.ascii_letters + string.digits + "_"
# This string includes all chars that may be the first char of an identifier
_id_first_chars = string.ascii_letters + "_"
-
+
# Given a string and pos, return the number of chars in the identifier
# which ends at pos, or 0 if there is no such one. Saved words are not
# identifiers.
@@ -157,7 +157,7 @@
keyword.iskeyword(str[i:pos])):
i = pos
return pos - i
-
+
def get_expression(self):
"""Return a string with the Python expression which ends at the given
index, which is empty if there is no real one.
@@ -165,17 +165,17 @@
if not self.is_in_code():
raise ValueError("get_expression should only be called if index "\
"is inside a code.")
-
+
rawtext = self.rawtext
bracketing = self.bracketing
-
+
brck_index = self.indexbracket
brck_limit = bracketing[brck_index][0]
pos = self.indexinrawtext
last_identifier_pos = pos
postdot_phase = True
-
+
while 1:
# Eat whitespaces, comments, and if postdot_phase is False - one dot
while 1:
@@ -212,7 +212,7 @@
# Now, in order to continue the search, we must find a dot.
postdot_phase = False
# (the loop continues now)
-
+
elif pos == brck_limit:
# We are at a bracketing limit. If it is a closing bracket,
# eat the bracket, otherwise, stop the search.
@@ -237,6 +237,5 @@
else:
# We've found an operator or something.
break
-
- return rawtext[last_identifier_pos:self.indexinrawtext]
+ return rawtext[last_identifier_pos:self.indexinrawtext]
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/MultiCall.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/MultiCall.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/MultiCall.py Sat Nov 12 01:36:07 2005
@@ -160,7 +160,7 @@
if r:
return r
return handler
-
+
def __init__(self, type, widget, widgetinst):
self.type = type
self.typename = _types[type][0]
@@ -231,7 +231,7 @@
_type_names = dict([(name, number)
for number in range(len(_types))
for name in _types[number]])
-
+
_keysym_re = re.compile(r"^\w+$")
_button_re = re.compile(r"^[1-5]$")
def _parse_sequence(sequence):
@@ -266,7 +266,7 @@
type_re = _keysym_re
else:
type_re = _button_re
-
+
if not words:
detail = None
elif len(words) == 1 and type_re.match(words[0]):
@@ -336,7 +336,7 @@
#print "event_add(%s,%s) was called"%(repr(virtual),repr(sequences))
if virtual not in self.__eventinfo:
self.__eventinfo[virtual] = [None, []]
-
+
func, triplets = self.__eventinfo[virtual]
for seq in sequences:
triplet = _parse_sequence(seq)
@@ -374,7 +374,7 @@
if func:
for triplet in triplets:
self.__binders[triplet[1]].unbind(triplet, func)
-
+
_multicall_dict[widget] = MultiCall
return MultiCall
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/ParenMatch.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/ParenMatch.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/ParenMatch.py Sat Nov 12 01:36:07 2005
@@ -73,7 +73,7 @@
for seq in self.RESTORE_SEQUENCES:
self.text.event_add(self.RESTORE_VIRTUAL_EVENT_NAME, seq)
self.is_restore_active = True
-
+
def deactivate_restore(self):
if self.is_restore_active:
for seq in self.RESTORE_SEQUENCES:
@@ -169,4 +169,3 @@
self.editwin.text_frame.after(self.FLASH_DELAY,
lambda self=self, c=self.counter: \
self.handle_restore_timer(c))
-
Modified: python/branches/IDLE-syntax-branch/Lib/idlelib/configDialog.py
==============================================================================
--- python/branches/IDLE-syntax-branch/Lib/idlelib/configDialog.py (original)
+++ python/branches/IDLE-syntax-branch/Lib/idlelib/configDialog.py Sat Nov 12 01:36:07 2005
@@ -1112,7 +1112,7 @@
winInstances=self.parent.instance_dict.keys()
for instance in winInstances:
instance.RemoveKeybindings()
-
+
def ActivateConfigChanges(self):
"Dynamically apply configuration changes"
winInstances=self.parent.instance_dict.keys()
More information about the Python-checkins
mailing list