Ignore:
Timestamp:
Aug 31, 2010 8:25:36 PM (14 years ago)
Author:
gah
Message:

re-merge with latest trunk changes

Location:
branches/blt4/gui/scripts
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/Makefile.in

    r1879 r1897  
    1414INSTALL         = @INSTALL@
    1515MKDIR_P         = @MKDIR_P@
    16 TCL_VERSION     = @TCL_VERSION@
    17 TCLSH           = $(bindir)/tclsh$(TCL_VERSION)
     16TCLSH           = @TCLSH@
    1817VPATH           = $(srcdir)
    1918PACKAGE_VERSION = @PACKAGE_VERSION@
     
    115114                $(srcdir)/utils.tcl \
    116115                $(srcdir)/valueresult.tcl \
     116                $(srcdir)/videoviewer.tcl \
    117117                $(srcdir)/visviewer.tcl \
    118118                $(srcdir)/vtkviewer.tcl \
  • branches/blt4/gui/scripts/analyzer.tcl

    r1879 r1897  
    433433
    434434    if {$status != 0} {
    435         $itk_component(runinfo) configure -state normal
    436         $itk_component(runinfo) delete 1.0 end
    437         $itk_component(runinfo) insert end "Problem launching job:\n\n" text
    438         _simOutput $result
    439         $itk_component(runinfo) configure -state disabled
    440         $itk_component(runinfo) see 1.0
    441 
    442         # Try to create a support ticket for this error.
    443         # It may be a real problem.
    444         if {[Rappture::bugreport::shouldReport for jobs]} {
    445             Rappture::bugreport::register "Problem launching job:\n\n$result\n== RAPPTURE INPUT ==\n[$_tool xml xml]"
    446         }
     435        $itk_component(runinfo) configure -state normal
     436        $itk_component(runinfo) delete 1.0 end
     437        $itk_component(runinfo) insert end "Problem launching job:\n\n" text
     438        _simOutput $result
     439        $itk_component(runinfo) configure -state disabled
     440        $itk_component(runinfo) see 1.0
     441
     442        # Try to create a support ticket for this error.
     443        # It may be a real problem.
     444        if {[Rappture::bugreport::shouldReport for jobs]} {
     445            set ::errorInfo "== RAPPTURE INPUT ==\n[$_tool xml xml]"
     446            Rappture::bugreport::register "Problem launching job:\n$result"
     447            Rappture::bugreport::send
     448        }
    447449    } else {
    448450        $itk_component(notebook) current analyze
  • branches/blt4/gui/scripts/balloon.tcl

    r1719 r1897  
    217217        # window). So for now, better to place the balloon window somewhere
    218218        # than to fail with a bad geometry.
    219         #
    220         # Update: This answer could be that the root window (deskop) is
    221         #         resized but XHeightOfScreen XWidthOfScreen still
    222         #         report the initial size.
    223         #
    224         #         Fixed in new BLT.
    225         #
    226219        wm geometry $p +$px+$py
    227220    } else {
  • branches/blt4/gui/scripts/bugreport.tcl

    r1651 r1897  
    1111#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1212# ======================================================================
     13option add *BugReport*Label.font {Helvetica -12} startupFile
    1314option add *BugReport*banner*foreground white startupFile
    1415option add *BugReport*banner*background #a9a9a9 startupFile
    1516option add *BugReport*banner*highlightBackground #a9a9a9 startupFile
    16 option add *BugReport*banner*font \
    17     -*-helvetica-bold-r-normal-*-18-* startupFile
    18 option add *BugReport*Label.font \
    19     -*-helvetica-medium-r-normal-*-12-* startupFile
     17option add *BugReport*banner.title.font {Helvetica -18 bold} startupFile
    2018option add *BugReport*xmit*wrapLength 3i startupFile
    2119option add *BugReport*expl.width 50 startupFile
    22 option add *BugReport*expl.font \
    23     -*-helvetica-medium-r-normal-*-12-* startupFile
    24 option add *BugReport*expl.boldFont \
    25     -*-helvetica-bold-r-normal-*-12-* startupFile
     20option add *BugReport*expl.font {Helvetica -12} startupFile
     21option add *BugReport*expl.boldFont {Helvetica -12 bold} startupFile
     22option add *BugReport*comments.l.font {Helvetica -12 italic} startupFile
     23option add *BugReport*comments.info.text.font {Helvetica -12} startupFile
     24option add *BugReport*details*font {Courier -12} startupFile
    2625
    2726namespace eval Rappture::bugreport {
     27    # details from the current trouble report
     28    variable details
     29
    2830    # assume that if there's a problem launching a job, we should know it
    2931    variable reportJobFailures 1
     
    5052proc Rappture::bugreport::activate {err} {
    5153    global env errorInfo
     54    variable details
    5255
    5356    if {"@SHOWDETAILS" == $err} {
     57        pack propagate .bugreport yes
     58        pack forget .bugreport.expl
    5459        pack forget .bugreport.xmit
    55         pack forget .bugreport.ok
     60        pack forget .bugreport.done
     61        pack forget .bugreport.cntls.show
     62        pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
    5663        pack .bugreport.details -after .bugreport.banner \
    5764            -expand yes -fill both -padx 8 -pady 8
    58         focus .bugreport.details.cntls.ok
     65        pack .bugreport.comments -after .bugreport.details \
     66            -expand yes -fill both -padx 8 -pady {0 8}
    5967        return
    6068    }
    6169
    62     # always fill in details so we can submit trouble reports later
     70    # gather details so we can submit trouble reports later
     71    # do this now, before we do anything with "catch" down below
     72    # that might mask the errorInfo
     73    register $err
     74
     75    pack propagate .bugreport yes
     76    pack forget .bugreport.details
     77    pack forget .bugreport.xmit
     78    pack forget .bugreport.done
     79    pack .bugreport.cntls.show -side right
     80    pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
     81    pack .bugreport.expl -after .bugreport.banner \
     82        -expand yes -fill both -padx 8 -pady 8
     83    pack .bugreport.comments -after .bugreport.expl \
     84        -expand yes -fill both -padx 8 -pady {0 8}
     85
     86    .bugreport.expl configure -state normal
     87    .bugreport.expl delete 1.0 end
     88
     89    set url [Rappture::Tool::resources -huburl]
     90    if {"" != $url} {
     91        .bugreport.expl insert end "Something went wrong with this tool.  Help us understand what happened by submitting a trouble report, so we can fix the problem.  If you continue having trouble with this tool, please close it and restart."
     92        .bugreport.cntls.send configure -state normal
     93        focus .bugreport.cntls.send
     94    } else {
     95        .bugreport.expl insert end "Something went wrong with this tool.  We would ask you to submit a trouble report about the error, but we can't tell what hub it should be submitted to.  If you continue having trouble with this tool, please close it and restart."
     96        pack forget .bugreport.comments
     97        .bugreport.cntls.send configure -state disabled
     98        focus .bugreport.cntls.ok
     99    }
     100    fixTextHeight .bugreport.expl
     101    .bugreport.expl configure -state disabled
     102
    63103    .bugreport.details.info.text configure -state normal
    64104    .bugreport.details.info.text delete 1.0 end
    65     .bugreport.details.info.text insert end "$err\n-----\n$errorInfo"
     105    .bugreport.details.info.text insert end "    USER: $details(login)\n"
     106    .bugreport.details.info.text insert end "HOSTNAME: $details(hostname)\n"
     107    .bugreport.details.info.text insert end "    TOOL: $details(referrer)\n"
     108    .bugreport.details.info.text insert end " SESSION: $details(session)\n"
     109    .bugreport.details.info.text insert end "CATEGORY: $details(category)\n"
     110    .bugreport.details.info.text insert end " SUMMARY: $details(summary)\n"
     111    .bugreport.details.info.text insert end "---------\n"
     112    .bugreport.details.info.text insert end $details(stackTrace)
    66113    .bugreport.details.info.text configure -state disabled
    67 
    68     if {[shouldReport for oops]} {
    69         pack forget .bugreport.details
    70         pack forget .bugreport.expl
    71         pack .bugreport.ok -side bottom -after .bugreport.banner -pady {0 8}
    72         pack .bugreport.xmit -after .bugreport.ok -padx 8 -pady 8
    73         focus .bugreport.ok
    74         set dosubmit 1
    75     } else {
    76         pack forget .bugreport.expl
    77         pack forget .bugreport.xmit
    78         pack forget .bugreport.ok
    79         pack .bugreport.details -after .bugreport.banner \
    80             -expand yes -fill both -padx 8 -pady 8
    81         focus .bugreport.details.cntls.ok
    82         set dosubmit 0
    83     }
    84114
    85115    set w [winfo reqwidth .bugreport]
    86116    set h [winfo reqheight .bugreport]
    87117    set x [expr {([winfo screenwidth .bugreport]-$w)/2}]
    88     set y [expr {([winfo screenheight .bugreport]-$w)/2}]
     118    if {$x < 0} {set x 0}
     119    set y [expr {([winfo screenheight .bugreport]-$h)/2}]
     120    if {$y < 0} {set y 0}
    89121
    90122    wm geometry .bugreport +$x+$y
     
    94126    catch {grab set .bugreport}
    95127    update
    96 
    97     if {$dosubmit} {
    98         submit
    99     }
    100128}
    101129
     
    123151    set info [.bugreport.details.info.text get 1.0 end]
    124152
     153    pack propagate .bugreport no
    125154    pack forget .bugreport.details
    126     pack .bugreport.ok -side bottom -after .bugreport.banner -pady {0 8}
    127     pack .bugreport.xmit -after .bugreport.ok -padx 8 -pady 8
     155    pack forget .bugreport.expl
     156    pack forget .bugreport.comments
     157    pack forget .bugreport.cntls
     158    pack .bugreport.xmit -after .bugreport.banner -padx 8 -pady 8
    128159    .bugreport.xmit.title configure -text "Sending trouble report to [Rappture::Tool::resources -hubname]..."
    129     focus .bugreport.ok
    130160
    131161    # send off the trouble report...
    132162    .bugreport.xmit.icon start
    133     set status [catch {register $info} result]
     163    set status [catch send result]
    134164    .bugreport.xmit.icon stop
    135165
     166    pack propagate .bugreport yes
    136167    pack forget .bugreport.xmit
    137     pack .bugreport.expl -after .bugreport.ok -padx 8 -pady 8
     168    pack .bugreport.expl -after .bugreport.banner -padx 8 -pady 8
    138169    .bugreport.expl configure -state normal
    139170    .bugreport.expl delete 1.0 end
     
    146177        .bugreport.details.info.text configure -state disabled
    147178
    148         .bugreport.expl insert end "This tool encountered an unexpected error.  We tried to submit a trouble report automatically, but that failed.  If you want to report this incident, you can file your own trouble report.  Look for the \"Help\" or \"Support\" links on the main navigation bar of the web site.\n\nIf you continue having trouble with this tool, please close it and launch another session."
     179        .bugreport.expl insert end "Oops! Ticket submission failed:\n$result\n\nIf you want to report the original problem, you can file your own trouble report by going to the web site and clicking on the \"Help\" or \"Support\" link on the main navigation bar.  If you continue having trouble with this tool, please close it and restart."
    149180    } elseif {[regexp {Ticket #([0-9]*) +\((.*?)\) +([0-9]+) +times} $result match ticket extra times]} {
    150         .bugreport.expl insert end "This tool encountered an unexpected error.  The problem has been reported as " "" "Ticket #$ticket" bold " in our system." ""
     181        .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." ""
    151182        if {[string is integer $times] && $times > 1} {
    152183            .bugreport.expl insert end "  This particular problem has been reported $times times."
    153184        }
    154         .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and launch another session."
     185        .bugreport.expl insert end "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!"
    155186    } else {
    156         .bugreport.expl insert end "This tool encountered an unexpected error, and the problem was reported.  Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and launch another session." ""
    157     }
    158     for {set h 1} {$h < 50} {incr h} {
    159         .bugreport.expl configure -height $h
    160         .bugreport.expl see 1.0
    161         update idletasks
    162         if {"" != [.bugreport.expl bbox end-1char]} {
    163             break
    164         }
    165     }
     187        .bugreport.expl insert end "This problem has been reported.  Here is the response from the hub, which may contain information about your ticket:\n" "" $result bold "\n\nIf you continue having trouble with this tool, please close it and restart.  Thanks for reporting the problem and helping us improve things!" ""
     188    }
     189    fixTextHeight .bugreport.expl
    166190    .bugreport.expl configure -state disabled
    167 }
    168 
    169 # ----------------------------------------------------------------------
    170 # USAGE: download
    171 #
    172 # Used to download the current ticket information to the user's
    173 # desktop.
    174 # ----------------------------------------------------------------------
    175 proc Rappture::bugreport::download {} {
    176     set info [.bugreport.details.info.text get 1.0 end]
    177     Rappture::filexfer::download $info bugreport.txt
    178 }
    179 
    180 # ----------------------------------------------------------------------
    181 # USAGE: register <stackTrace>
    182 #
    183 # Low-level function used to send bug reports back to the hub site.
    184 # Error details in the <stackTrace> are posted to a URL that creates
    185 # a support ticket.  Returns a string of the following form,
    186 # representing details about the new or existing ticket:
    187 #   Ticket #XX (XXXXXX) XX times
    188 # ----------------------------------------------------------------------
    189 proc Rappture::bugreport::register {stackTrace} {
    190     global env tcl_platform
    191 
    192     package require http
    193     package require tls
    194     http::register https 443 ::tls::socket
    195 
     191    pack .bugreport.done -side bottom -padx 8 -pady 8
     192    focus .bugreport.done
     193}
     194
     195# ----------------------------------------------------------------------
     196# USAGE: register <err>
     197#
     198# Low-level function used to capture information about a bug report
     199# prior to calling "send", which actually sends the ticket.  We usually
     200# let the user preview the information and decide whether or not to
     201# send the ticket.
     202# ----------------------------------------------------------------------
     203proc Rappture::bugreport::register {err} {
     204    global errorInfo tcl_platform
     205    variable details
     206
     207    #
     208    # Figure out exactly what we'll send if the bug report is
     209    # submitted, so we can show the user.
     210    #
     211    set stackTrace "$err\n---------\n$errorInfo"
    196212    if {![regexp {^([^\n]+)\n} $stackTrace match summary]} {
    197213        if {[string length $stackTrace] == 0} {
     
    246262    }
    247263
     264    set details(summary) $summary
     265    set details(category) $category
     266    set details(stackTrace) $stackTrace
     267    set details(login) $tcl_platform(user)
     268    set details(hostname) [info hostname]
     269    set details(session) [Rappture::Tool::resources -session]
     270    set details(referrer) "tool \"[Rappture::Tool::resources -appname]\""
     271}
     272
     273# ----------------------------------------------------------------------
     274# USAGE: send
     275#
     276# Low-level function used to send bug reports back to the hub site.
     277# Error details gathered by a previous call to "register" are sent
     278# along as a support ticket.  Returns a string of the following form,
     279# representing details about the new or existing ticket:
     280#   Ticket #XX (XXXXXX) XX times
     281# ----------------------------------------------------------------------
     282proc Rappture::bugreport::send {} {
     283    variable details
     284
     285    package require http
     286    package require tls
     287    http::register https 443 ::tls::socket
     288
     289    set report $details(stackTrace)
     290    set cmts [string trim [.bugreport.comments.info.text get 1.0 end]]
     291    if {[string length $cmts] > 0} {
     292        set report "$cmts\n[string repeat = 72]\n$report"
     293    }
     294
    248295    set query [http::formatQuery \
    249296        option com_support \
    250297        task create \
    251298        no_html 1 \
    252         report $stackTrace \
    253         login $tcl_platform(user) \
    254         sesstoken [Rappture::Tool::resources -session] \
    255         hostname [info hostname] \
    256         category $category \
    257         summary $summary \
    258         referrer "tool \"[Rappture::Tool::resources -appname]\"" \
     299        report $report \
     300        login $details(login) \
     301        sesstoken $details(session) \
     302        hostname $details(hostname) \
     303        category $details(category) \
     304        summary $details(summary) \
     305        referrer $details(referrer) \
    259306    ]
    260307   
     
    282329
    283330# ----------------------------------------------------------------------
     331# USAGE: fixTextHeight <widget>
     332#
     333# Used internally to adjust the height of a text widget so it is just
     334# tall enough to show the info within it.
     335# ----------------------------------------------------------------------
     336proc Rappture::bugreport::fixTextHeight {widget} {
     337    #
     338    # HACK ALERT!  In Tk8.5, we can count display lines directly.
     339    #   But for earlier versions, we have to cook up something
     340    #   similar.
     341    #
     342    if {[catch {$widget count -displaylines 1.0 end} h] == 0 && $h > 0} {
     343        $widget configure -height $h
     344    } else {
     345        for {set h 1} {$h < 15} {incr h} {
     346            $widget configure -height $h
     347            $widget see 1.0
     348            update idletasks
     349            if {"" != [$widget bbox end-1char]} {
     350                break
     351            }
     352        }
     353    }
     354}
     355
     356# ----------------------------------------------------------------------
    284357# USAGE: shouldReport jobfailures <boolean>
    285358# USAGE: shouldReport for ?oops|jobs?
     
    304377        }
    305378        for {
    306             # is this a tool in production?
    307             if {![info exists env(RAPPTURE_VERSION)]
    308                   || $env(RAPPTURE_VERSION) != "current"} {
    309                 return 0
    310             }
    311 
    312379            # is it being run within a workspace?
    313380            set appname [Rappture::Tool::resources -appname]
     
    343410label .bugreport.banner.icon -image [Rappture::icon alert]
    344411pack .bugreport.banner.icon -side left -padx 2 -pady 2
    345 label .bugreport.banner.title -text "Oops! Unexpected Error"
     412label .bugreport.banner.title -text "Oops! Internal Error"
    346413pack .bugreport.banner.title -side left -padx {0 8} -pady 2
    347414
     
    352419    Rappture::bugreport::deactivate
    353420
    354 button .bugreport.ok -text "Dismiss" -command Rappture::bugreport::deactivate
    355 pack .bugreport.ok -side bottom -pady {0 8}
     421set bg [.bugreport cget -background]
     422text .bugreport.expl -borderwidth 0 -highlightthickness 0 -background $bg \
     423    -height 3 -wrap word
     424.bugreport.expl tag configure bold \
     425    -font [option get .bugreport.expl boldFont Font]
     426#
     427# HACK ALERT!  We have problems with fixTextHeight working correctly
     428#   on Windows for Tk8.4 and earlier.  To make it work properly, we
     429#   add the binding below.  At some point, we'll ditch 8.4 and we can
     430#   use the new "count -displaylines" option in Tk8.5.
     431#
     432bind .bugreport.expl <Map> {Rappture::bugreport::fixTextHeight %W}
     433
     434frame .bugreport.comments
     435label .bugreport.comments.l -text "What were you doing just before this error?" -anchor w
     436pack .bugreport.comments.l -side top -anchor w
     437Rappture::Scroller .bugreport.comments.info -xscrollmode none -yscrollmode auto
     438text .bugreport.comments.info.text -width 30 -height 3 -wrap word
     439.bugreport.comments.info contents .bugreport.comments.info.text
     440bind .bugreport.comments.info.text <ButtonPress> {focus %W}
     441pack .bugreport.comments.info -expand yes -fill both
     442
     443frame .bugreport.cntls
     444pack .bugreport.cntls -side bottom -fill x
     445button .bugreport.cntls.ok -text "Ignore" -command {
     446    Rappture::bugreport::deactivate
     447}
     448pack .bugreport.cntls.ok -side left -padx {4 20} -pady 8
     449button .bugreport.cntls.send -text "Send Trouble Report" -command {
     450    Rappture::bugreport::submit
     451}
     452pack .bugreport.cntls.send -side right -padx 4 -pady 8
     453
     454button .bugreport.cntls.show -text "Show Details..." \
     455    -command {Rappture::bugreport::activate @SHOWDETAILS}
     456pack .bugreport.cntls.show -side right
     457
     458
     459frame .bugreport.details
     460Rappture::Scroller .bugreport.details.info -xscrollmode auto -yscrollmode auto
     461text .bugreport.details.info.text -width 50 -height 15 -wrap none
     462.bugreport.details.info contents .bugreport.details.info.text
     463pack .bugreport.details.info -expand yes -fill both
    356464
    357465frame .bugreport.xmit
     
    364472pack .bugreport.xmit.title -side left -expand yes -fill x
    365473
    366 text .bugreport.expl -borderwidth 0 -highlightthickness 0 -wrap word
    367 .bugreport.expl tag configure bold \
    368     -font [option get .bugreport.expl boldFont Font]
    369 
    370 bind .bugreport.expl <Control-1><Control-1><Control-3><Control-3> {
    371     Rappture::bugreport::activate @SHOWDETAILS
    372 }
    373 
    374 bind .bugreport.expl <Control-1><Control-1><Control-Shift-1><Control-Shift-1> {
    375     Rappture::bugreport::activate @SHOWDETAILS
    376 }
    377 
    378 frame .bugreport.details
    379 frame .bugreport.details.cntls
    380 pack .bugreport.details.cntls -side bottom -fill x
    381 button .bugreport.details.cntls.ok -text "Dismiss" -command {
    382     Rappture::bugreport::deactivate
    383 }
    384 pack .bugreport.details.cntls.ok -side right -padx 2 -pady 4
    385 button .bugreport.details.cntls.send -text "Send Trouble Report" -command {
    386     Rappture::bugreport::submit
    387 }
    388 pack .bugreport.details.cntls.send -side left -padx 2 -pady 4
    389 button .bugreport.details.cntls.dload -text "Download" -command {
    390     Rappture::bugreport::download
    391 }
    392 pack .bugreport.details.cntls.dload -side left -padx 2 -pady 4
    393 
    394 set scrollset .bugreport.details.info
    395 blt::scrollset $scrollset -xscrollbar $scrollset.xs -yscrollbar $scrollset.ys \
    396     -window $scrollset.text
    397 blt::tk::scrollbar $scrollset.xs
    398 blt::tk::scrollbar $scrollset.ys
    399 text .bugreport.details.info.text -width 50 -height 15 -wrap none
    400 pack .bugreport.details.info -expand yes -fill both
     474button .bugreport.done -text "Done" \
     475    -command Rappture::bugreport::deactivate
    401476
    402477# this binding keeps the bugreport window on top
  • branches/blt4/gui/scripts/combobox.tcl

    r1646 r1897  
    134134            $itk_component(entry) configure -state disabled
    135135        }
    136         set cmd [list event generate $itk_component(hull) <<Value>>]
    137         after 10 [list catch $cmd]
     136
     137        after 10 [list catch [list event generate $itk_component(hull) <<Value>>]]
    138138    } elseif {[llength $args] != 0} {
    139139        error "wrong # args: should be \"value ?newval?\""
  • branches/blt4/gui/scripts/filexfer.tcl

    r1587 r1897  
    338338              /apps/bin/clientaction
    339339              /apps/xvnc/bin/clientaction
     340              /usr/lib/mw/bin/clientaction
    340341              ""
    341342        } {
  • branches/blt4/gui/scripts/grab.tcl

    r1342 r1897  
    6565        }
    6666
     67        # if the window is already on the stack, then skip it
     68        if {[string equal [lindex $::Rappture::grab::stack 0] $window]} {
     69            return $window
     70        }
     71
    6772        # add the current configuration to the grab stack
    6873        set ::Rappture::grab::stack \
  • branches/blt4/gui/scripts/moleculeViewer.tcl

    r1719 r1897  
    700700}
    701701
    702 itcl::body Rappture::DeviceEditor::snap { w h } {
     702itcl::body Rappture::MoleculeViewer::snap { w h } {
    703703    if { $w <= 0 || $h <= 0 } {
    704704        set w [winfo width $itk_component(area)]
  • branches/blt4/gui/scripts/sidebarframe.tcl

    r1764 r1897  
    451451        release {
    452452            set minw [winfo reqwidth $itk_component(controlbar)]
    453             if { $_width != "auto" && ($_width-$minw) < 40} {
     453            if {$_width-$minw < 40} {
    454454                set _width "auto"
    455455                pop close
  • branches/blt4/gui/scripts/textentry.tcl

    r1862 r1897  
    231231        # take down any existing widget
    232232        foreach win [pack slaves $itk_interior] {
    233             pack forget $win
     233            if { [winfo name $win] != "hints" } {
     234                pack forget $win
     235            }
    234236        }
    235237
  • branches/blt4/gui/scripts/utils.tcl

    r1719 r1897  
    2323proc Rappture::utils::hexdump {args} {
    2424    Rappture::getopts args params {
    25         value -lines unlimited
     25        value -lines unlimited
    2626    }
    2727    if {[llength $args] != 1} {
    28         error "wrong # args: should be \"hexdump ?-lines num? data\""
     28        error "wrong # args: should be \"hexdump ?-lines num? data\""
    2929    }
    3030    set newval [lindex $args 0]
     
    3434
    3535    if {$params(-lines) != "unlimited" && $params(-lines) <= 0} {
    36         return $rval
     36        return $rval
    3737    }
    3838
     
    4040    set len [string length $newval]
    4141    for {set i 0} {$i < $len} {incr i 8} {
    42         append rval [format "%#06x: " $i]
    43         set ascii ""
    44         for {set j 0} {$j < 8} {incr j} {
    45             if {$i+$j < $len} {
    46                 set char [string index $newval [expr {$i+$j}]]
    47                 binary scan $char c ichar
    48                 set hexchar [format "%02x" [expr {0xff & $ichar}]]
    49             } else {
    50                 set char " "
    51                 set hexchar "  "
    52             }
    53             append rval "$hexchar "
    54             if {[regexp {[\000-\037\177-\377]} $char]} {
    55                 append ascii "."
    56             } else {
    57                 append ascii $char
    58             }
    59         }
    60         append rval " | $ascii\n"
     42        append rval [format "%#06x: " $i]
     43        set ascii ""
     44        for {set j 0} {$j < 8} {incr j} {
     45            if {$i+$j < $len} {
     46                set char [string index $newval [expr {$i+$j}]]
     47                binary scan $char c ichar
     48                set hexchar [format "%02x" [expr {0xff & $ichar}]]
     49            } else {
     50                set char " "
     51                set hexchar "  "
     52            }
     53            append rval "$hexchar "
     54            if {[regexp {[\000-\037\177-\377]} $char]} {
     55                append ascii "."
     56            } else {
     57                append ascii $char
     58            }
     59        }
     60        append rval " | $ascii\n"
    6161
    62         if {"unlimited" != $params(-lines) && $i/8+1 >= $params(-lines)} {
    63             if {$i < $len-1} {
    64                 append rval "more..."
    65             }
    66             break
    67         }
     62        if {"unlimited" != $params(-lines) && $i/8+1 >= $params(-lines)} {
     63            if {$i < $len-1} {
     64                append rval "more..."
     65            }
     66            break
     67        }
    6868    }
    6969    return $rval
     
    7878proc Rappture::utils::binsize {size} {
    7979    foreach {factor units} {
    80         1073741824 GB
    81         1048576 MB
    82         1024 kB
    83         1 bytes
     80        1073741824 GB
     81        1048576 MB
     82        1024 kB
     83        1 bytes
    8484    } {
    85         if {$size/$factor > 0} {
    86             if {$factor > 1} {
    87                 set size [format "%.1f" [expr {double($size)/$factor}]]
    88             }
    89             break
    90         }
     85        if {$size/$factor > 0} {
     86            if {$factor > 1} {
     87                set size [format "%.1f" [expr {double($size)/$factor}]]
     88            }
     89            break
     90        }
    9191    }
    9292    return "$size $units"
     
    127127    return $desc
    128128}
     129
     130# ----------------------------------------------------------------------
     131# USAGE: expandPath <path>
     132#
     133# Returns the true location of the provided path,
     134# automatically expanding links to form an absolute path.
     135# ----------------------------------------------------------------------
     136proc Rappture::utils::expandPath {args} {
     137    set path ""
     138    set dirs [file split [lindex $args 0]]
     139
     140    while {[llength $dirs] > 0} {
     141        set d [lindex $dirs 0]
     142        set dirs [lrange $dirs 1 end]
     143        if {[catch {file link [file join $path $d]} out] == 0} {
     144            # directory d is a link, follow it
     145            set outdirs [file split $out]
     146            if {[string compare "/" [lindex $outdirs 0]] == 0} {
     147                # directory leads back to root
     148                # clear path
     149                # reset dirs list
     150                set path ""
     151                set dirs $outdirs
     152            } else {
     153                # relative path for the link
     154                # prepend directory to dirs list
     155                set dirs [concat $outdirs $dirs]
     156            }
     157        } else {
     158            set path [file join $path $d]
     159        }
     160    }
     161    return $path
     162}
     163
  • branches/blt4/gui/scripts/xyresult.tcl

    r1804 r1897  
    279279        -brightness 0
    280280        -width 1
    281         -type "histogram"
     281        -type "line"
    282282        -raise 0
    283283        -linestyle solid
Note: See TracChangeset for help on using the changeset viewer.