Linux premium71.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
LiteSpeed
Server IP : 198.187.29.8 & Your IP : 3.149.24.115
Domains :
Cant Read [ /etc/named.conf ]
User : cleahvkv
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib64 /
python2.7 /
idlelib /
Delete
Unzip
Name
Size
Permission
Date
Action
Icons
[ DIR ]
drwxr-xr-x
2024-06-13 10:37
idle_test
[ DIR ]
drwxr-xr-x
2024-06-13 10:37
AutoComplete.py
8.75
KB
-rw-r--r--
2024-04-10 04:58
AutoComplete.pyc
7.82
KB
-rw-r--r--
2024-04-10 04:58
AutoComplete.pyo
7.82
KB
-rw-r--r--
2024-04-10 04:58
AutoCompleteWindow.py
16.91
KB
-rw-r--r--
2024-04-10 04:58
AutoCompleteWindow.pyc
12.19
KB
-rw-r--r--
2024-04-10 04:58
AutoCompleteWindow.pyo
12.13
KB
-rw-r--r--
2024-04-10 04:58
AutoExpand.py
3.32
KB
-rw-r--r--
2024-04-10 04:58
AutoExpand.pyc
3.42
KB
-rw-r--r--
2024-04-10 04:58
AutoExpand.pyo
3.42
KB
-rw-r--r--
2024-04-10 04:58
Bindings.py
2.91
KB
-rw-r--r--
2024-04-10 04:58
Bindings.pyc
4.58
KB
-rw-r--r--
2024-04-10 04:58
Bindings.pyo
4.58
KB
-rw-r--r--
2024-04-10 04:58
CREDITS.txt
1.82
KB
-rw-r--r--
2024-04-10 04:58
CallTipWindow.py
5.92
KB
-rw-r--r--
2024-04-10 04:58
CallTipWindow.pyc
5.99
KB
-rw-r--r--
2024-04-10 04:58
CallTipWindow.pyo
5.99
KB
-rw-r--r--
2024-04-10 04:58
CallTips.py
7.56
KB
-rw-r--r--
2024-04-10 04:58
CallTips.pyc
7.94
KB
-rw-r--r--
2024-04-10 04:58
CallTips.pyo
7.94
KB
-rw-r--r--
2024-04-10 04:58
ChangeLog
55.07
KB
-rw-r--r--
2024-04-10 04:58
ClassBrowser.py
6.83
KB
-rw-r--r--
2024-04-10 04:58
ClassBrowser.pyc
9.28
KB
-rw-r--r--
2024-04-10 04:58
ClassBrowser.pyo
9.28
KB
-rw-r--r--
2024-04-10 04:58
CodeContext.py
8.15
KB
-rw-r--r--
2024-04-10 04:58
CodeContext.pyc
6.5
KB
-rw-r--r--
2024-04-10 04:58
CodeContext.pyo
6.46
KB
-rw-r--r--
2024-04-10 04:58
ColorDelegator.py
9.53
KB
-rw-r--r--
2024-04-10 04:58
ColorDelegator.pyc
8.69
KB
-rw-r--r--
2024-04-10 04:58
ColorDelegator.pyo
8.69
KB
-rw-r--r--
2024-04-10 04:58
Debugger.py
17.81
KB
-rw-r--r--
2024-04-10 04:58
Debugger.pyc
17.13
KB
-rw-r--r--
2024-04-10 04:58
Debugger.pyo
17.13
KB
-rw-r--r--
2024-04-10 04:58
Delegator.py
665
B
-rw-r--r--
2024-04-10 04:58
Delegator.pyc
1.24
KB
-rw-r--r--
2024-04-10 04:58
Delegator.pyo
1.24
KB
-rw-r--r--
2024-04-10 04:58
EditorWindow.py
63.96
KB
-rw-r--r--
2024-04-10 04:58
EditorWindow.pyc
55.53
KB
-rw-r--r--
2024-04-10 04:58
EditorWindow.pyo
55.43
KB
-rw-r--r--
2024-04-10 04:58
FileList.py
3.63
KB
-rw-r--r--
2024-04-10 04:58
FileList.pyc
3.93
KB
-rw-r--r--
2024-04-10 04:58
FileList.pyo
3.9
KB
-rw-r--r--
2024-04-10 04:58
FormatParagraph.py
7.12
KB
-rw-r--r--
2024-04-10 04:58
FormatParagraph.pyc
6.97
KB
-rw-r--r--
2024-04-10 04:58
FormatParagraph.pyo
6.97
KB
-rw-r--r--
2024-04-10 04:58
GrepDialog.py
5.02
KB
-rw-r--r--
2024-04-10 04:58
GrepDialog.pyc
6.27
KB
-rw-r--r--
2024-04-10 04:58
GrepDialog.pyo
6.27
KB
-rw-r--r--
2024-04-10 04:58
HISTORY.txt
10.08
KB
-rw-r--r--
2024-04-10 04:58
HyperParser.py
10.25
KB
-rw-r--r--
2024-04-10 04:58
HyperParser.pyc
6.52
KB
-rw-r--r--
2024-04-10 04:58
HyperParser.pyo
6.52
KB
-rw-r--r--
2024-04-10 04:58
IOBinding.py
21.4
KB
-rw-r--r--
2024-04-10 04:58
IOBinding.pyc
18.1
KB
-rw-r--r--
2024-04-10 04:58
IOBinding.pyo
18.1
KB
-rw-r--r--
2024-04-10 04:58
IdleHistory.py
3.96
KB
-rw-r--r--
2024-04-10 04:58
IdleHistory.pyc
3.96
KB
-rw-r--r--
2024-04-10 04:58
IdleHistory.pyo
3.96
KB
-rw-r--r--
2024-04-10 04:58
MultiCall.py
17.29
KB
-rw-r--r--
2024-04-10 04:58
MultiCall.pyc
15.97
KB
-rw-r--r--
2024-04-10 04:58
MultiCall.pyo
15.9
KB
-rw-r--r--
2024-04-10 04:58
MultiStatusBar.py
1.32
KB
-rw-r--r--
2024-04-10 04:58
MultiStatusBar.pyc
2.23
KB
-rw-r--r--
2024-04-10 04:58
MultiStatusBar.pyo
2.23
KB
-rw-r--r--
2024-04-10 04:58
NEWS.txt
46.14
KB
-rw-r--r--
2024-04-10 04:58
ObjectBrowser.py
4.27
KB
-rw-r--r--
2024-04-10 04:58
ObjectBrowser.pyc
6.9
KB
-rw-r--r--
2024-04-10 04:58
ObjectBrowser.pyo
6.9
KB
-rw-r--r--
2024-04-10 04:58
OutputWindow.py
4.47
KB
-rw-r--r--
2024-04-10 04:58
OutputWindow.pyc
5.11
KB
-rw-r--r--
2024-04-10 04:58
OutputWindow.pyo
5.11
KB
-rw-r--r--
2024-04-10 04:58
ParenMatch.py
6.56
KB
-rw-r--r--
2024-04-10 04:58
ParenMatch.pyc
6.96
KB
-rw-r--r--
2024-04-10 04:58
ParenMatch.pyo
6.96
KB
-rw-r--r--
2024-04-10 04:58
PathBrowser.py
2.94
KB
-rw-r--r--
2024-04-10 04:58
PathBrowser.pyc
4.38
KB
-rw-r--r--
2024-04-10 04:58
PathBrowser.pyo
4.38
KB
-rw-r--r--
2024-04-10 04:58
Percolator.py
3.15
KB
-rw-r--r--
2024-04-10 04:58
Percolator.pyc
4.5
KB
-rw-r--r--
2024-04-10 04:58
Percolator.pyo
4.32
KB
-rw-r--r--
2024-04-10 04:58
PyParse.py
19.05
KB
-rw-r--r--
2024-04-10 04:58
PyParse.pyc
9.77
KB
-rw-r--r--
2024-04-10 04:58
PyParse.pyo
9.34
KB
-rw-r--r--
2024-04-10 04:58
PyShell.py
57.48
KB
-rwxr-xr-x
2024-04-10 04:58
PyShell.pyc
51.59
KB
-rw-r--r--
2024-04-10 04:58
PyShell.pyo
51.49
KB
-rw-r--r--
2024-04-10 04:58
README.txt
7.71
KB
-rw-r--r--
2024-04-10 04:58
RemoteDebugger.py
11.36
KB
-rw-r--r--
2024-04-10 04:58
RemoteDebugger.pyc
15.94
KB
-rw-r--r--
2024-04-10 04:58
RemoteDebugger.pyo
15.79
KB
-rw-r--r--
2024-04-10 04:58
RemoteObjectBrowser.py
942
B
-rw-r--r--
2024-04-10 04:58
RemoteObjectBrowser.pyc
2.1
KB
-rw-r--r--
2024-04-10 04:58
RemoteObjectBrowser.pyo
2.1
KB
-rw-r--r--
2024-04-10 04:58
ReplaceDialog.py
6.48
KB
-rw-r--r--
2024-04-10 04:58
ReplaceDialog.pyc
7.57
KB
-rw-r--r--
2024-04-10 04:58
ReplaceDialog.pyo
7.57
KB
-rw-r--r--
2024-04-10 04:58
RstripExtension.py
1.03
KB
-rw-r--r--
2024-04-10 04:58
RstripExtension.pyc
1.58
KB
-rw-r--r--
2024-04-10 04:58
RstripExtension.pyo
1.58
KB
-rw-r--r--
2024-04-10 04:58
ScriptBinding.py
8.26
KB
-rw-r--r--
2024-04-10 04:58
ScriptBinding.pyc
8.01
KB
-rw-r--r--
2024-04-10 04:58
ScriptBinding.pyo
8.01
KB
-rw-r--r--
2024-04-10 04:58
ScrolledList.py
4.27
KB
-rw-r--r--
2024-04-10 04:58
ScrolledList.pyc
6.33
KB
-rw-r--r--
2024-04-10 04:58
ScrolledList.pyo
6.33
KB
-rw-r--r--
2024-04-10 04:58
SearchDialog.py
2.57
KB
-rw-r--r--
2024-04-10 04:58
SearchDialog.pyc
3.89
KB
-rw-r--r--
2024-04-10 04:58
SearchDialog.pyo
3.89
KB
-rw-r--r--
2024-04-10 04:58
SearchDialogBase.py
6.93
KB
-rw-r--r--
2024-04-10 04:58
SearchDialogBase.pyc
8.26
KB
-rw-r--r--
2024-04-10 04:58
SearchDialogBase.pyo
8.26
KB
-rw-r--r--
2024-04-10 04:58
SearchEngine.py
7.29
KB
-rw-r--r--
2024-04-10 04:58
SearchEngine.pyc
8.11
KB
-rw-r--r--
2024-04-10 04:58
SearchEngine.pyo
8.11
KB
-rw-r--r--
2024-04-10 04:58
StackViewer.py
4.33
KB
-rw-r--r--
2024-04-10 04:58
StackViewer.pyc
6.25
KB
-rw-r--r--
2024-04-10 04:58
StackViewer.pyo
6.25
KB
-rw-r--r--
2024-04-10 04:58
TODO.txt
8.28
KB
-rw-r--r--
2024-04-10 04:58
ToolTip.py
3.1
KB
-rw-r--r--
2024-04-10 04:58
ToolTip.pyc
4.56
KB
-rw-r--r--
2024-04-10 04:58
ToolTip.pyo
4.56
KB
-rw-r--r--
2024-04-10 04:58
TreeWidget.py
14.68
KB
-rw-r--r--
2024-04-10 04:58
TreeWidget.pyc
17.28
KB
-rw-r--r--
2024-04-10 04:58
TreeWidget.pyo
17.28
KB
-rw-r--r--
2024-04-10 04:58
UndoDelegator.py
10.53
KB
-rw-r--r--
2024-04-10 04:58
UndoDelegator.pyc
13.24
KB
-rw-r--r--
2024-04-10 04:58
UndoDelegator.pyo
13.24
KB
-rw-r--r--
2024-04-10 04:58
WidgetRedirector.py
6.74
KB
-rw-r--r--
2024-04-10 04:58
WidgetRedirector.pyc
7.59
KB
-rw-r--r--
2024-04-10 04:58
WidgetRedirector.pyo
7.59
KB
-rw-r--r--
2024-04-10 04:58
WindowList.py
2.42
KB
-rw-r--r--
2024-04-10 04:58
WindowList.pyc
3.55
KB
-rw-r--r--
2024-04-10 04:58
WindowList.pyo
3.55
KB
-rw-r--r--
2024-04-10 04:58
ZoomHeight.py
1.27
KB
-rw-r--r--
2024-04-10 04:58
ZoomHeight.pyc
1.61
KB
-rw-r--r--
2024-04-10 04:58
ZoomHeight.pyo
1.61
KB
-rw-r--r--
2024-04-10 04:58
__init__.py
288
B
-rw-r--r--
2024-04-10 04:58
__init__.pyc
431
B
-rw-r--r--
2024-04-10 04:58
__init__.pyo
431
B
-rw-r--r--
2024-04-10 04:58
aboutDialog.py
6.85
KB
-rw-r--r--
2024-04-10 04:58
aboutDialog.pyc
6.69
KB
-rw-r--r--
2024-04-10 04:58
aboutDialog.pyo
6.69
KB
-rw-r--r--
2024-04-10 04:58
config-extensions.def
2.9
KB
-rw-r--r--
2024-04-10 04:58
config-highlight.def
2.46
KB
-rw-r--r--
2024-04-10 04:58
config-keys.def
7.59
KB
-rw-r--r--
2024-04-10 04:58
config-main.def
2.5
KB
-rw-r--r--
2024-04-10 04:58
configDialog.py
64.41
KB
-rw-r--r--
2024-04-10 04:58
configDialog.pyc
52.04
KB
-rw-r--r--
2024-04-10 04:58
configDialog.pyo
52.04
KB
-rw-r--r--
2024-04-10 04:58
configHandler.py
31.72
KB
-rw-r--r--
2024-04-10 04:58
configHandler.pyc
28.67
KB
-rw-r--r--
2024-04-10 04:58
configHandler.pyo
28.67
KB
-rw-r--r--
2024-04-10 04:58
configHelpSourceEdit.py
6.53
KB
-rw-r--r--
2024-04-10 04:58
configHelpSourceEdit.pyc
6.44
KB
-rw-r--r--
2024-04-10 04:58
configHelpSourceEdit.pyo
6.44
KB
-rw-r--r--
2024-04-10 04:58
configSectionNameDialog.py
3.95
KB
-rw-r--r--
2024-04-10 04:58
configSectionNameDialog.pyc
4.32
KB
-rw-r--r--
2024-04-10 04:58
configSectionNameDialog.pyo
4.32
KB
-rw-r--r--
2024-04-10 04:58
dynOptionMenuWidget.py
1.94
KB
-rw-r--r--
2024-04-10 04:58
dynOptionMenuWidget.pyc
2.72
KB
-rw-r--r--
2024-04-10 04:58
dynOptionMenuWidget.pyo
2.72
KB
-rw-r--r--
2024-04-10 04:58
extend.txt
3.56
KB
-rw-r--r--
2024-04-10 04:58
help.html
41.42
KB
-rw-r--r--
2024-04-10 04:58
help.py
10.78
KB
-rw-r--r--
2024-04-10 04:58
help.pyc
11.98
KB
-rw-r--r--
2024-04-10 04:58
help.pyo
11.98
KB
-rw-r--r--
2024-04-10 04:58
help.txt
11.86
KB
-rw-r--r--
2024-04-10 04:58
idle.py
453
B
-rw-r--r--
2024-04-10 04:58
idle.pyc
410
B
-rw-r--r--
2024-04-10 04:58
idle.pyo
410
B
-rw-r--r--
2024-04-10 04:58
idle.pyw
563
B
-rw-r--r--
2024-04-10 04:58
idlever.py
415
B
-rw-r--r--
2024-04-10 04:58
idlever.pyc
578
B
-rw-r--r--
2024-04-10 04:58
idlever.pyo
578
B
-rw-r--r--
2024-04-10 04:58
keybindingDialog.py
12.18
KB
-rw-r--r--
2024-04-10 04:58
keybindingDialog.pyc
11.89
KB
-rw-r--r--
2024-04-10 04:58
keybindingDialog.pyo
11.89
KB
-rw-r--r--
2024-04-10 04:58
macosxSupport.py
8.24
KB
-rw-r--r--
2024-04-10 04:58
macosxSupport.pyc
8.16
KB
-rw-r--r--
2024-04-10 04:58
macosxSupport.pyo
8.02
KB
-rw-r--r--
2024-04-10 04:58
rpc.py
19.68
KB
-rw-r--r--
2024-04-10 04:58
rpc.pyc
21.22
KB
-rw-r--r--
2024-04-10 04:58
rpc.pyo
21.12
KB
-rw-r--r--
2024-04-10 04:58
run.py
12.61
KB
-rw-r--r--
2024-04-10 04:58
run.pyc
13.1
KB
-rw-r--r--
2024-04-10 04:58
run.pyo
13.05
KB
-rw-r--r--
2024-04-10 04:58
tabbedpages.py
18.01
KB
-rw-r--r--
2024-04-10 04:58
tabbedpages.pyc
18.13
KB
-rw-r--r--
2024-04-10 04:58
tabbedpages.pyo
18.13
KB
-rw-r--r--
2024-04-10 04:58
textView.py
3.44
KB
-rw-r--r--
2024-04-10 04:58
textView.pyc
3.93
KB
-rw-r--r--
2024-04-10 04:58
textView.pyo
3.93
KB
-rw-r--r--
2024-04-10 04:58
Save
Rename
""" An auto-completion window for IDLE, used by the AutoComplete extension """ from Tkinter import * from idlelib.MultiCall import MC_SHIFT from idlelib.AutoComplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES HIDE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-hide>>" HIDE_SEQUENCES = ("<FocusOut>", "<ButtonPress>") KEYPRESS_VIRTUAL_EVENT_NAME = "<<autocompletewindow-keypress>>" # We need to bind event beyond <Key> so that the function will be called # before the default specific IDLE function KEYPRESS_SEQUENCES = ("<Key>", "<Key-BackSpace>", "<Key-Return>", "<Key-Tab>", "<Key-Up>", "<Key-Down>", "<Key-Home>", "<Key-End>", "<Key-Prior>", "<Key-Next>") KEYRELEASE_VIRTUAL_EVENT_NAME = "<<autocompletewindow-keyrelease>>" KEYRELEASE_SEQUENCE = "<KeyRelease>" LISTUPDATE_SEQUENCE = "<B1-ButtonRelease>" WINCONFIG_SEQUENCE = "<Configure>" DOUBLECLICK_SEQUENCE = "<B1-Double-ButtonRelease>" class AutoCompleteWindow: def __init__(self, widget): # The widget (Text) on which we place the AutoCompleteWindow self.widget = widget # The widgets we create self.autocompletewindow = self.listbox = self.scrollbar = None # The default foreground and background of a selection. Saved because # they are changed to the regular colors of list items when the # completion start is not a prefix of the selected completion self.origselforeground = self.origselbackground = None # The list of completions self.completions = None # A list with more completions, or None self.morecompletions = None # The completion mode. Either AutoComplete.COMPLETE_ATTRIBUTES or # AutoComplete.COMPLETE_FILES self.mode = None # The current completion start, on the text box (a string) self.start = None # The index of the start of the completion self.startindex = None # The last typed start, used so that when the selection changes, # the new start will be as close as possible to the last typed one. self.lasttypedstart = None # Do we have an indication that the user wants the completion window # (for example, he clicked the list) self.userwantswindow = None # event ids self.hideid = self.keypressid = self.listupdateid = self.winconfigid \ = self.keyreleaseid = self.doubleclickid = None # Flag set if last keypress was a tab self.lastkey_was_tab = False def _change_start(self, newstart): min_len = min(len(self.start), len(newstart)) i = 0 while i < min_len and self.start[i] == newstart[i]: i += 1 if i < len(self.start): self.widget.delete("%s+%dc" % (self.startindex, i), "%s+%dc" % (self.startindex, len(self.start))) if i < len(newstart): self.widget.insert("%s+%dc" % (self.startindex, i), newstart[i:]) self.start = newstart def _binary_search(self, s): """Find the first index in self.completions where completions[i] is greater or equal to s, or the last index if there is no such one.""" i = 0; j = len(self.completions) while j > i: m = (i + j) // 2 if self.completions[m] >= s: j = m else: i = m + 1 return min(i, len(self.completions)-1) def _complete_string(self, s): """Assuming that s is the prefix of a string in self.completions, return the longest string which is a prefix of all the strings which s is a prefix of them. If s is not a prefix of a string, return s.""" first = self._binary_search(s) if self.completions[first][:len(s)] != s: # There is not even one completion which s is a prefix of. return s # Find the end of the range of completions where s is a prefix of. i = first + 1 j = len(self.completions) while j > i: m = (i + j) // 2 if self.completions[m][:len(s)] != s: j = m else: i = m + 1 last = i-1 if first == last: # only one possible completion return self.completions[first] # We should return the maximum prefix of first and last first_comp = self.completions[first] last_comp = self.completions[last] min_len = min(len(first_comp), len(last_comp)) i = len(s) while i < min_len and first_comp[i] == last_comp[i]: i += 1 return first_comp[:i] def _selection_changed(self): """Should be called when the selection of the Listbox has changed. Updates the Listbox display and calls _change_start.""" cursel = int(self.listbox.curselection()[0]) self.listbox.see(cursel) lts = self.lasttypedstart selstart = self.completions[cursel] if self._binary_search(lts) == cursel: newstart = lts else: min_len = min(len(lts), len(selstart)) i = 0 while i < min_len and lts[i] == selstart[i]: i += 1 newstart = selstart[:i] self._change_start(newstart) if self.completions[cursel][:len(self.start)] == self.start: # start is a prefix of the selected completion self.listbox.configure(selectbackground=self.origselbackground, selectforeground=self.origselforeground) else: self.listbox.configure(selectbackground=self.listbox.cget("bg"), selectforeground=self.listbox.cget("fg")) # If there are more completions, show them, and call me again. if self.morecompletions: self.completions = self.morecompletions self.morecompletions = None self.listbox.delete(0, END) for item in self.completions: self.listbox.insert(END, item) self.listbox.select_set(self._binary_search(self.start)) self._selection_changed() def show_window(self, comp_lists, index, complete, mode, userWantsWin): """Show the autocomplete list, bind events. If complete is True, complete the text, and if there is exactly one matching completion, don't open a list.""" # Handle the start we already have self.completions, self.morecompletions = comp_lists self.mode = mode self.startindex = self.widget.index(index) self.start = self.widget.get(self.startindex, "insert") if complete: completed = self._complete_string(self.start) start = self.start self._change_start(completed) i = self._binary_search(completed) if self.completions[i] == completed and \ (i == len(self.completions)-1 or self.completions[i+1][:len(completed)] != completed): # There is exactly one matching completion return completed == start 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. acw.wm_geometry("+10000+10000") # Make it float acw.wm_overrideredirect(1) try: # 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, "help", "noActivates") except TclError: pass self.scrollbar = scrollbar = Scrollbar(acw, orient=VERTICAL) self.listbox = listbox = Listbox(acw, yscrollcommand=scrollbar.set, exportselection=False, bg="white") for item in self.completions: listbox.insert(END, item) self.origselforeground = listbox.cget("selectforeground") self.origselbackground = listbox.cget("selectbackground") scrollbar.config(command=listbox.yview) scrollbar.pack(side=RIGHT, fill=Y) listbox.pack(side=LEFT, fill=BOTH, expand=True) acw.lift() # work around bug in Tk 8.5.18+ (issue #24570) # Initialize the listbox selection self.listbox.select_set(self._binary_search(self.start)) self._selection_changed() # bind events self.hideid = self.widget.bind(HIDE_VIRTUAL_EVENT_NAME, self.hide_event) for seq in HIDE_SEQUENCES: self.widget.event_add(HIDE_VIRTUAL_EVENT_NAME, seq) self.keypressid = self.widget.bind(KEYPRESS_VIRTUAL_EVENT_NAME, self.keypress_event) for seq in KEYPRESS_SEQUENCES: self.widget.event_add(KEYPRESS_VIRTUAL_EVENT_NAME, seq) self.keyreleaseid = self.widget.bind(KEYRELEASE_VIRTUAL_EVENT_NAME, self.keyrelease_event) self.widget.event_add(KEYRELEASE_VIRTUAL_EVENT_NAME,KEYRELEASE_SEQUENCE) self.listupdateid = listbox.bind(LISTUPDATE_SEQUENCE, self.listselect_event) self.winconfigid = acw.bind(WINCONFIG_SEQUENCE, self.winconfig_event) self.doubleclickid = listbox.bind(DOUBLECLICK_SEQUENCE, self.doubleclick_event) def winconfig_event(self, event): if not self.is_active(): return # Position the completion list window text = self.widget text.see(self.startindex) x, y, cx, cy = text.bbox(self.startindex) acw = self.autocompletewindow acw_width, acw_height = acw.winfo_width(), acw.winfo_height() text_width, text_height = text.winfo_width(), text.winfo_height() new_x = text.winfo_rootx() + min(x, max(0, text_width - acw_width)) new_y = text.winfo_rooty() + y if (text_height - (y + cy) >= acw_height # enough height below or y < acw_height): # not enough height above # place acw below current line new_y += cy else: # place acw above current line new_y -= acw_height acw.wm_geometry("+%d+%d" % (new_x, new_y)) def hide_event(self, event): if not self.is_active(): return self.hide_window() def listselect_event(self, event): if not self.is_active(): return self.userwantswindow = True cursel = int(self.listbox.curselection()[0]) self._change_start(self.completions[cursel]) def doubleclick_event(self, event): # Put the selected completion in the text, and close the list 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 keysym = event.keysym if hasattr(event, "mc_state"): state = event.mc_state else: state = 0 if keysym != "Tab": self.lastkey_was_tab = False if (len(keysym) == 1 or keysym in ("underscore", "BackSpace") or (self.mode == COMPLETE_FILES and keysym in ("period", "minus"))) \ and not (state & ~MC_SHIFT): # Normal editing of text if len(keysym) == 1: self._change_start(self.start + keysym) elif keysym == "underscore": self._change_start(self.start + '_') elif keysym == "period": self._change_start(self.start + '.') elif keysym == "minus": self._change_start(self.start + '-') else: # keysym == "BackSpace" if len(self.start) == 0: self.hide_window() return self._change_start(self.start[:-1]) self.lasttypedstart = self.start self.listbox.select_clear(0, int(self.listbox.curselection()[0])) self.listbox.select_set(self._binary_search(self.start)) self._selection_changed() return "break" elif keysym == "Return": self.hide_window() return elif (self.mode == COMPLETE_ATTRIBUTES and keysym in ("period", "space", "parenleft", "parenright", "bracketleft", "bracketright")) or \ (self.mode == COMPLETE_FILES and keysym in ("slash", "backslash", "quotedbl", "apostrophe")) \ and not (state & ~MC_SHIFT): # If start is a prefix of the selection, but is not '' when # completing file names, put the whole # selected completion. Anyway, close the list. cursel = int(self.listbox.curselection()[0]) if self.completions[cursel][:len(self.start)] == self.start \ and (self.mode == COMPLETE_ATTRIBUTES or self.start): self._change_start(self.completions[cursel]) self.hide_window() return elif keysym in ("Home", "End", "Prior", "Next", "Up", "Down") and \ not state: # Move the selection in the listbox self.userwantswindow = True cursel = int(self.listbox.curselection()[0]) if keysym == "Home": newsel = 0 elif keysym == "End": newsel = len(self.completions)-1 elif keysym in ("Prior", "Next"): jump = self.listbox.nearest(self.listbox.winfo_height()) - \ self.listbox.nearest(0) if keysym == "Prior": newsel = max(0, cursel-jump) else: assert keysym == "Next" newsel = min(len(self.completions)-1, cursel+jump) elif keysym == "Up": newsel = max(0, cursel-1) else: assert keysym == "Down" newsel = min(len(self.completions)-1, cursel+1) self.listbox.select_clear(cursel) self.listbox.select_set(newsel) self._selection_changed() self._change_start(self.completions[newsel]) return "break" elif (keysym == "Tab" and not state): if self.lastkey_was_tab: # two tabs in a row; insert current selection and close acw cursel = int(self.listbox.curselection()[0]) self._change_start(self.completions[cursel]) self.hide_window() return "break" else: # first tab; let AutoComplete handle the completion self.userwantswindow = True self.lastkey_was_tab = True return elif any(s in keysym for s in ("Shift", "Control", "Alt", "Meta", "Command", "Option")): # A modifier key, so ignore return else: # Unknown event, close the window and let it through. self.hide_window() return def keyrelease_event(self, event): if not self.is_active(): return if self.widget.index("insert") != \ self.widget.index("%s+%dc" % (self.startindex, len(self.start))): # If we didn't catch an event which moved the insert, close window self.hide_window() def is_active(self): return self.autocompletewindow is not None def complete(self): self._change_start(self._complete_string(self.start)) # The selection doesn't change. def hide_window(self): if not self.is_active(): return # unbind events for seq in HIDE_SEQUENCES: self.widget.event_delete(HIDE_VIRTUAL_EVENT_NAME, seq) self.widget.unbind(HIDE_VIRTUAL_EVENT_NAME, self.hideid) self.hideid = None for seq in KEYPRESS_SEQUENCES: self.widget.event_delete(KEYPRESS_VIRTUAL_EVENT_NAME, seq) self.widget.unbind(KEYPRESS_VIRTUAL_EVENT_NAME, self.keypressid) self.keypressid = None self.widget.event_delete(KEYRELEASE_VIRTUAL_EVENT_NAME, KEYRELEASE_SEQUENCE) self.widget.unbind(KEYRELEASE_VIRTUAL_EVENT_NAME, self.keyreleaseid) self.keyreleaseid = None self.listbox.unbind(LISTUPDATE_SEQUENCE, self.listupdateid) self.listupdateid = None self.autocompletewindow.unbind(WINCONFIG_SEQUENCE, self.winconfigid) self.winconfigid = None # destroy widgets self.scrollbar.destroy() self.scrollbar = None self.listbox.destroy() self.listbox = None self.autocompletewindow.destroy() self.autocompletewindow = None