Changeset 2157


Ignore:
Timestamp:
Mar 27, 2011 3:13:21 PM (12 years ago)
Author:
mmc
Message:

Added support for -tooltip options on all attributes, and added descriptions
of attributes to all objects. This gives the user pop-up help inside the
builder.

Location:
trunk/lang/tcl/scripts
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/lang/tcl/scripts/objects.tcl

    r2154 r2157  
    865865    public variable only ""
    866866    public variable expand "no"
     867    public variable tooltip ""
    867868
    868869    constructor {args} {
  • trunk/lang/tcl/scripts/objects/base.rp

    r2154 r2157  
    11object base {
    2     attr label -title "Label" -type string -path about.label
    3     attr description -title "Description" -type string:lines=3 -expand yes -path about.description
    4     attr enable -title "Enable" -type string:validate=enable -path about.enable -only input
     2    attr label -title "Label" -type string -path about.label -tooltip "Short label for the object, indicating what it represents."
     3
     4    attr description -title "Description" -type string:lines=3 -expand yes -path about.description -tooltip "Brief description of the object, which appears in a tooltip when the user mouses over the value.  Avoid repeating the label.  Instead, add information about what the object represents for your simulator, what it affects as an input, or what it means as an output."
     5
     6    attr enable -title "Enable" -type string:validate=enable -path about.enable -only input -tooltip "Use this to enable/disable an input.  A value of \"false\" permanently disables the input.  More commonly, the value is an expression that indicates when the input should be enabled.\nEXAMPLE: input.choice(model) == \"dd\""
     7
    58
    69    check label {
  • trunk/lang/tcl/scripts/objects/boolean/boolean.rp

    r2154 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_boolean
    1919
    20     attr default -title "Default Value" -type boolean -path default -only input
     20    attr default -title "Default Value" -type boolean -path default -only input -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
    2121
    2222    check default {
  • trunk/lang/tcl/scripts/objects/choice/choice.rp

    r2154 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_choice
    1919
    20     attr options -title "Options" -type choices -path option
    21     attr default -title "Default Value" -type string -path default -only input
     20    attr options -title "Options" -type choices -path option -tooltip "List of choices that will appear on the drop-down menu in your program."
     21
     22    attr default -title "Default Value" -type string -path default -only input -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
    2223
    2324    check options {
  • trunk/lang/tcl/scripts/objects/curve/curve.rp

    r2154 r2157  
    1919    help http://rappture.org/wiki/rp_xml_ele_curve
    2020
    21     attr group -title "Plotting Group" -type string -path about.group
    22     attr xlabel -title "X-axis Label" -type string -path xaxis.label
    23     attr xdesc  -title "X-axis Description" -type string -path xaxis.description
    24     attr xunits -title "X-axis Units" -type units -path xaxis.units
    25     attr ylabel -title "Y-axis Label" -type string -path yaxis.label
    26     attr ydesc  -title "Y-axis Description" -type string -path yaxis.description
    27     attr yunits -title "Y-axis Units" -type units -path yaxis.units
     21    attr group -title "Plotting Group" -type string -path about.group -tooltip "If two or more curves share the same name for their plotting group, they are overlayed on the same plot.  The name for the plotting group becomes the name of the overall output, and the label for each curve appears in a tooltip when you mouse over its points."
     22
     23    attr xlabel -title "X-axis Label" -type string -path xaxis.label -tooltip "Label shown on the x-axis for the plot."
     24
     25    attr xdesc  -title "X-axis Description" -type string -path xaxis.description -tooltip "Description of the x-axis that appears in a tooltip window when you mouse over the x-axis.  This should not merely repeat what the label says, but explain what it means."
     26
     27    attr xunits -title "X-axis Units" -type units -path xaxis.units -tooltip "Units for the physical quantity that the x-axis represents."
     28
     29    attr ylabel -title "Y-axis Label" -type string -path yaxis.label -tooltip "Label shown on the y-axis for the plot."
     30
     31    attr ydesc  -title "Y-axis Description" -type string -path yaxis.description -tooltip "Description of the y-axis that appears in a tooltip window when you mouse over the y-axis.  This should not merely repeat what the label says, but explain what it means."
     32
     33    attr yunits -title "Y-axis Units" -type units -path yaxis.units -tooltip "Units for the physical quantity that the y-axis represents."
     34
    2835
    2936    check xlabel {
  • trunk/lang/tcl/scripts/objects/histogram/histogram.rp

    r2154 r2157  
    1919    help http://rappture.org/wiki/rp_xml_ele_histogram
    2020
    21     attr xlabel -title "X-axis Label" -type string -path xaxis.label
    22     attr xdesc  -title "X-axis Description" -type string -path xaxis.description
    23     attr xunits -title "X-axis Units" -type units -path xaxis.units
    24     attr ylabel -title "Y-axis Label" -type string -path yaxis.label
    25     attr ydesc  -title "Y-axis Description" -type string -path yaxis.description
    26     attr yunits -title "Y-axis Units" -type units -path yaxis.units
     21    attr xlabel -title "X-axis Label" -type string -path xaxis.label -tooltip "Label shown on the x-axis for the plot."
     22
     23    attr xdesc  -title "X-axis Description" -type string -path xaxis.description -tooltip "Description of the x-axis that appears in a tooltip window when you mouse over the x-axis.  This should not merely repeat what the label says, but explain what it means."
     24
     25    attr xunits -title "X-axis Units" -type units -path xaxis.units -tooltip "Units for the physical quantity that the x-axis represents."
     26
     27    attr ylabel -title "Y-axis Label" -type string -path yaxis.label -tooltip "Label shown on the y-axis for the plot."
     28
     29    attr ydesc  -title "Y-axis Description" -type string -path yaxis.description -tooltip "Description of the y-axis that appears in a tooltip window when you mouse over the y-axis.  This should not merely repeat what the label says, but explain what it means."
     30
     31    attr yunits -title "Y-axis Units" -type units -path yaxis.units -tooltip "Units for the physical quantity that the y-axis represents."
     32
    2733
    2834    check xlabel {
  • trunk/lang/tcl/scripts/objects/image/image.rp

    r2154 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_image
    1919
    20     attr default -title "Default Value" -type image -path default
    21     attr resize -title "Resize" -type string:validate=imresize -path resize
    22     attr convert -title "Convert" -type string:validate=imformat -path convert
     20    attr default -title "Default Value" -type image -path default -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
     21
     22    attr resize -title "Resize" -type string:validate=imresize -path resize -only input -tooltip "Limits the size of the thumbnail shown for any image uploaded into this input.  Valid options are:  auto, none, width=XX, height=XX"
     23
     24    attr convert -title "Convert" -type string:validate=imformat -path convert -only input -tooltip "Causes the image to be converted to a particular image format before being passed along to your simulation program.  Valid options are:  bmp, gif, ico, jpeg, pcx, png, pgm, ppm, ps, pdf, sgi, sun, tga, tiff, xbm, xpm"
     25
    2326
    2427    storage {
  • trunk/lang/tcl/scripts/objects/integer/integer.rp

    r2154 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_integer
    1919
    20     attr default -title "Default Value" -type string:validate=int -path default -only input
    21     attr min -title "Minimum Value" -type string:validate=int -path min -only input
    22     attr max -title "Maximum Value" -type string:validate=int -path max -only input
     20    attr default -title "Default Value" -type string:validate=int -path default -only input -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
     21
     22    attr min -title "Minimum Value" -type string:validate=int -path min -only input -tooltip "Sets the minimum value for this integer.  The value can be equal to the minimum, but no lower."
     23
     24    attr max -title "Maximum Value" -type string:validate=int -path max -only input -tooltip "Sets the maximum value for this integer.  The value can be equal to the maximum, but no higher."
     25
    2326
    2427    check default {
  • trunk/lang/tcl/scripts/objects/note/note.rp

    r2154 r2157  
    1919    help http://rappture.org/wiki/rp_xml_ele_note
    2020
    21     attr contents -title "HTML File" -type file -path contents
     21    attr contents -title "HTML File" -type file -path contents -tooltip "Name of an HTML file loaded into the note area as documentation.  The file may contain embedded images and links, as long as those files reside in the same directory as the HTML file or have explicit http:// paths."
     22
    2223
    2324    check contents {
  • trunk/lang/tcl/scripts/objects/number/number.rp

    r2156 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_number
    1919
    20     attr default -title "Default Value" -type string:validate=number -path default -only input
    21     attr units -title "Units of Measurement" -type units -path units
    22     attr min -title "Minimum Value" -type string:validate=number -path min -only input
    23     attr max -title "Maximum Value" -type string:validate=number -path max -only input
    24     attr icon -title "Icon" -type image:maxsize=20,rescale=yes -path about.icon -only input
    25     attr color -title "Color" -type color -path color -only input
     20    attr default -title "Default Value" -type string:validate=number -path default -only input -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
     21
     22    attr units -title "Units of Measurement" -type units -path units -tooltip "Units for the physical quantity that this number represents."
     23
     24    attr min -title "Minimum Value" -type string:validate=number -path min -only input -tooltip "Sets the minimum value for this number.  The value can be equal to the minimum, but no lower."
     25
     26    attr max -title "Maximum Value" -type string:validate=number -path max -only input -tooltip "Sets the maximum value for this number.  The value can be equal to the maximum, but no higher."
     27
     28    attr icon -title "Icon" -type image:maxsize=20,rescale=yes -path about.icon -only input -tooltip "Sets an icon shown next to the number, which is normally used to indicate the quantity that the number represents.  If the icon is transparent, any color set for the number will show through."
     29
     30    attr color -title "Color" -type color -path color -only input -tooltip "Sets the color shown next to the number to indicate its strength.  If the number is near the minimum, the color will be white; as it nears the maximum, it will be the color selected here."
     31
    2632
    2733    check default {
  • trunk/lang/tcl/scripts/objects/string/string.rp

    r2154 r2157  
    1818    help http://rappture.org/wiki/rp_xml_ele_string
    1919
    20     attr default -title "Default Value" -type string -path default -only input
    21     attr size -title "Size" -type string:validate=size -path size -only input
    22     attr hints -title "Hint String" -type string -path about.hints -only input
     20    attr default -title "Default Value" -type string -path default -only input -tooltip "Sets the value that this input has when the program first starts.  This value is used by default unless the user explicitly changes it."
     21
     22    attr size -title "Size" -type string:validate=size -path size -only input -tooltip "Sets the desired size for the string.  Strings are normally 1 line of text, but if the size is set to some WxH, then the entry area will be at least W chars wide and H lines tall.  For example, 40x5 says that the string should be 40 chars wide and 10 lines tall."
     23
     24    attr hints -title "Hint String" -type string -path about.hints -only input -tooltip "Sets a line of text displayed beneath the entry area for the string.  This is used to give a hint to the user about what should be entered in the string area."
     25
    2326
    2427    storage {
  • trunk/lang/tcl/scripts/types/boolean.tcl

    r2154 r2157  
    1414    constructor {win args} {
    1515        Rappture::getopts args params {
     16            value -tooltip ""
    1617        }
    1718
     
    1920        pack $win.val -side left
    2021        $win.val choices insert end 1 "True" 0 "False"
     22
     23        Rappture::Tooltip::for $win.val $params(-tooltip)
     24
    2125        set _win $win
    2226    }
  • trunk/lang/tcl/scripts/types/choices.tcl

    r2154 r2157  
    1414    constructor {win args} {
    1515        Rappture::getopts args params {
     16            value -tooltip ""
    1617        }
    1718
     
    2021        button $win.cntls.add -text "Add" -command [itcl::code $this _add]
    2122        pack $win.cntls.add -side left
     23        Rappture::Tooltip::for $win.cntls.add "Adds a new option to the list of choices."
    2224        button $win.cntls.del -text "Delete" -command [itcl::code $this _delete]
    2325        pack $win.cntls.del -side right
     26        Rappture::Tooltip::for $win.cntls.del "Removes an option from the list of choices."
    2427
    2528        Rappture::Scroller $win.scrl -height 1.5i \
     
    2932        bind $win.scrl.lbox <<ListboxSelect>> [itcl::code $this _edit]
    3033        $win.scrl contents $win.scrl.lbox
     34        Rappture::Tooltip::for $win.scrl.lbox $params(-tooltip)
    3135
    3236        frame $win.editelem
     
    3943        grid $win.editelem.l -row 1 -column 0 -sticky e
    4044        entry $win.editelem.label
     45        Rappture::Tooltip::for $win.editelem.label "Label for the option that appears in the drop-down list of choices."
    4146        grid $win.editelem.label -row 1 -column 1 -columnspan 2 -sticky ew
    4247        label $win.editelem.v -text "Value:"
    4348        grid $win.editelem.v -row 2 -column 0 -sticky e
    4449        entry $win.editelem.value
     50        Rappture::Tooltip::for $win.editelem.value "Value for the option reported to your program when this choice is selected."
    4551        grid $win.editelem.value -row 2 -column 1 -sticky ew
    4652        label $win.editelem.vopt -text "(optional)"
     
    5258        text $win.editelem.scrl.desc -wrap char
    5359        $win.editelem.scrl contents $win.editelem.scrl.desc
     60        Rappture::Tooltip::for $win.editelem.scrl.desc "Description of the option that appears in the tooltip when you mouse over the choice when it appears in the combobox."
    5461
    5562        bind $win.editelem.label <KeyPress-Return> \
  • trunk/lang/tcl/scripts/types/color.tcl

    r2154 r2157  
    1313    constructor {win args} {
    1414        Rappture::getopts args params {
     15            value -tooltip ""
    1516        }
    1617        set _icon [image create photo -width 20 -height 20]
     
    1819        label $win.sample -image $_icon
    1920        pack $win.sample -side left
     21        Rappture::Tooltip::for $win.sample $params(-tooltip)
     22
    2023        button $win.change -text "Choose..." -command [itcl::code $this choose]
    2124        pack $win.change -side left
  • trunk/lang/tcl/scripts/types/file.tcl

    r2154 r2157  
    1616    constructor {win args} {
    1717        Rappture::getopts args params {
     18            value -tooltip ""
    1819        }
    1920        label $win.file -text "select a file" -width 10 -anchor e -fg gray60
    2021        pack $win.file -side left
     22        Rappture::Tooltip::for $win.file $params(-tooltip)
     23
    2124        button $win.getfile -text "Choose..." -command [itcl::code $this _getfile]
    2225        pack $win.getfile -side left
  • trunk/lang/tcl/scripts/types/image.tcl

    r2154 r2157  
    1515            value -maxsize ""
    1616            value -rescale no
     17            value -tooltip ""
    1718        }
    1819        set _currview [image create photo]
     
    2223        label $win.image -image $_currview -borderwidth 1 -relief solid
    2324        pack $win.image -side left
     25        Rappture::Tooltip::for $win.image $params(-tooltip)
    2426
    2527        frame $win.btns
  • trunk/lang/tcl/scripts/types/language.tcl

    r2154 r2157  
    1717    constructor {win args} {
    1818        Rappture::getopts args params {
     19            value -tooltip ""
    1920        }
    2021
     
    2829        bind $win.val <<Value>> [itcl::code $this _react]
    2930
     31        Rappture::Tooltip::for $win.val $params(-tooltip)
     32
    3033        frame $win.custom
    3134        label $win.custom.l -text "Command:"
     
    3336        entry $win.custom.val
    3437        pack $win.custom.val -side left -expand yes -fill x
     38        Rappture::Tooltip::for $win.custom.val "Enter the command line that Rappture should invoke to run your simulation program.  Include @driver somewhere on this line; it will be replaced with the name of the Rappture driver file (usually passed in as the first argument on the command line).  If you include @tool, it will be replaced with the name of the directory where the tool.xml file is installed.  Instead of hard-coding your program path, you can express it as a relative path from @tool."
    3539
    3640        set _win $win
     
    9599
    96100    public proc export {xmlobj path value} {
    97         $xmlobj put $path $value
     101        set value [string trim $value]
     102        if {$value ne ""} {
     103            $xmlobj put $path $value
     104        }
    98105    }
    99106
  • trunk/lang/tcl/scripts/types/string.tcl

    r2154 r2157  
    2020            value -lines 1
    2121            value -validate ""
     22            value -tooltip ""
    2223        }
    2324
     
    2728            text $win.scrl.text -width 10 -height $params(-lines) -wrap word
    2829            $win.scrl contents $win.scrl.text
     30            Rappture::Tooltip::for $win.scrl.text $params(-tooltip)
    2931        } else {
    3032            entry $win.str
    3133            pack $win.str -fill x
     34            Rappture::Tooltip::for $win.str $params(-tooltip)
    3235        }
    3336        set _win $win
  • trunk/lang/tcl/scripts/types/units.tcl

    r2154 r2157  
    1414    constructor {win args} {
    1515        Rappture::getopts args params {
     16            value -tooltip ""
    1617        }
    1718
     
    5758          T   "  T - Teslas" \
    5859          G   "  G - Gauss"
     60
     61        Rappture::Tooltip::for $win.val $params(-tooltip)
    5962
    6063        set _win $win
     
    113116
    114117    public proc export {xmlobj path value} {
    115         $xmlobj put $path $value
     118        set value [string trim $value]
     119        if {$value ne ""} {
     120            $xmlobj put $path $value
     121        }
    116122    }
    117123
Note: See TracChangeset for help on using the changeset viewer.