mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	MERGE DS_RPC_BRANCH into MAIN
Removed Files: AutoIndent.py IdleConf.py MultiScrolledLists.py Separator.py config-unix.txt config-win.txt config.txt eventparse.py keydefs.py
This commit is contained in:
		
							parent
							
								
									9ef8f428a3
								
							
						
					
					
						commit
						3ae4eaab88
					
				
					 9 changed files with 0 additions and 1081 deletions
				
			
		| 
						 | 
					@ -1,520 +0,0 @@
 | 
				
			||||||
import string
 | 
					 | 
				
			||||||
#from Tkinter import TclError
 | 
					 | 
				
			||||||
#import tkMessageBox
 | 
					 | 
				
			||||||
#import tkSimpleDialog
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<newline-and-indent>>
 | 
					 | 
				
			||||||
###$ win <Key-Return>
 | 
					 | 
				
			||||||
###$ win <KP_Enter>
 | 
					 | 
				
			||||||
###$ unix <Key-Return>
 | 
					 | 
				
			||||||
###$ unix <KP_Enter>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<indent-region>>
 | 
					 | 
				
			||||||
###$ win <Control-bracketright>
 | 
					 | 
				
			||||||
###$ unix <Alt-bracketright>
 | 
					 | 
				
			||||||
###$ unix <Control-bracketright>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<dedent-region>>
 | 
					 | 
				
			||||||
###$ win <Control-bracketleft>
 | 
					 | 
				
			||||||
###$ unix <Alt-bracketleft>
 | 
					 | 
				
			||||||
###$ unix <Control-bracketleft>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<comment-region>>
 | 
					 | 
				
			||||||
###$ win <Alt-Key-3>
 | 
					 | 
				
			||||||
###$ unix <Alt-Key-3>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<uncomment-region>>
 | 
					 | 
				
			||||||
###$ win <Alt-Key-4>
 | 
					 | 
				
			||||||
###$ unix <Alt-Key-4>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<tabify-region>>
 | 
					 | 
				
			||||||
###$ win <Alt-Key-5>
 | 
					 | 
				
			||||||
###$ unix <Alt-Key-5>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
###$ event <<untabify-region>>
 | 
					 | 
				
			||||||
###$ win <Alt-Key-6>
 | 
					 | 
				
			||||||
###$ unix <Alt-Key-6>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import PyParse
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class AutoIndent:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    menudefs = [
 | 
					 | 
				
			||||||
        ('format', [       # /s/edit/format   dscherer@cmu.edu
 | 
					 | 
				
			||||||
            ('_Indent region', '<<indent-region>>'),
 | 
					 | 
				
			||||||
            ('_Dedent region', '<<dedent-region>>'),
 | 
					 | 
				
			||||||
            ('Comment _out region', '<<comment-region>>'),
 | 
					 | 
				
			||||||
            ('U_ncomment region', '<<uncomment-region>>'),
 | 
					 | 
				
			||||||
            ('Tabify region', '<<tabify-region>>'),
 | 
					 | 
				
			||||||
            ('Untabify region', '<<untabify-region>>'),
 | 
					 | 
				
			||||||
            ('Toggle tabs', '<<toggle-tabs>>'),
 | 
					 | 
				
			||||||
            ('New indent width', '<<change-indentwidth>>'),
 | 
					 | 
				
			||||||
        ]),
 | 
					 | 
				
			||||||
    ]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # usetabs true  -> literal tab characters are used by indent and
 | 
					 | 
				
			||||||
    #                  dedent cmds, possibly mixed with spaces if
 | 
					 | 
				
			||||||
    #                  indentwidth is not a multiple of tabwidth
 | 
					 | 
				
			||||||
    #         false -> tab characters are converted to spaces by indent
 | 
					 | 
				
			||||||
    #                  and dedent cmds, and ditto TAB keystrokes
 | 
					 | 
				
			||||||
    # indentwidth is the number of characters per logical indent level.
 | 
					 | 
				
			||||||
    # tabwidth is the display width of a literal tab character.
 | 
					 | 
				
			||||||
    # CAUTION:  telling Tk to use anything other than its default
 | 
					 | 
				
			||||||
    # tab setting causes it to use an entirely different tabbing algorithm,
 | 
					 | 
				
			||||||
    # treating tab stops as fixed distances from the left margin.
 | 
					 | 
				
			||||||
    # Nobody expects this, so for now tabwidth should never be changed.
 | 
					 | 
				
			||||||
    usetabs = 1
 | 
					 | 
				
			||||||
    indentwidth = 4
 | 
					 | 
				
			||||||
    tabwidth = 8    # for IDLE use, must remain 8 until Tk is fixed
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # If context_use_ps1 is true, parsing searches back for a ps1 line;
 | 
					 | 
				
			||||||
    # else searches for a popular (if, def, ...) Python stmt.
 | 
					 | 
				
			||||||
    context_use_ps1 = 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # When searching backwards for a reliable place to begin parsing,
 | 
					 | 
				
			||||||
    # first start num_context_lines[0] lines back, then
 | 
					 | 
				
			||||||
    # num_context_lines[1] lines back if that didn't work, and so on.
 | 
					 | 
				
			||||||
    # The last value should be huge (larger than the # of lines in a
 | 
					 | 
				
			||||||
    # conceivable file).
 | 
					 | 
				
			||||||
    # Making the initial values larger slows things down more often.
 | 
					 | 
				
			||||||
    num_context_lines = 50, 500, 5000000
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, editwin):
 | 
					 | 
				
			||||||
        self.editwin = editwin
 | 
					 | 
				
			||||||
        self.text = editwin.text
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def config(self, **options):
 | 
					 | 
				
			||||||
        for key, value in options.items():
 | 
					 | 
				
			||||||
            if key == 'usetabs':
 | 
					 | 
				
			||||||
                self.usetabs = value
 | 
					 | 
				
			||||||
            elif key == 'indentwidth':
 | 
					 | 
				
			||||||
                self.indentwidth = value
 | 
					 | 
				
			||||||
            elif key == 'tabwidth':
 | 
					 | 
				
			||||||
                self.tabwidth = value
 | 
					 | 
				
			||||||
            elif key == 'context_use_ps1':
 | 
					 | 
				
			||||||
                self.context_use_ps1 = value
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                raise KeyError, "bad option name: %s" % `key`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # If ispythonsource and guess are true, guess a good value for
 | 
					 | 
				
			||||||
    # indentwidth based on file content (if possible), and if
 | 
					 | 
				
			||||||
    # indentwidth != tabwidth set usetabs false.
 | 
					 | 
				
			||||||
    # In any case, adjust the Text widget's view of what a tab
 | 
					 | 
				
			||||||
    # character means.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def set_indentation_params(self, ispythonsource, guess=1):
 | 
					 | 
				
			||||||
        if guess and ispythonsource:
 | 
					 | 
				
			||||||
            i = self.guess_indent()
 | 
					 | 
				
			||||||
            if 2 <= i <= 8:
 | 
					 | 
				
			||||||
                self.indentwidth = i
 | 
					 | 
				
			||||||
            if self.indentwidth != self.tabwidth:
 | 
					 | 
				
			||||||
                self.usetabs = 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.editwin.set_tabwidth(self.tabwidth)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def smart_backspace_event(self, event):
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        first, last = self.editwin.get_selection_indices()
 | 
					 | 
				
			||||||
        if first and last:
 | 
					 | 
				
			||||||
            text.delete(first, last)
 | 
					 | 
				
			||||||
            text.mark_set("insert", first)
 | 
					 | 
				
			||||||
            return "break"
 | 
					 | 
				
			||||||
        # Delete whitespace left, until hitting a real char or closest
 | 
					 | 
				
			||||||
        # preceding virtual tab stop.
 | 
					 | 
				
			||||||
        chars = text.get("insert linestart", "insert")
 | 
					 | 
				
			||||||
        if chars == '':
 | 
					 | 
				
			||||||
            if text.compare("insert", ">", "1.0"):
 | 
					 | 
				
			||||||
                # easy: delete preceding newline
 | 
					 | 
				
			||||||
                text.delete("insert-1c")
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                text.bell()     # at start of buffer
 | 
					 | 
				
			||||||
            return "break"
 | 
					 | 
				
			||||||
        if  chars[-1] not in " \t":
 | 
					 | 
				
			||||||
            # easy: delete preceding real char
 | 
					 | 
				
			||||||
            text.delete("insert-1c")
 | 
					 | 
				
			||||||
            return "break"
 | 
					 | 
				
			||||||
        # Ick.  It may require *inserting* spaces if we back up over a
 | 
					 | 
				
			||||||
        # tab character!  This is written to be clear, not fast.
 | 
					 | 
				
			||||||
        expand, tabwidth = string.expandtabs, self.tabwidth
 | 
					 | 
				
			||||||
        have = len(expand(chars, tabwidth))
 | 
					 | 
				
			||||||
        assert have > 0
 | 
					 | 
				
			||||||
        want = ((have - 1) // self.indentwidth) * self.indentwidth
 | 
					 | 
				
			||||||
        ncharsdeleted = 0
 | 
					 | 
				
			||||||
        while 1:
 | 
					 | 
				
			||||||
            chars = chars[:-1]
 | 
					 | 
				
			||||||
            ncharsdeleted = ncharsdeleted + 1
 | 
					 | 
				
			||||||
            have = len(expand(chars, tabwidth))
 | 
					 | 
				
			||||||
            if have <= want or chars[-1] not in " \t":
 | 
					 | 
				
			||||||
                break
 | 
					 | 
				
			||||||
        text.undo_block_start()
 | 
					 | 
				
			||||||
        text.delete("insert-%dc" % ncharsdeleted, "insert")
 | 
					 | 
				
			||||||
        if have < want:
 | 
					 | 
				
			||||||
            text.insert("insert", ' ' * (want - have))
 | 
					 | 
				
			||||||
        text.undo_block_stop()
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def smart_indent_event(self, event):
 | 
					 | 
				
			||||||
        # if intraline selection:
 | 
					 | 
				
			||||||
        #     delete it
 | 
					 | 
				
			||||||
        # elif multiline selection:
 | 
					 | 
				
			||||||
        #     do indent-region & return
 | 
					 | 
				
			||||||
        # indent one level
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        first, last = self.editwin.get_selection_indices()
 | 
					 | 
				
			||||||
        text.undo_block_start()
 | 
					 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            if first and last:
 | 
					 | 
				
			||||||
                if index2line(first) != index2line(last):
 | 
					 | 
				
			||||||
                    return self.indent_region_event(event)
 | 
					 | 
				
			||||||
                text.delete(first, last)
 | 
					 | 
				
			||||||
                text.mark_set("insert", first)
 | 
					 | 
				
			||||||
            prefix = text.get("insert linestart", "insert")
 | 
					 | 
				
			||||||
            raw, effective = classifyws(prefix, self.tabwidth)
 | 
					 | 
				
			||||||
            if raw == len(prefix):
 | 
					 | 
				
			||||||
                # only whitespace to the left
 | 
					 | 
				
			||||||
                self.reindent_to(effective + self.indentwidth)
 | 
					 | 
				
			||||||
            else:
 | 
					 | 
				
			||||||
                if self.usetabs:
 | 
					 | 
				
			||||||
                    pad = '\t'
 | 
					 | 
				
			||||||
                else:
 | 
					 | 
				
			||||||
                    effective = len(string.expandtabs(prefix,
 | 
					 | 
				
			||||||
                                                      self.tabwidth))
 | 
					 | 
				
			||||||
                    n = self.indentwidth
 | 
					 | 
				
			||||||
                    pad = ' ' * (n - effective % n)
 | 
					 | 
				
			||||||
                text.insert("insert", pad)
 | 
					 | 
				
			||||||
            text.see("insert")
 | 
					 | 
				
			||||||
            return "break"
 | 
					 | 
				
			||||||
        finally:
 | 
					 | 
				
			||||||
            text.undo_block_stop()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def newline_and_indent_event(self, event):
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        first, last = self.editwin.get_selection_indices()
 | 
					 | 
				
			||||||
        text.undo_block_start()
 | 
					 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            if first and last:
 | 
					 | 
				
			||||||
                text.delete(first, last)
 | 
					 | 
				
			||||||
                text.mark_set("insert", first)
 | 
					 | 
				
			||||||
            line = text.get("insert linestart", "insert")
 | 
					 | 
				
			||||||
            i, n = 0, len(line)
 | 
					 | 
				
			||||||
            while i < n and line[i] in " \t":
 | 
					 | 
				
			||||||
                i = i+1
 | 
					 | 
				
			||||||
            if i == n:
 | 
					 | 
				
			||||||
                # the cursor is in or at leading indentation; just inject
 | 
					 | 
				
			||||||
                # an empty line at the start
 | 
					 | 
				
			||||||
                text.insert("insert linestart", '\n')
 | 
					 | 
				
			||||||
                return "break"
 | 
					 | 
				
			||||||
            indent = line[:i]
 | 
					 | 
				
			||||||
            # strip whitespace before insert point
 | 
					 | 
				
			||||||
            i = 0
 | 
					 | 
				
			||||||
            while line and line[-1] in " \t":
 | 
					 | 
				
			||||||
                line = line[:-1]
 | 
					 | 
				
			||||||
                i = i+1
 | 
					 | 
				
			||||||
            if i:
 | 
					 | 
				
			||||||
                text.delete("insert - %d chars" % i, "insert")
 | 
					 | 
				
			||||||
            # strip whitespace after insert point
 | 
					 | 
				
			||||||
            while text.get("insert") in " \t":
 | 
					 | 
				
			||||||
                text.delete("insert")
 | 
					 | 
				
			||||||
            # start new line
 | 
					 | 
				
			||||||
            text.insert("insert", '\n')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            # adjust indentation for continuations and block
 | 
					 | 
				
			||||||
            # open/close first need to find the last stmt
 | 
					 | 
				
			||||||
            lno = index2line(text.index('insert'))
 | 
					 | 
				
			||||||
            y = PyParse.Parser(self.indentwidth, self.tabwidth)
 | 
					 | 
				
			||||||
            for context in self.num_context_lines:
 | 
					 | 
				
			||||||
                startat = max(lno - context, 1)
 | 
					 | 
				
			||||||
                startatindex = `startat` + ".0"
 | 
					 | 
				
			||||||
                rawtext = text.get(startatindex, "insert")
 | 
					 | 
				
			||||||
                y.set_str(rawtext)
 | 
					 | 
				
			||||||
                bod = y.find_good_parse_start(
 | 
					 | 
				
			||||||
                          self.context_use_ps1,
 | 
					 | 
				
			||||||
                          self._build_char_in_string_func(startatindex))
 | 
					 | 
				
			||||||
                if bod is not None or startat == 1:
 | 
					 | 
				
			||||||
                    break
 | 
					 | 
				
			||||||
            y.set_lo(bod or 0)
 | 
					 | 
				
			||||||
            c = y.get_continuation_type()
 | 
					 | 
				
			||||||
            if c != PyParse.C_NONE:
 | 
					 | 
				
			||||||
                # The current stmt hasn't ended yet.
 | 
					 | 
				
			||||||
                if c == PyParse.C_STRING:
 | 
					 | 
				
			||||||
                    # inside a string; just mimic the current indent
 | 
					 | 
				
			||||||
                    text.insert("insert", indent)
 | 
					 | 
				
			||||||
                elif c == PyParse.C_BRACKET:
 | 
					 | 
				
			||||||
                    # line up with the first (if any) element of the
 | 
					 | 
				
			||||||
                    # last open bracket structure; else indent one
 | 
					 | 
				
			||||||
                    # level beyond the indent of the line with the
 | 
					 | 
				
			||||||
                    # last open bracket
 | 
					 | 
				
			||||||
                    self.reindent_to(y.compute_bracket_indent())
 | 
					 | 
				
			||||||
                elif c == PyParse.C_BACKSLASH:
 | 
					 | 
				
			||||||
                    # if more than one line in this stmt already, just
 | 
					 | 
				
			||||||
                    # mimic the current indent; else if initial line
 | 
					 | 
				
			||||||
                    # has a start on an assignment stmt, indent to
 | 
					 | 
				
			||||||
                    # beyond leftmost =; else to beyond first chunk of
 | 
					 | 
				
			||||||
                    # non-whitespace on initial line
 | 
					 | 
				
			||||||
                    if y.get_num_lines_in_stmt() > 1:
 | 
					 | 
				
			||||||
                        text.insert("insert", indent)
 | 
					 | 
				
			||||||
                    else:
 | 
					 | 
				
			||||||
                        self.reindent_to(y.compute_backslash_indent())
 | 
					 | 
				
			||||||
                else:
 | 
					 | 
				
			||||||
                    assert 0, "bogus continuation type " + `c`
 | 
					 | 
				
			||||||
                return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            # This line starts a brand new stmt; indent relative to
 | 
					 | 
				
			||||||
            # indentation of initial line of closest preceding
 | 
					 | 
				
			||||||
            # interesting stmt.
 | 
					 | 
				
			||||||
            indent = y.get_base_indent_string()
 | 
					 | 
				
			||||||
            text.insert("insert", indent)
 | 
					 | 
				
			||||||
            if y.is_block_opener():
 | 
					 | 
				
			||||||
                self.smart_indent_event(event)
 | 
					 | 
				
			||||||
            elif indent and y.is_block_closer():
 | 
					 | 
				
			||||||
                self.smart_backspace_event(event)
 | 
					 | 
				
			||||||
            return "break"
 | 
					 | 
				
			||||||
        finally:
 | 
					 | 
				
			||||||
            text.see("insert")
 | 
					 | 
				
			||||||
            text.undo_block_stop()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    auto_indent = newline_and_indent_event
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Our editwin provides a is_char_in_string function that works
 | 
					 | 
				
			||||||
    # with a Tk text index, but PyParse only knows about offsets into
 | 
					 | 
				
			||||||
    # a string. This builds a function for PyParse that accepts an
 | 
					 | 
				
			||||||
    # offset.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _build_char_in_string_func(self, startindex):
 | 
					 | 
				
			||||||
        def inner(offset, _startindex=startindex,
 | 
					 | 
				
			||||||
                  _icis=self.editwin.is_char_in_string):
 | 
					 | 
				
			||||||
            return _icis(_startindex + "+%dc" % offset)
 | 
					 | 
				
			||||||
        return inner
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def indent_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        for pos in range(len(lines)):
 | 
					 | 
				
			||||||
            line = lines[pos]
 | 
					 | 
				
			||||||
            if line:
 | 
					 | 
				
			||||||
                raw, effective = classifyws(line, self.tabwidth)
 | 
					 | 
				
			||||||
                effective = effective + self.indentwidth
 | 
					 | 
				
			||||||
                lines[pos] = self._make_blanks(effective) + line[raw:]
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def dedent_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        for pos in range(len(lines)):
 | 
					 | 
				
			||||||
            line = lines[pos]
 | 
					 | 
				
			||||||
            if line:
 | 
					 | 
				
			||||||
                raw, effective = classifyws(line, self.tabwidth)
 | 
					 | 
				
			||||||
                effective = max(effective - self.indentwidth, 0)
 | 
					 | 
				
			||||||
                lines[pos] = self._make_blanks(effective) + line[raw:]
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def comment_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        for pos in range(len(lines) - 1):
 | 
					 | 
				
			||||||
            line = lines[pos]
 | 
					 | 
				
			||||||
            lines[pos] = '##' + line
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def uncomment_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        for pos in range(len(lines)):
 | 
					 | 
				
			||||||
            line = lines[pos]
 | 
					 | 
				
			||||||
            if not line:
 | 
					 | 
				
			||||||
                continue
 | 
					 | 
				
			||||||
            if line[:2] == '##':
 | 
					 | 
				
			||||||
                line = line[2:]
 | 
					 | 
				
			||||||
            elif line[:1] == '#':
 | 
					 | 
				
			||||||
                line = line[1:]
 | 
					 | 
				
			||||||
            lines[pos] = line
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tabify_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        tabwidth = self._asktabwidth()
 | 
					 | 
				
			||||||
        for pos in range(len(lines)):
 | 
					 | 
				
			||||||
            line = lines[pos]
 | 
					 | 
				
			||||||
            if line:
 | 
					 | 
				
			||||||
                raw, effective = classifyws(line, tabwidth)
 | 
					 | 
				
			||||||
                ntabs, nspaces = divmod(effective, tabwidth)
 | 
					 | 
				
			||||||
                lines[pos] = '\t' * ntabs + ' ' * nspaces + line[raw:]
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def untabify_region_event(self, event):
 | 
					 | 
				
			||||||
        head, tail, chars, lines = self.get_region()
 | 
					 | 
				
			||||||
        tabwidth = self._asktabwidth()
 | 
					 | 
				
			||||||
        for pos in range(len(lines)):
 | 
					 | 
				
			||||||
            lines[pos] = string.expandtabs(lines[pos], tabwidth)
 | 
					 | 
				
			||||||
        self.set_region(head, tail, chars, lines)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def toggle_tabs_event(self, event):
 | 
					 | 
				
			||||||
        if self.editwin.askyesno(
 | 
					 | 
				
			||||||
              "Toggle tabs",
 | 
					 | 
				
			||||||
              "Turn tabs " + ("on", "off")[self.usetabs] + "?",
 | 
					 | 
				
			||||||
              parent=self.text):
 | 
					 | 
				
			||||||
            self.usetabs = not self.usetabs
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # XXX this isn't bound to anything -- see class tabwidth comments
 | 
					 | 
				
			||||||
    def change_tabwidth_event(self, event):
 | 
					 | 
				
			||||||
        new = self._asktabwidth()
 | 
					 | 
				
			||||||
        if new != self.tabwidth:
 | 
					 | 
				
			||||||
            self.tabwidth = new
 | 
					 | 
				
			||||||
            self.set_indentation_params(0, guess=0)
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def change_indentwidth_event(self, event):
 | 
					 | 
				
			||||||
        new = self.editwin.askinteger(
 | 
					 | 
				
			||||||
                  "Indent width",
 | 
					 | 
				
			||||||
                  "New indent width (1-16)",
 | 
					 | 
				
			||||||
                  parent=self.text,
 | 
					 | 
				
			||||||
                  initialvalue=self.indentwidth,
 | 
					 | 
				
			||||||
                  minvalue=1,
 | 
					 | 
				
			||||||
                  maxvalue=16)
 | 
					 | 
				
			||||||
        if new and new != self.indentwidth:
 | 
					 | 
				
			||||||
            self.indentwidth = new
 | 
					 | 
				
			||||||
        return "break"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def get_region(self):
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        first, last = self.editwin.get_selection_indices()
 | 
					 | 
				
			||||||
        if first and last:
 | 
					 | 
				
			||||||
            head = text.index(first + " linestart")
 | 
					 | 
				
			||||||
            tail = text.index(last + "-1c lineend +1c")
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            head = text.index("insert linestart")
 | 
					 | 
				
			||||||
            tail = text.index("insert lineend +1c")
 | 
					 | 
				
			||||||
        chars = text.get(head, tail)
 | 
					 | 
				
			||||||
        lines = string.split(chars, "\n")
 | 
					 | 
				
			||||||
        return head, tail, chars, lines
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def set_region(self, head, tail, chars, lines):
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        newchars = string.join(lines, "\n")
 | 
					 | 
				
			||||||
        if newchars == chars:
 | 
					 | 
				
			||||||
            text.bell()
 | 
					 | 
				
			||||||
            return
 | 
					 | 
				
			||||||
        text.tag_remove("sel", "1.0", "end")
 | 
					 | 
				
			||||||
        text.mark_set("insert", head)
 | 
					 | 
				
			||||||
        text.undo_block_start()
 | 
					 | 
				
			||||||
        text.delete(head, tail)
 | 
					 | 
				
			||||||
        text.insert(head, newchars)
 | 
					 | 
				
			||||||
        text.undo_block_stop()
 | 
					 | 
				
			||||||
        text.tag_add("sel", head, "insert")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Make string that displays as n leading blanks.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _make_blanks(self, n):
 | 
					 | 
				
			||||||
        if self.usetabs:
 | 
					 | 
				
			||||||
            ntabs, nspaces = divmod(n, self.tabwidth)
 | 
					 | 
				
			||||||
            return '\t' * ntabs + ' ' * nspaces
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            return ' ' * n
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Delete from beginning of line to insert point, then reinsert
 | 
					 | 
				
			||||||
    # column logical (meaning use tabs if appropriate) spaces.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def reindent_to(self, column):
 | 
					 | 
				
			||||||
        text = self.text
 | 
					 | 
				
			||||||
        text.undo_block_start()
 | 
					 | 
				
			||||||
        if text.compare("insert linestart", "!=", "insert"):
 | 
					 | 
				
			||||||
            text.delete("insert linestart", "insert")
 | 
					 | 
				
			||||||
        if column:
 | 
					 | 
				
			||||||
            text.insert("insert", self._make_blanks(column))
 | 
					 | 
				
			||||||
        text.undo_block_stop()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def _asktabwidth(self):
 | 
					 | 
				
			||||||
        return self.editwin.askinteger(
 | 
					 | 
				
			||||||
            "Tab width",
 | 
					 | 
				
			||||||
            "Spaces per tab?",
 | 
					 | 
				
			||||||
            parent=self.text,
 | 
					 | 
				
			||||||
            initialvalue=self.tabwidth,
 | 
					 | 
				
			||||||
            minvalue=1,
 | 
					 | 
				
			||||||
            maxvalue=16) or self.tabwidth
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Guess indentwidth from text content.
 | 
					 | 
				
			||||||
    # Return guessed indentwidth.  This should not be believed unless
 | 
					 | 
				
			||||||
    # it's in a reasonable range (e.g., it will be 0 if no indented
 | 
					 | 
				
			||||||
    # blocks are found).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def guess_indent(self):
 | 
					 | 
				
			||||||
        opener, indented = IndentSearcher(self.text, self.tabwidth).run()
 | 
					 | 
				
			||||||
        if opener and indented:
 | 
					 | 
				
			||||||
            raw, indentsmall = classifyws(opener, self.tabwidth)
 | 
					 | 
				
			||||||
            raw, indentlarge = classifyws(indented, self.tabwidth)
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            indentsmall = indentlarge = 0
 | 
					 | 
				
			||||||
        return indentlarge - indentsmall
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# "line.col" -> line, as an int
 | 
					 | 
				
			||||||
def index2line(index):
 | 
					 | 
				
			||||||
    return int(float(index))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Look at the leading whitespace in s.
 | 
					 | 
				
			||||||
# Return pair (# of leading ws characters,
 | 
					 | 
				
			||||||
#              effective # of leading blanks after expanding
 | 
					 | 
				
			||||||
#              tabs to width tabwidth)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def classifyws(s, tabwidth):
 | 
					 | 
				
			||||||
    raw = effective = 0
 | 
					 | 
				
			||||||
    for ch in s:
 | 
					 | 
				
			||||||
        if ch == ' ':
 | 
					 | 
				
			||||||
            raw = raw + 1
 | 
					 | 
				
			||||||
            effective = effective + 1
 | 
					 | 
				
			||||||
        elif ch == '\t':
 | 
					 | 
				
			||||||
            raw = raw + 1
 | 
					 | 
				
			||||||
            effective = (effective // tabwidth + 1) * tabwidth
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            break
 | 
					 | 
				
			||||||
    return raw, effective
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import tokenize
 | 
					 | 
				
			||||||
_tokenize = tokenize
 | 
					 | 
				
			||||||
del tokenize
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class IndentSearcher:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # .run() chews over the Text widget, looking for a block opener
 | 
					 | 
				
			||||||
    # and the stmt following it.  Returns a pair,
 | 
					 | 
				
			||||||
    #     (line containing block opener, line containing stmt)
 | 
					 | 
				
			||||||
    # Either or both may be None.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, text, tabwidth):
 | 
					 | 
				
			||||||
        self.text = text
 | 
					 | 
				
			||||||
        self.tabwidth = tabwidth
 | 
					 | 
				
			||||||
        self.i = self.finished = 0
 | 
					 | 
				
			||||||
        self.blkopenline = self.indentedline = None
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def readline(self):
 | 
					 | 
				
			||||||
        if self.finished:
 | 
					 | 
				
			||||||
            return ""
 | 
					 | 
				
			||||||
        i = self.i = self.i + 1
 | 
					 | 
				
			||||||
        mark = `i` + ".0"
 | 
					 | 
				
			||||||
        if self.text.compare(mark, ">=", "end"):
 | 
					 | 
				
			||||||
            return ""
 | 
					 | 
				
			||||||
        return self.text.get(mark, mark + " lineend+1c")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def tokeneater(self, type, token, start, end, line,
 | 
					 | 
				
			||||||
                   INDENT=_tokenize.INDENT,
 | 
					 | 
				
			||||||
                   NAME=_tokenize.NAME,
 | 
					 | 
				
			||||||
                   OPENERS=('class', 'def', 'for', 'if', 'try', 'while')):
 | 
					 | 
				
			||||||
        if self.finished:
 | 
					 | 
				
			||||||
            pass
 | 
					 | 
				
			||||||
        elif type == NAME and token in OPENERS:
 | 
					 | 
				
			||||||
            self.blkopenline = line
 | 
					 | 
				
			||||||
        elif type == INDENT and self.blkopenline:
 | 
					 | 
				
			||||||
            self.indentedline = line
 | 
					 | 
				
			||||||
            self.finished = 1
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def run(self):
 | 
					 | 
				
			||||||
        save_tabsize = _tokenize.tabsize
 | 
					 | 
				
			||||||
        _tokenize.tabsize = self.tabwidth
 | 
					 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            try:
 | 
					 | 
				
			||||||
                _tokenize.tokenize(self.readline, self.tokeneater)
 | 
					 | 
				
			||||||
            except _tokenize.TokenError:
 | 
					 | 
				
			||||||
                # since we cut off the tokenizer early, we can trigger
 | 
					 | 
				
			||||||
                # spurious errors
 | 
					 | 
				
			||||||
                pass
 | 
					 | 
				
			||||||
        finally:
 | 
					 | 
				
			||||||
            _tokenize.tabsize = save_tabsize
 | 
					 | 
				
			||||||
        return self.blkopenline, self.indentedline
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,113 +0,0 @@
 | 
				
			||||||
"""Provides access to configuration information"""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class IdleConfParser(ConfigParser):
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # these conf sections do not define extensions!
 | 
					 | 
				
			||||||
    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")
 | 
					 | 
				
			||||||
        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:
 | 
					 | 
				
			||||||
            return self.get(sec, options, raw, vars)
 | 
					 | 
				
			||||||
        except (NoSectionError, NoOptionError):
 | 
					 | 
				
			||||||
            return default
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def getsection(self, section):
 | 
					 | 
				
			||||||
        """Return a SectionConfigParser object"""
 | 
					 | 
				
			||||||
        return SectionConfigParser(section, self)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def getextensions(self):
 | 
					 | 
				
			||||||
        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)
 | 
					 | 
				
			||||||
        return exts
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def reload(self):
 | 
					 | 
				
			||||||
        global idleconf
 | 
					 | 
				
			||||||
        idleconf = IdleConfParser()
 | 
					 | 
				
			||||||
        load(_dir) # _dir is a global holding the last directory loaded
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class SectionConfigParser:
 | 
					 | 
				
			||||||
    """A ConfigParser object specialized for one section
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    This class has all the get methods that a regular ConfigParser does,
 | 
					 | 
				
			||||||
    but without requiring a section argument.
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    def __init__(self, section, config):
 | 
					 | 
				
			||||||
        self.section = section
 | 
					 | 
				
			||||||
        self.config = config
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def options(self):
 | 
					 | 
				
			||||||
        return self.config.options(self.section)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def get(self, options, raw=0, vars=None):
 | 
					 | 
				
			||||||
        return self.config.get(self.section, options, raw, vars)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def getdef(self, options, raw=0, vars=None, default=None):
 | 
					 | 
				
			||||||
        return self.config.getdef(self.section, options, raw, vars, default)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def getcolor(self, option):
 | 
					 | 
				
			||||||
        return self.config.getcolor(self.section, option)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def load(dir):
 | 
					 | 
				
			||||||
    """Load IDLE configuration files based on IDLE install in dir
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Attempts to load two config files:
 | 
					 | 
				
			||||||
    dir/config.txt
 | 
					 | 
				
			||||||
    dir/config-[win/mac/unix].txt
 | 
					 | 
				
			||||||
    dir/config-%(sys.platform)s.txt
 | 
					 | 
				
			||||||
    ~/.idle
 | 
					 | 
				
			||||||
    """
 | 
					 | 
				
			||||||
    global _dir
 | 
					 | 
				
			||||||
    _dir = dir
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if sys.platform[:3] == 'win':
 | 
					 | 
				
			||||||
        genplatfile = os.path.join(dir, "config-win.txt")
 | 
					 | 
				
			||||||
    # XXX don't know what the platform string is on a Mac
 | 
					 | 
				
			||||||
    elif sys.platform[:3] == 'mac':
 | 
					 | 
				
			||||||
        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:
 | 
					 | 
				
			||||||
        homedir = os.environ['HOME']
 | 
					 | 
				
			||||||
    except KeyError:
 | 
					 | 
				
			||||||
        homedir = os.getcwd()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    idleconf.read((os.path.join(dir, "config.txt"), genplatfile, platfile,
 | 
					 | 
				
			||||||
                   os.path.join(homedir, ".idle")))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
idleconf = IdleConfParser()
 | 
					 | 
				
			||||||
load(os.path.dirname(__file__))
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,138 +0,0 @@
 | 
				
			||||||
# One or more ScrolledLists with HSeparators between them.
 | 
					 | 
				
			||||||
# There is a hierarchical relationship between them:
 | 
					 | 
				
			||||||
# the right list displays the substructure of the selected item
 | 
					 | 
				
			||||||
# in the left list.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import string
 | 
					 | 
				
			||||||
from Tkinter import *
 | 
					 | 
				
			||||||
from WindowList import ListedToplevel
 | 
					 | 
				
			||||||
from Separator import HSeparator
 | 
					 | 
				
			||||||
from ScrolledList import ScrolledList
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class MultiScrolledLists:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, root, nlists=2):
 | 
					 | 
				
			||||||
        assert nlists >= 1
 | 
					 | 
				
			||||||
        self.root = root
 | 
					 | 
				
			||||||
        self.nlists = nlists
 | 
					 | 
				
			||||||
        self.path = []
 | 
					 | 
				
			||||||
        # create top
 | 
					 | 
				
			||||||
        self.top = top = ListedToplevel(root)
 | 
					 | 
				
			||||||
        top.protocol("WM_DELETE_WINDOW", self.close)
 | 
					 | 
				
			||||||
        top.bind("<Escape>", self.close)
 | 
					 | 
				
			||||||
        self.settitle()
 | 
					 | 
				
			||||||
        # create frames and separators in between
 | 
					 | 
				
			||||||
        self.frames = []
 | 
					 | 
				
			||||||
        self.separators = []
 | 
					 | 
				
			||||||
        last = top
 | 
					 | 
				
			||||||
        for i in range(nlists-1):
 | 
					 | 
				
			||||||
            sepa = HSeparator(last)
 | 
					 | 
				
			||||||
            self.separators.append(sepa)
 | 
					 | 
				
			||||||
            frame, last = sepa.parts()
 | 
					 | 
				
			||||||
            self.frames.append(frame)
 | 
					 | 
				
			||||||
        self.frames.append(last)
 | 
					 | 
				
			||||||
        # create labels and lists
 | 
					 | 
				
			||||||
        self.labels = []
 | 
					 | 
				
			||||||
        self.lists = []
 | 
					 | 
				
			||||||
        for i in range(nlists):
 | 
					 | 
				
			||||||
            frame = self.frames[i]
 | 
					 | 
				
			||||||
            label = Label(frame, text=self.subtitle(i),
 | 
					 | 
				
			||||||
                relief="groove", borderwidth=2)
 | 
					 | 
				
			||||||
            label.pack(fill="x")
 | 
					 | 
				
			||||||
            self.labels.append(label)
 | 
					 | 
				
			||||||
            list = ScrolledList(frame, width=self.width(i),
 | 
					 | 
				
			||||||
                height=self.height(i))
 | 
					 | 
				
			||||||
            self.lists.append(list)
 | 
					 | 
				
			||||||
            list.on_select = \
 | 
					 | 
				
			||||||
                lambda index, i=i, self=self: self.on_select(index, i)
 | 
					 | 
				
			||||||
            list.on_double = \
 | 
					 | 
				
			||||||
                lambda index, i=i, self=self: self.on_double(index, i)
 | 
					 | 
				
			||||||
        # fill leftmost list (rest get filled on demand)
 | 
					 | 
				
			||||||
        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()
 | 
					 | 
				
			||||||
        if short and long:
 | 
					 | 
				
			||||||
            title = short + " - " + long
 | 
					 | 
				
			||||||
        elif short:
 | 
					 | 
				
			||||||
            title = short
 | 
					 | 
				
			||||||
        elif long:
 | 
					 | 
				
			||||||
            title = long
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            title = "Untitled"
 | 
					 | 
				
			||||||
        icon = short or long or title
 | 
					 | 
				
			||||||
        self.top.wm_title(title)
 | 
					 | 
				
			||||||
        self.top.wm_iconname(icon)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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()
 | 
					 | 
				
			||||||
            self.labels[k].configure(text=self.subtitle(k))
 | 
					 | 
				
			||||||
        list = self.lists[i]
 | 
					 | 
				
			||||||
        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 = []
 | 
					 | 
				
			||||||
        for k in range(10):
 | 
					 | 
				
			||||||
            s = str(k)
 | 
					 | 
				
			||||||
            if i > 0:
 | 
					 | 
				
			||||||
                s = self.path[i-1] + "." + s
 | 
					 | 
				
			||||||
            l.append(s)
 | 
					 | 
				
			||||||
        return l
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def on_double(self, index, i):
 | 
					 | 
				
			||||||
        pass
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def main():
 | 
					 | 
				
			||||||
    root = Tk()
 | 
					 | 
				
			||||||
    quit = Button(root, text="Exit", command=root.destroy)
 | 
					 | 
				
			||||||
    quit.pack()
 | 
					 | 
				
			||||||
    MultiScrolledLists(root, 4)
 | 
					 | 
				
			||||||
    root.mainloop()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == "__main__":
 | 
					 | 
				
			||||||
    main()
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,92 +0,0 @@
 | 
				
			||||||
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)
 | 
					 | 
				
			||||||
        if orient in ("h", "horizontal"):
 | 
					 | 
				
			||||||
            self.side = "left"
 | 
					 | 
				
			||||||
            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"
 | 
					 | 
				
			||||||
            self.cursor = "sb_v_double_arrow"
 | 
					 | 
				
			||||||
        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)
 | 
					 | 
				
			||||||
        self.f1.pack(expand=1, fill="both", side=self.side)
 | 
					 | 
				
			||||||
        self.div = Frame(master, cursor=self.cursor)
 | 
					 | 
				
			||||||
        self.div[self.dim] = self.thickness
 | 
					 | 
				
			||||||
        self.div.pack(fill="both", side=self.side)
 | 
					 | 
				
			||||||
        self.f2 = Frame(master)
 | 
					 | 
				
			||||||
        self.f2.pack(expand=1, fill="both", side=self.side)
 | 
					 | 
				
			||||||
        self.div.bind("<ButtonPress-1>", self.divider_press)
 | 
					 | 
				
			||||||
        if bg:
 | 
					 | 
				
			||||||
            ##self.f1["bg"] = bg
 | 
					 | 
				
			||||||
            ##self.f2["bg"] = bg
 | 
					 | 
				
			||||||
            self.div["bg"] = bg
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def parts(self):
 | 
					 | 
				
			||||||
        return self.f1, self.f2
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def divider_press(self, event):
 | 
					 | 
				
			||||||
        self.press_event = event
 | 
					 | 
				
			||||||
        self.f1.pack_propagate(0)
 | 
					 | 
				
			||||||
        self.f2.pack_propagate(0)
 | 
					 | 
				
			||||||
        for f in self.f1, self.f2:
 | 
					 | 
				
			||||||
            for dim in "width", "height":
 | 
					 | 
				
			||||||
                f[dim] = getattr(f, "winfo_"+dim)()
 | 
					 | 
				
			||||||
        self.div.bind("<Motion>", self.div_motion)
 | 
					 | 
				
			||||||
        self.div.bind("<ButtonRelease-1>", self.div_release)
 | 
					 | 
				
			||||||
        self.div.grab_set()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def div_motion(self, event):
 | 
					 | 
				
			||||||
        delta = getattr(event, self.dir) - getattr(self.press_event, self.dir)
 | 
					 | 
				
			||||||
        if delta:
 | 
					 | 
				
			||||||
            dim1 = getattr(self.f1, self.winfo_dim)()
 | 
					 | 
				
			||||||
            dim2 = getattr(self.f2, self.winfo_dim)()
 | 
					 | 
				
			||||||
            delta = max(delta, self.min-dim1)
 | 
					 | 
				
			||||||
            delta = min(delta, dim2-self.min)
 | 
					 | 
				
			||||||
            dim1 = dim1 + delta
 | 
					 | 
				
			||||||
            dim2 = dim2 - delta
 | 
					 | 
				
			||||||
            self.f1[self.dim] = dim1
 | 
					 | 
				
			||||||
            self.f2[self.dim] = dim2
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def div_release(self, event):
 | 
					 | 
				
			||||||
        self.div_motion(event)
 | 
					 | 
				
			||||||
        self.div.unbind("<Motion>")
 | 
					 | 
				
			||||||
        self.div.grab_release()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class VSeparator(Separator):
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, master, min=10, thickness=5, bg=None):
 | 
					 | 
				
			||||||
        Separator.__init__(self, master, "v", min, thickness, bg)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class HSeparator(Separator):
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __init__(self, master, min=10, thickness=5, bg=None):
 | 
					 | 
				
			||||||
        Separator.__init__(self, master, "h", min, thickness, bg)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def main():
 | 
					 | 
				
			||||||
    root = Tk()
 | 
					 | 
				
			||||||
    tlist = []
 | 
					 | 
				
			||||||
    outer = HSeparator(root, bg="red")
 | 
					 | 
				
			||||||
    for part in outer.parts():
 | 
					 | 
				
			||||||
        inner = VSeparator(part, bg="blue")
 | 
					 | 
				
			||||||
        for f in inner.parts():
 | 
					 | 
				
			||||||
            t = Text(f, width=40, height=10, borderwidth=0)
 | 
					 | 
				
			||||||
            t.pack(fill="both", expand=1)
 | 
					 | 
				
			||||||
            tlist.append(t)
 | 
					 | 
				
			||||||
    tlist[0].insert("1.0", "Make your own Mondrian!")
 | 
					 | 
				
			||||||
    tlist[1].insert("1.0", "Move the colored dividers...")
 | 
					 | 
				
			||||||
    root.mainloop()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    main()
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
[EditorWindow]
 | 
					 | 
				
			||||||
font-name= courier
 | 
					 | 
				
			||||||
font-size= 10
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
[EditorWindow]
 | 
					 | 
				
			||||||
font-name: courier new
 | 
					 | 
				
			||||||
font-size: 10
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,64 +0,0 @@
 | 
				
			||||||
# IDLE reads several config files to determine user preferences.  This 
 | 
					 | 
				
			||||||
# file is the default config file.  When IDLE starts, it will look in
 | 
					 | 
				
			||||||
# the following four files in order:
 | 
					 | 
				
			||||||
#     config.txt                      the default config file
 | 
					 | 
				
			||||||
#     config-[win/unix/mac].txt       the generic platform config file
 | 
					 | 
				
			||||||
#     config-[sys.platform].txt       the specific platform config file
 | 
					 | 
				
			||||||
#     ~/.idle                         the user config file
 | 
					 | 
				
			||||||
# XXX what about Windows?
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# The last definition of each option is used.  For example, you can
 | 
					 | 
				
			||||||
# override the default window size (80x24) by defining width and
 | 
					 | 
				
			||||||
# height options in the EditorWindow section of your ~/.idle file
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# IDLE extensions can be enabled and disabled by adding them to one of
 | 
					 | 
				
			||||||
# the config files.  To enable an extension, create a section with the
 | 
					 | 
				
			||||||
# same name as the extension, e.g. the [ParenMatch] section below.  To
 | 
					 | 
				
			||||||
# disable an extension, either remove the section or add the 'enable'
 | 
					 | 
				
			||||||
# option with the value 0.  
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[EditorWindow]
 | 
					 | 
				
			||||||
width= 80
 | 
					 | 
				
			||||||
height= 24
 | 
					 | 
				
			||||||
# fonts defined in config-[win/unix].txt
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[Colors]
 | 
					 | 
				
			||||||
normal-foreground= black
 | 
					 | 
				
			||||||
normal-background= white
 | 
					 | 
				
			||||||
# These color types are not explicitly defined= sync, todo, stdin
 | 
					 | 
				
			||||||
keyword-foreground= #ff7700
 | 
					 | 
				
			||||||
comment-foreground= #dd0000
 | 
					 | 
				
			||||||
string-foreground= #00aa00
 | 
					 | 
				
			||||||
definition-foreground= #0000ff
 | 
					 | 
				
			||||||
hilite-foreground= #000068
 | 
					 | 
				
			||||||
hilite-background= #006868
 | 
					 | 
				
			||||||
break-foreground= #ff7777
 | 
					 | 
				
			||||||
hit-foreground= #ffffff
 | 
					 | 
				
			||||||
hit-background= #000000
 | 
					 | 
				
			||||||
stdout-foreground= blue
 | 
					 | 
				
			||||||
stderr-foreground= red
 | 
					 | 
				
			||||||
console-foreground= #770000
 | 
					 | 
				
			||||||
error-background= #ff7777
 | 
					 | 
				
			||||||
cursor-background= black
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SearchBinding]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[AutoIndent]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[AutoExpand]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[FormatParagraph]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[ZoomHeight]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ScriptBinding]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[CallTips]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[ParenMatch]
 | 
					 | 
				
			||||||
enable= 0
 | 
					 | 
				
			||||||
style= expression
 | 
					 | 
				
			||||||
flash-delay= 500
 | 
					 | 
				
			||||||
bell= 1
 | 
					 | 
				
			||||||
hilite-foreground= black
 | 
					 | 
				
			||||||
hilite-background= #43cd80
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,93 +0,0 @@
 | 
				
			||||||
#! /usr/bin/env python
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"""Parse event definitions out of comments in source files."""
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import re
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import string
 | 
					 | 
				
			||||||
import getopt
 | 
					 | 
				
			||||||
import glob
 | 
					 | 
				
			||||||
import fileinput
 | 
					 | 
				
			||||||
import pprint
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def main():
 | 
					 | 
				
			||||||
    hits = []
 | 
					 | 
				
			||||||
    sublist = []
 | 
					 | 
				
			||||||
    args = sys.argv[1:]
 | 
					 | 
				
			||||||
    if not args:
 | 
					 | 
				
			||||||
        args = filter(lambda s: 'A' <= s[0] <= 'Z', glob.glob("*.py"))
 | 
					 | 
				
			||||||
        if not args:
 | 
					 | 
				
			||||||
            print "No arguments, no [A-Z]*.py files."
 | 
					 | 
				
			||||||
            return 1
 | 
					 | 
				
			||||||
    for line in fileinput.input(args):
 | 
					 | 
				
			||||||
        if line[:2] == '#$':
 | 
					 | 
				
			||||||
            if not sublist:
 | 
					 | 
				
			||||||
                sublist.append('file %s' % fileinput.filename())
 | 
					 | 
				
			||||||
                sublist.append('line %d' % fileinput.lineno())
 | 
					 | 
				
			||||||
            sublist.append(string.strip(line[2:-1]))
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            if sublist:
 | 
					 | 
				
			||||||
                hits.append(sublist)
 | 
					 | 
				
			||||||
                sublist = []
 | 
					 | 
				
			||||||
    if sublist:
 | 
					 | 
				
			||||||
        hits.append(sublist)
 | 
					 | 
				
			||||||
        sublist = []
 | 
					 | 
				
			||||||
    dd = {}
 | 
					 | 
				
			||||||
    for sublist in hits:
 | 
					 | 
				
			||||||
        d = {}
 | 
					 | 
				
			||||||
        for line in sublist:
 | 
					 | 
				
			||||||
            words = string.split(line, None, 1)
 | 
					 | 
				
			||||||
            if len(words) != 2:
 | 
					 | 
				
			||||||
                continue
 | 
					 | 
				
			||||||
            tag = words[0]
 | 
					 | 
				
			||||||
            l = d.get(tag, [])
 | 
					 | 
				
			||||||
            l.append(words[1])
 | 
					 | 
				
			||||||
            d[tag] = l
 | 
					 | 
				
			||||||
        if d.has_key('event'):
 | 
					 | 
				
			||||||
            keys = d['event']
 | 
					 | 
				
			||||||
            if len(keys) != 1:
 | 
					 | 
				
			||||||
                print "Multiple event keys in", d
 | 
					 | 
				
			||||||
                print 'File "%s", line %d' % (d['file'], d['line'])
 | 
					 | 
				
			||||||
            key = keys[0]
 | 
					 | 
				
			||||||
            if dd.has_key(key):
 | 
					 | 
				
			||||||
                print "Duplicate event in", d
 | 
					 | 
				
			||||||
                print 'File "%s", line %d' % (d['file'], d['line'])
 | 
					 | 
				
			||||||
                return
 | 
					 | 
				
			||||||
            dd[key] = d
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            print "No event key in", d
 | 
					 | 
				
			||||||
            print 'File "%s", line %d' % (d['file'], d['line'])
 | 
					 | 
				
			||||||
    winevents = getevents(dd, "win")
 | 
					 | 
				
			||||||
    unixevents = getevents(dd, "unix")
 | 
					 | 
				
			||||||
    save = sys.stdout
 | 
					 | 
				
			||||||
    f = open("keydefs.py", "w")
 | 
					 | 
				
			||||||
    try:
 | 
					 | 
				
			||||||
        sys.stdout = f
 | 
					 | 
				
			||||||
        print "windows_keydefs = \\"
 | 
					 | 
				
			||||||
        pprint.pprint(winevents)
 | 
					 | 
				
			||||||
        print
 | 
					 | 
				
			||||||
        print "unix_keydefs = \\"
 | 
					 | 
				
			||||||
        pprint.pprint(unixevents)
 | 
					 | 
				
			||||||
    finally:
 | 
					 | 
				
			||||||
        sys.stdout = save
 | 
					 | 
				
			||||||
    f.close()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def getevents(dd, key):
 | 
					 | 
				
			||||||
    res = {}
 | 
					 | 
				
			||||||
    events = dd.keys()
 | 
					 | 
				
			||||||
    events.sort()
 | 
					 | 
				
			||||||
    for e in events:
 | 
					 | 
				
			||||||
        d = dd[e]
 | 
					 | 
				
			||||||
        if d.has_key(key) or d.has_key("all"):
 | 
					 | 
				
			||||||
            list = []
 | 
					 | 
				
			||||||
            for x in d.get(key, []) + d.get("all", []):
 | 
					 | 
				
			||||||
                list.append(x)
 | 
					 | 
				
			||||||
                if key == "unix" and x[:5] == "<Alt-":
 | 
					 | 
				
			||||||
                    x = "<Meta-" + x[5:]
 | 
					 | 
				
			||||||
                    list.append(x)
 | 
					 | 
				
			||||||
            res[e] = list
 | 
					 | 
				
			||||||
    return res
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    sys.exit(main())
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,55 +0,0 @@
 | 
				
			||||||
windows_keydefs = \
 | 
					 | 
				
			||||||
{'<<Copy>>': ['<Control-c>', '<Control-C>'],
 | 
					 | 
				
			||||||
 '<<Cut>>': ['<Control-x>', '<Control-X>'],
 | 
					 | 
				
			||||||
 '<<Paste>>': ['<Control-v>', '<Control-V>'],
 | 
					 | 
				
			||||||
 '<<beginning-of-line>>': ['<Control-a>', '<Home>'],
 | 
					 | 
				
			||||||
 '<<center-insert>>': ['<Control-l>'],
 | 
					 | 
				
			||||||
 '<<close-all-windows>>': ['<Control-q>'],
 | 
					 | 
				
			||||||
 '<<close-window>>': ['<Alt-F4>'],
 | 
					 | 
				
			||||||
 '<<dump-undo-state>>': ['<Control-backslash>'],
 | 
					 | 
				
			||||||
 '<<end-of-file>>': ['<Control-d>'],
 | 
					 | 
				
			||||||
 '<<python-docs>>': ['<F1>'],
 | 
					 | 
				
			||||||
 '<<history-next>>': ['<Alt-n>'],
 | 
					 | 
				
			||||||
 '<<history-previous>>': ['<Alt-p>'],
 | 
					 | 
				
			||||||
 '<<interrupt-execution>>': ['<Control-c>'],
 | 
					 | 
				
			||||||
 '<<open-class-browser>>': ['<Alt-c>'],
 | 
					 | 
				
			||||||
 '<<open-module>>': ['<Alt-m>'],
 | 
					 | 
				
			||||||
 '<<open-new-window>>': ['<Control-n>'],
 | 
					 | 
				
			||||||
 '<<open-window-from-file>>': ['<Control-o>'],
 | 
					 | 
				
			||||||
 '<<plain-newline-and-indent>>': ['<Control-j>'],
 | 
					 | 
				
			||||||
 '<<redo>>': ['<Control-y>'],
 | 
					 | 
				
			||||||
 '<<remove-selection>>': ['<Escape>'],
 | 
					 | 
				
			||||||
 '<<save-copy-of-window-as-file>>': ['<Alt-Shift-s>'],
 | 
					 | 
				
			||||||
 '<<save-window-as-file>>': ['<Alt-s>'],
 | 
					 | 
				
			||||||
 '<<save-window>>': ['<Control-s>'],
 | 
					 | 
				
			||||||
 '<<select-all>>': ['<Alt-a>'],
 | 
					 | 
				
			||||||
 '<<toggle-auto-coloring>>': ['<Control-slash>'],
 | 
					 | 
				
			||||||
 '<<undo>>': ['<Control-z>']}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
unix_keydefs = \
 | 
					 | 
				
			||||||
{'<<Copy>>': ['<Alt-w>', '<Meta-w>'],
 | 
					 | 
				
			||||||
 '<<Cut>>': ['<Control-w>'],
 | 
					 | 
				
			||||||
 '<<Paste>>': ['<Control-y>'],
 | 
					 | 
				
			||||||
 '<<beginning-of-line>>': ['<Control-a>', '<Home>'],
 | 
					 | 
				
			||||||
 '<<center-insert>>': ['<Control-l>'],
 | 
					 | 
				
			||||||
 '<<close-all-windows>>': ['<Control-x><Control-c>'],
 | 
					 | 
				
			||||||
 '<<close-window>>': ['<Control-x><Control-0>', '<Control-x><Key-0>'],
 | 
					 | 
				
			||||||
 '<<do-nothing>>': ['<Control-x>'],
 | 
					 | 
				
			||||||
 '<<dump-undo-state>>': ['<Control-backslash>'],
 | 
					 | 
				
			||||||
 '<<end-of-file>>': ['<Control-d>'],
 | 
					 | 
				
			||||||
 '<<help>>': ['<F1>'],
 | 
					 | 
				
			||||||
 '<<history-next>>': ['<Alt-n>', '<Meta-n>'],
 | 
					 | 
				
			||||||
 '<<history-previous>>': ['<Alt-p>', '<Meta-p>'],
 | 
					 | 
				
			||||||
 '<<interrupt-execution>>': ['<Control-c>'],
 | 
					 | 
				
			||||||
 '<<open-class-browser>>': ['<Control-x><Control-b>'],
 | 
					 | 
				
			||||||
 '<<open-module>>': ['<Control-x><Control-m>'],
 | 
					 | 
				
			||||||
 '<<open-new-window>>': ['<Control-x><Control-n>'],
 | 
					 | 
				
			||||||
 '<<open-window-from-file>>': ['<Control-x><Control-f>'],
 | 
					 | 
				
			||||||
 '<<plain-newline-and-indent>>': ['<Control-j>'],
 | 
					 | 
				
			||||||
 '<<redo>>': ['<Alt-z>', '<Meta-z>'],
 | 
					 | 
				
			||||||
 '<<save-copy-of-window-as-file>>': ['<Control-x><w>'],
 | 
					 | 
				
			||||||
 '<<save-window-as-file>>': ['<Control-x><Control-w>'],
 | 
					 | 
				
			||||||
 '<<save-window>>': ['<Control-x><Control-s>'],
 | 
					 | 
				
			||||||
 '<<select-all>>': ['<Alt-a>', '<Meta-a>'],
 | 
					 | 
				
			||||||
 '<<toggle-auto-coloring>>': ['<Control-slash>'],
 | 
					 | 
				
			||||||
 '<<undo>>': ['<Control-z>']}
 | 
					 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue