Changeset 1897 for branches/blt4/gui/scripts
- Timestamp:
- Aug 31, 2010 8:25:36 PM (14 years ago)
- Location:
- branches/blt4/gui/scripts
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/Makefile.in
r1879 r1897 14 14 INSTALL = @INSTALL@ 15 15 MKDIR_P = @MKDIR_P@ 16 TCL_VERSION = @TCL_VERSION@ 17 TCLSH = $(bindir)/tclsh$(TCL_VERSION) 16 TCLSH = @TCLSH@ 18 17 VPATH = $(srcdir) 19 18 PACKAGE_VERSION = @PACKAGE_VERSION@ … … 115 114 $(srcdir)/utils.tcl \ 116 115 $(srcdir)/valueresult.tcl \ 116 $(srcdir)/videoviewer.tcl \ 117 117 $(srcdir)/visviewer.tcl \ 118 118 $(srcdir)/vtkviewer.tcl \ -
branches/blt4/gui/scripts/analyzer.tcl
r1879 r1897 433 433 434 434 if {$status != 0} { 435 $itk_component(runinfo) configure -state normal 436 $itk_component(runinfo) delete 1.0 end 437 $itk_component(runinfo) insert end "Problem launching job:\n\n" text 438 _simOutput $result 439 $itk_component(runinfo) configure -state disabled 440 $itk_component(runinfo) see 1.0 441 442 # Try to create a support ticket for this error. 443 # It may be a real problem. 444 if {[Rappture::bugreport::shouldReport for jobs]} { 445 Rappture::bugreport::register "Problem launching job:\n\n$result\n== RAPPTURE INPUT ==\n[$_tool xml xml]" 446 } 435 $itk_component(runinfo) configure -state normal 436 $itk_component(runinfo) delete 1.0 end 437 $itk_component(runinfo) insert end "Problem launching job:\n\n" text 438 _simOutput $result 439 $itk_component(runinfo) configure -state disabled 440 $itk_component(runinfo) see 1.0 441 442 # Try to create a support ticket for this error. 443 # It may be a real problem. 444 if {[Rappture::bugreport::shouldReport for jobs]} { 445 set ::errorInfo "== RAPPTURE INPUT ==\n[$_tool xml xml]" 446 Rappture::bugreport::register "Problem launching job:\n$result" 447 Rappture::bugreport::send 448 } 447 449 } else { 448 450 $itk_component(notebook) current analyze -
branches/blt4/gui/scripts/balloon.tcl
r1719 r1897 217 217 # window). So for now, better to place the balloon window somewhere 218 218 # than to fail with a bad geometry. 219 #220 # Update: This answer could be that the root window (deskop) is221 # resized but XHeightOfScreen XWidthOfScreen still222 # report the initial size.223 #224 # Fixed in new BLT.225 #226 219 wm geometry $p +$px+$py 227 220 } else { -
branches/blt4/gui/scripts/bugreport.tcl
r1651 r1897 11 11 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 12 # ====================================================================== 13 option add *BugReport*Label.font {Helvetica -12} startupFile 13 14 option add *BugReport*banner*foreground white startupFile 14 15 option add *BugReport*banner*background #a9a9a9 startupFile 15 16 option add *BugReport*banner*highlightBackground #a9a9a9 startupFile 16 option add *BugReport*banner*font \ 17 -*-helvetica-bold-r-normal-*-18-* startupFile 18 option add *BugReport*Label.font \ 19 -*-helvetica-medium-r-normal-*-12-* startupFile 17 option add *BugReport*banner.title.font {Helvetica -18 bold} startupFile 20 18 option add *BugReport*xmit*wrapLength 3i startupFile 21 19 option add *BugReport*expl.width 50 startupFile 22 option add *BugReport*expl.font \ 23 -*-helvetica-medium-r-normal-*-12-* startupFile 24 option add *BugReport*expl.boldFont \ 25 -*-helvetica-bold-r-normal-*-12-* startupFile 20 option add *BugReport*expl.font {Helvetica -12} startupFile 21 option add *BugReport*expl.boldFont {Helvetica -12 bold} startupFile 22 option add *BugReport*comments.l.font {Helvetica -12 italic} startupFile 23 option add *BugReport*comments.info.text.font {Helvetica -12} startupFile 24 option add *BugReport*details*font {Courier -12} startupFile 26 25 27 26 namespace eval Rappture::bugreport { 27 # details from the current trouble report 28 variable details 29 28 30 # assume that if there's a problem launching a job, we should know it 29 31 variable reportJobFailures 1 … … 50 52 proc Rappture::bugreport::activate {err} { 51 53 global env errorInfo 54 variable details 52 55 53 56 if {"@SHOWDETAILS" == $err} { 57 pack propagate .bugreport yes 58 pack forget .bugreport.expl 54 59 pack forget .bugreport.xmit 55 pack forget .bugreport.ok 60 pack forget .bugreport.done 61 pack forget .bugreport.cntls.show 62 pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x 56 63 pack .bugreport.details -after .bugreport.banner \ 57 64 -expand yes -fill both -padx 8 -pady 8 58 focus .bugreport.details.cntls.ok 65 pack .bugreport.comments -after .bugreport.details \ 66 -expand yes -fill both -padx 8 -pady {0 8} 59 67 return 60 68 } 61 69 62 # always fill in details so we can submit trouble reports later 70 # gather details so we can submit trouble reports later 71 # do this now, before we do anything with "catch" down below 72 # that might mask the errorInfo 73 register $err 74 75 pack propagate .bugreport yes 76 pack forget .bugreport.details 77 pack forget .bugreport.xmit 78 pack forget .bugreport.done 79 pack .bugreport.cntls.show -side right 80 pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x 81 pack .bugreport.expl -after .bugreport.banner \ 82 -expand yes -fill both -padx 8 -pady 8 83 pack .bugreport.comments -after .bugreport.expl \ 84 -expand yes -fill both -padx 8 -pady {0 8} 85 86 .bugreport.expl configure -state normal 87 .bugreport.expl delete 1.0 end 88 89 set url [Rappture::Tool::resources -huburl] 90 if {"" != $url} { 91 .bugreport.expl insert end "Something went wrong with this tool. Help us understand what happened by submitting a trouble report, so we can fix the problem. If you continue having trouble with this tool, please close it and restart." 92 .bugreport.cntls.send configure -state normal 93 focus .bugreport.cntls.send 94 } else { 95 .bugreport.expl insert end "Something went wrong with this tool. We would ask you to submit a trouble report about the error, but we can't tell what hub it should be submitted to. If you continue having trouble with this tool, please close it and restart." 96 pack forget .bugreport.comments 97 .bugreport.cntls.send configure -state disabled 98 focus .bugreport.cntls.ok 99 } 100 fixTextHeight .bugreport.expl 101 .bugreport.expl configure -state disabled 102 63 103 .bugreport.details.info.text configure -state normal 64 104 .bugreport.details.info.text delete 1.0 end 65 .bugreport.details.info.text insert end "$err\n-----\n$errorInfo" 105 .bugreport.details.info.text insert end " USER: $details(login)\n" 106 .bugreport.details.info.text insert end "HOSTNAME: $details(hostname)\n" 107 .bugreport.details.info.text insert end " TOOL: $details(referrer)\n" 108 .bugreport.details.info.text insert end " SESSION: $details(session)\n" 109 .bugreport.details.info.text insert end "CATEGORY: $details(category)\n" 110 .bugreport.details.info.text insert end " SUMMARY: $details(summary)\n" 111 .bugreport.details.info.text insert end "---------\n" 112 .bugreport.details.info.text insert end $details(stackTrace) 66 113 .bugreport.details.info.text configure -state disabled 67 68 if {[shouldReport for oops]} {69 pack forget .bugreport.details70 pack forget .bugreport.expl71 pack .bugreport.ok -side bottom -after .bugreport.banner -pady {0 8}72 pack .bugreport.xmit -after .bugreport.ok -padx 8 -pady 873 focus .bugreport.ok74 set dosubmit 175 } else {76 pack forget .bugreport.expl77 pack forget .bugreport.xmit78 pack forget .bugreport.ok79 pack .bugreport.details -after .bugreport.banner \80 -expand yes -fill both -padx 8 -pady 881 focus .bugreport.details.cntls.ok82 set dosubmit 083 }84 114 85 115 set w [winfo reqwidth .bugreport] 86 116 set h [winfo reqheight .bugreport] 87 117 set x [expr {([winfo screenwidth .bugreport]-$w)/2}] 88 set y [expr {([winfo screenheight .bugreport]-$w)/2}] 118 if {$x < 0} {set x 0} 119 set y [expr {([winfo screenheight .bugreport]-$h)/2}] 120 if {$y < 0} {set y 0} 89 121 90 122 wm geometry .bugreport +$x+$y … … 94 126 catch {grab set .bugreport} 95 127 update 96 97 if {$dosubmit} {98 submit99 }100 128 } 101 129 … … 123 151 set info [.bugreport.details.info.text get 1.0 end] 124 152 153 pack propagate .bugreport no 125 154 pack forget .bugreport.details 126 pack .bugreport.ok -side bottom -after .bugreport.banner -pady {0 8} 127 pack .bugreport.xmit -after .bugreport.ok -padx 8 -pady 8 155 pack forget .bugreport.expl 156 pack forget .bugreport.comments 157 pack forget .bugreport.cntls 158 pack .bugreport.xmit -after .bugreport.banner -padx 8 -pady 8 128 159 .bugreport.xmit.title configure -text "Sending trouble report to [Rappture::Tool::resources -hubname]..." 129 focus .bugreport.ok130 160 131 161 # send off the trouble report... 132 162 .bugreport.xmit.icon start 133 set status [catch {register $info}result]163 set status [catch send result] 134 164 .bugreport.xmit.icon stop 135 165 166 pack propagate .bugreport yes 136 167 pack forget .bugreport.xmit 137 pack .bugreport.expl -after .bugreport. ok-padx 8 -pady 8168 pack .bugreport.expl -after .bugreport.banner -padx 8 -pady 8 138 169 .bugreport.expl configure -state normal 139 170 .bugreport.expl delete 1.0 end … … 146 177 .bugreport.details.info.text configure -state disabled 147 178 148 .bugreport.expl insert end " This tool encountered an unexpected error. We tried to submit a trouble report automatically, but that failed. If you want to report this incident, you can file your own trouble report. Look for the \"Help\" or \"Support\" links on the main navigation bar of the web site.\n\nIf you continue having trouble with this tool, please close it and launch another session."179 .bugreport.expl insert end "Oops! Ticket submission failed:\n$result\n\nIf you want to report the original problem, you can file your own trouble report by going to the web site and clicking on the \"Help\" or \"Support\" link on the main navigation bar. If you continue having trouble with this tool, please close it and restart." 149 180 } elseif {[regexp {Ticket #([0-9]*) +\((.*?)\) +([0-9]+) +times} $result match ticket extra times]} { 150 .bugreport.expl insert end "This tool encountered an unexpected error. Theproblem has been reported as " "" "Ticket #$ticket" bold " in our system." ""181 .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." "" 151 182 if {[string is integer $times] && $times > 1} { 152 183 .bugreport.expl insert end " This particular problem has been reported $times times." 153 184 } 154 .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and launch another session."185 .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and restart. Thanks for reporting the problem and helping us improve things!" 155 186 } else { 156 .bugreport.expl insert end "This tool encountered an unexpected error, and the problem was reported. Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and launch another session." "" 157 } 158 for {set h 1} {$h < 50} {incr h} { 159 .bugreport.expl configure -height $h 160 .bugreport.expl see 1.0 161 update idletasks 162 if {"" != [.bugreport.expl bbox end-1char]} { 163 break 164 } 165 } 187 .bugreport.expl insert end "This problem has been reported. Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and restart. Thanks for reporting the problem and helping us improve things!" "" 188 } 189 fixTextHeight .bugreport.expl 166 190 .bugreport.expl configure -state disabled 167 } 168 169 # ---------------------------------------------------------------------- 170 # USAGE: download 171 # 172 # Used to download the current ticket information to the user's 173 # desktop. 174 # ---------------------------------------------------------------------- 175 proc Rappture::bugreport::download {} { 176 set info [.bugreport.details.info.text get 1.0 end] 177 Rappture::filexfer::download $info bugreport.txt 178 } 179 180 # ---------------------------------------------------------------------- 181 # USAGE: register <stackTrace> 182 # 183 # Low-level function used to send bug reports back to the hub site. 184 # Error details in the <stackTrace> are posted to a URL that creates 185 # a support ticket. Returns a string of the following form, 186 # representing details about the new or existing ticket: 187 # Ticket #XX (XXXXXX) XX times 188 # ---------------------------------------------------------------------- 189 proc Rappture::bugreport::register {stackTrace} { 190 global env tcl_platform 191 192 package require http 193 package require tls 194 http::register https 443 ::tls::socket 195 191 pack .bugreport.done -side bottom -padx 8 -pady 8 192 focus .bugreport.done 193 } 194 195 # ---------------------------------------------------------------------- 196 # USAGE: register <err> 197 # 198 # Low-level function used to capture information about a bug report 199 # prior to calling "send", which actually sends the ticket. We usually 200 # let the user preview the information and decide whether or not to 201 # send the ticket. 202 # ---------------------------------------------------------------------- 203 proc Rappture::bugreport::register {err} { 204 global errorInfo tcl_platform 205 variable details 206 207 # 208 # Figure out exactly what we'll send if the bug report is 209 # submitted, so we can show the user. 210 # 211 set stackTrace "$err\n---------\n$errorInfo" 196 212 if {![regexp {^([^\n]+)\n} $stackTrace match summary]} { 197 213 if {[string length $stackTrace] == 0} { … … 246 262 } 247 263 264 set details(summary) $summary 265 set details(category) $category 266 set details(stackTrace) $stackTrace 267 set details(login) $tcl_platform(user) 268 set details(hostname) [info hostname] 269 set details(session) [Rappture::Tool::resources -session] 270 set details(referrer) "tool \"[Rappture::Tool::resources -appname]\"" 271 } 272 273 # ---------------------------------------------------------------------- 274 # USAGE: send 275 # 276 # Low-level function used to send bug reports back to the hub site. 277 # Error details gathered by a previous call to "register" are sent 278 # along as a support ticket. Returns a string of the following form, 279 # representing details about the new or existing ticket: 280 # Ticket #XX (XXXXXX) XX times 281 # ---------------------------------------------------------------------- 282 proc Rappture::bugreport::send {} { 283 variable details 284 285 package require http 286 package require tls 287 http::register https 443 ::tls::socket 288 289 set report $details(stackTrace) 290 set cmts [string trim [.bugreport.comments.info.text get 1.0 end]] 291 if {[string length $cmts] > 0} { 292 set report "$cmts\n[string repeat = 72]\n$report" 293 } 294 248 295 set query [http::formatQuery \ 249 296 option com_support \ 250 297 task create \ 251 298 no_html 1 \ 252 report $ stackTrace\253 login $ tcl_platform(user) \254 sesstoken [Rappture::Tool::resources -session]\255 hostname [info hostname]\256 category $ category\257 summary $ summary\258 referrer "tool \"[Rappture::Tool::resources -appname]\""\299 report $report \ 300 login $details(login) \ 301 sesstoken $details(session) \ 302 hostname $details(hostname) \ 303 category $details(category) \ 304 summary $details(summary) \ 305 referrer $details(referrer) \ 259 306 ] 260 307 … … 282 329 283 330 # ---------------------------------------------------------------------- 331 # USAGE: fixTextHeight <widget> 332 # 333 # Used internally to adjust the height of a text widget so it is just 334 # tall enough to show the info within it. 335 # ---------------------------------------------------------------------- 336 proc Rappture::bugreport::fixTextHeight {widget} { 337 # 338 # HACK ALERT! In Tk8.5, we can count display lines directly. 339 # But for earlier versions, we have to cook up something 340 # similar. 341 # 342 if {[catch {$widget count -displaylines 1.0 end} h] == 0 && $h > 0} { 343 $widget configure -height $h 344 } else { 345 for {set h 1} {$h < 15} {incr h} { 346 $widget configure -height $h 347 $widget see 1.0 348 update idletasks 349 if {"" != [$widget bbox end-1char]} { 350 break 351 } 352 } 353 } 354 } 355 356 # ---------------------------------------------------------------------- 284 357 # USAGE: shouldReport jobfailures <boolean> 285 358 # USAGE: shouldReport for ?oops|jobs? … … 304 377 } 305 378 for { 306 # is this a tool in production?307 if {![info exists env(RAPPTURE_VERSION)]308 || $env(RAPPTURE_VERSION) != "current"} {309 return 0310 }311 312 379 # is it being run within a workspace? 313 380 set appname [Rappture::Tool::resources -appname] … … 343 410 label .bugreport.banner.icon -image [Rappture::icon alert] 344 411 pack .bugreport.banner.icon -side left -padx 2 -pady 2 345 label .bugreport.banner.title -text "Oops! UnexpectedError"412 label .bugreport.banner.title -text "Oops! Internal Error" 346 413 pack .bugreport.banner.title -side left -padx {0 8} -pady 2 347 414 … … 352 419 Rappture::bugreport::deactivate 353 420 354 button .bugreport.ok -text "Dismiss" -command Rappture::bugreport::deactivate 355 pack .bugreport.ok -side bottom -pady {0 8} 421 set bg [.bugreport cget -background] 422 text .bugreport.expl -borderwidth 0 -highlightthickness 0 -background $bg \ 423 -height 3 -wrap word 424 .bugreport.expl tag configure bold \ 425 -font [option get .bugreport.expl boldFont Font] 426 # 427 # HACK ALERT! We have problems with fixTextHeight working correctly 428 # on Windows for Tk8.4 and earlier. To make it work properly, we 429 # add the binding below. At some point, we'll ditch 8.4 and we can 430 # use the new "count -displaylines" option in Tk8.5. 431 # 432 bind .bugreport.expl <Map> {Rappture::bugreport::fixTextHeight %W} 433 434 frame .bugreport.comments 435 label .bugreport.comments.l -text "What were you doing just before this error?" -anchor w 436 pack .bugreport.comments.l -side top -anchor w 437 Rappture::Scroller .bugreport.comments.info -xscrollmode none -yscrollmode auto 438 text .bugreport.comments.info.text -width 30 -height 3 -wrap word 439 .bugreport.comments.info contents .bugreport.comments.info.text 440 bind .bugreport.comments.info.text <ButtonPress> {focus %W} 441 pack .bugreport.comments.info -expand yes -fill both 442 443 frame .bugreport.cntls 444 pack .bugreport.cntls -side bottom -fill x 445 button .bugreport.cntls.ok -text "Ignore" -command { 446 Rappture::bugreport::deactivate 447 } 448 pack .bugreport.cntls.ok -side left -padx {4 20} -pady 8 449 button .bugreport.cntls.send -text "Send Trouble Report" -command { 450 Rappture::bugreport::submit 451 } 452 pack .bugreport.cntls.send -side right -padx 4 -pady 8 453 454 button .bugreport.cntls.show -text "Show Details..." \ 455 -command {Rappture::bugreport::activate @SHOWDETAILS} 456 pack .bugreport.cntls.show -side right 457 458 459 frame .bugreport.details 460 Rappture::Scroller .bugreport.details.info -xscrollmode auto -yscrollmode auto 461 text .bugreport.details.info.text -width 50 -height 15 -wrap none 462 .bugreport.details.info contents .bugreport.details.info.text 463 pack .bugreport.details.info -expand yes -fill both 356 464 357 465 frame .bugreport.xmit … … 364 472 pack .bugreport.xmit.title -side left -expand yes -fill x 365 473 366 text .bugreport.expl -borderwidth 0 -highlightthickness 0 -wrap word 367 .bugreport.expl tag configure bold \ 368 -font [option get .bugreport.expl boldFont Font] 369 370 bind .bugreport.expl <Control-1><Control-1><Control-3><Control-3> { 371 Rappture::bugreport::activate @SHOWDETAILS 372 } 373 374 bind .bugreport.expl <Control-1><Control-1><Control-Shift-1><Control-Shift-1> { 375 Rappture::bugreport::activate @SHOWDETAILS 376 } 377 378 frame .bugreport.details 379 frame .bugreport.details.cntls 380 pack .bugreport.details.cntls -side bottom -fill x 381 button .bugreport.details.cntls.ok -text "Dismiss" -command { 382 Rappture::bugreport::deactivate 383 } 384 pack .bugreport.details.cntls.ok -side right -padx 2 -pady 4 385 button .bugreport.details.cntls.send -text "Send Trouble Report" -command { 386 Rappture::bugreport::submit 387 } 388 pack .bugreport.details.cntls.send -side left -padx 2 -pady 4 389 button .bugreport.details.cntls.dload -text "Download" -command { 390 Rappture::bugreport::download 391 } 392 pack .bugreport.details.cntls.dload -side left -padx 2 -pady 4 393 394 set scrollset .bugreport.details.info 395 blt::scrollset $scrollset -xscrollbar $scrollset.xs -yscrollbar $scrollset.ys \ 396 -window $scrollset.text 397 blt::tk::scrollbar $scrollset.xs 398 blt::tk::scrollbar $scrollset.ys 399 text .bugreport.details.info.text -width 50 -height 15 -wrap none 400 pack .bugreport.details.info -expand yes -fill both 474 button .bugreport.done -text "Done" \ 475 -command Rappture::bugreport::deactivate 401 476 402 477 # this binding keeps the bugreport window on top -
branches/blt4/gui/scripts/combobox.tcl
r1646 r1897 134 134 $itk_component(entry) configure -state disabled 135 135 } 136 set cmd [list event generate $itk_component(hull) <<Value>>] 137 after 10 [list catch $cmd]136 137 after 10 [list catch [list event generate $itk_component(hull) <<Value>>]] 138 138 } elseif {[llength $args] != 0} { 139 139 error "wrong # args: should be \"value ?newval?\"" -
branches/blt4/gui/scripts/filexfer.tcl
r1587 r1897 338 338 /apps/bin/clientaction 339 339 /apps/xvnc/bin/clientaction 340 /usr/lib/mw/bin/clientaction 340 341 "" 341 342 } { -
branches/blt4/gui/scripts/grab.tcl
r1342 r1897 65 65 } 66 66 67 # if the window is already on the stack, then skip it 68 if {[string equal [lindex $::Rappture::grab::stack 0] $window]} { 69 return $window 70 } 71 67 72 # add the current configuration to the grab stack 68 73 set ::Rappture::grab::stack \ -
branches/blt4/gui/scripts/moleculeViewer.tcl
r1719 r1897 700 700 } 701 701 702 itcl::body Rappture:: DeviceEditor::snap { w h } {702 itcl::body Rappture::MoleculeViewer::snap { w h } { 703 703 if { $w <= 0 || $h <= 0 } { 704 704 set w [winfo width $itk_component(area)] -
branches/blt4/gui/scripts/sidebarframe.tcl
r1764 r1897 451 451 release { 452 452 set minw [winfo reqwidth $itk_component(controlbar)] 453 if { $_width != "auto" && ($_width-$minw)< 40} {453 if {$_width-$minw < 40} { 454 454 set _width "auto" 455 455 pop close -
branches/blt4/gui/scripts/textentry.tcl
r1862 r1897 231 231 # take down any existing widget 232 232 foreach win [pack slaves $itk_interior] { 233 pack forget $win 233 if { [winfo name $win] != "hints" } { 234 pack forget $win 235 } 234 236 } 235 237 -
branches/blt4/gui/scripts/utils.tcl
r1719 r1897 23 23 proc Rappture::utils::hexdump {args} { 24 24 Rappture::getopts args params { 25 25 value -lines unlimited 26 26 } 27 27 if {[llength $args] != 1} { 28 28 error "wrong # args: should be \"hexdump ?-lines num? data\"" 29 29 } 30 30 set newval [lindex $args 0] … … 34 34 35 35 if {$params(-lines) != "unlimited" && $params(-lines) <= 0} { 36 36 return $rval 37 37 } 38 38 … … 40 40 set len [string length $newval] 41 41 for {set i 0} {$i < $len} {incr i 8} { 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 42 append rval [format "%#06x: " $i] 43 set ascii "" 44 for {set j 0} {$j < 8} {incr j} { 45 if {$i+$j < $len} { 46 set char [string index $newval [expr {$i+$j}]] 47 binary scan $char c ichar 48 set hexchar [format "%02x" [expr {0xff & $ichar}]] 49 } else { 50 set char " " 51 set hexchar " " 52 } 53 append rval "$hexchar " 54 if {[regexp {[\000-\037\177-\377]} $char]} { 55 append ascii "." 56 } else { 57 append ascii $char 58 } 59 } 60 append rval " | $ascii\n" 61 61 62 63 64 65 66 67 62 if {"unlimited" != $params(-lines) && $i/8+1 >= $params(-lines)} { 63 if {$i < $len-1} { 64 append rval "more..." 65 } 66 break 67 } 68 68 } 69 69 return $rval … … 78 78 proc Rappture::utils::binsize {size} { 79 79 foreach {factor units} { 80 81 82 83 80 1073741824 GB 81 1048576 MB 82 1024 kB 83 1 bytes 84 84 } { 85 86 87 88 89 90 85 if {$size/$factor > 0} { 86 if {$factor > 1} { 87 set size [format "%.1f" [expr {double($size)/$factor}]] 88 } 89 break 90 } 91 91 } 92 92 return "$size $units" … … 127 127 return $desc 128 128 } 129 130 # ---------------------------------------------------------------------- 131 # USAGE: expandPath <path> 132 # 133 # Returns the true location of the provided path, 134 # automatically expanding links to form an absolute path. 135 # ---------------------------------------------------------------------- 136 proc Rappture::utils::expandPath {args} { 137 set path "" 138 set dirs [file split [lindex $args 0]] 139 140 while {[llength $dirs] > 0} { 141 set d [lindex $dirs 0] 142 set dirs [lrange $dirs 1 end] 143 if {[catch {file link [file join $path $d]} out] == 0} { 144 # directory d is a link, follow it 145 set outdirs [file split $out] 146 if {[string compare "/" [lindex $outdirs 0]] == 0} { 147 # directory leads back to root 148 # clear path 149 # reset dirs list 150 set path "" 151 set dirs $outdirs 152 } else { 153 # relative path for the link 154 # prepend directory to dirs list 155 set dirs [concat $outdirs $dirs] 156 } 157 } else { 158 set path [file join $path $d] 159 } 160 } 161 return $path 162 } 163 -
branches/blt4/gui/scripts/xyresult.tcl
r1804 r1897 279 279 -brightness 0 280 280 -width 1 281 -type " histogram"281 -type "line" 282 282 -raise 0 283 283 -linestyle solid
Note: See TracChangeset
for help on using the changeset viewer.