|
|
@ -4,7 +4,7 @@ EZ-Bkup is released under the General Public License 3.0. |
|
|
|
See COPYING or <https://www.gnu.org/licenses/> for details.]# |
|
|
|
See COPYING or <https://www.gnu.org/licenses/> for details.]# |
|
|
|
|
|
|
|
|
|
|
|
import owlkettle |
|
|
|
import owlkettle |
|
|
|
import std/osproc, std/os, std/logging |
|
|
|
import osproc, os, logging, sequtils |
|
|
|
import edit_routine_dialog |
|
|
|
import edit_routine_dialog |
|
|
|
import "../models/routine", "../shared" |
|
|
|
import "../models/routine", "../shared" |
|
|
|
|
|
|
|
|
|
|
@ -13,15 +13,10 @@ viewable RoutineList: |
|
|
|
runStatus: string |
|
|
|
runStatus: string |
|
|
|
selected: seq[RoutineId] |
|
|
|
selected: seq[RoutineId] |
|
|
|
|
|
|
|
|
|
|
|
# hey, hook. |
|
|
|
|
|
|
|
hooks: |
|
|
|
hooks: |
|
|
|
# yes, you, the build hook. |
|
|
|
|
|
|
|
build: |
|
|
|
build: |
|
|
|
# i love you. :) |
|
|
|
|
|
|
|
state.selected = selectedPreload() |
|
|
|
state.selected = selectedPreload() |
|
|
|
|
|
|
|
|
|
|
|
proc changed(state: bool) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var thread: Thread[RoutineListState] |
|
|
|
var thread: Thread[RoutineListState] |
|
|
|
|
|
|
|
|
|
|
|
proc rsyncThread(list: RoutineListState) {.thread.} = |
|
|
|
proc rsyncThread(list: RoutineListState) {.thread.} = |
|
|
@ -116,7 +111,7 @@ method view(list: RoutineListState): Widget = |
|
|
|
margin = 6 |
|
|
|
margin = 6 |
|
|
|
spacing = 6 |
|
|
|
spacing = 6 |
|
|
|
Switch {.expand: false, vAlign: AlignCenter.}: |
|
|
|
Switch {.expand: false, vAlign: AlignCenter.}: |
|
|
|
state = routine.selByDef |
|
|
|
state = sequtils.any(list.selected, proc (id: RoutineId): bool = id == routine.id) |
|
|
|
tooltip = "Enable/Disable this Routine for the current Bkup run." |
|
|
|
tooltip = "Enable/Disable this Routine for the current Bkup run." |
|
|
|
proc changed(state: bool) = |
|
|
|
proc changed(state: bool) = |
|
|
|
if state == true: |
|
|
|
if state == true: |
|
|
@ -125,9 +120,6 @@ method view(list: RoutineListState): Widget = |
|
|
|
let index = list.selected.find(routine.id) |
|
|
|
let index = list.selected.find(routine.id) |
|
|
|
if index != -1: |
|
|
|
if index != -1: |
|
|
|
list.selected.delete(index) |
|
|
|
list.selected.delete(index) |
|
|
|
|
|
|
|
|
|
|
|
if not list.changed.isNil: |
|
|
|
|
|
|
|
list.changed.callback(true) |
|
|
|
|
|
|
|
Label: |
|
|
|
Label: |
|
|
|
text = "<span size=\"large\">" & routine.name & "</span>" |
|
|
|
text = "<span size=\"large\">" & routine.name & "</span>" |
|
|
|
xAlign = 0 |
|
|
|
xAlign = 0 |
|
|
@ -146,12 +138,14 @@ method view(list: RoutineListState): Widget = |
|
|
|
if res.kind == DialogAccept: |
|
|
|
if res.kind == DialogAccept: |
|
|
|
# The "Update" button was clicked |
|
|
|
# The "Update" button was clicked |
|
|
|
list.routineModel.update(EditRoutineDialogState(state).routine) |
|
|
|
list.routineModel.update(EditRoutineDialogState(state).routine) |
|
|
|
|
|
|
|
list.selected = selectedPreload() |
|
|
|
# Delete Button |
|
|
|
# Delete Button |
|
|
|
Button {.expand: false.}: |
|
|
|
Button {.expand: false.}: |
|
|
|
icon = "user-trash-symbolic" |
|
|
|
icon = "user-trash-symbolic" |
|
|
|
tooltip = "Delete this Routine. Warning: will not ask you to confirm." |
|
|
|
tooltip = "Delete this Routine. Warning: will not ask you to confirm." |
|
|
|
proc clicked() = |
|
|
|
proc clicked() = |
|
|
|
list.routineModel.delete(routine.id) |
|
|
|
list.routineModel.delete(routine.id) |
|
|
|
|
|
|
|
list.selected = selectedPreload() |
|
|
|
if routine.id in list.selected: |
|
|
|
if routine.id in list.selected: |
|
|
|
Box: |
|
|
|
Box: |
|
|
|
orient = OrientY |
|
|
|
orient = OrientY |
|
|
|