diff --git a/Main.sublime-menu b/Main.sublime-menu index 2fecd33..543fe7a 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -82,6 +82,12 @@ "command": "stino_open_in_new_win", "checkbox": true }, + { + "caption": "All Source Files", + "id": "stino_open_all_src", + "command": "stino_open_all_src", + "checkbox": true + }, {"caption": "-"}, { "caption": "New Sketch...", diff --git a/StinoCommands.py b/StinoCommands.py index f4c2479..d12e6ae 100644 --- a/StinoCommands.py +++ b/StinoCommands.py @@ -278,6 +278,25 @@ def is_checked(self): return state +class StinoOpenAllSrcCommand(sublime_plugin.WindowCommand): + """.""" + + def run(self): + """.""" + if stino.arduino_info['init_done']: + state = \ + bool(stino.arduino_info['settings'].get('open_all_src')) + stino.arduino_info['settings'].set('open_all_src', not state) + + def is_checked(self): + """.""" + state = False + if stino.arduino_info['init_done']: + state = \ + bool(stino.arduino_info['settings'].get('open_all_src')) + return state + + class StinoOpenSketchCommand(sublime_plugin.WindowCommand): """Open Sketch.""" diff --git a/libs/base_utils/exceptions.py b/libs/base_utils/exceptions.py new file mode 100644 index 0000000..c58a726 --- /dev/null +++ b/libs/base_utils/exceptions.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +"""Doc.""" + +from __future__ import absolute_import +from __future__ import print_function +from __future__ import division +from __future__ import unicode_literals + diff --git a/libs/stino_runtime/__init__.py b/libs/stino_runtime/__init__.py index 0fc4fc7..806a57d 100644 --- a/libs/stino_runtime/__init__.py +++ b/libs/stino_runtime/__init__.py @@ -772,14 +772,16 @@ def open_project(project_path, win): has_prj_file = True break - if has_prj_file: + is_open_all_src = arduino_info['settings'].get('open_all_src') + + if has_prj_file and not is_open_all_src: win.open_file(file_path) else: paths = glob.glob(project_path + '/*') file_paths = [p for p in paths if os.path.isfile(p)] for file_path in file_paths: ext = os.path.splitext(file_path)[-1] - if ext in c_file.INOC_EXTS: + if ext in c_file.SRC_EXTS: win.open_file(file_path) diff --git a/libs/stino_runtime/st_menu.py b/libs/stino_runtime/st_menu.py index e3a0700..a0243a2 100644 --- a/libs/stino_runtime/st_menu.py +++ b/libs/stino_runtime/st_menu.py @@ -210,6 +210,12 @@ def update_sketchbook_menu(arduino_info): text += '\t' * 6 + '"command": "stino_open_in_new_win",\n' text += '\t' * 6 + '"checkbox": true\n' text += '\t' * 5 + '},\n' + text += '\t' * 5 + '{\n' + text += '\t' * 6 + '"caption": "All Source Files",\n' + text += '\t' * 6 + '"id": "stino_open_all_src",\n' + text += '\t' * 6 + '"command": "stino_open_all_src",\n' + text += '\t' * 6 + '"checkbox": true\n' + text += '\t' * 5 + '},\n' text += '\t' * 5 + '{"caption": "-"},' text += '\t' * 5 + '{\n' text += '\t' * 6 + '"caption": "New Sketch...",\n'