コード例 #1
0
 def run(self, edit):
     core = Core()
     project_dir = self.view.file_name()
     partial_dir = core.get_partial_path(project_dir)
     self.partial_asset = os.path.relpath(partial_dir, os.path.dirname(project_dir))
     self.partial_list = []
     for name in os.listdir(partial_dir):
         if core.is_erb_layout_file(name) is False:
             continue
         if os.path.isfile(os.path.join(partial_dir, name)):
             self.partial_list.append([name, os.path.join(partial_dir, name)])
     sublime.active_window().show_quick_panel(self.partial_list, self.on_mapping)
コード例 #2
0
 def run(self, *args, **kwargs):
     core = Core()
     self.layout_list = []
     path = self.window.active_view().file_name()
     if core.is_erb_file(path) is False:
         sublime.error_message("File is not ERB file.")
         return
     self.project_dir = core.get_project_path(path)
     self.view_dir = os.path.dirname(path)
     if self.project_dir is not None:
         for name in os.listdir(self.project_dir):
             if core.is_erb_layout_file(name) is False:
                 continue
             if os.path.isfile(os.path.join(self.project_dir, name)):
                 self.layout_list.append([name, os.path.join(self.project_dir, name)])
         sublime.active_window().show_quick_panel(self.layout_list, self.on_mapping)
     else:
         sublime.error_message("We don't find your project folder. Please check your '.base' file.")