mirror of
https://github.com/TimeCrafters/timecrafters_configuration_tool_desktop.git
synced 2025-12-16 05:42:35 +00:00
Presets are now actually created, added notifications when creating preset.
This commit is contained in:
@@ -31,22 +31,22 @@ module TAC
|
||||
|
||||
button group.name, width: 0.895
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group preset" do
|
||||
push_state(
|
||||
Dialog::NamePromptDialog,
|
||||
title: "Rename Group",
|
||||
title: "Rename Group Preset",
|
||||
renaming: group,
|
||||
list: window.backend.config.presets.groups,
|
||||
callback_method: method(:update_group)
|
||||
callback_method: method(:update_group_preset)
|
||||
)
|
||||
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 preset", **THEME_DANGER_BUTTON do
|
||||
push_state(
|
||||
Dialog::ConfirmDialog,
|
||||
title: "Are you sure?",
|
||||
message: "Delete group and all of its actions and variables?",
|
||||
callback_method: proc { delete_group(group) }
|
||||
message: "Delete group preset and all of its actions and variables?",
|
||||
callback_method: proc { delete_group_preset(group) }
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -62,28 +62,56 @@ module TAC
|
||||
|
||||
button action.name, width: 0.895
|
||||
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit group" do
|
||||
button get_image("#{TAC::ROOT_PATH}/media/icons/gear.png"), image_width: THEME_ICON_SIZE, tip: "Edit action preset" do
|
||||
push_state(
|
||||
Dialog::NamePromptDialog,
|
||||
title: "Rename Group",
|
||||
renaming: group,
|
||||
list: window.backend.config.presets.groups,
|
||||
callback_method: method(:update_group)
|
||||
title: "Rename Action Preset",
|
||||
renaming: action,
|
||||
list: window.backend.config.presets.actions,
|
||||
callback_method: method(:update_action_preset)
|
||||
)
|
||||
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 action preset", **THEME_DANGER_BUTTON do
|
||||
push_state(
|
||||
Dialog::ConfirmDialog,
|
||||
title: "Are you sure?",
|
||||
message: "Delete group and all of its actions and variables?",
|
||||
callback_method: proc { delete_group(group) }
|
||||
message: "Delete action preset and all of its actions and variables?",
|
||||
callback_method: proc { delete_action_preset(action) }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_group_preset(group, name)
|
||||
group.name = name
|
||||
window.backend.config_changed!
|
||||
|
||||
populate_group_presets
|
||||
end
|
||||
|
||||
def delete_group_preset(group)
|
||||
window.backend.config.presets.groups.delete(group)
|
||||
window.backend.config_changed!
|
||||
|
||||
populate_group_presets
|
||||
end
|
||||
|
||||
def update_action_preset(action, name)
|
||||
action.name = name
|
||||
window.backend.config_changed!
|
||||
|
||||
populate_group_presets
|
||||
end
|
||||
|
||||
def delete_action_preset(action)
|
||||
window.backend.config.presets.action.delete(action)
|
||||
window.backend.config_changed!
|
||||
|
||||
populate_action_presets
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user