1 | #!/usr/bin/wish |
---|
2 | |
---|
3 | package require Tix |
---|
4 | |
---|
5 | proc addSampleToList { } { |
---|
6 | global lf |
---|
7 | global sf |
---|
8 | |
---|
9 | set lbox [$lf.slist subwidget listbox] |
---|
10 | |
---|
11 | set sstring [binary format A5 [$sf.prefix get]] |
---|
12 | append sstring " " |
---|
13 | append sstring [binary format A20 [$sf.comment get]] |
---|
14 | append sstring " " |
---|
15 | append sstring [format "%6.2g " [$sf.qstart get]] |
---|
16 | append sstring [format "%6.2g " [$sf.qend get]] |
---|
17 | append sstring [$sf.qend get] |
---|
18 | |
---|
19 | $lbox insert end $sstring |
---|
20 | $lbox selection clear 0 end |
---|
21 | $lbox selection set end |
---|
22 | } |
---|
23 | |
---|
24 | proc removeSampleFromList { } { |
---|
25 | global lf |
---|
26 | |
---|
27 | set lbox [$lf.slist subwidget listbox] |
---|
28 | |
---|
29 | set cursample [$lbox curselection] |
---|
30 | |
---|
31 | foreach sample $cursample { |
---|
32 | $lbox delete $sample |
---|
33 | } |
---|
34 | |
---|
35 | $lbox selection clear 0 end |
---|
36 | if {$cursample < [$lbox index end]} { |
---|
37 | $lbox selection set $cursample |
---|
38 | } else { |
---|
39 | $lbox selection set end |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | proc moveSampleUpList { } { |
---|
44 | global lf |
---|
45 | |
---|
46 | set lbox [$lf.slist subwidget listbox] |
---|
47 | |
---|
48 | set cursample [$lbox curselection] |
---|
49 | |
---|
50 | foreach sample $cursample { |
---|
51 | set sval [$lbox get $sample] |
---|
52 | $lbox delete $sample |
---|
53 | if {$sample == 0} { |
---|
54 | $lbox insert 0 $sval |
---|
55 | $lbox selection clear 0 end |
---|
56 | $lbox selection set 0 |
---|
57 | } else { |
---|
58 | $lbox insert [ expr $sample - 1] $sval |
---|
59 | $lbox selection clear 0 end |
---|
60 | $lbox selection set [expr $sample - 1] |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | proc moveSampleDownList { } { |
---|
67 | global lf |
---|
68 | |
---|
69 | set lbox [$lf.slist subwidget listbox] |
---|
70 | |
---|
71 | set cursample [$lbox curselection] |
---|
72 | |
---|
73 | foreach sample $cursample { |
---|
74 | set sval [$lbox get $sample] |
---|
75 | $lbox delete $sample |
---|
76 | if {$sample > [$lbox index end]} { |
---|
77 | $lbox insert end $sval |
---|
78 | $lbox selection clear 0 end |
---|
79 | $lbox selection set end |
---|
80 | } else { |
---|
81 | $lbox insert [ expr $sample + 1] $sval |
---|
82 | $lbox selection clear 0 end |
---|
83 | $lbox selection set [expr $sample + 1] |
---|
84 | } |
---|
85 | } |
---|
86 | |
---|
87 | } |
---|
88 | |
---|
89 | #Build GUI |
---|
90 | frame .fmain |
---|
91 | set controlstrip [frame .fmain.fcontrolstrip] |
---|
92 | |
---|
93 | #Populate controlstrip |
---|
94 | pack [button $controlstrip.run_b -text "Run Experiment"] -fill none -side left |
---|
95 | pack [button $controlstrip.pause_b -text "Pause Experiment"] -fill none -side left |
---|
96 | pack [button $controlstrip.stop_b -text "Stop Experiment"] -fill none -side left |
---|
97 | pack [button $controlstrip.abort_b -text "Abort Experiment"] -fill none -side left |
---|
98 | |
---|
99 | #Create Notebook tabs |
---|
100 | set nb [tixNoteBook .fmain.noteb] |
---|
101 | $nb add samples -label "Samples" -underline 0 |
---|
102 | $nb add buffers -label "Buffers" -underline 0 |
---|
103 | $nb add icp -label "ICP" -underline 0 |
---|
104 | #Get frames for each tab |
---|
105 | set sampletab [frame [$nb subwidget samples].f] |
---|
106 | set buffertab [frame [$nb subwidget buffers].f] |
---|
107 | set icptab [frame [$nb subwidget icp].f] |
---|
108 | |
---|
109 | |
---|
110 | #Populate samples tab |
---|
111 | set sf [frame $sampletab.sframe -background grey -padx 2 -pady 2] |
---|
112 | |
---|
113 | pack [label $sf.plabel -text "Prefix" -background grey] -side left -anchor n |
---|
114 | pack [entry $sf.prefix -width 5 -background grey] -side left -anchor n |
---|
115 | pack [label $sf.pcomment -text "Comment" -background grey] -side left -anchor n |
---|
116 | pack [entry $sf.comment -background grey] -side left -anchor n |
---|
117 | pack [label $sf.pqstart -text "Q Start" -background grey] -side left -anchor n |
---|
118 | pack [entry $sf.qstart -width 5 -background grey] -side left -anchor n |
---|
119 | pack [label $sf.pqend -text "Q End" -background grey] -side left -anchor n |
---|
120 | pack [entry $sf.qend -width 5 -background grey] -side left -anchor n |
---|
121 | pack [label $sf.pctime -text "Run Time" -background grey] -side left -anchor n |
---|
122 | pack [entry $sf.counttime -width 8 -background grey] -side left -anchor n |
---|
123 | pack $sf -fill x |
---|
124 | |
---|
125 | ### |
---|
126 | set bf [frame $sampletab.bframe -background grey] |
---|
127 | pack [button $bf.add_b -text "Add Sample" -command {addSampleToList} ] -expand true -fill x -side left |
---|
128 | pack [button $bf.del_b -text "Remove Sample" -command {removeSampleFromList} ] -expand true -fill x -side left |
---|
129 | pack [button $bf.up_b -text "Move Sample Up" -command {moveSampleUpList}] -fill x -side left |
---|
130 | pack [button $bf.down_b -text "Move Sample Down" -command {moveSampleDownList}] -fill x -side left |
---|
131 | |
---|
132 | pack $bf -fill x |
---|
133 | |
---|
134 | ### |
---|
135 | set lf [frame $sampletab.lframe] |
---|
136 | |
---|
137 | pack [tixScrolledListBox $lf.slist] -expand true -fill both -side left -anchor w |
---|
138 | $lf.slist subwidget listbox configure -background grey |
---|
139 | pack $lf -expand true -fill both |
---|
140 | |
---|
141 | #Populate icp tab |
---|
142 | pack [text $icptab.icp] -fill both |
---|
143 | |
---|
144 | pack .fmain -expand true -fill both -anchor nw |
---|
145 | pack $nb $sampletab $buffertab $icptab -expand true -fill both -anchor nw |
---|
146 | pack $controlstrip |
---|