-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDSx_backflush.dsx
77 lines (63 loc) · 2.71 KB
/
DSx_backflush.dsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
set ::DSx_BF_alternative_ui 0
set ::DSx_BF_label_idle "Backflush"
set ::DSx_BF_label_active "Backflushing ..."
set ::DSx_BF_profile_filename "cleaning_forward_flush"
set ::DSx_BF_bypass_shot_history 1
set version 1.3.1
proc DSx_BF_start {} {
if {[file exists [homedir]/profiles/${::DSx_BF_profile_filename}.tcl] != 1} {
borg toast [translate "Could not find ${::DSx_BF_profile_filename}.tcl"]
} else {
if {$::DSx_BF_label == $::DSx_BF_label_active} {
DSx_BF_stop
} else {
set ::DSx_BF_label $::DSx_BF_label_active
set ::DSx_BF_last_profile $::settings(profile_filename)
DSx_BF_load_profile ${::DSx_BF_profile_filename}
start_espresso
}
}
}
proc DSx_BF_load_profile {profile_filename} {
set fn "[homedir]/profiles/${profile_filename}.tcl"
load_settings_vars $fn
save_settings_to_de1
}
proc DSx_BF_finished {unused_old_state unused_new_state} {
DSx_BF_stop
}
proc DSx_BF_starting {unused_old_state unused_new_state} {
if { $::DSx_BF_label == $::DSx_BF_label_active && $::DSx_BF_bypass_shot_history == 1 } {
set ::settings(should_save_history) 0
}
}
proc DSx_BF_stop {} {
if {$::DSx_BF_label == $::DSx_BF_label_active } {
set ::settings(should_save_history) $::DSx_BF_save_history
if { $::DSx_settings(pink_cup_indicator) == "." } {
load_pinkcup
} elseif { $::DSx_settings(blue_cup_indicator) == "." } {
load_bluecup
} elseif { $::DSx_settings(orange_cup_indicator) == "." } {
load_orangecup
} else {
DSx_BF_load_profile $::DSx_BF_last_profile
}
set ::DSx_BF_label $::DSx_BF_label_idle
}
}
after idle {after 0 {register_state_change_handler Espresso Idle DSx_BF_finished}}
after idle {after 0 {register_state_change_handler Idle Espresso DSx_BF_starting}}
proc DSx_BF_init_plugin args {
set ::DSx_BF_last_profile {}
set ::DSx_BF_save_history $::settings(should_save_history)
set ::DSx_BF_label $::DSx_BF_label_idle
if {$::DSx_BF_alternative_ui == 1} {
add_de1_variable "$::DSx_home_pages" 100 150 -text "" -font [DSx_font font 10] -fill $::DSx_settings(font_colour) -anchor "nw" -justify "left" -textvariable { $::DSx_BF_label }
add_de1_button "$::DSx_standby_pages" { DSx_BF_start } 50 100 400 200
} else {
add_de1_variable "$::DSx_home_pages" 100 1150 -text "" -font [DSx_font font 10] -fill $::DSx_settings(font_colour) -anchor "nw" -justify "left" -textvariable { $::DSx_BF_label }
add_de1_button "$::DSx_standby_pages" { DSx_BF_start } 50 1100 400 1200
}
}
lappend ::run_after_startup DSx_BF_init_plugin