Skip to content

[3.9] bpo-33610: Edit idlelib.codecontext (GH-23773) #23775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Lib/idlelib/codecontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
enclosing block. The number of hint lines is determined by the maxlines
variable in the codecontext section of config-extensions.def. Lines which do
not open blocks are not shown in the context hints pane.

For EditorWindows, <<toggle-code-context>> is bound to CodeContext(self).
toggle_code_context_event.
"""
import re
from sys import maxsize as INFINITY

import tkinter
from tkinter import Frame, Text, TclError
from tkinter.constants import NSEW, SUNKEN

from idlelib.config import idleConf
Expand Down Expand Up @@ -83,7 +86,7 @@ def __del__(self):
if self.t1 is not None:
try:
self.text.after_cancel(self.t1)
except tkinter.TclError: # pragma: no cover
except TclError: # pragma: no cover
pass
self.t1 = None

Expand Down Expand Up @@ -111,7 +114,7 @@ def toggle_code_context_event(self, event=None):
padx += widget.tk.getint(info['padx'])
padx += widget.tk.getint(widget.cget('padx'))
border += widget.tk.getint(widget.cget('border'))
context = self.context = tkinter.Text(
context = self.context = Text(
self.editwin.text_frame,
height=1,
width=1, # Don't request more than we get.
Expand All @@ -127,7 +130,7 @@ def toggle_code_context_event(self, event=None):

line_number_colors = idleConf.GetHighlight(idleConf.CurrentTheme(),
'linenumber')
self.cell00 = tkinter.Frame(self.editwin.text_frame,
self.cell00 = Frame(self.editwin.text_frame,
bg=line_number_colors['background'])
self.cell00.grid(row=0, column=0, sticky=NSEW)
menu_status = 'Hide'
Expand Down Expand Up @@ -221,7 +224,7 @@ def jumptoline(self, event=None):
"""
try:
self.context.index("sel.first")
except tkinter.TclError:
except TclError:
lines = len(self.info)
if lines == 1: # No context lines are showing.
newtop = 1
Expand Down