Skip to content

Commit

Permalink
Fix issue 90: Turn off console on startup, add a config in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilius committed Jan 6, 2018
1 parent ffcb609 commit 2dda17a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/testup/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ module TestUp
# Sketchup.write_default(TestUp::PLUGIN_ID, 'dev-mode', true)
DEBUG = Sketchup.read_default(PLUGIN_ID, 'dev-mode', false)

# <debug>
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
# </debug>

PATH_IMAGES = File.join(PATH, 'images').freeze
PATH_JS_SCRIPTS = File.join(PATH, 'js').freeze
Expand Down Expand Up @@ -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


Expand Down
11 changes: 11 additions & 0 deletions src/testup/ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2dda17a

Please sign in to comment.