Changeset 2025
- Timestamp:
- Jan 10, 2011 8:00:24 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/video/piv/piv.tcl
r2024 r2025 99 99 set vc [Rappture::VideoChooser $chooser.vc -variable ::previewVar] 100 100 #$vc load [glob "/home/derrick/projects/piv/video/*.mp4"] 101 $vc load [glob "/apps/ piv/video/*.mp4"]101 $vc load [glob "/apps/video/*.mp4"] 102 102 103 103 pack $chooser.step1 -side top -anchor w -pady 8 … … 168 168 169 169 set f [$nb insert end video] 170 set vs [Rappture::VideoScreen $f.viewer -fileopen {$nb current about}] 170 set vs [Rappture::VideoScreen $f.viewer -fileopen { 171 $vs video stop 172 $nb current about}] 171 173 pack $vs -expand yes -fill both 172 174 -
trunk/gui/scripts/videodial2.tcl
r2023 r2025 243 243 # 244 244 # Clients use this to add a mark to the timeline 245 # type can be any one of loopstart, loopend, particle, arrow245 # type can be any one of loopstart, loopend, particle, measure 246 246 # where is interpreted based on the preceeding flag if available. 247 247 # in the default case, <where> is interpreted as a frame number … … 459 459 460 460 } 461 " arrow" {461 "measure*" { 462 462 set radius 3 463 463 set amx0 $frx0 -
trunk/gui/scripts/videodistance.tcl
r1979 r2025 27 27 itk_option define -units units Units "m" 28 28 itk_option define -bindings bindings Bindings "enable" 29 itk_option define -ondelete ondelete Ondelete "" 30 itk_option define -onframe onframe Onframe "" 31 29 32 30 33 constructor { name win args } { … … 56 59 protected method _fixBindings {status} 57 60 58 private method _controls {args}59 60 61 private variable _canvas "" ;# canvas which owns the object 61 62 private variable _name "" ;# id of the object … … 63 64 private variable _frame 0 ;# frame number where the object lives 64 65 private variable _coords "" ;# coords of the object, x0 y0 x1 y1 65 private variable _menu "" ;# controls balloon widget66 66 private variable _x 0 ;# x coord when "pressed" for motion 67 67 private variable _y 0 ;# y coord when "pressed" for motion … … 85 85 86 86 # setup the control menu 87 set _menu $itk_component(hull).distancecontrols 88 Rappture::Balloon ${_menu} -title "Controls" 89 set controls [${_menu} component inner] 87 set menu $itk_component(hull).distancecontrols 88 itk_component add menu { 89 Rappture::Balloon $itk_interior.menu -title "Controls" 90 } 91 set controls [$itk_component(menu) component inner] 90 92 91 93 set fg [option get $itk_component(hull) font Font] … … 97 99 -highlightthickness 0 98 100 entry $controls.measuremente -width 5 -background white 101 102 # Frame number control 103 label $controls.framenuml -text "Frame" -font "Arial 9"\ 104 -highlightthickness 0 105 Rappture::Spinint $controls.framenume \ 106 -min 0 -width 5 -font "arial 9" 99 107 100 108 # x0 … … 126 134 -min 0 -max [winfo height ${_canvas}] -width 4 -font "arial 9" 127 135 128 # Hide control129 label $controls. hidel -text "Hide" -font $fg \136 # Delete control 137 label $controls.deletel -text "Delete" -font $fg \ 130 138 -highlightthickness 0 131 Rappture::Switch $controls. hideb -showtext "false"132 $controls. hideb value false139 Rappture::Switch $controls.deleteb -showtext "false" 140 $controls.deleteb value false 133 141 134 142 button $controls.saveb -text Save \ 135 143 -relief raised -pady 0 -padx 0 -font "Arial 9" \ 136 -command [itcl::code $this _controlssave] \144 -command [itcl::code $this Menu deactivate save] \ 137 145 -activebackground grey90 138 146 139 147 button $controls.cancelb -text Cancel \ 140 148 -relief raised -pady 0 -padx 0 -font "Arial 9" \ 141 -command [itcl::code $this _controlscancel] \149 -command [itcl::code $this Menu deactivate cancel] \ 142 150 -activebackground grey90 143 151 144 152 grid $controls.measurementl -column 0 -row 0 -sticky e 145 153 grid $controls.measuremente -column 1 -row 0 -sticky w 154 grid $controls.framenuml -column 2 -row 0 -sticky e 155 grid $controls.framenume -column 3 -row 0 -sticky w 146 156 grid $controls.x0l -column 0 -row 1 -sticky e 147 157 grid $controls.x0e -column 1 -row 1 -sticky w … … 152 162 grid $controls.y1l -column 2 -row 2 -sticky e 153 163 grid $controls.y1e -column 3 -row 2 -sticky w 154 grid $controls. hidel-column 2 -row 3 -sticky e155 grid $controls. hideb-column 3 -row 3 -sticky w164 grid $controls.deletel -column 2 -row 3 -sticky e 165 grid $controls.deleteb -column 3 -row 3 -sticky w 156 166 grid $controls.saveb -column 0 -row 4 -sticky e -columnspan 2 157 167 grid $controls.cancelb -column 2 -row 4 -sticky w -columnspan 2 … … 161 171 eval itk_initialize $args 162 172 163 set _frame [uplevel \#0 $fncallback]164 173 # set the frame for the particle 174 Frame [uplevel \#0 $fncallback] 165 175 bind ${_name}-FrameEvent <<Frame>> [itcl::code $this CatchEvent Frame] 166 176 } … … 171 181 itcl::body Rappture::VideoDistance::destructor {} { 172 182 configure -px2dist "" ;# remove variable trace 183 184 Hide object 185 _fixBindings disable 186 187 if {"" != $itk_option(-ondelete)} { 188 uplevel \#0 $itk_option(-ondelete) 189 } 190 173 191 } 174 192 … … 183 201 } 184 202 set _frame $val 203 204 if {"" != $itk_option(-onframe)} { 205 uplevel \#0 $itk_option(-onframe) ${_frame} 206 } 185 207 } elseif {[llength $args] != 0} { 186 208 error "wrong # args: should be \"Frame ?<frameNumber>?\"" … … 224 246 _fixValue 225 247 return ${_coords} 226 }227 228 # ----------------------------------------------------------------------229 # _controls - save or cancel adjustments made in the controls menu230 # ----------------------------------------------------------------------231 itcl::body Rappture::VideoDistance::_controls {args} {232 Menu deactivate $args233 248 } 234 249 … … 363 378 set x [expr $x0+$x] 364 379 set y [expr $y0+$y] 365 $ {_menu}activate @$x,$y $dir380 $itk_component(menu) activate @$x,$y $dir 366 381 367 382 # update the values in the menu 368 set controls [$ {_menu}component inner]383 set controls [$itk_component(menu) component inner] 369 384 foreach {x0 y0 x1 y1} ${_coords} break 370 385 $controls.measuremente delete 0 end 371 386 $controls.measuremente insert 0 "${_dist} ${_units}" 387 $controls.framenume value ${_frame} 372 388 $controls.x0e value $x0 373 389 $controls.y0e value $y0 374 390 $controls.x1e value $x1 375 391 $controls.y1e value $y1 376 $controls. hideb value false392 $controls.deleteb value false 377 393 } 378 394 "deactivate" { 379 $ {_menu}deactivate395 $itk_component(menu) deactivate 380 396 if {[llength $args] != 2} { 381 397 error "wrong # args: should be \"deactivate <status>\"" … … 384 400 switch -- $status { 385 401 "save" { 386 set controls [${_menu} component inner] 402 set controls [$itk_component(menu) component inner] 403 404 set newframenum [$controls.framenume value] 405 if {${_frame} != $newframenum} { 406 Frame $newframenum 407 } 387 408 388 409 foreach {oldx0 oldy0 oldx1 oldy1} ${_coords} break … … 413 434 } 414 435 415 if {[$controls.hideb value]} { 416 # FIXME: might need to do this in an after idle 417 # if the value is updated, and the object 418 # is scheduled to be hidden, writing 419 # the new value to the screen will 420 # occur after the object has been hidden, 421 # resulting in a floating value. 422 Hide object 436 if {[$controls.deleteb value]} { 437 itcl::delete object $this 423 438 } 424 439 } … … 471 486 set tagnum [lsearch [bindtags ${_canvas}] "${_name}-FrameEvent"] 472 487 if {$tagnum >= 0} { 473 bindtags ${_canvas} [lreplace [bindtags ${_canvas} $tagnum $tagnum]]488 bindtags ${_canvas} [lreplace [bindtags ${_canvas}] $tagnum $tagnum] 474 489 } 475 490 } … … 533 548 ${_canvas} delete ${_name}-val 534 549 535 set controls [$ {_menu}component inner]536 if {![$controls. hideb value]} {550 set controls [$itk_component(menu) component inner] 551 if {![$controls.deleteb value]} { 537 552 # if the object is not hidden, write _dist to the canvas 538 553 uplevel \#0 $writetextcb $args -
trunk/gui/scripts/videoparticle.tcl
r1979 r2025 28 28 itk_option define -units units Units "m/s" 29 29 itk_option define -bindings bindings Bindings "enable" 30 itk_option define -ondelete ondelete Ondelete "" 31 itk_option define -onframe onframe Onframe "" 32 itk_option define -framerange framerange Framerange "" 30 33 31 34 constructor { name win args } { … … 36 39 } 37 40 38 public method Delete {args}39 41 public method Show {args} 40 42 public method Hide {args} … … 69 71 private variable _coords "" ;# list of coords where the object lives 70 72 private variable _halo 0 ;# about the diameter of the particle 71 private variable _menu "" ;# particle controls balloon widget72 73 private variable _x 0 ;# x coord when "pressed" for motion 73 74 private variable _y 0 ;# y coord when "pressed" for motion … … 93 94 94 95 # setup the particle control menu 95 set _menu $itk_component(hull).particlecontrols 96 Rappture::Balloon ${_menu} -title "Particle Controls" 97 set controls [${_menu} component inner] 98 99 # Link control 100 #button $controls.link -text Link \ 101 # -relief flat -pady 0 -padx 0 -font "Arial 9" \ 102 # -command [itcl::code $this Link] -overrelief flat \ 103 # -activebackground grey90 96 itk_component add menu { 97 Rappture::Balloon $itk_interior.particlecontrols -title "Particle Controls" 98 } 99 100 set controls [$itk_component(menu) component inner] 101 102 # Frame number control 103 label $controls.framenuml -text "Frame" -font "Arial 9"\ 104 -highlightthickness 0 105 Rappture::Spinint $controls.framenume \ 106 -min 0 -width 5 -font "arial 9" 104 107 105 108 # Delete control 106 button $controls.delete -text Delete \ 107 -relief flat -pady 0 -padx 0 -font "Arial 9" \ 108 -command [itcl::code $this Delete frame] -overrelief flat \ 109 label $controls.deletel -text "Delete" -font "Arial 9" \ 110 -highlightthickness 0 111 Rappture::Switch $controls.deleteb -showtext "false" 112 $controls.deleteb value false 113 114 # Save button 115 button $controls.saveb -text Save \ 116 -relief raised -pady 0 -padx 0 -font "Arial 9" \ 117 -command [itcl::code $this Menu deactivate save] \ 109 118 -activebackground grey90 110 119 111 #grid $controls.link -column 0 -row 0 -sticky w 112 grid $controls.delete -column 0 -row 1 -sticky w 113 # grid $controls.rename -column 0 -row 2 -sticky w 114 # grid $controls.recolor -column 0 -row 3 -sticky w 115 116 grid columnconfigure $controls 0 -weight 1 120 # Cancel button 121 button $controls.cancelb -text Cancel \ 122 -relief raised -pady 0 -padx 0 -font "Arial 9" \ 123 -command [itcl::code $this Menu deactivate cancel] \ 124 -activebackground grey90 125 126 127 grid $controls.framenuml -column 0 -row 0 -sticky e 128 grid $controls.framenume -column 1 -row 0 -sticky w 129 grid $controls.deletel -column 0 -row 1 -sticky e 130 grid $controls.deleteb -column 1 -row 1 -sticky w 131 grid $controls.saveb -column 0 -row 2 -sticky e 132 grid $controls.cancelb -column 1 -row 2 -sticky w 133 134 135 grid columnconfigure $controls 0 -weight 1 117 136 118 137 # finish configuring the particle 119 138 eval itk_initialize $args 120 139 121 set _frame [uplevel \#0 $fncallback]122 140 # set the frame for the particle 141 Frame [uplevel \#0 $fncallback] 123 142 bind ${_name}-FrameEvent <<Frame>> [itcl::code $this CatchEvent Frame] 124 143 } … … 129 148 itcl::body Rappture::VideoParticle::destructor {} { 130 149 configure -px2dist "" ;# remove variable trace 131 }132 133 # ----------------------------------------------------------------------134 # Delete - remove the particle135 # ----------------------------------------------------------------------136 itcl::body Rappture::VideoParticle::Delete {args} {137 138 Menu deactivate139 150 140 151 Hide object … … 151 162 ${_prevnode} drawVectors 152 163 } 153 } 154 164 165 _fixBindings disable 166 167 if {"" != $itk_option(-ondelete)} { 168 uplevel \#0 $itk_option(-ondelete) 169 } 170 } 155 171 156 172 # ---------------------------------------------------------------------- … … 271 287 # create 272 288 # activate x y 273 # deactivate 289 # deactivate status 274 290 # ---------------------------------------------------------------------- 275 291 itcl::body Rappture::VideoParticle::Menu {args} { … … 288 304 set x [expr $x0+$x] 289 305 set y [expr $y0+$y] 290 ${_menu} activate @$x,$y $dir 306 $itk_component(menu) activate @$x,$y $dir 307 308 # update the values in the menu 309 set controls [$itk_component(menu) component inner] 310 $controls.framenume value ${_frame} 311 $controls.deleteb value false 291 312 } 292 313 "deactivate" { 293 ${_menu} deactivate 314 $itk_component(menu) deactivate 315 if {[llength $args] != 2} { 316 error "wrong # args: should be \"deactivate <status>\"" 317 } 318 set status [lindex $args 1] 319 switch -- $status { 320 "save" { 321 set controls [$itk_component(menu) component inner] 322 323 set newframenum [$controls.framenume value] 324 if {${_frame} != $newframenum} { 325 Frame $newframenum 326 } 327 328 if {[$controls.deleteb value]} { 329 itcl::delete object $this 330 } 331 } 332 "cancel" { 333 } 334 "default" { 335 error "bad value \"$status\": should be one of save, cancel" 336 } 337 } 294 338 } 295 339 default { … … 365 409 } 366 410 set _frame $val 411 412 if {"" != $itk_option(-onframe)} { 413 uplevel \#0 $itk_option(-onframe) ${_frame} 414 } 367 415 } elseif {[llength $args] != 0} { 368 416 error "wrong # args: should be \"Frame ?<number>?\"" … … 466 514 set tagnum [lsearch [bindtags ${_canvas}] "${_name}-FrameEvent"] 467 515 if {$tagnum >= 0} { 468 bindtags ${_canvas} [lreplace [bindtags ${_canvas} $tagnum $tagnum]]516 bindtags ${_canvas} [lreplace [bindtags ${_canvas}] $tagnum $tagnum] 469 517 } 470 518 } … … 539 587 540 588 # ---------------------------------------------------------------------- 589 # CONFIGURE: -framerange 590 # ---------------------------------------------------------------------- 591 itcl::configbody Rappture::VideoParticle::framerange { 592 if {"" == $itk_option(-framerange)} { 593 return 594 } 595 if {[llength $itk_option(-framerange)] != 2} { 596 error "bad value \"$itk_option(-framerange)\": should be 2 integers" 597 } 598 foreach {min max} $itk_option(-framerange) break 599 if {!([string is integer $min]) || !([string is integer $max])} { 600 error "bad value \"$itk_option(-framerange)\": should be 2 integers" 601 } 602 set controls [$itk_component(menu) component inner] 603 $controls.framenume configure -min $min -max $max 604 } 605 606 # ---------------------------------------------------------------------- -
trunk/gui/scripts/videoscreen.tcl
r2024 r2025 554 554 } 555 555 "update" { 556 #eventually seek [expr round($_settings($this-framenum))]557 Seek [expr round($_settings($this-framenum))]556 eventually seek [expr round($_settings($this-framenum))] 557 # Seek [expr round($_settings($this-framenum))] 558 558 } 559 559 default { … … 867 867 -bindleavecb [itcl::code $this togglePtrBind current] \ 868 868 -writetextcb [itcl::code $this writeText] \ 869 -ondelete [itcl::code $itk_component(dialminor) mark remove $name] \ 870 -onframe [itcl::code $itk_component(dialminor) mark add $name] \ 869 871 -px2dist [itcl::scope _px2dist] \ 870 872 -units "m" \ … … 873 875 ${_obj} Coords $x $y $x $y 874 876 ${_obj} Show object 875 $itk_component(dialminor) mark add arrow current876 877 } 877 878 "drag" { … … 929 930 -bindleavecb [itcl::code $this togglePtrBind current] \ 930 931 -trajcallback [itcl::code $this Trajectory] \ 932 -ondelete [itcl::code $itk_component(dialminor) mark remove $name] \ 933 -onframe [itcl::code $itk_component(dialminor) mark add $name] \ 934 -framerange "0 ${_lastFrame}" \ 931 935 -halo 5 \ 932 936 -color green \ … … 935 939 ${_obj} Coords $x $y 936 940 ${_obj} Show object 937 $itk_component(dialminor) mark add $name current941 #$itk_component(dialminor) mark add $name current 938 942 # bind $itk_component(hull) <<Frame>> [itcl::code $itk_component(main).$name UpdateFrame] 939 943 940 # link the new particle to the last particle added 941 if {[llength ${_particles}] > 0} { 944 # link the new particle to the last particle added, if it exists 945 set lastp [lindex ${_particles} end] 946 while {"" == [info commands $lastp]} { 947 set _particles [lreplace ${_particles} end end] 948 if {[llength ${_particles}] == 0} { 949 break 950 } 942 951 set lastp [lindex ${_particles} end] 952 } 953 if {"" != [info commands $lastp]} { 943 954 $lastp Link ${_obj} 944 955 } … … 946 957 # add the particle to the list 947 958 lappend _particles ${_obj} 948 949 # set pm [Rappture::VideoParticleManager]950 # $pm add $p0951 # set plist [$pm list]952 959 } 953 960 default {
Note: See TracChangeset
for help on using the changeset viewer.