mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 13:52:34 +00:00
Refactored ROOT_PATH to be a subfolder in the current user's home directory (configs and settings will not need to be manually moved between updates)
This commit is contained in:
@@ -5,7 +5,7 @@ module TAC
|
||||
header_bar("Manage Configurations")
|
||||
|
||||
menu_bar.clear do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_height: 1.0, tip: "Add configuration" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_height: 1.0, tip: "Add configuration" do
|
||||
push_state(Dialog::NamePromptDialog, title: "Config Name", callback_method: proc { |name|
|
||||
window.backend.write_new_config(name)
|
||||
|
||||
@@ -60,7 +60,7 @@ module TAC
|
||||
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::MEDIA_PATH}/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Rename configuration" do
|
||||
push_state(Dialog::NamePromptDialog, title: "Rename Config", renaming: @config_files_list.find { |c| c.name == name }, list: @config_files_list, accept_label: "Update", callback_method: proc { |old_name, new_name|
|
||||
if not File.exist?("#{TAC::CONFIGS_PATH}/#{new_name}.json")
|
||||
FileUtils.mv(
|
||||
@@ -79,7 +79,7 @@ module TAC
|
||||
})
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, **THEME_DANGER_BUTTON, tip: "Delete configuration" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, **THEME_DANGER_BUTTON, tip: "Delete configuration" do
|
||||
push_state(Dialog::ConfirmDialog, title: "Delete Config?", dangerous: true, callback_method: proc {
|
||||
File.delete("#{TAC::CONFIGS_PATH}/#{name}.json")
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ module TAC
|
||||
]
|
||||
|
||||
menu_bar.clear do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_height: 1.0, tip: "Export rotation as Comma-Seperated Values" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/save.png"), image_height: 1.0, tip: "Export rotation as Comma-Seperated Values" do
|
||||
export_rotation
|
||||
|
||||
@status_bar.clear do
|
||||
@@ -45,7 +45,7 @@ module TAC
|
||||
|
||||
flow(width: 1.0, height: 32, margin_bottom: 20) do
|
||||
@role_name = edit_line "", placeholder: "Add role", fill: true, height: 1.0
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_height: 1.0, tip: "Add role" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_height: 1.0, tip: "Add role" do
|
||||
if @role_name.value.strip.length.positive?
|
||||
@roles.push(@role_name.value.strip)
|
||||
@role_name.value = ""
|
||||
@@ -64,7 +64,7 @@ module TAC
|
||||
|
||||
flow(width: 1.0, height: 32, margin_bottom: 20) do
|
||||
@roster_name = edit_line "", placeholder: "Add name", height: 1.0, fill: true
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_height: 1.0, tip: "Add name" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_height: 1.0, tip: "Add name" do
|
||||
if @roster_name.value.strip.length.positive?
|
||||
@roster.push(@roster_name.value.strip)
|
||||
@roster_name.value = ""
|
||||
@@ -99,7 +99,7 @@ module TAC
|
||||
background i.even? ? 0xff_007000 : 0xff_006000
|
||||
|
||||
tagline name, fill: true
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_height: 1.0, tip: "Remove role", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_height: 1.0, tip: "Remove role", **THEME_DANGER_BUTTON do
|
||||
@roles.delete(name)
|
||||
populate_roles
|
||||
end
|
||||
@@ -115,7 +115,7 @@ module TAC
|
||||
background i.even? ? 0xff_007000 : 0xff_006000
|
||||
|
||||
tagline name, fill: true
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_height: 1.0, tip: "Remove name", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_height: 1.0, tip: "Remove name", **THEME_DANGER_BUTTON do
|
||||
@roster.delete(name)
|
||||
populate_roster
|
||||
end
|
||||
|
||||
@@ -46,11 +46,11 @@ module TAC
|
||||
@groups_menu = flow(width: 1.0, height: 36) do
|
||||
label "Groups", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add group" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add group" do
|
||||
push_state(TAC::Dialog::NamePromptDialog, title: "Create Group", list: window.backend.config.groups, callback_method: method(:create_group))
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/button2.png"), image_width: THEME_ICON_SIZE, tip: "Clone currently selected group" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/button2.png"), image_width: THEME_ICON_SIZE, tip: "Clone currently selected group" do
|
||||
if @active_group
|
||||
push_state(Dialog::NamePromptDialog, title: "Clone Group", renaming: @active_group, accept_label: "Clone", list: window.backend.config.groups, callback_method: proc { |group, name|
|
||||
clone = TAC::Config::Group.from_json( JSON.parse( @active_group.to_json, symbolize_names: true ))
|
||||
@@ -72,7 +72,7 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: THEME_ICON_SIZE, tip: "Save group as preset" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/save.png"), image_width: THEME_ICON_SIZE, tip: "Save group as preset" do
|
||||
if @active_group
|
||||
push_state(Dialog::NamePromptDialog, title: "Save Group Preset", renaming: @active_group, accept_label: "Save", list: window.backend.config.presets.groups, callback_method: proc { |group, name|
|
||||
clone = TAC::Config::Group.from_json( JSON.parse( @active_group.to_json, symbolize_names: true ))
|
||||
@@ -89,7 +89,7 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/import.png"), image_width: THEME_ICON_SIZE, tip: "Import group from preset" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/import.png"), image_width: THEME_ICON_SIZE, tip: "Import group from preset" do
|
||||
push_state(Dialog::PickPresetDialog, title: "Pick Group Preset", limit: :groups, callback_method: proc { |preset|
|
||||
push_state(Dialog::NamePromptDialog, title: "Name Group", renaming: preset, accept_label: "Add", list: window.backend.config.groups, callback_method: proc { |group, name|
|
||||
clone = TAC::Config::Group.from_json( JSON.parse( group.to_json, symbolize_names: true ))
|
||||
@@ -119,7 +119,7 @@ module TAC
|
||||
@actions_menu = flow(width: 1.0, height: 36) do
|
||||
label "Actions", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add action" do
|
||||
if @active_group
|
||||
push_state(TAC::Dialog::ActionDialog, title: "Create Action", list: @active_group.actions, callback_method: method(:create_action))
|
||||
else
|
||||
@@ -127,7 +127,7 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/button2.png"), image_width: THEME_ICON_SIZE, tip: "Clone currently selected action" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/button2.png"), image_width: THEME_ICON_SIZE, tip: "Clone currently selected action" do
|
||||
if @active_group && @active_action
|
||||
push_state(Dialog::ActionDialog, title: "Clone Action", action: @active_action, cloning: true, accept_label: "Clone", list: @active_group.actions, callback_method: proc { |action, name, comment|
|
||||
clone = TAC::Config::Action.from_json( JSON.parse( @active_action.to_json, symbolize_names: true ))
|
||||
@@ -150,7 +150,7 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), image_width: THEME_ICON_SIZE, tip: "Save action as preset" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/save.png"), image_width: THEME_ICON_SIZE, tip: "Save action as preset" do
|
||||
if @active_action
|
||||
push_state(Dialog::NamePromptDialog, title: "Save Action Preset", renaming: @active_action, accept_label: "Save", list: window.backend.config.presets.actions, callback_method: proc { |action, name|
|
||||
clone = TAC::Config::Action.from_json( JSON.parse( @active_action.to_json, symbolize_names: true ))
|
||||
@@ -167,7 +167,7 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/import.png"), image_width: THEME_ICON_SIZE, tip: "Import action from preset" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/import.png"), image_width: THEME_ICON_SIZE, tip: "Import action from preset" do
|
||||
if @active_group
|
||||
push_state(Dialog::PickPresetDialog, title: "Pick Action Preset", limit: :actions, callback_method: proc { |preset|
|
||||
push_state(Dialog::ActionDialog, title: "Name Action", action: preset, accept_label: "Add", list: @active_group.actions, callback_method: proc { |action, name, comment|
|
||||
@@ -202,7 +202,7 @@ module TAC
|
||||
stack fill: true, height: 1.0, padding_left: 2, padding_right: 2 do
|
||||
@variables_menu = flow(width: 1.0, height: 36) do
|
||||
label "Variables", text_size: THEME_SUBHEADING_TEXT_SIZE, fill: true, text_align: :center
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add variable" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/plus.png"), image_width: THEME_ICON_SIZE, tip: "Add variable" do
|
||||
if @active_action
|
||||
push_state(TAC::Dialog::VariableDialog, title: "Create Variable", list: @active_action.variables, callback_method: method(:create_variable))
|
||||
else
|
||||
@@ -553,10 +553,10 @@ module TAC
|
||||
@variables_list.clear
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
push_state(Dialog::NamePromptDialog, title: "Rename Group", renaming: group, list: window.backend.config.groups, callback_method: method(:update_group))
|
||||
end
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete group", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete group", **THEME_DANGER_BUTTON do
|
||||
push_state(Dialog::ConfirmDialog, dangerous: true, title: "Are you sure?", message: "Delete group and all of its actions and variables?", callback_method: proc { delete_group(group) })
|
||||
end
|
||||
end
|
||||
@@ -586,11 +586,11 @@ module TAC
|
||||
window.backend.config_changed!
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action" do
|
||||
push_state(Dialog::ActionDialog, title: "Edit Action", action: action, list: @active_group.actions, callback_method: method(:update_action))
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete action", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete action", **THEME_DANGER_BUTTON do
|
||||
push_state(Dialog::ConfirmDialog, dangerous: true, title: "Are you sure?", message: "Delete action and all of its variables?", callback_method: proc { delete_action(action) })
|
||||
end
|
||||
end
|
||||
@@ -612,7 +612,7 @@ module TAC
|
||||
push_state(Dialog::VariableDialog, title: "Edit Variable", variable: variable, list: @active_action.variables, callback_method: method(:update_variable))
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete variable", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete variable", **THEME_DANGER_BUTTON do
|
||||
push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Delete variable?", callback_method: proc { delete_variable(variable) })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ module TAC
|
||||
# Spawn game clock window
|
||||
$clock_pid = Process.spawn(
|
||||
RbConfig.ruby,
|
||||
"#{ROOT_PATH}/timecrafters_configuration_tool.rb",
|
||||
"#{MEDIA_PATH}/../timecrafters_configuration_tool.rb",
|
||||
"--game-clock-remote-display"
|
||||
)
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ module TAC
|
||||
page(TAC::Pages::Editor, { group: group, group_is_preset: true })
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
push_state(
|
||||
Dialog::NamePromptDialog,
|
||||
title: "Rename Group Preset",
|
||||
@@ -128,7 +128,7 @@ module TAC
|
||||
)
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete group", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete group", **THEME_DANGER_BUTTON do
|
||||
push_state(
|
||||
Dialog::ConfirmDialog,
|
||||
title: "Are you sure?",
|
||||
@@ -151,7 +151,7 @@ module TAC
|
||||
page(TAC::Pages::Editor, { action: action, action_is_preset: true })
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action" do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action" do
|
||||
push_state(
|
||||
Dialog::ActionDialog,
|
||||
title: "Edit Action Preset",
|
||||
@@ -161,7 +161,7 @@ module TAC
|
||||
)
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete action", **THEME_DANGER_BUTTON do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete action", **THEME_DANGER_BUTTON do
|
||||
push_state(
|
||||
Dialog::ConfirmDialog,
|
||||
title: "Are you sure?",
|
||||
|
||||
@@ -6,7 +6,7 @@ module TAC
|
||||
|
||||
menu_bar.clear do
|
||||
search = edit_line "", fill: true, height: 1.0
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/zoom.png"), image_height: 1.0 do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/zoom.png"), image_height: 1.0 do
|
||||
unless search.value.strip.empty?
|
||||
search_results = search_config(search.value.strip)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ module TAC
|
||||
header_bar("Simulator")
|
||||
|
||||
menu_bar.clear do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/right.png"), tip: "Run Simulation", image_height: 1.0 do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/right.png"), tip: "Run Simulation", image_height: 1.0 do
|
||||
save_source
|
||||
|
||||
begin
|
||||
@@ -19,11 +19,11 @@ module TAC
|
||||
end
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/stop.png"), tip: "Stop Simulation", image_height: 1.0 do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/stop.png"), tip: "Stop Simulation", image_height: 1.0 do
|
||||
@simulation.robots.each { |robot| robot.queue.clear } if @simulation
|
||||
end
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/save.png"), tip: "Save", image_height: 1.0 do
|
||||
button get_image("#{TAC::MEDIA_PATH}/icons/save.png"), tip: "Save", image_height: 1.0 do
|
||||
save_source
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ module TAC
|
||||
end
|
||||
|
||||
status_bar.clear do
|
||||
@tacnet_icon = image "#{TAC::ROOT_PATH}/media/icons/signal3.png", height: 26
|
||||
@tacnet_icon = image "#{TAC::MEDIA_PATH}/icons/signal3.png", height: 26
|
||||
@status_label = label "TACNET: Not Connected", text_size: 26
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user