Changeset 2252
- Timestamp:
- May 20, 2011 12:38:51 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/builder/scripts/main.tcl
r2160 r2252 323 323 324 324 # ---------------------------------------------------------------------- 325 # USAGE: main_errors 325 # USAGE: main_errors ?-strict? 326 326 # 327 327 # Checks the values of all objects in the tree to look for errors 328 # before previewing and saving. If any errors are found, the user 329 # is prompted to look at them, and they can be popped up in a viewer 330 # above the object tree. 331 # ---------------------------------------------------------------------- 332 proc main_errors {} { 328 # before previewing and saving. If any errors are found and the 329 # -strict flag is set, the user is forced to look at them before 330 # continuing on. Otherwise, the user may choose to look at warnings 331 # and errors before continuing. Usually called before previewing 332 # and saving the tool definition. Returns 1 if there are errors that 333 # should be viewed/fixed, and 0 otherwise. 334 # ---------------------------------------------------------------------- 335 proc main_errors {args} { 333 336 global ErrList ErrListPos 337 338 set strict no 339 while {[llength $args] > 0} { 340 set flag [lindex $args 0] 341 set args [lrange $args 1 end] 342 if {$flag eq "-strict"} { 343 set strict yes 344 } else { 345 error "bad option \"$flag\": should be -strict" 346 } 347 } 334 348 335 349 set ErrList "" … … 443 457 set errors "these errors" 444 458 } else { 445 set errors "at least the $nerrs errors" 459 set errors "at least the $nerrs error" 460 if {$nerrs > 1} {lappend errors "s"} 446 461 } 447 462 } … … 449 464 # if there are errors, we can't continue on 450 465 if {$nerrs > 0} { 451 tk_messageBox -icon error -type ok -title "Rappture: Problems with your tool definition" -message "$thereis $phrases for your current tool definition. You must resolve $errors before you continue with the preview." 452 return 1 466 if {$strict} { 467 tk_messageBox -icon error -type ok -title "Rappture: Problems with your tool definition" -message "$thereis $phrases for your current tool definition. You must resolve $errors before you continue with the preview." 468 return 1 469 } else { 470 set resp [tk_messageBox -icon error -type yesno -title "Rappture: Problems with your tool definition" -message "$thereis $phrases for your current tool definition. Examine and resolve $problem?"] 471 return $resp 472 } 453 473 } 454 474 … … 649 669 $win.scrl.skel select none 650 670 651 # generate now to catch any errors 652 main_generate_xml 671 # freshen up the ToolXml 672 if {![main_generate_xml]} { 673 # something went wrong while saving the xml 674 # pull up the build tab, so we can see the error 675 .func select [.func index -name "Build"] 676 return 677 } 678 679 if {[main_errors]} { 680 .func select [.func index -name "Build"] 681 pack .func.build.options.errs \ 682 -before .func.build.options.panes \ 683 -pady {10 0} -fill x 684 main_errors_nav 0 685 return 686 } 653 687 654 688 # get the language choice and update the skeleton program option … … 965 999 } 966 1000 967 if {[main_errors ]} {1001 if {[main_errors -strict]} { 968 1002 .func select [.func index -name "Build"] 969 1003 pack .func.build.options.errs -before .func.build.options.panes \
Note: See TracChangeset
for help on using the changeset viewer.