Changeset 5278
- Timestamp:
- Apr 18, 2015 1:13:45 AM (6 years ago)
- Location:
- branches/1.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4
-
branches/1.4/gui/scripts/flowvisviewer.tcl
r5275 r5278 6 6 # It connects to the Flowvis server running on a rendering farm, transmits 7 7 # data, and displays the results. 8 #9 8 # ====================================================================== 10 9 # AUTHOR: Michael McLennan, Purdue University … … 70 69 public method scale {args} 71 70 public method updateTransferFunctions {} 72 73 # soon to be removed.74 private method Flow {option args}75 private method Play {}76 private method Pause {}77 71 78 72 # The following methods are only used by this class. … … 445 439 "Set duration of flow (format is min:sec)" 446 440 447 448 441 itk_component add durationlabel { 449 442 label $itk_component(flowcontrols).durationl \ … … 1225 1218 } 1226 1219 1227 1228 1220 # sync the state of slicers 1229 1221 set vols [CurrentVolumeIds -cutplanes] … … 1425 1417 $itk_component(3dview) configure -cursor "" 1426 1418 } 1427 }1428 1429 1430 # ----------------------------------------------------------------------1431 # USAGE: Flow movie record|stop|play ?on|off|toggle?1432 #1433 # Called when the user clicks on the record, stop or play buttons1434 # for flow visualization.1435 # ----------------------------------------------------------------------1436 itcl::body Rappture::FlowvisViewer::Flow {option args} {1437 switch -- $option {1438 movie {1439 if {[llength $args] < 1 || [llength $args] > 2} {1440 error "wrong # args: should be \"Flow movie record|stop|play ?on|off|toggle?\""1441 }1442 set action [lindex $args 0]1443 set op [lindex $args 1]1444 if {$op == ""} { set op "on" }1445 1446 set current [State $action]1447 if {$op == "toggle"} {1448 if {$current == "on"} {1449 set op "off"1450 } else {1451 set op "on"1452 }1453 }1454 set cmds ""1455 switch -- $action {1456 record {1457 if { [$itk_component(rewind) cget -relief] != "sunken" } {1458 $itk_component(rewind) configure -relief sunken1459 $itk_component(stop) configure -relief raised1460 $itk_component(play) configure -relief raised1461 set inner $itk_component(settingsFrame)1462 set frames [$inner.framecnt value]1463 set _settings(nsteps) $frames1464 set cmds "flow capture $frames"1465 SendCmd $cmds1466 }1467 }1468 stop {1469 if { [$itk_component(stop) cget -relief] != "sunken" } {1470 $itk_component(rewind) configure -relief raised1471 $itk_component(stop) configure -relief sunken1472 $itk_component(play) configure -relief raised1473 _pause1474 set cmds "flow reset"1475 SendCmd $cmds1476 }1477 }1478 play {1479 if { [$itk_component(play) cget -relief] != "sunken" } {1480 $itk_component(rewind) configure -relief raised1481 $itk_component(stop) configure -relief raised1482 $itk_component(play) configure \1483 -image [Rappture::icon flow-pause] \1484 -relief sunken1485 bind $itk_component(play) <ButtonPress> \1486 [itcl::code $this _pause]1487 flow next1488 }1489 }1490 default {1491 error "bad option \"$option\": should be one of record|stop|play"1492 }1493 1494 }1495 }1496 default {1497 error "bad option \"$option\": should be movie"1498 }1499 }1500 }1501 1502 # ----------------------------------------------------------------------1503 # USAGE: Play1504 #1505 # ----------------------------------------------------------------------1506 itcl::body Rappture::FlowvisViewer::Play {} {1507 SendCmd "flow next"1508 set delay [expr {int(ceil(pow($_settings(speed)/10.0+2,2.0)*15))}]1509 $_dispatcher event -after $delay !play1510 }1511 1512 # ----------------------------------------------------------------------1513 # USAGE: Pause1514 #1515 # Invoked when the user hits the "pause" button to stop playing the1516 # current sequence of frames as a movie.1517 # ----------------------------------------------------------------------1518 itcl::body Rappture::FlowvisViewer::Pause {} {1519 $_dispatcher cancel !play1520 1521 # Toggle the button to "play" mode1522 $itk_component(play) configure \1523 -image [Rappture::icon flow-start] \1524 -relief raised1525 bind $itk_component(play) <ButtonPress> \1526 [itcl::code $this Flow movie play toggle]1527 1419 } 1528 1420 … … 2602 2494 } 2603 2495 2604 2605 2496 # 2606 2497 # flow -- … … 2746 2637 } 2747 2638 2748 itcl::body Rappture::FlowvisViewer::GetPngImage 2639 itcl::body Rappture::FlowvisViewer::GetPngImage { widget width height } { 2749 2640 set token "print[incr _nextToken]" 2750 2641 set var ::Rappture::FlowvisViewer::_hardcopy($this-$token)
Note: See TracChangeset
for help on using the changeset viewer.