@@ -576,24 +576,23 @@ def create_page_highlight(self):
576
576
(*)theme_message: Label
577
577
"""
578
578
self .theme_elements = {
579
- # Display_name: ('internal_name, sort_number').
580
- # TODO: remove sort_number unneeded with dict ordering.
581
- 'Normal Code or Text' : ('normal' , '00' ),
582
- 'Code Context' : ('context' , '01' ),
583
- 'Python Keywords' : ('keyword' , '02' ),
584
- 'Python Definitions' : ('definition' , '03' ),
585
- 'Python Builtins' : ('builtin' , '04' ),
586
- 'Python Comments' : ('comment' , '05' ),
587
- 'Python Strings' : ('string' , '06' ),
588
- 'Selected Text' : ('hilite' , '07' ),
589
- 'Found Text' : ('hit' , '08' ),
590
- 'Cursor' : ('cursor' , '09' ),
591
- 'Editor Breakpoint' : ('break' , '10' ),
592
- 'Shell Prompt' : ('console' , '11' ),
593
- 'Error Text' : ('error' , '12' ),
594
- 'Shell User Output' : ('stdout' , '13' ),
595
- 'Shell User Exception' : ('stderr' , '14' ),
596
- 'Line Number' : ('linenumber' , '16' ),
579
+ # Display-name: internal-config-tag-name.
580
+ 'Normal Code or Text' : 'normal' ,
581
+ 'Code Context' : 'context' ,
582
+ 'Python Keywords' : 'keyword' ,
583
+ 'Python Definitions' : 'definition' ,
584
+ 'Python Builtins' : 'builtin' ,
585
+ 'Python Comments' : 'comment' ,
586
+ 'Python Strings' : 'string' ,
587
+ 'Selected Text' : 'hilite' ,
588
+ 'Found Text' : 'hit' ,
589
+ 'Cursor' : 'cursor' ,
590
+ 'Editor Breakpoint' : 'break' ,
591
+ 'Shell Prompt' : 'console' ,
592
+ 'Error Text' : 'error' ,
593
+ 'Shell User Output' : 'stdout' ,
594
+ 'Shell User Exception' : 'stderr' ,
595
+ 'Line Number' : 'linenumber' ,
597
596
}
598
597
self .builtin_name = tracers .add (
599
598
StringVar (self ), self .var_changed_builtin_name )
@@ -653,7 +652,7 @@ def tem(event, elem=element):
653
652
# event.widget.winfo_top_level().highlight_target.set(elem)
654
653
self .highlight_target .set (elem )
655
654
text .tag_bind (
656
- self .theme_elements [element ][ 0 ] , '<ButtonPress-1>' , tem )
655
+ self .theme_elements [element ], '<ButtonPress-1>' , tem )
657
656
text ['state' ] = 'disabled'
658
657
self .style .configure ('frame_color_set.TFrame' , borderwidth = 1 ,
659
658
relief = 'solid' )
@@ -761,7 +760,6 @@ def load_theme_cfg(self):
761
760
self .set_theme_type ()
762
761
# Load theme element option menu.
763
762
theme_names = list (self .theme_elements )
764
- theme_names .sort (key = lambda x : self .theme_elements [x ][1 ])
765
763
self .targetlist .SetMenu (theme_names , theme_names [0 ])
766
764
self .paint_theme_sample ()
767
765
self .set_highlight_target ()
@@ -888,7 +886,7 @@ def on_new_color_set(self):
888
886
new_color = self .color .get ()
889
887
self .style .configure ('frame_color_set.TFrame' , background = new_color )
890
888
plane = 'foreground' if self .fg_bg_toggle .get () else 'background'
891
- sample_element = self .theme_elements [self .highlight_target .get ()][ 0 ]
889
+ sample_element = self .theme_elements [self .highlight_target .get ()]
892
890
self .highlight_sample .tag_config (sample_element , ** {plane : new_color })
893
891
theme = self .custom_name .get ()
894
892
theme_element = sample_element + '-' + plane
@@ -1002,7 +1000,7 @@ def set_color_sample(self):
1002
1000
frame_color_set
1003
1001
"""
1004
1002
# Set the color sample area.
1005
- tag = self .theme_elements [self .highlight_target .get ()][ 0 ]
1003
+ tag = self .theme_elements [self .highlight_target .get ()]
1006
1004
plane = 'foreground' if self .fg_bg_toggle .get () else 'background'
1007
1005
color = self .highlight_sample .tag_cget (tag , plane )
1008
1006
self .style .configure ('frame_color_set.TFrame' , background = color )
@@ -1032,7 +1030,7 @@ def paint_theme_sample(self):
1032
1030
else : # User theme
1033
1031
theme = self .custom_name .get ()
1034
1032
for element_title in self .theme_elements :
1035
- element = self .theme_elements [element_title ][ 0 ]
1033
+ element = self .theme_elements [element_title ]
1036
1034
colors =
8000
idleConf .GetHighlight (theme , element )
1037
1035
if element == 'cursor' : # Cursor sample needs special painting.
1038
1036
colors ['background' ] = idleConf .GetHighlight (
0 commit comments