mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 13:52:34 +00:00
Initial presets editing support
This commit is contained in:
@@ -48,6 +48,8 @@ module TAC
|
|||||||
|
|
||||||
populate_groups_list
|
populate_groups_list
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to clone group, no group selected.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -61,6 +63,8 @@ module TAC
|
|||||||
|
|
||||||
window.toast("Saved Group Preset", "Saved preset: #{name}")
|
window.toast("Saved Group Preset", "Saved preset: #{name}")
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to create group preset, no group selected.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -77,7 +81,7 @@ module TAC
|
|||||||
if @active_group
|
if @active_group
|
||||||
push_state(TAC::Dialog::ActionDialog, title: "Create Action", list: @active_group.actions, callback_method: method(:create_action))
|
push_state(TAC::Dialog::ActionDialog, title: "Create Action", list: @active_group.actions, callback_method: method(:create_action))
|
||||||
else
|
else
|
||||||
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to create action,\nno group selected.")
|
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to create action, no group selected.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -92,6 +96,8 @@ module TAC
|
|||||||
|
|
||||||
populate_actions_list(@active_group)
|
populate_actions_list(@active_group)
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to clone action, no action selected.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,6 +111,8 @@ module TAC
|
|||||||
|
|
||||||
window.toast("Saved Action Preset", "Saved preset: #{name}")
|
window.toast("Saved Action Preset", "Saved preset: #{name}")
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
push_state(TAC::Dialog::AlertDialog, title: "Error", message: "Unable to create action preset, no action selected.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -133,20 +141,38 @@ module TAC
|
|||||||
|
|
||||||
populate_groups_list
|
populate_groups_list
|
||||||
|
|
||||||
if @options[:group]
|
if @options[:group_is_preset]
|
||||||
@active_group = @options[:group]
|
@active_group = @options[:group]
|
||||||
@active_group_label.value = @active_group.name
|
@active_group_label.value = @active_group.name
|
||||||
|
|
||||||
populate_actions_list(@active_group)
|
populate_actions_list(@active_group)
|
||||||
|
|
||||||
if @options[:action]
|
@groups_menu.hide
|
||||||
@active_action = @options[:action]
|
|
||||||
@active_action_label.value = @active_action.name
|
|
||||||
|
|
||||||
populate_variables_list(@active_action)
|
elsif @options[:action_is_preset]
|
||||||
|
@active_action = @options[:action]
|
||||||
|
@active_action_label.value = @active_action.name
|
||||||
|
|
||||||
if @options[:variable]
|
populate_variables_list(@options[:action])
|
||||||
# Scroll into view?
|
|
||||||
|
@groups_menu.hide
|
||||||
|
@actions_menu.hide
|
||||||
|
|
||||||
|
else
|
||||||
|
if @options[:group]
|
||||||
|
@active_group = @options[:group]
|
||||||
|
@active_group_label.value = @active_group.name
|
||||||
|
|
||||||
|
populate_actions_list(@active_group)
|
||||||
|
|
||||||
|
if @options[:action]
|
||||||
|
@active_action = @options[:action]
|
||||||
|
@active_action_label.value = @active_action.name
|
||||||
|
|
||||||
|
populate_variables_list(@active_action)
|
||||||
|
|
||||||
|
if @options[:variable]
|
||||||
|
# Scroll into view?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -241,7 +267,11 @@ module TAC
|
|||||||
end
|
end
|
||||||
|
|
||||||
def populate_groups_list
|
def populate_groups_list
|
||||||
groups = window.backend.config.groups
|
groups = []
|
||||||
|
|
||||||
|
unless @options[:group_is_preset] || @options[:action_is_preset]
|
||||||
|
groups = window.backend.config.groups
|
||||||
|
end
|
||||||
|
|
||||||
@groups_list.clear do
|
@groups_list.clear do
|
||||||
groups.each_with_index do |group, i|
|
groups.each_with_index do |group, i|
|
||||||
@@ -262,7 +292,7 @@ module TAC
|
|||||||
push_state(Dialog::NamePromptDialog, title: "Rename Group", renaming: group, list: window.backend.config.groups, callback_method: method(:update_group))
|
push_state(Dialog::NamePromptDialog, title: "Rename Group", renaming: group, list: window.backend.config.groups, callback_method: method(:update_group))
|
||||||
end
|
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::ROOT_PATH}/media/icons/trashcan.png"), image_width: THEME_ICON_SIZE, tip: "Delete group", **THEME_DANGER_BUTTON 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) })
|
push_state(Dialog::ConfirmDialog, title: "Are you sure?", message: "Delete group and all of its actions and variables?", callback_method: proc { delete_group(group) })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ module TAC
|
|||||||
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do
|
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do
|
||||||
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
|
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
|
||||||
|
|
||||||
button group.name, width: 0.895
|
button group.name, width: 0.895 do
|
||||||
|
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 preset" do
|
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group preset" do
|
||||||
push_state(
|
push_state(
|
||||||
@@ -60,7 +62,9 @@ module TAC
|
|||||||
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do
|
flow(width: 1.0, **THEME_ITEM_CONTAINER_PADDING) do
|
||||||
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
|
background i.even? ? THEME_EVEN_COLOR : THEME_ODD_COLOR
|
||||||
|
|
||||||
button action.name, width: 0.895
|
button action.name, width: 0.895 do
|
||||||
|
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 preset" do
|
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action preset" do
|
||||||
push_state(
|
push_state(
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ require_relative "lib/backend"
|
|||||||
require_relative "lib/config"
|
require_relative "lib/config"
|
||||||
require_relative "lib/settings"
|
require_relative "lib/settings"
|
||||||
require_relative "lib/states/boot"
|
require_relative "lib/states/boot"
|
||||||
require_relative "lib/states/editor"
|
|
||||||
require_relative "lib/states/new_editor"
|
require_relative "lib/states/new_editor"
|
||||||
require_relative "lib/states/simulator"
|
# require_relative "lib/states/editor"
|
||||||
require_relative "lib/states/manage_presets"
|
# require_relative "lib/states/simulator"
|
||||||
require_relative "lib/states/manage_configurations"
|
# require_relative "lib/states/manage_presets"
|
||||||
|
# require_relative "lib/states/manage_configurations"
|
||||||
require_relative "lib/page"
|
require_relative "lib/page"
|
||||||
require_relative "lib/pages/home"
|
require_relative "lib/pages/home"
|
||||||
require_relative "lib/pages/editor"
|
require_relative "lib/pages/editor"
|
||||||
|
|||||||
Reference in New Issue
Block a user