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