source: sans/utils/bt5/icpgui-test/mockgui @ 722

Last change on this file since 722 was 150, checked in by ajj, 16 years ago

Moving icpgui to icpgui-test

  • Property svn:executable set to *
File size: 4.1 KB
Line 
1#!/usr/bin/wish
2
3package require Tix
4
5proc 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
24proc 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
43proc 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
66proc 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
90frame .fmain
91set controlstrip [frame .fmain.fcontrolstrip]
92
93#Populate controlstrip
94pack [button $controlstrip.run_b -text "Run Experiment"] -fill none -side left
95pack [button $controlstrip.pause_b -text "Pause Experiment"] -fill none -side left
96pack [button $controlstrip.stop_b -text "Stop Experiment"] -fill none -side left
97pack [button $controlstrip.abort_b -text "Abort Experiment"] -fill none -side left
98
99#Create Notebook tabs
100set 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
105set sampletab [frame [$nb subwidget samples].f]
106set buffertab [frame [$nb subwidget buffers].f]
107set icptab [frame [$nb subwidget icp].f]
108
109
110#Populate samples tab
111set sf [frame $sampletab.sframe -background grey -padx 2 -pady 2]
112
113pack [label $sf.plabel -text "Prefix" -background grey] -side left -anchor n
114pack [entry $sf.prefix -width 5 -background grey] -side left -anchor n
115pack [label $sf.pcomment -text "Comment" -background grey] -side left -anchor n
116pack [entry $sf.comment -background grey] -side left -anchor n
117pack [label $sf.pqstart -text "Q Start" -background grey] -side left -anchor n
118pack [entry $sf.qstart -width 5 -background grey] -side left -anchor n
119pack [label $sf.pqend -text "Q End" -background grey] -side left -anchor n
120pack [entry $sf.qend -width 5 -background grey] -side left -anchor n
121pack [label $sf.pctime -text "Run Time" -background grey] -side left -anchor n
122pack [entry $sf.counttime -width 8 -background grey] -side left -anchor n
123pack $sf -fill x
124
125###
126set bf [frame $sampletab.bframe -background grey]
127pack [button $bf.add_b -text "Add Sample" -command {addSampleToList} ] -expand true -fill x -side left
128pack [button $bf.del_b -text "Remove Sample" -command {removeSampleFromList} ] -expand true -fill x -side left
129pack [button $bf.up_b -text "Move Sample Up" -command {moveSampleUpList}] -fill x -side left
130pack [button $bf.down_b -text "Move Sample Down" -command {moveSampleDownList}] -fill x -side left
131
132pack $bf -fill x
133
134###
135set lf [frame $sampletab.lframe]
136
137pack [tixScrolledListBox $lf.slist] -expand true -fill both -side left -anchor w
138$lf.slist subwidget listbox configure -background grey
139pack $lf -expand true -fill both
140
141#Populate icp tab
142pack [text $icptab.icp] -fill both
143
144pack .fmain -expand true -fill both -anchor nw
145pack $nb $sampletab $buffertab $icptab -expand true -fill both -anchor nw
146pack $controlstrip
Note: See TracBrowser for help on using the repository browser.