/
usr
/
lib
/
python2.6
/
idlelib
/
/usr/lib/python2.6/idlelib
mkdir
upload
Name
Size
Mode
Actions
Icons/
-
0755
rm
aboutDialog.py
6825
0644
edit
dl
rm
aboutDialog.pyc
6937
0644
edit
dl
rm
aboutDialog.pyo
6937
0644
edit
dl
rm
AutoComplete.py
9061
0644
edit
dl
rm
AutoComplete.pyc
7997
0644
edit
dl
rm
AutoComplete.pyo
7997
0644
edit
dl
rm
AutoCompleteWindow.py
17201
0644
edit
dl
rm
AutoCompleteWindow.pyc
12544
0644
edit
dl
rm
AutoCompleteWindow.pyo
12481
0644
edit
dl
rm
AutoExpand.py
2483
0644
edit
dl
rm
AutoExpand.pyc
2575
0644
edit
dl
rm
AutoExpand.pyo
2575
0644
edit
dl
rm
Bindings.py
3502
0644
edit
dl
rm
Bindings.pyc
5062
0644
edit
dl
rm
Bindings.pyo
5062
0644
edit
dl
rm
CallTips.py
7608
0644
edit
dl
rm
CallTips.pyc
10219
0644
edit
dl
rm
CallTips.pyo
10219
0644
edit
dl
rm
CallTipWindow.py
5924
0644
edit
dl
rm
CallTipWindow.pyc
6189
0644
edit
dl
rm
CallTipWindow.pyo
6189
0644
edit
dl
rm
ChangeLog
56393
0644
edit
dl
rm
ClassBrowser.py
6369
0644
edit
dl
rm
ClassBrowser.pyc
9160
0644
edit
dl
rm
ClassBrowser.pyo
9160
0644
edit
dl
rm
CodeContext.py
8347
0644
edit
dl
rm
CodeContext.pyc
6713
0644
edit
dl
rm
CodeContext.pyo
6667
0644
edit
dl
rm
ColorDelegator.py
10150
0644
edit
dl
rm
ColorDelegator.pyc
8942
0644
edit
dl
rm
ColorDelegator.pyo
8942
0644
edit
dl
rm
config-extensions.def
2697
0644
edit
dl
rm
config-highlight.def
1740
0644
edit
dl
rm
config-keys.def
7517
0644
edit
dl
rm
config-main.def
2512
0644
edit
dl
rm
configDialog.py
53229
0644
edit
dl
rm
configDialog.pyc
44828
0644
edit
dl
rm
configDialog.pyo
44828
0644
edit
dl
rm
configHandler.py
28803
0644
edit
dl
rm
configHandler.pyc
27268
0644
edit
dl
rm
configHandler.pyo
27268
0644
edit
dl
rm
configHelpSourceEdit.py
6680
0644
edit
dl
rm
configHelpSourceEdit.pyc
6731
0644
edit
dl
rm
configHelpSourceEdit.pyo
6731
0644
edit
dl
rm
configSectionNameDialog.py
3720
0644
edit
dl
rm
configSectionNameDialog.pyc
4305
0644
edit
dl
rm
configSectionNameDialog.pyo
4305
0644
edit
dl
rm
CREDITS.txt
1856
0644
edit
dl
rm
Debugger.py
15818
0644
edit
dl
rm
Debugger.pyc
16986
0644
edit
dl
rm
Debugger.pyo
16986
0644
edit
dl
rm
Delegator.py
831
0644
edit
dl
rm
Delegator.pyc
1607
0644
edit
dl
rm
Delegator.pyo
1607
0644
edit
dl
rm
dynOptionMenuWidget.py
1302
0644
edit
dl
rm
dynOptionMenuWidget.pyc
1699
0644
edit
dl
rm
dynOptionMenuWidget.pyo
1699
0644
edit
dl
rm
EditorWindow.py
59734
0644
edit
dl
rm
EditorWindow.pyc
52769
0644
edit
dl
rm
EditorWindow.pyo
52666
0644
edit
dl
rm
extend.txt
3652
0644
edit
dl
rm
FileList.py
3660
0644
edit
dl
rm
FileList.pyc
3988
0644
edit
dl
rm
FileList.pyo
3953
0644
edit
dl
rm
FormatParagraph.py
5734
0644
edit
dl
rm
FormatParagraph.pyc
4803
0644
edit
dl
rm
FormatParagraph.pyo
4803
0644
edit
dl
rm
GrepDialog.py
4052
0644
edit
dl
rm
GrepDialog.pyc
5037
0644
edit
dl
rm
GrepDialog.pyo
5037
0644
edit
dl
rm
help.txt
11223
0644
edit
dl
rm
HISTORY.txt
10317
0644
edit
dl
rm
HyperParser.py
10310
0644
edit
dl
rm
HyperParser.pyc
6620
0644
edit
dl
rm
HyperParser.pyo
6620
0644
edit
dl
rm
idle.py
664
0644
edit
dl
rm
idle.pyc
594
0644
edit
dl
rm
idle.pyo
594
0644
edit
dl
rm
idle.pyw
664
0644
edit
dl
rm
IdleHistory.py
3145
0644
edit
dl
rm
IdleHistory.pyc
3213
0644
edit
dl
rm
IdleHistory.pyo
3213
0644
edit
dl
rm
idlever.py
23
0644
edit
dl
rm
idlever.pyc
157
0644
edit
dl
rm
idlever.pyo
157
0644
edit
dl
rm
IOBinding.py
20972
0644
edit
dl
rm
IOBinding.pyc
17713
0644
edit
dl
rm
IOBinding.pyo
17713
0644
edit
dl
rm
keybindingDialog.py
12407
0644
edit
dl
rm
keybindingDialog.pyc
12384
0644
edit
dl
rm
keybindingDialog.pyo
12384
0644
edit
dl
rm
macosxSupport.py
4724
0644
edit
dl
rm
macosxSupport.pyc
4864
0644
edit
dl
rm
macosxSupport.pyo
4864
0644
edit
dl
rm
MultiCall.py
17470
0644
edit
dl
rm
MultiCall.pyc
16142
0644
edit
dl
rm
MultiCall.pyo
16066
0644
edit
dl
rm
MultiStatusBar.py
789
0644
edit
dl
rm
MultiStatusBar.pyc
1538
0644
edit
dl
rm
MultiStatusBar.pyo
1538
0644
edit
dl
rm
NEWS.txt
27165
0644
edit
dl
rm
ObjectBrowser.py
4156
0644
edit
dl
rm
ObjectBrowser.pyc
6691
0644
edit
dl
rm
ObjectBrowser.pyo
6691
0644
edit
dl
rm
OutputWindow.py
4392
0644
edit
dl
rm
OutputWindow.pyc
4990
0644
edit
dl
rm
OutputWindow.pyo
4990
0644
edit
dl
rm
ParenMatch.py
6627
0644
edit
dl
rm
ParenMatch.pyc
6973
0644
edit
dl
rm
ParenMatch.pyo
6973
0644
edit
dl
rm
PathBrowser.py
2646
0644
edit
dl
rm
PathBrowser.pyc
4135
0644
edit
dl
rm
PathBrowser.pyo
4135
0644
edit
dl
rm
Percolator.py
2616
0644
edit
dl
rm
Percolator.pyc
3634
0644
edit
dl
rm
Percolator.pyo
3440
0644
edit
dl
rm
PyParse.py
19510
0644
edit
dl
rm
PyParse.pyc
10179
0644
edit
dl
rm
PyParse.pyo
9711
0644
edit
dl
rm
PyShell.py
51909
0644
edit
dl
rm
PyShell.pyc
46494
0644
edit
dl
rm
PyShell.pyo
46393
0644
edit
dl
rm
README.txt
2623
0644
edit
dl
rm
RemoteDebugger.py
11660
0644
edit
dl
rm
RemoteDebugger.pyc
16290
0644
edit
dl
rm
RemoteDebugger.pyo
16135
0644
edit
dl
rm
RemoteObjectBrowser.py
942
0644
edit
dl
rm
RemoteObjectBrowser.pyc
2147
0644
edit
dl
rm
RemoteObjectBrowser.pyo
2147
0644
edit
dl
rm
ReplaceDialog.py
5134
0644
edit
dl
rm
ReplaceDialog.pyc
5954
0644
edit
dl
rm
ReplaceDialog.pyo
5954
0644
edit
dl
rm
rpc.py
20215
0644
edit
dl
rm
rpc.pyc
21819
0644
edit
dl
rm
rpc.pyo
21709
0644
edit
dl
rm
run.py
11337
0644
edit
dl
rm
run.pyc
12164
0644
edit
dl
rm
run.pyo
12164
0644
edit
dl
rm
ScriptBinding.py
7783
0644
edit
dl
rm
ScriptBinding.pyc
7585
0644
edit
dl
rm
ScriptBinding.pyo
7585
0644
edit
dl
rm
ScrolledList.py
3995
0644
edit
dl
rm
ScrolledList.pyc
6147
0644
edit
dl
rm
ScrolledList.pyo
6147
0644
edit
dl
rm
SearchDialog.py
2040
0644
edit
dl
rm
SearchDialog.pyc
3006
0644
edit
dl
rm
SearchDialog.pyo
3006
0644
edit
dl
rm
SearchDialogBase.py
4385
0644
edit
dl
rm
SearchDialogBase.pyc
5492
0644
edit
dl
rm
SearchDialogBase.pyo
5492
0644
edit
dl
rm
SearchEngine.py
6731
0644
edit
dl
rm
SearchEngine.pyc
7215
0644
edit
dl
rm
SearchEngine.pyo
7215
0644
edit
dl
rm
StackViewer.py
3857
0644
edit
dl
rm
StackViewer.pyc
5916
0644
edit
dl
rm
StackViewer.pyo
5916
0644
edit
dl
rm
tabbedpages.py
18188
0644
edit
dl
rm
tabbedpages.pyc
18085
0644
edit
dl
rm
tabbedpages.pyo
18085
0644
edit
dl
rm
textView.py
3246
0644
edit
dl
rm
textView.pyc
3965
0644
edit
dl
rm
textView.pyo
3965
0644
edit
dl
rm
TODO.txt
8478
0644
edit
dl
rm
ToolTip.py
2736
0644
edit
dl
rm
ToolTip.pyc
4126
0644
edit
dl
rm
ToolTip.pyo
4126
0644
edit
dl
rm
TreeWidget.py
15237
0644
edit
dl
rm
TreeWidget.pyc
17906
0644
edit
dl
rm
TreeWidget.pyo
17906
0644
edit
dl
rm
UndoDelegator.py
10277
0644
edit
dl
rm
UndoDelegator.pyc
12550
0644
edit
dl
rm
UndoDelegator.pyo
12550
0644
edit
dl
rm
WidgetRedirector.py
4476
0644
edit
dl
rm
WidgetRedirector.pyc
5338
0644
edit
dl
rm
WidgetRedirector.pyo
5338
0644
edit
dl
rm
WindowList.py
2473
0644
edit
dl
rm
WindowList.pyc
3624
0644
edit
dl
rm
WindowList.pyo
3624
0644
edit
dl
rm
ZoomHeight.py
1307
0644
edit
dl
rm
ZoomHeight.pyc
1651
0644
edit
dl
rm
ZoomHeight.pyo
1651
0644
edit
dl
rm
__init__.py
37
0644
edit
dl
rm
__init__.pyc
125
0644
edit
dl
rm
__init__.pyo
125
0644
edit
dl
rm
Edit:
/usr/lib/python2.6/idlelib/ParenMatch.py
(6627B)
"""ParenMatch -- An IDLE extension for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to parentheses, square brackets, and curly braces. """ from idlelib.HyperParser import HyperParser from idlelib.configHandler import idleConf _openers = {')':'(',']':'[','}':'{'} CHECK_DELAY = 100 # miliseconds 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 HILITE_STYLE attribute; it can be changed used the set_style method. The supported styles are: default -- When a right paren is typed, highlight the matching left paren for 1/2 sec. expression -- When a right paren is typed, highlight the entire expression from the left paren to the right paren. TODO: - extend IDLE with configuration dialog to change options - implement rest of Emacs highlight styles (see below) - print mismatch warning in IDLE status window Note: In Emacs, there are several styles of highlight where the matching paren is highlighted whenever the cursor is immediately to the right of a right paren. I don't know how to do that in Tk, so I haven't bothered. """ menudefs = [ ('edit', [ ("Show surrounding parens", "<<flash-paren>>"), ]) ] STYLE = idleConf.GetOption('extensions','ParenMatch','style', default='expression') FLASH_DELAY = idleConf.GetOption('extensions','ParenMatch','flash-delay', type='int',default=500) HILITE_CONFIG = idleConf.GetHighlight(idleConf.CurrentTheme(),'hilite') BELL = idleConf.GetOption('extensions','ParenMatch','bell', type='bool',default=1) RESTORE_VIRTUAL_EVENT_NAME = "<<parenmatch-check-restore>>" # We want the restore event be called before the usual return and # backspace events. RESTORE_SEQUENCES = ("<KeyPress>", "<ButtonPress>", "<Key-Return>", "<Key-BackSpace>") def __init__(self, editwin): self.editwin = editwin self.text = editwin.text # Bind the check-restore event to the function restore_event, # so that we can then use activate_restore (which calls event_add) # and deactivate_restore (which calls event_delete). editwin.text.bind(self.RESTORE_VIRTUAL_EVENT_NAME, self.restore_event) self.counter = 0 self.is_restore_active = 0 self.set_style(self.STYLE) def activate_restore(self): if not self.is_restore_active: 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: self.text.event_delete(self.RESTORE_VIRTUAL_EVENT_NAME, seq) self.is_restore_active = False def set_style(self, style): self.STYLE = style if style == "default": self.create_tag = self.create_tag_default self.set_timeout = self.set_timeout_last elif style == "expression": self.create_tag = self.create_tag_expression self.set_timeout = self.set_timeout_none def flash_paren_event(self, event): indices = HyperParser(self.editwin, "insert").get_surrounding_brackets() if indices is None: self.warn_mismatched() return self.activate_restore() self.create_tag(indices) self.set_timeout_last() def paren_closed_event(self, event): # If it was a shortcut and not really a closing paren, quit. closer = self.text.get("insert-1c") if closer not in _openers: return hp = HyperParser(self.editwin, "insert-1c") if not hp.is_in_code(): return indices = hp.get_surrounding_brackets(_openers[closer], True) if indices is None: self.warn_mismatched() return self.activate_restore() self.create_tag(indices) self.set_timeout() def restore_event(self, event=None): self.text.tag_delete("paren") self.deactivate_restore() self.counter += 1 # disable the last timer, if there is one. def handle_restore_timer(self, timer_count): if timer_count == self.counter: self.restore_event() def warn_mismatched(self): if self.BELL: self.text.bell() # any one of the create_tag_XXX methods can be used depending on # the style def create_tag_default(self, indices): """Highlight the single paren that matches""" self.text.tag_add("paren", indices[0]) self.text.tag_config("paren", self.HILITE_CONFIG) def create_tag_expression(self, indices): """Highlight the entire expression""" if self.text.get(indices[1]) in (')', ']', '}'): rightindex = indices[1]+"+1c" else: rightindex = indices[1] self.text.tag_add("paren", indices[0], rightindex) self.text.tag_config("paren", self.HILITE_CONFIG) # any one of the set_timeout_XXX methods can be used depending on # the style def set_timeout_none(self): """Highlight will remain until user input turns it off or the insert has moved""" # After CHECK_DELAY, call a function which disables the "paren" tag # if the event is for the most recent timer and the insert has changed, # or schedules another call for itself. self.counter += 1 def callme(callme, self=self, c=self.counter, index=self.text.index("insert")): if index != self.text.index("insert"): self.handle_restore_timer(c) else: self.editwin.text_frame.after(CHECK_DELAY, callme, callme) self.editwin.text_frame.after(CHECK_DELAY, callme, callme) def set_timeout_last(self): """The last highlight created will be removed after .5 sec""" # associate a counter with an event; only disable the "paren" # tag if the event is for the most recent timer. self.counter += 1 self.editwin.text_frame.after(self.FLASH_DELAY, lambda self=self, c=self.counter: \ self.handle_restore_timer(c))
Save
cmd:
run