Changeset 1342 for trunk/gui/scripts/analyzer.tcl
- Timestamp:
- Mar 18, 2009, 2:59:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r1274 r1342 98 98 99 99 itk_component add simbg { 100 100 frame $itk_interior.simol.simbg -borderwidth 0 101 101 } { 102 103 102 usual 103 rename -background -simcontrolcolor simControlColor Color 104 104 } 105 105 pack $itk_component(simbg) -expand yes -fill both … … 107 107 set simtxt [$tool xml get tool.action.label] 108 108 if {"" == $simtxt} { 109 109 set simtxt "Simulate" 110 110 } 111 111 itk_component add simulate { 112 113 112 button $itk_component(simbg).simulate -text $simtxt \ 113 -command [itcl::code $this simulate] 114 114 } { 115 116 115 usual 116 rename -highlightbackground -simcontrolcolor simControlColor Color 117 117 } 118 118 pack $itk_component(simulate) -side left -padx 4 -pady 4 … … 122 122 set url [Rappture::Tool::resources -huburl] 123 123 if {"" != $url && "" != $app} { 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 124 itk_component add hubcntls { 125 frame $itk_component(simbg).hubcntls 126 } { 127 usual 128 rename -background -simcontrolcolor simControlColor Color 129 } 130 pack $itk_component(hubcntls) -side right -padx 4 131 132 itk_component add icon { 133 label $itk_component(hubcntls).icon -image [Rappture::icon ask] \ 134 -highlightthickness 0 135 } { 136 usual 137 ignore -highlightthickness 138 rename -background -simcontrolcolor simControlColor Color 139 } 140 pack $itk_component(icon) -side left 141 142 itk_component add about { 143 button $itk_component(hubcntls).about -text "About this tool" \ 144 -command [list Rappture::filexfer::webpage "$url/tools/$app"] 145 } { 146 usual 147 ignore -font 148 rename -background -simcontrolcolor simControlColor Color 149 rename -highlightbackground -simcontrolcolor simControlColor Color 150 } 151 pack $itk_component(about) -side top -anchor w 152 153 itk_component add questions { 154 button $itk_component(hubcntls).questions -text Questions? \ 155 -command [list Rappture::filexfer::webpage "$url/resources/$app/questions"] 156 } { 157 usual 158 ignore -font 159 rename -background -simcontrolcolor simControlColor Color 160 rename -highlightbackground -simcontrolcolor simControlColor Color 161 } 162 pack $itk_component(questions) -side top -anchor w 163 163 } 164 164 165 165 itk_component add simstatus { 166 167 168 166 text $itk_component(simbg).simstatus -borderwidth 0 \ 167 -highlightthickness 0 -height 1 -width 1 -wrap none \ 168 -state disabled 169 169 } { 170 171 172 173 170 usual 171 ignore -highlightthickness 172 rename -background -simcontrolcolor simControlColor Color 173 rename -font -textfont textFont Font 174 174 } 175 175 pack $itk_component(simstatus) -side left -expand yes -fill x 176 176 177 177 $itk_component(simstatus) tag configure popup \ 178 178 -underline 1 -foreground blue 179 179 180 180 $itk_component(simstatus) tag bind popup \ 181 181 <Enter> {%W configure -cursor center_ptr} 182 182 $itk_component(simstatus) tag bind popup \ 183 183 <Leave> {%W configure -cursor ""} 184 184 $itk_component(simstatus) tag bind popup \ 185 185 <ButtonPress> {after idle {Rappture::Tooltip::tooltip show %W}} 186 186 187 187 188 188 itk_component add notebook { 189 189 Rappture::Notebook $itk_interior.nb 190 190 } 191 191 pack $itk_interior.nb -expand yes -fill both … … 199 199 pack $w.info -expand yes -fill both -padx 4 -pady 20 200 200 itk_component add toolinfo { 201 202 201 text $w.info.text -width 1 -height 1 -wrap word \ 202 -borderwidth 0 -highlightthickness 0 203 203 } { 204 205 206 204 usual 205 ignore -borderwidth -relief 206 rename -font -textfont textFont Font 207 207 } 208 208 $w.info contents $w.info.text … … 218 218 219 219 itk_component add abort { 220 221 220 button $w.cntls.abort -text "Abort" \ 221 -command [itcl::code $_tool abort] 222 222 } 223 223 pack $itk_component(abort) -side left -expand yes -padx 4 -pady 4 … … 226 226 pack $w.info -expand yes -fill both -padx 4 -pady 4 227 227 itk_component add runinfo { 228 229 230 228 text $w.info.text -width 1 -height 1 -wrap none \ 229 -borderwidth 0 -highlightthickness 0 \ 230 -state disabled 231 231 } { 232 233 234 232 usual 233 ignore -borderwidth -relief 234 rename -font -codefont codeFont Font 235 235 } 236 236 $w.info contents $w.info.text 237 237 238 238 itk_component add progress { 239 239 Rappture::Progress $w.progress 240 240 } 241 241 … … 251 251 252 252 itk_component add resultselector { 253 253 Rappture::Combobox $w.top.sel -width 10 -editable no 254 254 } { 255 256 255 usual 256 rename -font -textfont textFont Font 257 257 } 258 258 pack $itk_component(resultselector) -side left -expand yes -fill x 259 259 bind $itk_component(resultselector) <<Value>> [itcl::code $this _fixResult] 260 260 bind $itk_component(resultselector) <Enter> \ 261 261 [itcl::code $this download coming] 262 262 263 263 Rappture::Tooltip::for $itk_component(resultselector) \ 264 264 "@[itcl::code $this _resultTooltip]" 265 265 266 266 $itk_component(resultselector) choices insert end \ 267 267 --- "---" 268 268 269 269 itk_component add download { 270 271 272 270 button $w.top.dl -image [Rappture::icon download] -anchor e \ 271 -borderwidth 1 -relief flat -overrelief raised \ 272 -command [itcl::code $this download start $w.top.dl] 273 273 } 274 274 pack $itk_component(download) -side right -padx {4 0} 275 275 bind $itk_component(download) <Enter> \ 276 276 [itcl::code $this download coming] 277 277 278 278 $itk_component(resultselector) choices insert end \ 279 279 @download [Rappture::filexfer::label download] 280 280 281 281 if {[Rappture::filexfer::enabled]} { 282 282 Rappture::Tooltip::for $itk_component(download) "Downloads the current result to a new web browser window on your desktop. From there, you can easily print or save results. 283 283 284 284 NOTE: Your web browser must allow pop-ups from this site. If your output does not appear, look for a 'pop-up blocked' message and enable pop-ups." 285 285 } else { 286 286 Rappture::Tooltip::for $itk_component(download) "Saves the current result to a file on your desktop." 287 287 } 288 288 289 289 itk_component add results { 290 290 Rappture::Panes $w.pane -sashwidth 1 -sashrelief solid -sashpadding {4 0} 291 291 } 292 292 pack $itk_component(results) -expand yes -fill both … … 294 294 295 295 itk_component add resultpages { 296 296 Rappture::Notebook $f.nb 297 297 } 298 298 pack $itk_component(resultpages) -expand yes -fill both … … 300 300 set f [$itk_component(results) insert end -fraction 0.1] 301 301 itk_component add resultset { 302 303 304 305 302 Rappture::ResultSet $f.rset \ 303 -clearcommand [itcl::code $this clear] \ 304 -settingscommand [itcl::code $this _plot] \ 305 -promptcommand [itcl::code $this _simState] 306 306 } 307 307 pack $itk_component(resultset) -expand yes -fill both … … 318 318 # 319 319 $itk_component(toolinfo) tag configure title \ 320 320 -font $itk_option(-boldtextfont) 321 321 322 322 set mesg [$tool xml get tool.title] 323 323 if {"" != $mesg} { 324 325 324 $itk_component(toolinfo) insert end $mesg title 325 $itk_component(toolinfo) insert end "\n\n" 326 326 } 327 327 328 328 set mesg [$tool xml get tool.about] 329 329 if {"" != $mesg} { 330 330 $itk_component(toolinfo) insert end $mesg 331 331 } 332 332 $itk_component(toolinfo) configure -state disabled … … 336 336 set cntl [$tool xml get tool.control] 337 337 if {"" == $cntl} { 338 338 set cntl [$tool xml get tool.control.type] 339 339 } 340 340 if {"" != $cntl} { 341 341 set _control $cntl 342 342 } 343 343 … … 351 351 itcl::body Rappture::Analyzer::destructor {} { 352 352 foreach obj $_runs { 353 353 itcl::delete object $obj 354 354 } 355 355 after cancel [itcl::code $this simulate] … … 368 368 itcl::body Rappture::Analyzer::simulate {args} { 369 369 if {$args == "-ifneeded"} { 370 371 372 373 374 375 376 377 378 370 # check to see if simulation is really needed 371 $_tool sync 372 if {[$itk_component(resultset) contains [$_tool xml object]] 373 && ![string equal $_control "manual-resim"]} { 374 # not needed -- show results and return 375 $itk_component(notebook) current analyze 376 return 377 } 378 set args "" 379 379 } 380 380 … … 394 394 # if the hold window is set, then put up a busy cursor 395 395 if {$itk_option(-holdwindow) != ""} { 396 397 398 396 blt::busy hold $itk_option(-holdwindow) 397 raise $itk_component(hull) 398 update 399 399 } 400 400 … … 404 404 # if job was aborted, then allow simulation again 405 405 if {$result == "ABORT"} { 406 406 _simState on "Aborted" 407 407 } 408 408 409 409 # load results from run.xml into analyzer 410 410 if {$status == 0 && $result != "ABORT"} { 411 411 set status [catch {load $result} result] 412 412 } 413 413 414 414 # back to normal 415 415 if {$itk_option(-holdwindow) != ""} { 416 416 blt::busy release $itk_option(-holdwindow) 417 417 } 418 418 $itk_component(abort) configure -state disabled 419 419 420 420 if {$status != 0} { 421 422 423 424 425 426 427 428 429 430 431 432 421 $itk_component(runinfo) configure -state normal 422 $itk_component(runinfo) delete 1.0 end 423 $itk_component(runinfo) insert end "Problem launching job:\n\n" text 424 _simOutput $result 425 $itk_component(runinfo) configure -state disabled 426 $itk_component(runinfo) see 1.0 427 428 # Try to create a support ticket for this error. 429 # It may be a real problem. 430 if {[Rappture::bugreport::shouldReport for jobs]} { 431 Rappture::bugreport::register "Problem launching job:\n\n$result\n== RAPPTURE INPUT ==\n[$_tool xml xml]" 432 } 433 433 } else { 434 434 $itk_component(notebook) current analyze 435 435 } 436 436 … … 449 449 itcl::body Rappture::Analyzer::reset {{when -eventually}} { 450 450 if {$when == "-eventually"} { 451 452 453 451 after cancel [list catch [itcl::code $this reset -now]] 452 after idle [list catch [itcl::code $this reset -now]] 453 return 454 454 } 455 455 … … 457 457 $_tool sync 458 458 if {![$itk_component(resultset) contains [$_tool xml object]] 459 460 461 462 463 464 465 466 467 468 469 459 || [string equal $_control "manual-resim"]} { 460 # if control mode is "auto", then simulate right away 461 if {[string match auto* $_control]} { 462 # auto control -- don't need button 463 pack forget $itk_interior.simol 464 465 after cancel [itcl::code $this simulate] 466 after idle [itcl::code $this simulate] 467 } else { 468 _simState on "new input parameters" 469 } 470 470 } else { 471 471 _simState off 472 472 } 473 473 } … … 482 482 # only show the last result? then clear first 483 483 if {[$_tool xml get tool.analyzer] == "last"} { 484 484 clear 485 485 } 486 486 … … 488 488 # each run.xml is loaded as a previous simulation. 489 489 foreach item [$xmlobj children -type run output.load] { 490 491 492 490 set loadfile [$xmlobj get output.load.$item] 491 set loadobj [Rappture::library $loadfile] 492 load $loadobj 493 493 } 494 494 495 495 foreach item [$xmlobj children -type run output.include] { 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 496 set id [$xmlobj element -as id output.include.$item] 497 set inclfile [$xmlobj get output.include.$item] 498 set inclobj [Rappture::library $inclfile] 499 foreach c [$inclobj children output] { 500 switch -glob -- $c { 501 # we don't want to include these tags 502 include* - time* - status* - user* { 503 continue 504 } 505 default { 506 set oldid [$inclobj element -as id output.$c] 507 set oldtype [$inclobj element -as type output.$c] 508 set newcomp "$oldtype\($id-$oldid\)" 509 $xmlobj copy output.$newcomp from $inclobj output.$c 510 } 511 } 512 } 513 513 } 514 514 … … 518 518 set haveresults 0 519 519 foreach item [_reorder [$xmlobj children output]] { 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 520 switch -glob -- $item { 521 log* { 522 _autoLabel $xmlobj output.$item "Output Log" counters 523 } 524 number* { 525 _autoLabel $xmlobj output.$item "Number" counters 526 } 527 integer* { 528 _autoLabel $xmlobj output.$item "Integer" counters 529 } 530 string* { 531 _autoLabel $xmlobj output.$item "String" counters 532 } 533 histogram* - curve* - field* { 534 _autoLabel $xmlobj output.$item "Plot" counters 535 } 536 structure* { 537 _autoLabel $xmlobj output.$item "Structure" counters 538 } 539 table* { 540 _autoLabel $xmlobj output.$item "Energy Levels" counters 541 } 542 sequence* { 543 _autoLabel $xmlobj output.$item "Sequence" counters 544 } 545 } 546 set label [$xmlobj get output.$item.about.group] 547 if {"" == $label} { 548 set label [$xmlobj get output.$item.about.label] 549 } 550 551 set hidden [$xmlobj get output.$item.hide] 552 set hidden [expr {"" != $hidden && $hidden}] 553 554 if {"" != $label && !$hidden} { 555 set haveresults 1 556 } 557 557 } 558 558 559 559 # if there are any valid results, add them to the resultset 560 560 if {$haveresults} { 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 561 set index [$itk_component(resultset) add $xmlobj] 562 563 # add each result to a result viewer 564 foreach item [_reorder [$xmlobj children output]] { 565 set label [$xmlobj get output.$item.about.group] 566 if {"" == $label} { 567 set label [$xmlobj get output.$item.about.label] 568 } 569 570 set hidden [$xmlobj get output.$item.hide] 571 set hidden [expr {"" != $hidden && $hidden}] 572 573 if {"" != $label && !$hidden} { 574 if {![info exists _label2page($label)]} { 575 set name "page[incr _pages]" 576 set page [$itk_component(resultpages) insert end $name] 577 set _label2page($label) $page 578 set _label2desc($label) \ 579 [$xmlobj get output.$item.about.description] 580 Rappture::ResultViewer $page.rviewer 581 pack $page.rviewer -expand yes -fill both -pady 4 582 583 set end [$itk_component(resultselector) \ 584 choices index -value ---] 585 if {$end < 0} { 586 set end "end" 587 } 588 $itk_component(resultselector) choices insert $end \ 589 $name $label 590 } 591 592 # add/replace the latest result into this viewer 593 set page $_label2page($label) 594 595 if {![info exists reset($page)]} { 596 $page.rviewer clear $index 597 set reset($page) 1 598 } 599 $page.rviewer add $index $xmlobj output.$item 600 } 601 } 602 602 } 603 603 … … 605 605 set max [$itk_component(resultselector) choices size] 606 606 for {set i 0} {$i < $max} {incr i} { 607 608 609 610 611 612 613 614 615 616 617 607 set first [$itk_component(resultselector) choices get -label $i] 608 if {$first != ""} { 609 set page [$itk_component(resultselector) choices get -value $i] 610 set char [string index $page 0] 611 if {$char != "@" && $char != "-"} { 612 $itk_component(resultpages) current $page 613 $itk_component(resultselector) value $first 614 set _lastlabel $first 615 break 616 } 617 } 618 618 } 619 619 } … … 626 626 itcl::body Rappture::Analyzer::clear {} { 627 627 foreach obj $_runs { 628 628 itcl::delete object $obj 629 629 } 630 630 set _runs "" … … 639 639 640 640 foreach label [array names _label2page] { 641 642 641 set page $_label2page($label) 642 $page.rviewer clear 643 643 } 644 644 $itk_component(resultselector) value "" … … 650 650 $itk_component(resultselector) choices insert end --- "---" 651 651 $itk_component(resultselector) choices insert end \ 652 652 @download [Rappture::filexfer::label download] 653 653 set _lastlabel "" 654 654 … … 680 680 681 681 switch -- $option { 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 682 coming { 683 # 684 # Warn result that a download is coming, in case 685 # it needs to take a screen snap. 686 # 687 if {![regexp {^(|@download|---)$} $page]} { 688 set f [$itk_component(resultpages) page $page] 689 $f.rviewer download coming 690 } 691 } 692 controls { 693 # no controls for this download yet 694 return "" 695 } 696 start { 697 set widget $itk_component(download) 698 if {[llength $args] > 0} { 699 set widget [lindex $args 0] 700 if {[catch {winfo class $widget}]} { 701 set widget $itk_component(download) 702 } 703 } 704 # 705 # See if this download has any controls. If so, then 706 # post them now and let the user continue the download 707 # after selecting a file format. 708 # 709 if {$page != ""} { 710 set ext "" 711 set f [$itk_component(resultpages) page $page] 712 set popup [$f.rviewer download controls \ 713 [itcl::code $this download now $widget]] 714 715 if {"" != $popup} { 716 $popup activate $widget below 717 } else { 718 download now $widget 719 } 720 } else { 721 # this shouldn't happen 722 set file error.html 723 set data "<h1>Not Found</h1>There is no result selected." 724 } 725 } 726 now { 727 set widget $itk_component(download) 728 if {[llength $args] > 0} { 729 set widget [lindex $args 0] 730 if {[catch {winfo class $widget}]} { 731 set widget $itk_component(download) 732 } 733 } 734 # 735 # Perform the actual download. 736 # 737 if {$page != ""} { 738 set ext "" 739 set f [$itk_component(resultpages) page $page] 740 foreach {ext data} [$f.rviewer download now] break 741 if {"" == $ext} { 742 if {"" != $widget} { 743 Rappture::Tooltip::cue $widget \ 744 "Can't download this result." 745 } 746 return 747 } 748 regsub -all {[\ -\/\:-\@\{-\~]} $title {} title 749 set file "$title$ext" 750 } else { 751 # this shouldn't happen 752 set file error.html 753 set data "<h1>Not Found</h1>There is no result selected." 754 } 755 756 set mesg [Rappture::filexfer::download $data $file] 757 if {[string length $mesg] > 0} { 758 Rappture::Tooltip::cue $widget $mesg 759 } 760 } 761 default { 762 error "bad option \"$option\": should be coming, controls, now, start" 763 } 764 764 } 765 765 } … … 778 778 set page [$itk_component(resultselector) translate $page] 779 779 if {"" != $page} { 780 781 782 783 784 780 set f [$itk_component(resultpages) page $page] 781 $f.rviewer plot clear 782 foreach {index opts} $_plotlist { 783 $f.rviewer plot add $index $opts 784 } 785 785 } 786 786 } … … 797 797 set max [llength $comps] 798 798 while {$i < $max} { 799 800 801 802 803 804 805 806 799 set c [lindex $comps $i] 800 if {[string match log* $c]} { 801 set comps [lreplace $comps $i $i] 802 lappend comps $c 803 incr max -1 804 } else { 805 incr i 806 } 807 807 } 808 808 return $comps … … 828 828 set label [$xmlobj get $path.about.label] 829 829 if {"" == $label} { 830 831 832 833 834 835 836 837 830 # no label -- make one up using the title specified 831 if {![info exists counters($group-$title)]} { 832 set counters($group-$title) 1 833 set label $title 834 } else { 835 set label "$title (#[incr counters($group-$title)])" 836 } 837 $xmlobj put $path.about.label $label 838 838 } else { 839 840 841 842 843 844 845 839 # handle the case of two identical labels in <output> 840 if {![info exists counters($group-$label)]} { 841 set counters($group-$label) 1 842 } else { 843 set label "$label (#[incr counters($group-$label)])" 844 $xmlobj put $path.about.label $label 845 } 846 846 } 847 847 return $label … … 858 858 set page "" 859 859 if {"" != $name} { 860 860 set page [$itk_component(resultselector) translate $name] 861 861 } 862 862 if {$page == "@download"} { 863 864 865 866 867 868 869 863 # put the combobox back to its last value 864 $itk_component(resultselector) component entry configure -state normal 865 $itk_component(resultselector) component entry delete 0 end 866 $itk_component(resultselector) component entry insert end $_lastlabel 867 $itk_component(resultselector) component entry configure -state disabled 868 # perform the actual download 869 download start $itk_component(resultselector) 870 870 } elseif {$page == "---"} { 871 872 873 874 875 871 # put the combobox back to its last value 872 $itk_component(resultselector) component entry configure -state normal 873 $itk_component(resultselector) component entry delete 0 end 874 $itk_component(resultselector) component entry insert end $_lastlabel 875 $itk_component(resultselector) component entry configure -state disabled 876 876 } elseif {$page != ""} { 877 878 879 880 881 882 883 884 885 877 set _lastlabel $name 878 set win [winfo toplevel $itk_component(hull)] 879 blt::busy hold $win; update idletasks 880 $itk_component(resultpages) current $page 881 882 set f [$itk_component(resultpages) page $page] 883 $f.rviewer plot clear 884 eval $f.rviewer plot add $_plotlist 885 blt::busy release [winfo toplevel $itk_component(hull)] 886 886 } 887 887 } … … 901 901 902 902 if {$frac < 0.4} { 903 903 $itk_component(results) fraction end $frac 904 904 } 905 905 _fixSimControl … … 920 920 itcl::body Rappture::Analyzer::_simState {state args} { 921 921 if {$state} { 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 922 $itk_interior.simol configure \ 923 -background $itk_option(-simcontrolactiveoutline) 924 configure -simcontrolcolor $itk_option(-simcontrolactivebackground) 925 926 $itk_component(abort) configure -state disabled 927 $itk_component(simulate) configure -state normal \ 928 -command [itcl::code $this simulate] 929 930 # 931 # If there's a special message, then put it up next to the button. 932 # 933 set mesg [lindex $args 0] 934 if {"" != $mesg} { 935 $itk_component(simstatus) configure -state normal 936 $itk_component(simstatus) delete 1.0 end 937 $itk_component(simstatus) insert end $mesg 938 939 # 940 # If there are any settings, then install them in the 941 # "Simulate" button. Also, pop them up as a tooltip 942 # for the message. 943 # 944 set settings [lindex $args 1] 945 if {[llength $settings] > 0} { 946 $itk_component(simulate) configure \ 947 -command [eval itcl::code $this simulate $settings] 948 949 set details "" 950 foreach {path val} $settings { 951 set str [$_tool xml get $path.about.label] 952 if {"" == $str} { 953 set str [$_tool xml element -as id $path] 954 } 955 append details "$str = $val\n" 956 } 957 set details [string trim $details] 958 959 Rappture::Tooltip::for $itk_component(simstatus) $details 960 $itk_component(simstatus) insert end " " 961 $itk_component(simstatus) insert end "(details...)" popup 962 } 963 $itk_component(simstatus) configure -state disabled 964 } 965 965 } else { 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 966 if {"" != $itk_option(-simcontrolbackground)} { 967 set simcbg $itk_option(-simcontrolbackground) 968 } else { 969 set simcbg $itk_option(-background) 970 } 971 $itk_interior.simol configure \ 972 -background $itk_option(-simcontroloutline) 973 configure -simcontrolcolor $simcbg 974 975 $itk_component(simulate) configure -state disabled 976 $itk_component(abort) configure -state normal 977 978 $itk_component(simstatus) configure -state normal 979 $itk_component(simstatus) delete 1.0 end 980 set mesg [lindex $args 0] 981 if {"" != $mesg} { 982 $itk_component(simstatus) insert end $mesg 983 } 984 $itk_component(simstatus) configure -state disabled 985 985 } 986 986 } … … 1002 1002 # 1003 1003 while {[regexp -indices \ 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1004 {=RAPPTURE-PROGRESS=> *([-+]?[0-9]+) +([^\n]*)(\n|$)} $message \ 1005 match percent mesg]} { 1006 1007 foreach {i0 i1} $percent break 1008 set percent [string range $message $i0 $i1] 1009 1010 foreach {i0 i1} $mesg break 1011 set mesg [string range $message $i0 $i1] 1012 1013 pack $itk_component(progress) -fill x -padx 10 -pady 10 1014 $itk_component(progress) settings -percent $percent -message $mesg 1015 1016 foreach {i0 i1} $match break 1017 set message [string replace $message $i0 $i1] 1018 1018 } 1019 1019 … … 1025 1025 1026 1026 while {[regexp -indices \ 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1027 {=RAPPTURE-([a-zA-Z]+)=>([^\n]*)(\n|$)} $message \ 1028 match type mesg]} { 1029 1030 foreach {i0 i1} $match break 1031 set first [string range $message 0 [expr {$i0-1}]] 1032 if {[string length $first] > 0} { 1033 $itk_component(runinfo) insert end $first 1034 $itk_component(runinfo) insert end \n 1035 } 1036 1037 foreach {t0 t1} $type break 1038 set type [string range $message $t0 $t1] 1039 foreach {m0 m1} $mesg break 1040 set mesg [string range $message $m0 $m1] 1041 if {[string length $mesg] > 0 && $type != "RUN"} { 1042 $itk_component(runinfo) insert end $mesg $type 1043 $itk_component(runinfo) insert end \n $type 1044 } 1045 1046 set message [string range $message [expr {$i1+1}] end] 1047 1047 } 1048 1048 1049 1049 if {[string length $message] > 0} { 1050 1051 1052 1053 1054 1050 $itk_component(runinfo) insert end $message 1051 if {[$itk_component(runinfo) get end-2char] != "\n"} { 1052 $itk_component(runinfo) insert end "\n" 1053 } 1054 $itk_component(runinfo) see end 1055 1055 } 1056 1056 $itk_component(runinfo) configure -state disabled … … 1070 1070 set name [$itk_component(resultselector) value] 1071 1071 if {[info exists _label2desc($name)] && 1072 1073 1072 [string length $_label2desc($name)] > 0} { 1073 append tip "$_label2desc($name)\n\n" 1074 1074 } 1075 1075 if {[array size _label2page] > 1} { 1076 1076 append tip "Use this control to display other output results." 1077 1077 } 1078 1078 return $tip … … 1088 1088 itcl::body Rappture::Analyzer::_fixSimControl {} { 1089 1089 switch -- $itk_option(-simcontrol) { 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1090 on { 1091 pack $itk_interior.simol -fill x -before $itk_interior.nb 1092 } 1093 off { 1094 pack forget $itk_interior.simol 1095 } 1096 auto { 1097 # 1098 # If we have two or more radiodials, then there is a 1099 # chance of encountering a combination of parameters 1100 # with no data, requiring simulation. 1101 # 1102 if {[$itk_component(resultset) size -controls] >= 2} { 1103 pack $itk_interior.simol -fill x -before $itk_interior.nb 1104 } else { 1105 pack forget $itk_interior.simol 1106 } 1107 } 1108 default { 1109 error "bad value \"$itk_option(-simcontrol)\": should be on, off, auto" 1110 } 1111 1111 } 1112 1112 } … … 1119 1119 itcl::body Rappture::Analyzer::_fixNotebook {} { 1120 1120 switch -- $itk_option(-notebookpage) { 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1121 about { 1122 $itk_component(notebook) current about 1123 } 1124 simulate { 1125 $itk_component(notebook) current simulate 1126 } 1127 analyze { 1128 $itk_component(notebook) current analyze 1129 } 1130 default { 1131 error "bad value \"$itk_option(-notebookpage)\": should be about, simulate, analyze" 1132 } 1133 1133 } 1134 1134 }
Note: See TracChangeset
for help on using the changeset viewer.