Changeset 2294
- Timestamp:
- Jul 5, 2011, 2:41:41 PM (13 years ago)
- Location:
- branches/blt4/builder/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/builder/scripts/main.tcl
r2275 r2294 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 "Build" 676 return 677 } 678 679 if {[main_errors]} { 680 .func select "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 … … 750 784 main_generate_xml 751 785 786 # change any !Language for the command into a proper 787 # invocation command. Grab the XML before we do this 788 # as the last official XML that's been saved. We'll 789 # know later if things changed and we need to save again. 790 set xmlBeforeCmdSubst [$ToolXml xml] 791 752 792 set cmd [$ToolXml get tool.command] 753 793 if {[string index $cmd 0] eq "!"} { … … 773 813 set status "error" 774 814 } else { 775 set LastToolXmlLoaded [$ToolXml xml]815 set LastToolXmlLoaded $xmlBeforeCmdSubst 776 816 } 777 817 } … … 932 972 933 973 if {[$ToolXml xml] ne $LastToolXmlLoaded} { 934 set choice [tk_messageBox -icon warning -type yesno -title "Rappture: Save Changes?" -message "Changes to the current tool haven't been saved.\n\nSave changes?"]974 set choice [tk_messageBox -icon warning -type yesnocancel -title "Rappture: Save Changes?" -message "Changes to the current tool haven't been saved.\n\nSave changes?"] 935 975 if {$choice == "yes" && ![main_saveas]} { 976 return 977 } elseif {$choice == "cancel"} { 936 978 return 937 979 } -
branches/blt4/builder/scripts/templates/python.tl
r2170 r2294 79 79 code "\n# save output value for $path" 80 80 code "# this shows just one (x,y) point -- modify as needed" 81 code "line = "%g %g\n" % (x, y)"81 code "line = \"%g %g\n\" % (x, y)" 82 82 code "io.put('$path.component.xy', line, append=1)" 83 83 } … … 86 86 code "# this shows just one point -- modify as needed" 87 87 code "# (x,h,w) = x-coord, height of bar, and width of bar (optional)" 88 code "line = "%g %g %g\n" % (x, h, w)"88 code "line = \"%g %g %g\n\" % (x, h, w)" 89 89 code "io.put('$path.component.xhw', line, append=1)" 90 90 }
Note: See TracChangeset
for help on using the changeset viewer.