From 2dda17afdb36f55f99e837a44c66634b0cc0a4f1 Mon Sep 17 00:00:00 2001 From: Aerilius Date: Sat, 6 Jan 2018 17:57:15 +0100 Subject: [PATCH] Fix issue 90: Turn off console on startup, add a config in menu --- src/testup/core.rb | 13 +++++++------ src/testup/ui.rb | 11 +++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/testup/core.rb b/src/testup/core.rb index e850444..a8a730f 100644 --- a/src/testup/core.rb +++ b/src/testup/core.rb @@ -39,13 +39,13 @@ module TestUp # Sketchup.write_default(TestUp::PLUGIN_ID, 'dev-mode', true) DEBUG = Sketchup.read_default(PLUGIN_ID, 'dev-mode', false) - # - if defined?(SKETCHUP_CONSOLE) - SKETCHUP_CONSOLE.show - elsif defined?(LAYOUT_CONSOLE) - LAYOUT_CONSOLE.show + if Sketchup.read_default(PLUGIN_ID, 'open_console_on_startup', false) + if defined?(SKETCHUP_CONSOLE) + SKETCHUP_CONSOLE.show + elsif defined?(LAYOUT_CONSOLE) + LAYOUT_CONSOLE.show + end end - # PATH_IMAGES = File.join(PATH, 'images').freeze PATH_JS_SCRIPTS = File.join(PATH, 'js').freeze @@ -130,6 +130,7 @@ def self.reset_settings @settings[:run_in_gui] = nil @settings[:verbose_console_tests] = nil @settings[:paths_to_testsuites] = nil + @settings[:open_console_on_startup] = nil end diff --git a/src/testup/ui.rb b/src/testup/ui.rb index 1af5cff..974ee1d 100644 --- a/src/testup/ui.rb +++ b/src/testup/ui.rb @@ -84,6 +84,16 @@ def self.init_ui cmd.status_bar_text = 'Open folder with logs.' cmd_open_logs = cmd + cmd = UI::Command.new('Open console on startup') { + self.settings[:open_console_on_startup] = !self.settings[:open_console_on_startup] + } + cmd.tooltip = 'Open console on startup' + cmd.status_bar_text = 'Open console on startup.' + cmd.set_validation_proc { + self.settings[:open_console_on_startup] ? MF_CHECKED : MF_ENABLED + } if defined?(Sketchup) + cmd_open_console_on_startup = cmd + cmd = UI::Command.new('Reload TestUp') { TESTUP_CONSOLE.clear window_visible = @window && @window.visible? @@ -136,6 +146,7 @@ def self.init_ui sub_menu.add_item('Remove Run...') { self::Runs.remove } menu.add_separator menu.add_item(cmd_open_logs) + menu.add_item(cmd_open_console_on_startup) menu.add_item(cmd_toggle_run_tests_in_console) menu.add_item(cmd_toggle_verbose_console_tests) menu.add_item(cmd_display_minitest_help)