mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-15 13:32:33 +00:00
Add support for select and delete config packet emission
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user