コード例 #1
0
ファイル: create_layout.py プロジェクト: 7sun/ERBAutocomplete
 def run(self, edit):
     core = Core()
     path = self.view.file_name();
     self.project_dir = core.get_project_path(path)
     if self.project_dir is not None:
         self.view.window().show_input_panel('Enter layout filename.', '_custom_layout.html.erb', self.on_done, None, None)
     else:
         sublime.active_window().new_file()
コード例 #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.")