def choose_layout(self):
def on_done(index):
if index >= 0:
layout = files[index]
self.load_layout_from_file(layout)
elif self.preview:
if index == -1:
self.layout_from_json(self.temp_layout, mode="layout")
def on_highlight(index):
if self.preview:
if index >= 0:
self.collapse_layout()
layout = files[index]
self.layout_preview(layout)
# build layouts list
path = layouts_path()
files = []
for entry in os.listdir(path):
if os.path.isfile(os.path.join(path, entry)):
# remove .layout extension from filename
entry = entry[0:(len(entry) - 7)]
files.append(entry)
self.window.show_quick_panel(
files, on_done,
sublime.KEEP_OPEN_ON_FOCUS_LOST,
0, on_highlight)
评论列表
文章目录