1 | #!/bin/sh |
---|
2 | #\ |
---|
3 | exec wish "$0" $* |
---|
4 | # ---------------------------------------------------------------------- |
---|
5 | # wish executes everything from here on... |
---|
6 | |
---|
7 | package require RapptureGUI |
---|
8 | package require BLT |
---|
9 | package require Img |
---|
10 | |
---|
11 | |
---|
12 | option add *font -*-helvetica-medium-r-normal-*-12-* |
---|
13 | option add *background #d9d9d9 |
---|
14 | option add *Tooltip.background white |
---|
15 | option add *BugReport*banner*foreground white |
---|
16 | option add *BugReport*banner*background #a9a9a9 |
---|
17 | option add *BugReport*banner*highlightBackground #a9a9a9 |
---|
18 | option add *BugReport*banner*font -*-helvetica-bold-r-normal-*-18-* |
---|
19 | option add *upload*Label*font -*-helvetica-medium-r-normal-*-12-* |
---|
20 | option add *download*Label*font -*-helvetica-medium-r-normal-*-12-* |
---|
21 | |
---|
22 | switch $tcl_platform(platform) { |
---|
23 | unix - windows { |
---|
24 | event add <<PopupMenu>> <ButtonPress-3> |
---|
25 | } |
---|
26 | macintosh { |
---|
27 | event add <<PopupMenu>> <Control-ButtonPress-1> |
---|
28 | } |
---|
29 | } |
---|
30 | |
---|
31 | # install some Rappture support stuff... |
---|
32 | Rappture::bugreport::install |
---|
33 | Rappture::filexfer::init |
---|
34 | Rappture::grab::init |
---|
35 | |
---|
36 | |
---|
37 | wm title . "particle velocity estimate" |
---|
38 | wm withdraw . |
---|
39 | set width 960 |
---|
40 | set height 625 |
---|
41 | |
---|
42 | set installdir [file dirname [ \ |
---|
43 | Rappture::utils::expandPath [ \ |
---|
44 | file normalize [info script]]]] |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | # ------------------------------------------------------------------ |
---|
49 | # Main Window |
---|
50 | # ------------------------------------------------------------------ |
---|
51 | |
---|
52 | # create a notebook to hold the different pages |
---|
53 | |
---|
54 | set nb [Rappture::Notebook .nb] |
---|
55 | pack .nb -expand yes -fill both |
---|
56 | |
---|
57 | # ------------------------------------------------------------------ |
---|
58 | # About Page |
---|
59 | # ------------------------------------------------------------------ |
---|
60 | |
---|
61 | set f [$nb insert end about] |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | # html intro page |
---|
66 | |
---|
67 | set intro [frame $f.intro] |
---|
68 | |
---|
69 | Rappture::Scroller $intro.scroller -xscrollmode auto -yscrollmode auto |
---|
70 | pack $intro.scroller -expand yes -fill both |
---|
71 | |
---|
72 | Rappture::HTMLviewer $intro.scroller.html |
---|
73 | $intro.scroller contents $intro.scroller.html |
---|
74 | |
---|
75 | set fid [open "intro.html" r] |
---|
76 | set html [read $fid] |
---|
77 | close $fid |
---|
78 | $intro.scroller.html load $html |
---|
79 | |
---|
80 | |
---|
81 | # verticle divider |
---|
82 | set div [frame $f.div -width 1 -background black] |
---|
83 | |
---|
84 | |
---|
85 | set previewVar "" |
---|
86 | |
---|
87 | # movie chooser |
---|
88 | |
---|
89 | set chooser [frame $f.chooser_f] |
---|
90 | |
---|
91 | set fid [open [file join $installdir images step1.png] r] |
---|
92 | fconfigure $fid -translation binary -encoding binary |
---|
93 | set data [read $fid] |
---|
94 | close $fid |
---|
95 | set imh [image create photo] |
---|
96 | $imh put $data |
---|
97 | label $chooser.step1 -image $imh |
---|
98 | |
---|
99 | set vc [Rappture::VideoChooser $chooser.vc -variable ::previewVar] |
---|
100 | $vc load [glob "/home/derrick/projects/piv/video/*.mp4"] |
---|
101 | # $vc load [glob "/apps/piv/video/*.mp4"] |
---|
102 | |
---|
103 | pack $chooser.step1 -side top -anchor w -pady 8 |
---|
104 | pack $vc -side bottom -anchor center |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | # movie previewer |
---|
109 | |
---|
110 | set preview [frame $f.preview_f] |
---|
111 | |
---|
112 | set fid [open [file join $installdir images step2.png] r] |
---|
113 | fconfigure $fid -translation binary -encoding binary |
---|
114 | set data [read $fid] |
---|
115 | close $fid |
---|
116 | set imh [image create photo] |
---|
117 | $imh put $data |
---|
118 | label $preview.step2 -image $imh |
---|
119 | |
---|
120 | set vp [Rappture::VideoPreview $preview.preview -variable ::previewVar] |
---|
121 | |
---|
122 | pack $preview.step2 -side top -anchor w -pady 8 |
---|
123 | pack $vp -side bottom -anchor center |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | # analyze button gets us to the analyze page |
---|
128 | |
---|
129 | set analyze [frame $f.analyze_f] |
---|
130 | |
---|
131 | set fid [open [file join $installdir images step3.png] r] |
---|
132 | fconfigure $fid -translation binary -encoding binary |
---|
133 | set data [read $fid] |
---|
134 | close $fid |
---|
135 | set imh [image create photo] |
---|
136 | $imh put $data |
---|
137 | label $analyze.step3 -image $imh |
---|
138 | |
---|
139 | button $analyze.go \ |
---|
140 | -text "Analyze" \ |
---|
141 | -command { |
---|
142 | $vp video stop |
---|
143 | $vs load file $previewVar |
---|
144 | $vs video seek [$vp query framenum] |
---|
145 | $nb current next> |
---|
146 | # FIXME: video loaded into memory twice |
---|
147 | } |
---|
148 | pack $analyze.step3 -side left -anchor w |
---|
149 | pack $analyze.go -anchor center |
---|
150 | |
---|
151 | |
---|
152 | set reqwidth [expr round($width/2.0)] |
---|
153 | blt::table $f \ |
---|
154 | 0,0 $intro -rowspan 3 -fill both -reqwidth $reqwidth\ |
---|
155 | 0,1 $div -rowspan 3 -fill y -pady 8 -padx 8\ |
---|
156 | 0,2 $chooser -fill x -padx {0 8}\ |
---|
157 | 1,2 $preview -fill x \ |
---|
158 | 2,2 $analyze -fill x |
---|
159 | |
---|
160 | blt::table configure $f c0 -resize none |
---|
161 | blt::table configure $f c1 -resize none |
---|
162 | blt::table configure $f c2 -resize none |
---|
163 | # blt::table configure $f r0 -pady 1 |
---|
164 | |
---|
165 | # ------------------------------------------------------------------ |
---|
166 | # VIDEO PAGE |
---|
167 | # ------------------------------------------------------------------ |
---|
168 | |
---|
169 | set f [$nb insert end video] |
---|
170 | set vs [Rappture::VideoScreen $f.viewer -fileopen {$nb current about}] |
---|
171 | pack $vs -expand yes -fill both |
---|
172 | |
---|
173 | |
---|
174 | # ------------------------------------------------------------------ |
---|
175 | # SHOW WINDOW |
---|
176 | # ------------------------------------------------------------------ |
---|
177 | |
---|
178 | |
---|
179 | $nb current about |
---|
180 | wm geometry . ${width}x${height} |
---|
181 | wm deiconify . |
---|
182 | |
---|
183 | #update idletasks |
---|
184 | #image delete $imh |
---|