mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 05:42:35 +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
|
button "#{name}", width: 0.94 do
|
||||||
change_config(name)
|
change_config(name)
|
||||||
|
|
||||||
|
if window.backend.tacnet.connected?
|
||||||
|
window.backend.tacnet.puts(TAC::TACNET::PacketHandler.packet_select_config(name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Rename configuration" do
|
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")
|
File.delete("#{TAC::CONFIGS_PATH}/#{name}.json")
|
||||||
|
|
||||||
if window.backend.settings.config == name
|
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
|
end
|
||||||
|
|
||||||
populate_configs
|
populate_configs
|
||||||
|
|||||||
@@ -218,6 +218,14 @@ module TAC
|
|||||||
list
|
list
|
||||||
)
|
)
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ module TAC
|
|||||||
|
|
||||||
def close
|
def close
|
||||||
if @backend.config_changed?
|
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?
|
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
|
else
|
||||||
cleanup_and_close
|
cleanup_and_close
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
begin
|
||||||
require_relative "../cyberarm_engine/lib/cyberarm_engine"
|
require_relative "../cyberarm_engine/lib/cyberarm_engine"
|
||||||
|
rescue LoadError
|
||||||
|
require "cyberarm_engine"
|
||||||
|
end
|
||||||
require "gosu_notifications"
|
require "gosu_notifications"
|
||||||
require "socket"
|
require "socket"
|
||||||
require "securerandom"
|
require "securerandom"
|
||||||
|
|||||||
Reference in New Issue
Block a user