initial commit
This commit is contained in:
41
views/edit_routine_dialog.nim
Normal file
41
views/edit_routine_dialog.nim
Normal file
@@ -0,0 +1,41 @@
|
||||
#[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 {.locks: "unknown".} =
|
||||
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
|
||||
Reference in New Issue
Block a user