| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7d50e93 commit 032ac55
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ def loadini(struct, configfile): | |||
| 164 | 164 | key_dispatch[key] | |
| 165 | 165 | ||
| 166 | 166 | # TODO consolidate | |
| 167 | - def load_gtk_theme(struct, path, inipath, default_colors): | ||
| 167 | + def load_theme(struct, path, inipath, default_colors): | ||
| 168 | 168 | theme = ConfigParser() | |
| 169 | 169 | try: | |
| 170 | 170 | f = open(path, 'r') | |
@@ -173,7 +173,7 @@ def load_gtk_theme(struct, path, inipath, default_colors): | |||
| 173 | 173 | (inipath, e)) | |
| 174 | 174 | sys.exit(1) | |
| 175 | 175 | theme.readfp(f) | |
| 176 | - struct.color_gtk_scheme = {} | ||
| 176 | + struct.color_scheme = {} | ||
| 177 | 177 | for k, v in chain(theme.items('syntax'), theme.items('interface')): | |
| 178 | 178 | if theme.has_option('syntax', k): | |
| 179 | 179 | struct.color_scheme[k] = theme.get('syntax', k) | |
@@ -187,6 +187,29 @@ def load_gtk_theme(struct, path, inipath, default_colors): | |||
| 187 | 187 | f.close() | |
| 188 | 188 | ||
| 189 | 189 | ||
| 190 | + def load_gtk_theme(struct, path, inipath, default_colors): | ||
| 191 | + theme = ConfigParser() | ||
| 192 | + try: | ||
| 193 | + f = open(path, 'r') | ||
| 194 | + except (IOError, OSError), e: | ||
| 195 | + sys.stdout.write("Error loading theme file specified in '%s':\n%s\n" % | ||
| 196 | + (inipath, e)) | ||
| 197 | + sys.exit(1) | ||
| 198 | + theme.readfp(f) | ||
| 199 | + struct.color_gtk_scheme = {} | ||
| 200 | + for k, v in chain(theme.items('syntax'), theme.items('interface')): | ||
| 201 | + if theme.has_option('syntax', k): | ||
| 202 | + struct.color_gtk_scheme[k] = theme.get('syntax', k) | ||
| 203 | + else: | ||
| 204 | + struct.color_gtk_scheme[k] = theme.get('interface', k) | ||
| 205 | + | ||
| 206 | + # Check against default theme to see if all values are defined | ||
| 207 | + for k, v in default_colors.iteritems(): | ||
| 208 | + if k not in struct.color_gtk_scheme: | ||
| 209 | + struct.color_gtk_scheme[k] = v | ||
| 210 | + f.close() | ||
| 211 | + | ||
| 212 | + | ||
| 190 | 213 | ||
| 191 | 214 | def migrate_rc(path): | |
| 192 | 215 | """Use the shlex module to convert the old configuration file to the new | |
| Back | FazBrowse Home | New Git URL |
0 commit comments