From 7fde76f2da5d2a1da6e48e64e85bd691efe7fc6c Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Tue, 9 Jun 2020 12:50:38 -0500 Subject: [PATCH] Stubbed simulator, renamed app, added more tooltips and use more icons --- lib/states/editor.rb | 34 +++++++++++++++-------------- lib/states/manage_presets.rb | 2 +- lib/states/simulator.rb | 21 ++++++++++++++++++ lib/version.rb | 2 +- timecrafters_action_configurator.rb | 1 + 5 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 lib/states/simulator.rb diff --git a/lib/states/editor.rb b/lib/states/editor.rb index 7af324b..074050e 100644 --- a/lib/states/editor.rb +++ b/lib/states/editor.rb @@ -26,8 +26,10 @@ module TAC end flow width: 0.395 do - button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), image_width: 18, margin_left: 10, tip: "Simulate robot path" - button "Presets", text_size: 18, margin_left: 10, tip: "Manage presets" do + button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), image_width: 18, margin_left: 10, tip: "Simulator" do + push_state(Simulator) + end + button get_image("#{TAC::ROOT_PATH}/media/icons/menuList.png"), image_width: 18, margin_left: 10, tip: "Manage presets" do push_state(ManagePresets) end button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: 18, margin_left: 10, tip: "Save config to disk" do @@ -60,7 +62,7 @@ module TAC window.backend.tacnet.connect("localhost")#("192.168.1.5") end end - button "Status", text_size: 18, width: 0.475 do + button get_image("#{TAC::ROOT_PATH}/media/icons/information.png"), image_width: 18, width: 0.475 do push_state(Dialog::AlertDialog, title: "TACNET Status", message: window.backend.tacnet.full_status) end end @@ -74,11 +76,11 @@ module TAC background TAC::Palette::GROUPS_PRIMARY flow do label "Groups" - button "+", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: 18, tip: "Add group" do push_state(TAC::Dialog::NamePromptDialog, title: "Create Group", callback_method: method(:create_group)) end - button "Clone", text_size: 18, tip: "Clone currently selected group" - button "Create Preset", text_size: 18, tip: "Save group as preset" + button get_image("#{TAC::ROOT_PATH}/media/icons/button2.png"), image_width: 18, tip: "Clone currently selected group" + button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: 18, tip: "Save group as preset" end @groups_list = stack width: 1.0 do @@ -88,15 +90,15 @@ module TAC background TAC::Palette::ACTIONS_PRIMARY flow do label "Actions" - button "+", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: 18, tip: "Add action" do if @active_group push_state(TAC::Dialog::NamePromptDialog, title: "Create Action", callback_method: method(:create_action)) else push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to create action,\nno group selected.") end end - button "Clone", text_size: 18, tip: "Clone currently selected action" - button "Create Preset", text_size: 18, tip: "Save action as preset" + button get_image("#{TAC::ROOT_PATH}/media/icons/button2.png"), image_width: 18, tip: "Clone currently selected action" + button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: 18, tip: "Save action as preset" end @actions_list = stack width: 1.0 do @@ -106,7 +108,7 @@ module TAC background TAC::Palette::VARIABLES_PRIMARY flow do label "Values" - button "+", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: 18, tip: "Add variable" do if @active_action push_state(TAC::Dialog::VariableDialog, title: "Create Value", callback_method: method(:create_variable)) else @@ -248,10 +250,10 @@ module TAC @variables_list.clear end - button "E", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/wrench.png"), image_width: 18, tip: "Edit group" do push_state(Dialog::NamePromptDialog, title: "Rename Group", renaming: group, callback_method: method(:update_group)) end - button "D", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: 18, tip: "Delete group" do push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Delete group and all\nof its actions and variables?", callback_method: proc { delete_group(group) }) end end @@ -272,10 +274,10 @@ module TAC populate_variables_list(action) end - button "E", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/wrench.png"), image_width: 18, tip: "Edit action" do push_state(Dialog::NamePromptDialog, title: "Rename Action", renaming: action, callback_method: method(:update_action)) end - button "D", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: 18, tip: "Delete action" do push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Delete action and all\nof its variables?", callback_method: proc { delete_action(action) }) end end @@ -293,10 +295,10 @@ module TAC label variable.name, text_size: 18, width: 0.855 - button "E", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/wrench.png"), image_width: 18, tip: "Edit variable" do push_state(Dialog::VariableDialog, title: "Edit Variable", variable: variable, callback_method: method(:update_variable)) end - button "D", text_size: 18 do + button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: 18, tip: "Delete variable" do push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Delete variable?", callback_method: proc { delete_variable(variable) }) end end diff --git a/lib/states/manage_presets.rb b/lib/states/manage_presets.rb index 818135b..b61eabc 100644 --- a/lib/states/manage_presets.rb +++ b/lib/states/manage_presets.rb @@ -6,7 +6,7 @@ module TAC stack width: 1.0, height: 0.1 do background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] - label "Manage Presets", text_size: 28 + label "#{TAC::NAME} ― Manage Presets", text_size: 28, color: Gosu::Color::BLACK button "Close", text_size: 18 do pop_state end diff --git a/lib/states/simulator.rb b/lib/states/simulator.rb new file mode 100644 index 0000000..8c51d9f --- /dev/null +++ b/lib/states/simulator.rb @@ -0,0 +1,21 @@ +module TAC + class States + class Simulator < CyberarmEngine::GuiState + def setup + theme(THEME) + + stack width: 1.0, height: 0.1 do + background [TAC::Palette::TIMECRAFTERS_PRIMARY, TAC::Palette::TIMECRAFTERS_SECONDARY] + label "#{TAC::NAME} ― Simulator", text_size: 28, color: Gosu::Color::BLACK + button "Close", text_size: 18 do + pop_state + end + end + + flow width: 1.0, height: 1.0 do + background [Gosu::Color::GRAY, Gosu::Color::BLACK] + end + end + end + end +end \ No newline at end of file diff --git a/lib/version.rb b/lib/version.rb index 42f4449..1ad32f1 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,5 +1,5 @@ module TAC - NAME = "TimeCrafters Action Configurator" + NAME = "TimeCrafters Configuration Tool" VERSION = "0.1.0" RELEASE_NAME = "IN-DEV" end \ No newline at end of file diff --git a/timecrafters_action_configurator.rb b/timecrafters_action_configurator.rb index 92e9e2a..499fa8a 100644 --- a/timecrafters_action_configurator.rb +++ b/timecrafters_action_configurator.rb @@ -11,6 +11,7 @@ require_relative "lib/backend" require_relative "lib/config" require_relative "lib/states/boot" require_relative "lib/states/editor" +require_relative "lib/states/simulator" require_relative "lib/states/manage_presets" require_relative "lib/theme" require_relative "lib/logger"