A desktop backup program focusing on ease-of-use and simplicity, as well as quality, low resource usage, and performance.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
EZ-Bkup/views/edit_routine_dialog.nim

41 lines
1.3 KiB

#[Copyright 2023 ITwrx.
This file is part of EZ-Bkup.
EZ-Bkup is released under the General Public License 3.0.
See COPYING or <https://www.gnu.org/licenses/> for details.]#
import owlkettle
import ../models/routine
import routine_editor
type EditRoutineDialogMode* = enum
EditRoutineCreate = "Create"
EditRoutineUpdate = "Update"
viewable EditRoutineDialog:
## A dialog for editing a routine. We use the same dialog for creating and updating
## a routine. Since we want to use different titles and labels for the buttons in each case,
## the EditRoutineDialog.mode field specifies the purpose of the dialog.
routine: Routine ## The routine being edited
mode: EditRoutineDialogMode ## Purpose of the dialog (create/update)
method view(dialog: EditRoutineDialogState): Widget =
result = gui:
Dialog:
title = $dialog.mode & " Routine"
defaultSize = (800, 600)
DialogButton {.addButton.}:
# Create / Update Button
text = $dialog.mode
style = [ButtonSuggested]
res = DialogAccept
DialogButton {.addButton.}:
text = "Cancel"
res = DialogCancel
# Content
RoutineEditor:
routine = dialog.routine
proc changed(routine: Routine) =
dialog.routine = routine
export EditRoutineDialog, EditRoutineDialogState