(self, flist=None, filename=None, key=None, root=None)
| 59 | user_input_insert_tags = None |
| 60 | |
| 61 | def __init__(self, flist=None, filename=None, key=None, root=None): |
| 62 | # Delay import: runscript imports pyshell imports EditorWindow. |
| 63 | from idlelib.runscript import ScriptBinding |
| 64 | |
| 65 | if EditorWindow.help_url is None: |
| 66 | EditorWindow.help_url = _get_dochome() |
| 67 | self.flist = flist |
| 68 | root = root or flist.root |
| 69 | self.root = root |
| 70 | self.menubar = Menu(root) |
| 71 | self.top = top = window.ListedToplevel(root, menu=self.menubar) |
| 72 | if flist: |
| 73 | self.tkinter_vars = flist.vars |
| 74 | #self.top.instance_dict makes flist.inversedict available to |
| 75 | #configdialog.py so it can access all EditorWindow instances |
| 76 | self.top.instance_dict = flist.inversedict |
| 77 | else: |
| 78 | self.tkinter_vars = {} # keys: Tkinter event names |
| 79 | # values: Tkinter variable instances |
| 80 | self.top.instance_dict = {} |
| 81 | self.recent_files_path = idleConf.userdir and os.path.join( |
| 82 | idleConf.userdir, 'recent-files.lst') |
| 83 | |
| 84 | self.prompt_last_line = '' # Override in PyShell |
| 85 | self.text_frame = text_frame = Frame(top) |
| 86 | self.vbar = vbar = Scrollbar(text_frame, name='vbar') |
| 87 | width = idleConf.GetOption('main', 'EditorWindow', 'width', type='int') |
| 88 | text_options = { |
| 89 | 'name': 'text', |
| 90 | 'padx': 5, |
| 91 | 'wrap': 'none', |
| 92 | 'highlightthickness': 0, |
| 93 | 'width': width, |
| 94 | 'tabstyle': 'wordprocessor', # new in 8.5 |
| 95 | 'height': idleConf.GetOption( |
| 96 | 'main', 'EditorWindow', 'height', type='int'), |
| 97 | } |
| 98 | self.text = text = MultiCallCreator(Text)(text_frame, **text_options) |
| 99 | self.top.focused_widget = self.text |
| 100 | |
| 101 | self.createmenubar() |
| 102 | self.apply_bindings() |
| 103 | |
| 104 | self.top.protocol("WM_DELETE_WINDOW", self.close) |
| 105 | self.top.bind("<<close-window>>", self.close_event) |
| 106 | if macosx.isAquaTk(): |
| 107 | # Command-W on editor windows doesn't work without this. |
| 108 | text.bind('<<close-window>>', self.close_event) |
| 109 | # Some OS X systems have only one mouse button, so use |
| 110 | # control-click for popup context menus there. For two |
| 111 | # buttons, AquaTk defines <2> as the right button, not <3>. |
| 112 | text.bind("<Control-Button-1>",self.right_menu_event) |
| 113 | text.bind("<2>", self.right_menu_event) |
| 114 | else: |
| 115 | # Elsewhere, use right-click for popup menus. |
| 116 | text.bind("<3>",self.right_menu_event) |
| 117 | |
| 118 | text.bind('<MouseWheel>', wheel_event) |
nothing calls this directly
no test coverage detected