Permalink
Browse files

FIX #15: apply correct theme from quicklist

1 parent 32b4838 commit beb7d3e633f4dab5305f8998d5e4e9677bf9bcb6 @blopker blopker committed Dec 19, 2014
Showing with 9 additions and 4 deletions.
  1. +7 −3 colorsublime-plugin.py
  2. +1 −0 colorsublime/commands.py
  3. +1 −1 colorsublime/theme.py
@@ -36,26 +36,30 @@ def display_list(self, themes):
quick_list = [[theme.name,
theme.author,
- theme.description] for theme in self.themes]
+ theme.description] for theme in self.themes.values()]
quick_list.sort()
+ self.quick_list = quick_list
self.window.show_quick_panel(quick_list,
self.on_done,
on_highlight=self.on_highlighted)
def on_highlighted(self, theme_index):
- commands.preview_theme(self.themes[theme_index])
+ commands.preview_theme(self._quick_list_to_theme(theme_index))
def on_done(self, theme_index):
if theme_index is NO_SELECTION:
commands.revert_theme(self.initial_theme)
status.message('Theme selection cancelled.')
return
- theme = self.themes[theme_index]
+ theme = self._quick_list_to_theme(theme_index)
commands.install_theme(theme)
status.message('Theme %s installed!' % theme.name)
+ def _quick_list_to_theme(self, index):
+ return self.themes[self.quick_list[index][0]]
+
class BrowseCommand(sublime_plugin.WindowCommand):
def run(self):
@@ -30,6 +30,7 @@ def fetch_repo():
io.extract(archive, settings.cache_path())
themes_list = io.read_json(settings.themes_list_path())
themes = [Theme.from_json(theme) for theme in themes_list]
+ themes = {t.name: t for t in themes}
return themes
@@ -14,7 +14,7 @@ def abs(self):
@property
def rel(self):
path = self.abs.replace(settings.packages_path(), '')
- return 'Packages/' + path
+ return 'Packages' + path
@functools.total_ordering

0 comments on commit beb7d3e

Please sign in to comment.