Apply the theme colors to each element tag in the sample text. Instance attributes accessed: theme_elements theme_source builtin_name custom_name Attributes updated: highlight_sample: Set the tag elements to the theme.
(self)
| 1006 | self.style.configure('frame_color_set.TFrame', background=color) |
| 1007 | |
| 1008 | def paint_theme_sample(self): |
| 1009 | """Apply the theme colors to each element tag in the sample text. |
| 1010 | |
| 1011 | Instance attributes accessed: |
| 1012 | theme_elements |
| 1013 | theme_source |
| 1014 | builtin_name |
| 1015 | custom_name |
| 1016 | |
| 1017 | Attributes updated: |
| 1018 | highlight_sample: Set the tag elements to the theme. |
| 1019 | |
| 1020 | Methods: |
| 1021 | set_color_sample |
| 1022 | |
| 1023 | Called from: |
| 1024 | var_changed_builtin_name |
| 1025 | var_changed_custom_name |
| 1026 | load_theme_cfg |
| 1027 | """ |
| 1028 | if self.theme_source.get(): # Default theme |
| 1029 | theme = self.builtin_name.get() |
| 1030 | else: # User theme |
| 1031 | theme = self.custom_name.get() |
| 1032 | for element_title in self.theme_elements: |
| 1033 | element = self.theme_elements[element_title] |
| 1034 | colors = idleConf.GetHighlight(theme, element) |
| 1035 | if element == 'cursor': # Cursor sample needs special painting. |
| 1036 | colors['background'] = idleConf.GetHighlight( |
| 1037 | theme, 'normal')['background'] |
| 1038 | # Handle any unsaved changes to this theme. |
| 1039 | if theme in changes['highlight']: |
| 1040 | theme_dict = changes['highlight'][theme] |
| 1041 | if element + '-foreground' in theme_dict: |
| 1042 | colors['foreground'] = theme_dict[element + '-foreground'] |
| 1043 | if element + '-background' in theme_dict: |
| 1044 | colors['background'] = theme_dict[element + '-background'] |
| 1045 | self.highlight_sample.tag_config(element, **colors) |
| 1046 | self.set_color_sample() |
| 1047 | |
| 1048 | def save_new(self, theme_name, theme): |
| 1049 | """Save a newly created theme to idleConf. |