|
|
@ -8,19 +8,11 @@ import std/osproc |
|
|
|
import edit_routine_dialog |
|
|
|
import edit_routine_dialog |
|
|
|
import "../models/routine", "../shared" |
|
|
|
import "../models/routine", "../shared" |
|
|
|
|
|
|
|
|
|
|
|
##preload selectedRoutines using routines' selByDef field value from DB. |
|
|
|
|
|
|
|
#var selectedRoutines: seq[SelectedRoutine] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
viewable RoutineList: |
|
|
|
viewable RoutineList: |
|
|
|
## Displays a list of routines |
|
|
|
## Displays a list of routines |
|
|
|
|
|
|
|
|
|
|
|
#filter: string ## Filter used to search for routines |
|
|
|
|
|
|
|
routineModel: RoutineModel ## Model of all routines |
|
|
|
routineModel: RoutineModel ## Model of all routines |
|
|
|
#selectedRoutines: selectedRoutines |
|
|
|
|
|
|
|
#selectedRoutines: seq[SelectedRoutine] |
|
|
|
|
|
|
|
runStatus: string |
|
|
|
runStatus: string |
|
|
|
|
|
|
|
|
|
|
|
#proc changed(currentRun: CurrentRun) |
|
|
|
|
|
|
|
proc changed(state: bool) |
|
|
|
proc changed(state: bool) |
|
|
|
|
|
|
|
|
|
|
|
method view(list: RoutineListState): Widget {.locks: "unknown".} = |
|
|
|
method view(list: RoutineListState): Widget {.locks: "unknown".} = |
|
|
@ -30,7 +22,6 @@ method view(list: RoutineListState): Widget {.locks: "unknown".} = |
|
|
|
orient = OrientY |
|
|
|
orient = OrientY |
|
|
|
if list.routineModel.routineSeq().len() > 0: |
|
|
|
if list.routineModel.routineSeq().len() > 0: |
|
|
|
ListBox: |
|
|
|
ListBox: |
|
|
|
#for routine in list.model.search(list.filter): |
|
|
|
|
|
|
|
for it, routine in list.routineModel.routineSeq(): |
|
|
|
for it, routine in list.routineModel.routineSeq(): |
|
|
|
Box: |
|
|
|
Box: |
|
|
|
orient = OrientY |
|
|
|
orient = OrientY |
|
|
@ -39,33 +30,10 @@ method view(list: RoutineListState): Widget {.locks: "unknown".} = |
|
|
|
Box: |
|
|
|
Box: |
|
|
|
orient = OrientX |
|
|
|
orient = OrientX |
|
|
|
margin = 6 |
|
|
|
margin = 6 |
|
|
|
spacing = 6 |
|
|
|
spacing = 6 |
|
|
|
#[Switch {.expand: false.}: |
|
|
|
|
|
|
|
state = routine.selByDef |
|
|
|
|
|
|
|
proc changed(state: bool) = |
|
|
|
|
|
|
|
#if state == true: |
|
|
|
|
|
|
|
#list.selectedRoutines.ids.add(routine.id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not list.changed.isNil: |
|
|
|
|
|
|
|
list.changed.callback(list.selectedRoutines) ]# |
|
|
|
|
|
|
|
#[CheckButton {.expand: false.}: |
|
|
|
|
|
|
|
state = routine.selected |
|
|
|
|
|
|
|
#if routine.selected == true: |
|
|
|
|
|
|
|
#echo list.currentRun.selected |
|
|
|
|
|
|
|
#list.currentRun.selected[it] = true |
|
|
|
|
|
|
|
#state = t |
|
|
|
|
|
|
|
#state = list.currentRun.selectedRoutines[it] |
|
|
|
|
|
|
|
proc changed(state: bool) = |
|
|
|
|
|
|
|
list.currentRun.selectedRoutines.add(routine.id) |
|
|
|
|
|
|
|
if routine.id in list.currentRun.selectedRoutines: |
|
|
|
|
|
|
|
= state |
|
|
|
|
|
|
|
#echo "hehe" |
|
|
|
|
|
|
|
#list.currentRun.selectedRoutines[it] = state ]# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Label: |
|
|
|
Label: |
|
|
|
#text = "<span size=\"large\" weight=\"bold\">" & routine.name & "</span>" |
|
|
|
|
|
|
|
text = "<span size=\"large\">" & routine.name & "</span>" |
|
|
|
text = "<span size=\"large\">" & routine.name & "</span>" |
|
|
|
xAlign = 0 # Align left |
|
|
|
xAlign = 0 |
|
|
|
useMarkup = true |
|
|
|
useMarkup = true |
|
|
|
# Edit Button |
|
|
|
# Edit Button |
|
|
|
Button {.expand: false.}: |
|
|
|
Button {.expand: false.}: |
|
|
@ -175,7 +143,6 @@ method view(list: RoutineListState): Widget {.locks: "unknown".} = |
|
|
|
#using this as "selected" for now. |
|
|
|
#using this as "selected" for now. |
|
|
|
if routine.selByDef == true: |
|
|
|
if routine.selByDef == true: |
|
|
|
#skip routines that don't have at least one source and one destination. |
|
|
|
#skip routines that don't have at least one source and one destination. |
|
|
|
#list.routineModel.routineSeq() returns an empty seq so len != 0 when empty... |
|
|
|
|
|
|
|
if routine.sources.len != 0 and routine.destinations.len != 0: |
|
|
|
if routine.sources.len != 0 and routine.destinations.len != 0: |
|
|
|
routineRuncount += 1 |
|
|
|
routineRuncount += 1 |
|
|
|
for source in routine.sources: |
|
|
|
for source in routine.sources: |
|
|
|