Changeset 1932 for branches/blt4/gui/scripts
- Timestamp:
- Oct 25, 2010 3:16:06 PM (14 years ago)
- Location:
- branches/blt4/gui/scripts
- Files:
-
- 7 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/filexfer.tcl
r1897 r1932 91 91 } 92 92 } 93 uploadWord { 94 if {[Rappture::filexfer::enabled]} { 95 return "Upload" 96 } else { 97 return "Browse" 98 } 99 } 93 100 download { 94 101 if {[Rappture::filexfer::enabled]} { … … 106 113 } 107 114 default { 108 error "bad option \"$operation\": should be upload, download, or downloadWord"115 error "bad option \"$operation\": should be upload, uploadWord, download, or downloadWord" 109 116 } 110 117 } -
branches/blt4/gui/scripts/imageentry.tcl
r1923 r1932 151 151 set newval [lindex $args 0] 152 152 if {[string length $newval] > 0} { 153 set imh [image create p hoto-data $newval]153 set imh [image create picture -data $newval] 154 154 } else { 155 155 set imh "" … … 176 176 set fmt [$_owner xml get $_path.convert] 177 177 if {"" != $fmt && "" != $_imh} { 178 if {"pgm" == $fmt} { set fmt "ppm -grayscale" } 179 set bytes [eval $_imh data -format $fmt] 180 set bytes [Rappture::encoding::decode -as b64 $bytes] 178 switch -- $fmt { 179 "pgm" - "ppm" { 180 $_imh export pbm -data bytes 181 } 182 "jpeg" { 183 $_imh export jpg -data bytes 184 } 185 "tiff" { 186 $_imh export tif -data bytes 187 } 188 "bmp" - "png" - "xbm" - "xpm" { 189 $_imh export $fmt -data bytes 190 } 191 default { 192 error "unknown image format \"$fmt\"" 193 } 194 } 181 195 } 182 196 return $bytes -
branches/blt4/gui/scripts/videoviewer.tcl
r1919 r1932 16 16 package require RapptureGUI 17 17 18 option add *VideoViewer.width 5i widgetDefault18 #option add *VideoViewer.width 5i widgetDefault 19 19 option add *VideoViewer*cursor crosshair widgetDefault 20 option add *VideoViewer.height 4i widgetDefault20 #option add *VideoViewer.height 4i widgetDefault 21 21 option add *VideoViewer.foreground black widgetDefault 22 22 option add *VideoViewer.controlBackground gray widgetDefault … … 34 34 itk_option define -plotbackground plotBackground Background "" 35 35 itk_option define -plotoutline plotOutline PlotOutline "" 36 itk_option define -width width Width -1 37 itk_option define -height height Height -1 38 itk_option define -controls controls Controls "show" 36 39 37 40 constructor { args } { … … 44 47 public method load {filename} 45 48 public method video {args} 49 public method query {type} 46 50 47 51 protected method togglePtrBind {pbvar} … … 58 62 protected method updateMeasurements {} 59 63 protected method calculateTrajectory {args} 64 protected method fixSize {} 65 66 60 67 61 68 private common _settings 62 69 63 private variable _width 0 64 private variable _height 0 70 private variable _width -1 71 private variable _height -1 72 private variable _controls "" 65 73 private variable _x0 0 ;# start x for rubberbanding 66 74 private variable _y0 0 ;# start y for rubberbanding … … 399 407 # ---------------------------------------------------------------------- 400 408 itcl::body Rappture::VideoViewer::load {filename} { 401 set _movie [Rappture::Video $filename] 409 410 # open the file 411 412 set _movie [Rappture::Video "file" $filename] 402 413 set _framerate [${_movie} get framerate] 403 414 set _mspf [expr round(((1.0/${_framerate})*1000)/pow(2,[$itk_component(speed) value]-1))] 404 # set _mspf 7405 415 puts "framerate = ${_framerate}" 406 416 puts "mspf = ${_mspf}" 407 417 418 ${_movie} seek 0 419 420 # setup the image display 421 408 422 set _imh [image create photo] 409 $_imh put [$_movie next] 423 foreach {w h} [query dimensions] break 424 if {${_width} == -1} { 425 set _width $w 426 } 427 if {${_height} == -1} { 428 set _height $h 429 } 430 # ${_imh} put [$_movie get image ${_width} ${_height}] 410 431 $itk_component(main) create image 0 0 -anchor nw -image $_imh 432 433 # setup timings for playing video 411 434 412 435 set _lastFrame [$_movie get position end] … … 424 447 $itk_component(framenum) configure -max ${_lastFrame} -width $cnt 425 448 426 set pch [$itk_component(pointercontrols) cget -height] 427 set mch [$itk_component(moviecontrols) cget -height] 428 set pch 30 429 set mch 30 449 fixSize 450 } 451 452 # ---------------------------------------------------------------------- 453 # fixSize 454 # ---------------------------------------------------------------------- 455 itcl::body Rappture::VideoViewer::fixSize {} { 456 457 if {[string compare "" ${_movie}] == 0} { 458 return 459 } 460 461 # get an image with the new size 462 ${_imh} put [${_movie} get image ${_width} ${_height}] 463 464 # fix the dimesions of the canvas 465 $itk_component(main) configure -width ${_width} -height ${_height} 466 430 467 $itk_component(main) configure -scrollregion [$itk_component(main) bbox all] 431 foreach { x0 y0 x1 y1 } [$itk_component(main) bbox all] break 432 set w [expr abs($x1-$x0)] 433 set h [expr abs($y1-$y0+$pch+$mch)] 434 # $itk_component(main) configure -width $w -height $h 435 .main configure -width $w -height $h 436 468 #foreach { x0 y0 x1 y1 } [$itk_component(main) bbox all] break 469 #set w [expr abs($x1-$x0)] 470 #set h [expr abs($y1-$y0)] 471 #$itk_component(main) configure -width $w -height $h 472 # component hull configure -width $w -height $h 437 473 } 438 474 … … 483 519 484 520 # ---------------------------------------------------------------------- 521 # query - query things about the video 522 # ---------------------------------------------------------------------- 523 itcl::body Rappture::VideoViewer::query { type } { 524 set ret "" 525 switch -- $type { 526 "dimensions" { 527 set ret [${_movie} size] 528 } 529 default { 530 error "bad type \"$type\": should be dimensions." 531 } 532 } 533 return $ret 534 } 535 536 # ---------------------------------------------------------------------- 485 537 # togglePtrCtrl - choose pointer mode: 486 538 # rectangle, distance, measure, particlemark … … 617 669 618 670 # display the next frame 619 $_imh put [$_movie next] 671 $_movie next 672 $_imh put [$_movie get image ${_width} ${_height}] 620 673 621 674 # update the dial and framenum widgets … … 670 723 error "bad value: \"$val\": should be \"seek \[-percent\] value\"" 671 724 } 672 $_imh put [$_movie seek $val] 673 set cur [$_movie get position cur] 725 ${_movie} seek $val 726 ${_imh} put [${_movie} get image ${_width} ${_height}] 727 set cur [${_movie} get position cur] 674 728 set _settings($this-currenttime) [expr double($cur) / double(${_lastFrame})] 675 729 } … … 1006 1060 } 1007 1061 1062 # ---------------------------------------------------------------------- 1063 # OPTION: -width 1064 # ---------------------------------------------------------------------- 1065 itcl::configbody Rappture::VideoViewer::width { 1066 # $_dispatcher event -idle !fixsize 1067 if {[string is integer $itk_option(-width)] == 0} { 1068 error "bad value: \"$itk_option(-width)\": width should be an integer" 1069 } 1070 set _width $itk_option(-width) 1071 after idle [itcl::code $this fixSize] 1072 } 1073 1074 # ---------------------------------------------------------------------- 1075 # OPTION: -height 1076 # ---------------------------------------------------------------------- 1077 itcl::configbody Rappture::VideoViewer::height { 1078 # $_dispatcher event -idle !fixsize 1079 if {[string is integer $itk_option(-height)] == 0} { 1080 error "bad value: \"$itk_option(-height)\": height should be an integer" 1081 } 1082 set _height $itk_option(-height) 1083 after idle [itcl::code $this fixSize] 1084 } 1085 1086 # ---------------------------------------------------------------------- 1087 # OPTION: -controls 1088 # ---------------------------------------------------------------------- 1089 itcl::configbody Rappture::VideoViewer::controls { 1090 switch $itk_option(-controls) { 1091 show { 1092 } 1093 hide { 1094 } 1095 default { 1096 error "bad value: \"$itk_option(-height)\": height should be an integer" 1097 } 1098 } 1099 set _height $itk_option(-height) 1100 after idle [itcl::code $this fixSize] 1101 } 1102 -
branches/blt4/gui/scripts/xyprint.tcl
r1923 r1932 219 219 return [list .gif $bytes] 220 220 } 221 221 222 222 # Handle encapsulated postscript or portable document format. 223 223 … … 1224 1224 1225 1225 blt::table configure $page c0 c7 c8 -resize none 1226 1227 1226 } 1228 1227 -
branches/blt4/gui/scripts/xyresult.tcl
r1923 r1932 25 25 26 26 set autocolors { 27 #0000ff #ff0000 #00cc00 28 #cc00cc #ff9900 #cccc00 29 #000080 #800000 #006600 30 #660066 #996600 #666600 31 } 32 set autocolors { 33 #0000cd 34 #cd0000 35 #00cd00 36 #3a5fcd 37 #cdcd00 38 #cd1076 39 #009acd 40 #00c5cd 41 #a2b5cd 42 #7ac5cd 43 #66cdaa 44 #a2cd5a 45 #cd9b9b 46 #cdba96 47 #cd3333 48 #cd6600 49 #cd8c95 50 #cd00cd 51 #9a32cd 52 #6ca6cd 53 #9ac0cd 54 #9bcd9b 55 #00cd66 56 #cdc673 57 #cdad00 58 #cd5555 59 #cd853f 60 #cd7054 61 #cd5b45 62 #cd6889 63 #cd69c9 64 #551a8b 27 #0000cd 28 #cd0000 29 #00cd00 30 #3a5fcd 31 #cdcd00 32 #cd1076 33 #009acd 34 #00c5cd 35 #a2b5cd 36 #7ac5cd 37 #66cdaa 38 #a2cd5a 39 #cd9b9b 40 #cdba96 41 #cd3333 42 #cd6600 43 #cd8c95 44 #cd00cd 45 #9a32cd 46 #6ca6cd 47 #9ac0cd 48 #9bcd9b 49 #00cd66 50 #cdc673 51 #cdad00 52 #cd5555 53 #cd853f 54 #cd7054 55 #cd5b45 56 #cd6889 57 #cd69c9 58 #551a8b 65 59 } 66 60 … … 1505 1499 itcl::body Rappture::XyResult::_getTextMarkerOptions {style} { 1506 1500 array set textOptions { 1507 "-color" 1508 "-textcolor" 1509 "-font" 1510 "-xoffset" 1511 "-yoffset" 1512 "-anchor" 1513 "-rotate" 1501 "-color" "-outline" 1502 "-textcolor" "-outline" 1503 "-font" "-font" 1504 "-xoffset" "-xoffset" 1505 "-yoffset" "-yoffset" 1506 "-anchor" "-anchor" 1507 "-rotate" "-rotate" 1514 1508 } 1515 1509 set options {}
Note: See TracChangeset
for help on using the changeset viewer.