bpo-4630: Add cursor no-blink option for IDLE (GH-16960)

This immediately toggles shell, editor, and output windows, but does not affect other input widgets.
This commit is contained in:
Zackery Spytz 2019-11-13 00:13:33 -07:00 committed by Terry Jan Reedy
parent 2d56af7a94
commit 9c2844927d
7 changed files with 48 additions and 1 deletions

View file

@ -241,6 +241,12 @@ class EditorWindow(object):
self.indentwidth = self.tabwidth
self.set_notabs_indentwidth()
# Store the current value of the insertofftime now so we can restore
# it if needed.
if not hasattr(idleConf, 'blink_off_time'):
idleConf.blink_off_time = self.text['insertofftime']
self.update_cursor_blink()
# 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.
@ -803,6 +809,16 @@ class EditorWindow(object):
text.mark_set("insert", pos + "+1c")
text.see(pos)
def update_cursor_blink(self):
"Update the cursor blink configuration."
cursorblink = idleConf.GetOption(
'main', 'EditorWindow', 'cursor-blink', type='bool')
if not cursorblink:
self.text['insertofftime'] = 0
else:
# Restore the original value
self.text['insertofftime'] = idleConf.blink_off_time
def ResetFont(self):
"Update the text widgets' font if it is changed"
# Called from configdialog.py