diff --git a/lib/pages/configurations.rb b/lib/pages/configurations.rb index 6d00201..4e548d9 100644 --- a/lib/pages/configurations.rb +++ b/lib/pages/configurations.rb @@ -41,6 +41,10 @@ module TAC button "#{name}", width: 0.94 do change_config(name) + + if window.backend.tacnet.connected? + window.backend.tacnet.puts(TAC::TACNET::PacketHandler.packet_select_config(name)) + end end button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Rename configuration" do @@ -67,7 +71,11 @@ module TAC File.delete("#{TAC::CONFIGS_PATH}/#{name}.json") if window.backend.settings.config == name - change_config(nil) + change_config("") + end + + if window.backend.tacnet.connected? + window.backend.tacnet.puts(TAC::TACNET::PacketHandler.packet_delete_config(name)) end populate_configs diff --git a/lib/tacnet/packet_handler.rb b/lib/tacnet/packet_handler.rb index 68fcc91..98b8c1a 100644 --- a/lib/tacnet/packet_handler.rb +++ b/lib/tacnet/packet_handler.rb @@ -218,6 +218,14 @@ module TAC list ) end + + def self.packet_select_config(config_name) + Packet.create(Packet::PACKET_TYPES[:select_config], config_name) + end + + def self.packet_delete_config(config_name) + Packet.create(Packet::PACKET_TYPES[:delete_config], config_name) + end end end end diff --git a/lib/window.rb b/lib/window.rb index f5dcda2..9b05f31 100644 --- a/lib/window.rb +++ b/lib/window.rb @@ -63,9 +63,9 @@ module TAC def close if @backend.config_changed? - push_state(Dialog::ConfirmDialog, title: "Unsaved Config", message: "Config has unsaved changes\nthat will be lost if you continue!", callback_method: proc { cleanup_and_close }) + push_state(Dialog::ConfirmDialog, title: "Unsaved Config", message: "Config has unsaved changes that will be lost if you continue!", callback_method: proc { cleanup_and_close }) elsif @backend.settings_changed? - push_state(Dialog::ConfirmDialog, title: "Unsaved Settings", message: "Settings has unsaved changes\nthat will be lost if you continue!", callback_method: proc { cleanup_and_close }) + push_state(Dialog::ConfirmDialog, title: "Unsaved Settings", message: "Settings has unsaved changes that will be lost if you continue!", callback_method: proc { cleanup_and_close }) else cleanup_and_close end diff --git a/timecrafters_configuration_tool.rb b/timecrafters_configuration_tool.rb index 08beaad..8906095 100644 --- a/timecrafters_configuration_tool.rb +++ b/timecrafters_configuration_tool.rb @@ -1,4 +1,8 @@ -require_relative "../cyberarm_engine/lib/cyberarm_engine" +begin + require_relative "../cyberarm_engine/lib/cyberarm_engine" +rescue LoadError + require "cyberarm_engine" +end require "gosu_notifications" require "socket" require "securerandom"