From f4ef224fa571675ced3aa851e6a440a24f2d3bdc Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 13:48:20 -0400 Subject: [PATCH 1/7] Change theme element labels --- Lib/idlelib/configdialog.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 4df6ecee69f1d2..2c418adafb8cfe 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -808,7 +808,7 @@ def create_page_highlight(self): (*)theme_message: Label """ self.theme_elements = { - 'Normal Text': ('normal', '00'), + 'Normal Code or Text': ('normal', '00'), 'Code Context': ('context', '01'), 'Python Keywords': ('keyword', '02'), 'Python Definitions': ('definition', '03'), @@ -819,10 +819,10 @@ def create_page_highlight(self): 'Found Text': ('hit', '08'), 'Cursor': ('cursor', '09'), 'Editor Breakpoint': ('break', '10'), - 'Shell Normal Text': ('console', '11'), - 'Shell Error Text': ('error', '12'), - 'Shell Stdout Text': ('stdout', '13'), - 'Shell Stderr Text': ('stderr', '14'), + 'Shell Prompt': ('console', '11'), + 'Shell Internal Error': ('error', '12'), + 'Shell User Output': ('stdout', '13'), + 'Shell User Exception': ('stderr', '14'), 'Line Number': ('linenumber', '16'), } self.builtin_name = tracers.add( From 339a680429e7c958f404c71801a3591f1fb068ba Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 14:48:23 -0400 Subject: [PATCH 2/7] Rename and revise string_tags. --- Lib/idlelib/configdialog.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 2c418adafb8cfe..f5977d0112d28d 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -820,7 +820,7 @@ def create_page_highlight(self): 'Cursor': ('cursor', '09'), 'Editor Breakpoint': ('break', '10'), 'Shell Prompt': ('console', '11'), - 'Shell Internal Error': ('error', '12'), + 'Error Text': ('error', '12'), 'Shell User Output': ('stdout', '13'), 'Shell User Exception': ('stderr', '14'), 'Line Number': ('linenumber', '16'), @@ -852,10 +852,8 @@ def create_page_highlight(self): takefocus=FALSE, highlightthickness=0, wrap=NONE) text.bind('', lambda e: 'break') text.bind('', lambda e: 'break') - text_and_tags=( - ('\n', 'normal'), - ('#you can click here', 'comment'), ('\n', 'normal'), - ('#to choose items', 'comment'), ('\n', 'normal'), + string_tags=( + ('# Click item to select.', 'comment'), ('\n', 'normal'), ('code context section', 'context'), ('\n\n', 'normal'), ('def', 'keyword'), (' ', 'normal'), ('func', 'definition'), ('(param):\n ', 'normal'), @@ -866,13 +864,14 @@ def create_page_highlight(self): ('list', 'builtin'), ('(', 'normal'), ('None', 'keyword'), (')\n', 'normal'), (' breakpoint("line")', 'break'), ('\n\n', 'normal'), - (' error ', 'error'), (' ', 'normal'), - ('cursor |', 'cursor'), ('\n ', 'normal'), - ('shell', 'console'), (' ', 'normal'), - ('stdout', 'stdout'), (' ', 'normal'), - ('stderr', 'stderr'), ('\n\n', 'normal')) - for texttag in text_and_tags: - text.insert(END, texttag[0], texttag[1]) + ('>>>', 'console'), (' 1000 ', 'normal'), + ('| cursor', 'cursor'), ('\n ', 'normal'), + ('1000', 'stdout'), ('\n', 'normal'), + ('>>>', 'console'), (' a ', 'normal'), + ('b', 'error'), ('\n', 'normal'), + ('SyntaxError', 'stderr'), ('\n', 'normal')) + for string, tag in string_tags: + text.insert(END, string, tag) n_lines = len(text.get('1.0', END).splitlines()) for lineno in range(1, n_lines): text.insert(f'{lineno}.0', From 6bb475f851cb8161668df00315289df01f537ac7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 15:14:39 -0400 Subject: [PATCH 3/7] blurb --- Misc/NEWS.d/next/IDLE/2019-07-27-15-14-20.bpo-37692.TRHGjD.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2019-07-27-15-14-20.bpo-37692.TRHGjD.rst diff --git a/Misc/NEWS.d/next/IDLE/2019-07-27-15-14-20.bpo-37692.TRHGjD.rst b/Misc/NEWS.d/next/IDLE/2019-07-27-15-14-20.bpo-37692.TRHGjD.rst new file mode 100644 index 00000000000000..b3beadc1e0264d --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2019-07-27-15-14-20.bpo-37692.TRHGjD.rst @@ -0,0 +1,2 @@ +Improve highlight config sample with example shell interaction and better +labels for shell elements. From dc2e76c75b5dfa75ba4293b5c3d8744a2edeb005 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 15:15:10 -0400 Subject: [PATCH 4/7] Final? touchup. --- Lib/idlelib/configdialog.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index f5977d0112d28d..9c90da5a97e1a5 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -853,20 +853,20 @@ def create_page_highlight(self): text.bind('', lambda e: 'break') text.bind('', lambda e: 'break') string_tags=( - ('# Click item to select.', 'comment'), ('\n', 'normal'), + ('# Click selects item.', 'comment'), ('\n', 'normal'), ('code context section', 'context'), ('\n\n', 'normal'), ('def', 'keyword'), (' ', 'normal'), ('func', 'definition'), ('(param):\n ', 'normal'), - ('"""string"""', 'string'), ('\n var0 = ', 'normal'), + ('"Return None."', 'string'), ('\n var0 = ', 'normal'), ("'string'", 'string'), ('\n var1 = ', 'normal'), ("'selected'", 'hilite'), ('\n var2 = ', 'normal'), ("'found'", 'hit'), ('\n var3 = ', 'normal'), ('list', 'builtin'), ('(', 'normal'), ('None', 'keyword'), (')\n', 'normal'), (' breakpoint("line")', 'break'), ('\n\n', 'normal'), - ('>>>', 'console'), (' 1000 ', 'normal'), + ('>>>', 'console'), (' 3.14**2 ', 'normal'), ('| cursor', 'cursor'), ('\n ', 'normal'), - ('1000', 'stdout'), ('\n', 'normal'), + ('9.8596', 'stdout'), ('\n', 'normal'), ('>>>', 'console'), (' a ', 'normal'), ('b', 'error'), ('\n', 'normal'), ('SyntaxError', 'stderr'), ('\n', 'normal')) From d705a048117afbec0cd3b9d9a643bc6422d286b5 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 17:02:05 -0400 Subject: [PATCH 5/7] Move cursor item to near top. --- Lib/idlelib/configdialog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 9c90da5a97e1a5..a05bc871ac11e7 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -854,7 +854,8 @@ def create_page_highlight(self): text.bind('', lambda e: 'break') string_tags=( ('# Click selects item.', 'comment'), ('\n', 'normal'), - ('code context section', 'context'), ('\n\n', 'normal'), + ('code context section', 'context'), ('\n', 'normal'), + ('| cursor', 'cursor'), ('\n', 'normal'), ('def', 'keyword'), (' ', 'normal'), ('func', 'definition'), ('(param):\n ', 'normal'), ('"Return None."', 'string'), ('\n var0 = ', 'normal'), @@ -864,8 +865,7 @@ def create_page_highlight(self): ('list', 'builtin'), ('(', 'normal'), ('None', 'keyword'), (')\n', 'normal'), (' breakpoint("line")', 'break'), ('\n\n', 'normal'), - ('>>>', 'console'), (' 3.14**2 ', 'normal'), - ('| cursor', 'cursor'), ('\n ', 'normal'), + ('>>>', 'console'), (' 3.14**2\n', 'normal'), ('9.8596', 'stdout'), ('\n', 'normal'), ('>>>', 'console'), (' a ', 'normal'), ('b', 'error'), ('\n', 'normal'), From 66d09855c941426ab0d6c7958e5b253fa06bdc13 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 27 Jul 2019 17:04:10 -0400 Subject: [PATCH 6/7] Characters after error-tagged char are normal. --- Lib/idlelib/configdialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index a05bc871ac11e7..8349a8939307d3 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -867,8 +867,8 @@ def create_page_highlight(self): (' breakpoint("line")', 'break'), ('\n\n', 'normal'), ('>>>', 'console'), (' 3.14**2\n', 'normal'), ('9.8596', 'stdout'), ('\n', 'normal'), - ('>>>', 'console'), (' a ', 'normal'), - ('b', 'error'), ('\n', 'normal'), + ('>>>', 'console'), (' py ', 'normal'), + ('t', 'error'), ('hon\n', 'normal'), ('SyntaxError', 'stderr'), ('\n', 'normal')) for string, tag in string_tags: text.insert(END, string, tag) From 11936db7958266804837e8778aec5b98d462fc08 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sun, 28 Jul 2019 11:14:34 -0400 Subject: [PATCH 7/7] Replace 'py thon' with 'pri nt(' as more realistic error. --- Lib/idlelib/configdialog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index 8349a8939307d3..bba17d34938d27 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -867,8 +867,8 @@ def create_page_highlight(self): (' breakpoint("line")', 'break'), ('\n\n', 'normal'), ('>>>', 'console'), (' 3.14**2\n', 'normal'), ('9.8596', 'stdout'), ('\n', 'normal'), - ('>>>', 'console'), (' py ', 'normal'), - ('t', 'error'), ('hon\n', 'normal'), + ('>>>', 'console'), (' pri ', 'normal'), + ('n', 'error'), ('t(\n', 'normal'), ('SyntaxError', 'stderr'), ('\n', 'normal')) for string, tag in string_tags: text.insert(END, string, tag)