| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3a295e0 commit 4a6bb99
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,8 +95,7 @@ def loadini(struct, configfile): | |||
| 95 | 95 | ||
| 96 | 96 | color_scheme_name = config.get('general', 'color_scheme') | |
| 97 | 97 | ||
| 98 | - if color_scheme_name == 'default': | ||
| 99 | - struct.color_scheme = { | ||
| 98 | + default_colors = { | ||
| 100 | 99 | 'keyword': 'y', | |
| 101 | 100 | 'name': 'c', | |
| 102 | 101 | 'comment': 'b', | |
@@ -113,16 +112,19 @@ def loadini(struct, configfile): | |||
| 113 | 112 | 'prompt': 'c', | |
| 114 | 113 | 'prompt_more': 'g', | |
| 115 | 114 | } | |
| 115 | + | ||
| 116 | + if color_scheme_name == 'default': | ||
| 117 | + struct.color_scheme = default_colors | ||
| 116 | 118 | else: | |
| 117 | 119 | path = os.path.expanduser('~/.bpython/%s.theme' % (color_scheme_name,)) | |
| 118 | - load_theme(struct, path, config_path) | ||
| 120 | + load_theme(struct, path, config_path, default_colors) | ||
| 119 | 121 | ||
| 120 | 122 | # checks for valid key configuration this part still sucks | |
| 121 | 123 | for key in (struct.pastebin_key, struct.save_key): | |
| 122 | 124 | key_dispatch[key] | |
| 123 | 125 | ||
| 124 | 126 | ||
| 125 | - def load_theme(struct, path, inipath): | ||
| 127 | + def load_theme(struct, path, inipath, default_colors): | ||
| 126 | 128 | theme = ConfigParser() | |
| 127 | 129 | try: | |
| 128 | 130 | f = open(path, 'r') | |
@@ -137,6 +139,11 @@ def load_theme(struct, path, inipath): | |||
| 137 | 139 | struct.color_scheme[k] = theme.get('syntax', k) | |
| 138 | 140 | else: | |
| 139 | 141 | struct.color_scheme[k] = theme.get('interface', k) | |
| 142 | + | ||
| 143 | + # Check against default theme to see if all values are defined | ||
| 144 | + for k, v in default_colors.iteritems(): | ||
| 145 | + if k not in chain(theme.items('syntax'), theme.items('interface')): | ||
| 146 | + struct.color_scheme[k] = v | ||
| 140 | 147 | f.close() | |
| 141 | 148 | ||
| 142 | 149 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments