source: trunk/gui/scripts/bugreport.tcl @ 2686

Last change on this file since 2686 was 2686, checked in by gah, 10 years ago
File size: 26.8 KB
Line 
1
2# ----------------------------------------------------------------------
3#  UTILITY: bugreport
4#
5#  This redefines the usual Tcl bgerror command to install a nicer
6#  looking bug handler.  Bug reports can be submitted back to a
7#  HUBzero-based site as support tickets.  Additional information
8#  can be obtained by defining procedures as bugreport::instrumented
9#  proc (captures entrance/exit from proc) and by calling
10#  bugreport::remark with extra info along the way.
11# ======================================================================
12#  AUTHOR:  Michael McLennan, Purdue University
13#  Copyright (c) 2004-2006  Purdue Research Foundation
14#
15#  See the file "license.terms" for information on usage and
16#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
17# ======================================================================
18option add *BugReport*Label.font {Helvetica -12} startupFile
19option add *BugReport*banner*foreground white startupFile
20option add *BugReport*banner*background #a9a9a9 startupFile
21option add *BugReport*banner*highlightBackground #a9a9a9 startupFile
22option add *BugReport*banner.title.font {Helvetica -18 bold} startupFile
23option add *BugReport*xmit*wrapLength 3i startupFile
24option add *BugReport*expl.width 50 startupFile
25option add *BugReport*expl.font {Helvetica -12} startupFile
26option add *BugReport*expl.boldFont {Helvetica -12 bold} startupFile
27option add *BugReport*comments.l.font {Helvetica -12 italic} startupFile
28option add *BugReport*comments.info.text.font {Helvetica -12} startupFile
29option add *BugReport*details*font {Courier -12} startupFile
30
31namespace eval Rappture::bugreport {
32    # details from the current trouble report, which user may decide to submit
33    variable details
34
35    # status from bugreport::instrumented/remark in case a bug occurs
36    variable extraStack ""
37    variable extraInfo ""
38
39    # assume that if there's a problem launching a job, we should know it
40    variable reportJobFailures 1
41
42    # submit these kinds of tickets by default
43    variable settings
44    set settings(user) $::tcl_platform(user)
45    set settings(type) "automatic"
46    set settings(group) ""
47    set settings(category) "Rappture"
48}
49
50# ----------------------------------------------------------------------
51# USAGE: install
52#
53# Called once in the main program to install this bug reporting
54# facility.  Any unexpected errors after this call will be handled
55# by this mechanism.
56# ----------------------------------------------------------------------
57proc Rappture::bugreport::install {} {
58    ::proc ::bgerror {err} { ::Rappture::bugreport::activate $err }
59}
60
61# ----------------------------------------------------------------------
62# USAGE: activate <error>
63#
64# Used internally to pop up the bug handler whenver a bug is
65# encountered.  Tells the user that there is a bug and logs the
66# problem, so it can be fixed.
67# ----------------------------------------------------------------------
68proc Rappture::bugreport::activate {err} {
69    global env errorInfo
70    variable details
71    variable settings
72
73    if {"@SHOWDETAILS" == $err} {
74        pack propagate .bugreport yes
75        pack forget .bugreport.expl
76        pack forget .bugreport.xmit
77        pack forget .bugreport.done
78        pack forget .bugreport.cntls.show
79        pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
80        pack .bugreport.details -after .bugreport.banner \
81            -expand yes -fill both -padx 8 -pady 8
82        pack .bugreport.comments -after .bugreport.details \
83            -expand yes -fill both -padx 8 -pady {0 8}
84
85        update idletasks
86        set w [winfo reqwidth .bugreport]
87        set h [winfo reqheight .bugreport]
88        #gah@purdue: temporary hack to force view of dismiss button
89        incr h 300
90        set x [expr {([winfo screenwidth .bugreport]-$w)/2}]
91        if {$x < 0} {set x "+0"} else {set x "+$x"}
92        set y [expr {([winfo screenheight .bugreport]-$h)/2}]
93        if {$y < 0} {set y "-0"} else {set y "+$y"}
94
95        wm geometry .bugreport $x$y
96        raise .bugreport
97        return
98    }
99
100    # gather details so we can submit trouble reports later
101    # do this now, before we do anything with "catch" down below
102    # that might mask the errorInfo
103    register $err
104
105    pack propagate .bugreport yes
106    pack forget .bugreport.details
107    pack forget .bugreport.xmit
108    pack forget .bugreport.done
109    pack .bugreport.cntls.show -side right
110    pack .bugreport.cntls -after .bugreport.banner -side bottom -fill x
111    pack .bugreport.expl -after .bugreport.banner \
112        -expand yes -fill both -padx 8 -pady 8
113    pack .bugreport.comments -after .bugreport.expl \
114        -expand yes -fill both -padx 8 -pady {0 8}
115
116    .bugreport.expl configure -state normal
117    .bugreport.expl delete 1.0 end
118
119    set url [Rappture::Tool::resources -huburl]
120    if {"" != $url} {
121        .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."
122        .bugreport.cntls.send configure -state normal
123        focus .bugreport.cntls.send
124    } else {
125        .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."
126        pack forget .bugreport.comments
127        .bugreport.cntls.send configure -state disabled
128        focus .bugreport.cntls.ok
129    }
130    fixTextHeight .bugreport.expl
131    .bugreport.expl configure -state disabled
132
133    .bugreport.details.info.text configure -state normal
134    .bugreport.details.info.text delete 1.0 end
135    .bugreport.details.info.text insert end "    USER: $settings(user)\n"
136    .bugreport.details.info.text insert end "HOSTNAME: $details(hostname)\n"
137    .bugreport.details.info.text insert end "PLATFORM: $details(platform)\n"
138    .bugreport.details.info.text insert end "CATEGORY: $details(category)\n"
139    .bugreport.details.info.text insert end "    TOOL: $details(referrer)\n"
140    .bugreport.details.info.text insert end " SESSION: $details(session)\n"
141    .bugreport.details.info.text insert end " SUMMARY: $details(summary)\n"
142    .bugreport.details.info.text insert end "---------\n"
143    .bugreport.details.info.text insert end $details(stackTrace)
144    .bugreport.details.info.text configure -state disabled
145
146    set w [winfo reqwidth .bugreport]
147    set h [winfo reqheight .bugreport]
148    set x [expr {([winfo screenwidth .bugreport]-$w)/2}]
149    if {$x < 0} {set x 0}
150    set y [expr {([winfo screenheight .bugreport]-$h)/2}]
151    if {$y < 0} {set y 0}
152
153    wm geometry .bugreport +$x+$y
154    wm deiconify .bugreport
155    raise .bugreport
156
157    catch {grab set .bugreport}
158    update
159}
160
161# ----------------------------------------------------------------------
162# USAGE: deactivate
163#
164# Used internally to take down the bug handler dialog.
165# ----------------------------------------------------------------------
166proc Rappture::bugreport::deactivate {} {
167    grab release .bugreport
168    wm withdraw .bugreport
169
170    # reset the grab in case it's hosed
171    Rappture::grab::reset
172}
173
174# ----------------------------------------------------------------------
175# USAGE: instrumented <what> <name> <arglist> <body>
176#
177# Used instead of the usual Tcl "proc" or itcl::body to define a
178# procedure that will automatically register information about its
179# execution in the bugreport mechanism.  The <what> parameter should
180# be either "proc" or "itcl::body" or something like that.  When the
181# procedure starts, it pushes its call information onto the stack,
182# then invokes the procedure body, then adds information about the
183# return code.
184# ----------------------------------------------------------------------
185proc Rappture::bugreport::instrumented {what name arglist body} {
186    set avals ""
187    foreach term $arglist {
188        set aname [lindex $term 0]
189        append avals "\$$aname "
190    }
191    uplevel [list $what $name $arglist [format {
192        Rappture::bugreport::remark -enter "PROC %s: %s"
193        set __status [catch {%s} __result]
194        Rappture::bugreport::remark -leave "PROC %s: code($__status) => $__result"
195        switch -- $__status {
196            0 - 2 {
197                return $__result
198            }
199            3 {
200                set __result "invoked \"break\" outside of a loop"
201            }
202            4 {
203                set __result "invoked \"continue\" outside of a loop"
204            }
205        }
206        error $__result $::errorInfo
207    } $name $avals $body $name]]
208}
209
210# ----------------------------------------------------------------------
211# USAGE: remark ?-enter|-leave? <message>
212#
213# Adds the <message> to the current "extraInfo" being kept about the
214# program.  This adds useful debugging info to the report that gets
215# sent back when an unexpected error is trapped.  The -enter and -leave
216# options are used when a bugreport::instrumented proc starts/exits to
217# change the indent level for future messages.
218# ----------------------------------------------------------------------
219proc Rappture::bugreport::remark {args} {
220    variable extraStack
221    variable extraInfo
222
223    if {[llength $args] > 1} {
224        set option [lindex $args 0]
225        set args [lrange $args 1 end]
226        switch -- $option {
227            -enter {
228                if {[llength $args] != 1} {
229                    error "wrong # args: should be \"remark -enter message\""
230                }
231                set mesg [lindex $args 0]
232                if {[llength $extraStack] == 0} {
233                    set extraInfo ""
234                }
235                append extraInfo [remark -indent ">> $mesg"]
236                set extraStack [linsert $extraStack 0 $mesg]
237                return
238            }
239            -leave {
240                if {[llength $args] != 1} {
241                    error "wrong # args: should be \"remark -leave message\""
242                }
243                set mesg [lindex $args 0]
244                set extraStack [lrange $extraStack 1 end]
245                append extraInfo [remark -indent "<< $mesg"]
246                return
247            }
248            -indent {
249                if {[llength $args] != 1} {
250                    error "wrong # args: should be \"remark -indent message\""
251                }
252            }
253            default {
254                error "bad option \"$option\": should be -enter, -leave, -indent"
255            }
256        }
257    }
258    set mesg [lindex $args 0]
259    set nlevel [llength $extraStack]
260    set indent [string repeat { } [expr {2*$nlevel}]]
261    foreach line [split $mesg \n] {
262        append extraInfo "$indent$line\n"
263        set prefix "   "
264    }
265}
266
267# ----------------------------------------------------------------------
268# USAGE: sanitize <string> ?<replacement>?
269#
270# Removes any sensitive information in the bug report.  This is useful
271# for things such as passwords that should be scrubbed out before any
272# ticket is filed.  Replaces the <string> with an optional <replacement>
273# string (or ******** by default).  This is usually called in some sort
274# of "catch" before forwarding the error on to the usual bgerror routine.
275# ----------------------------------------------------------------------
276proc Rappture::bugreport::sanitize {str {repl ********}} {
277    global errorInfo
278    variable extraInfo
279
280    set map [list $str $repl]
281    set errorInfo [string map $map $errorInfo]
282    set extraInfo [string map $map $extraInfo]
283}
284
285# ----------------------------------------------------------------------
286# USAGE: attach <name> <string>
287#
288# Removes any sensitive information in the bug report.  This is useful
289# for things such as passwords that should be scrubbed out before any
290# ticket is filed.  Replaces the <string> with an optional <replacement>
291# string (or ******** by default).  This is usually called in some sort
292# of "catch" before forwarding the error on to the usual bgerror routine.
293# ----------------------------------------------------------------------
294proc Rappture::bugreport::attach {str {repl ********}} {
295    global errorInfo
296    variable extraInfo
297
298    set map [list $str $repl]
299    set errorInfo [string map $map $errorInfo]
300    set extraInfo [string map $map $extraInfo]
301}
302
303
304# ----------------------------------------------------------------------
305# USAGE: submit
306#
307# Takes details currently stored in the panel and registers them
308# as a support ticket on the hosting hub site.  Pops up a panel
309# during the process and informs the user of the result.
310# ----------------------------------------------------------------------
311proc Rappture::bugreport::submit {} {
312    set info [.bugreport.details.info.text get 1.0 end]
313
314    pack propagate .bugreport no
315    pack forget .bugreport.details
316    pack forget .bugreport.expl
317    pack forget .bugreport.comments
318    pack forget .bugreport.cntls
319    pack .bugreport.xmit -after .bugreport.banner -padx 8 -pady 8
320    .bugreport.xmit.title configure -text "Sending trouble report to [Rappture::Tool::resources -hubname]..."
321
322    # send off the trouble report...
323    .bugreport.xmit.icon start
324    set status [catch send result]
325    .bugreport.xmit.icon stop
326
327    pack propagate .bugreport yes
328    pack forget .bugreport.xmit
329    pack .bugreport.expl -after .bugreport.banner -padx 8 -pady 8
330    .bugreport.expl configure -state normal
331    .bugreport.expl delete 1.0 end
332
333    # handle the result
334    if {$status != 0} {
335        # add error to the details field, so we can see it with magic clicks
336        .bugreport.details.info.text configure -state normal
337        .bugreport.details.info.text insert 1.0 "Ticket submission failed:\n$result\n-----\n"
338        .bugreport.details.info.text configure -state disabled
339
340        .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."
341    } elseif {[regexp {Ticket #([0-9]*) +\((.*?)\) +([0-9]+) +times} $result match ticket extra times]} {
342        .bugreport.expl insert end "This problem has been reported as " "" "Ticket #$ticket" bold " in our system." ""
343        if {[string is integer $times] && $times > 1} {
344            .bugreport.expl insert end "  This particular problem has been reported $times times."
345        }
346        .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!"
347    } else {
348        .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!" ""
349    }
350    fixTextHeight .bugreport.expl
351    .bugreport.expl configure -state disabled
352    pack .bugreport.done -side bottom -padx 8 -pady 8
353    focus .bugreport.done
354}
355
356# ----------------------------------------------------------------------
357# USAGE: register <err>
358#
359# Low-level function used to capture information about a bug report
360# prior to calling "send", which actually sends the ticket.  We usually
361# let the user preview the information and decide whether or not to
362# send the ticket.
363# ----------------------------------------------------------------------
364proc Rappture::bugreport::register {err} {
365    global errorInfo tcl_platform
366    variable details
367    variable settings
368    variable extraInfo
369
370    #
371    # Figure out exactly what we'll send if the bug report is
372    # submitted, so we can show the user.
373    #
374    set stackTrace "$err\n---------\n$errorInfo\n---------\n$extraInfo"
375    if {![regexp {^([^\n]+)\n} $stackTrace match summary]} {
376        if {[string length $stackTrace] == 0} {
377            set summary "Unexpected error from Rappture"
378        } else {
379            set summary $stackTrace
380        }
381    }
382    if {[string length $summary] > 200} {
383        set summary "[string range $summary 0 200]..."
384    }
385    if {[string match {Problem launching job*} $summary]} {
386        append summary " (in tool \"[Rappture::Tool::resources -appname]\")"
387        set category "Tools"
388    } else {
389        set category $settings(category)
390    }
391
392    # make sure that the stack trace isn't too long
393    set toolong 20000
394    if {[string length $stackTrace] > $toolong} {
395        #
396        # If this came from "Problem launching job", then it will have
397        # a "== RAPPTURE INPUT ==" part somewhere in the middle.  Try
398        # to show the first part, this middle part, and the very last
399        # part, cutting out whatever we have to in the middle.
400        #
401        if {[regexp -indices {\n== RAPPTURE INPUT ==\n} $stackTrace match]} {
402            foreach {smid0 smid1} $match break
403            set quarter [expr {$toolong/4}]
404            set s0 $quarter
405            set smid0 [expr {$smid0-$quarter}]
406            set smid1 [expr {$smid1+$quarter}]
407            set s1 [expr {[string length $stackTrace]-$quarter}]
408
409            if {$smid0 < $s0} {
410                # first part is short -- truncate last part
411                set stackTrace "[string range $stackTrace 0 $smid1]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-($toolong-$smid1)}] end]"
412            } elseif {$smid1 > $s1} {
413                # last part is short -- truncate first part
414                set tailsize [expr {[string length $stackTrace]-$smid0}]
415                set stackTrace "[string range $stackTrace 0 [expr {$toolong-$tailsize}]]\n...\n[string range $stackTrace $smid0 end]"
416            } else {
417                # rappture input line is right about in the middle
418                set stackTrace "[string range $stackTrace 0 $s0]\n...\n[string range $stackTrace $smid0 $smid1]\n...\n[string range $stackTrace $s1 end]"
419            }
420        } else {
421            # no Rappture input -- just show first part and last part
422            set half [expr {$toolong/2}]
423            set stackTrace "[string range $stackTrace 0 $half]\n...\n[string range $stackTrace [expr {[string length $stackTrace]-$half}] end]"
424        }
425    }
426
427    set details(summary) $summary
428    set details(category) $category
429    set details(stackTrace) $stackTrace
430    set details(hostname) [info hostname]
431    set details(session) [Rappture::Tool::resources -session]
432    set details(referrer) [Rappture::Tool::resources -appname]
433    set details(platform) [array get tcl_platform]
434}
435
436# ----------------------------------------------------------------------
437# USAGE: attachment <string>
438#
439# Low-level function used to capture information about a bug report
440# prior to calling "send", which actually sends the ticket.  We usually
441# let the user preview the information and decide whether or not to
442# send the ticket.
443# ----------------------------------------------------------------------
444proc Rappture::bugreport::attachment { string } {
445    variable details
446    set details(attachment) $string
447}
448
449# ----------------------------------------------------------------------
450# USAGE: send
451#
452# Low-level function used to send bug reports back to the hub site.
453# Error details gathered by a previous call to "register" are sent
454# along as a support ticket.  Returns a string of the following form,
455# representing details about the new or existing ticket:
456#   Ticket #XX (XXXXXX) XX times
457# ----------------------------------------------------------------------
458proc Rappture::bugreport::send {} {
459    variable details
460    variable settings
461
462    package require http
463    package require tls
464    http::register https 443 ::tls::socket
465
466    set report $details(stackTrace)
467    set cmts [string trim [.bugreport.comments.info.text get 1.0 end]]
468    if {[string length $cmts] > 0} {
469        set report "$cmts\n\n[string repeat = 72]\n$report"
470    }
471    set toolFile ""
472    if { [info exists details(attachment)] } {
473        set toolFile "/tmp/tool[pid].xml"
474        set f [open $toolFile "w"]
475        puts $f $details(attachment)
476        close $f
477        unset details(attachment)
478    }
479    set query [http::formatQuery \
480        option com_support \
481        controller tickets \
482        upload $toolFile \
483        task create \
484        no_html 1 \
485        report $report \
486        sesstoken $details(session) \
487        hostname $details(hostname) \
488        os $details(platform) \
489        category $details(category) \
490        summary $details(summary) \
491        referrer $details(referrer) \
492        login $settings(user) \
493        group $settings(group) \
494        type $settings(type) \
495    ]
496    set url [Rappture::Tool::resources -huburl]
497    if { $url == "" } {
498        set url "http://hubzero.org"
499    }
500    if {[string index $url end] == "/"} {
501        append url "index.php"
502    } else {
503        append url "/index.php"
504    }
505
506    set token [http::geturl $url -query $query -timeout 60000]
507
508    if {[http::ncode $token] != 200} {
509        error [http::code $token]
510    }
511    upvar #0 $token rval
512    set info $rval(body)
513    http::cleanup $token
514
515    if { $toolFile != "" } {
516        file delete $toolFile
517    }
518    if {[regexp {Ticket #[0-9]* +\(.*?\) +[0-9]+ +times} $info match]} {
519        return $match
520    }
521    error "Report received, but ticket may not have been filed.  Here's the result...\n$info"
522}
523
524# ----------------------------------------------------------------------
525# USAGE: fixTextHeight <widget>
526#
527# Used internally to adjust the height of a text widget so it is just
528# tall enough to show the info within it.
529# ----------------------------------------------------------------------
530proc Rappture::bugreport::fixTextHeight {widget} {
531    #
532    # HACK ALERT!  In Tk8.5, we can count display lines directly.
533    #   But for earlier versions, we have to cook up something
534    #   similar.
535    #
536    if {[catch {$widget count -displaylines 1.0 end} h] == 0 && $h > 0} {
537        $widget configure -height $h
538    } else {
539        for {set h 1} {$h < 15} {incr h} {
540            $widget configure -height $h
541            $widget see 1.0
542            update idletasks
543            if {"" != [$widget bbox end-1char]} {
544                break
545            }
546        }
547    }
548}
549
550# ----------------------------------------------------------------------
551# USAGE: shouldReport jobfailures <boolean>
552# USAGE: shouldReport for ?oops|jobs?
553#
554# Used internally to determine whether or not this system should
555# automatically report errors back to the hosting hub.  Returns 1
556# if the tool should, and 0 otherwise.  The decision is made based
557# on whether this is a current tool in production, whether it is
558# being tested in a workspace, and whether the tool commonly generates
559# problems (by pilot error in its input deck).
560# ----------------------------------------------------------------------
561proc Rappture::bugreport::shouldReport {option value} {
562    global env
563
564    switch -- $option {
565        jobfailures {
566            variable reportJobFailures
567            if {![string is boolean $value]} {
568                error "bad value \"$value\": should be boolean"
569            }
570            set reportJobFailures $value
571        }
572        for {
573            # is it being run within a workspace?
574            set appname [Rappture::Tool::resources -appname]
575            if {[string match {[Ww]orkspace*} $appname]} {
576                return 0
577            }
578
579            # if this is a problem launching a job and the tool
580            # expects this, then don't bother with automatic reports.
581            variable reportJobFailures
582            if {"jobs" == $value && !$reportJobFailures} {
583                return 0
584            }
585
586            # this is a real problem -- report it!
587            return 1
588        }
589        default {
590            error "bad option \"$option\": should be jobfailures or for"
591        }
592    }
593}
594
595# ----------------------------------------------------------------------
596# Build the bug reporting dialog
597# ----------------------------------------------------------------------
598toplevel .bugreport -class BugReport -borderwidth 1 -relief solid
599wm overrideredirect .bugreport 1
600wm withdraw .bugreport
601
602frame .bugreport.banner -background #a9a9a9
603pack .bugreport.banner -side top -fill x
604label .bugreport.banner.icon -image [Rappture::icon alert]
605pack .bugreport.banner.icon -side left -padx 2 -pady 2
606label .bugreport.banner.title -text "Oops! Internal Error"
607pack .bugreport.banner.title -side left -padx {0 8} -pady 2
608
609# add these frustration bindings in case the "Dismiss" button is off screen
610bind .bugreport.banner.icon <Double-ButtonPress-1> \
611    Rappture::bugreport::deactivate
612bind .bugreport.banner.title <Double-ButtonPress-1> \
613    Rappture::bugreport::deactivate
614bind .bugreport <KeyPress-Escape> \
615    Rappture::bugreport::deactivate
616
617set bg [.bugreport cget -background]
618text .bugreport.expl -borderwidth 0 -highlightthickness 0 -background $bg \
619    -height 3 -wrap word
620.bugreport.expl tag configure bold \
621    -font [option get .bugreport.expl boldFont Font]
622#
623# HACK ALERT!  We have problems with fixTextHeight working correctly
624#   on Windows for Tk8.4 and earlier.  To make it work properly, we
625#   add the binding below.  At some point, we'll ditch 8.4 and we can
626#   use the new "count -displaylines" option in Tk8.5.
627#
628bind .bugreport.expl <Map> {Rappture::bugreport::fixTextHeight %W}
629
630frame .bugreport.comments
631label .bugreport.comments.l -text "What were you doing just before this error?" -anchor w
632pack .bugreport.comments.l -side top -anchor w
633Rappture::Scroller .bugreport.comments.info -xscrollmode none -yscrollmode auto
634text .bugreport.comments.info.text -width 30 -height 3 -wrap word
635.bugreport.comments.info contents .bugreport.comments.info.text
636bind .bugreport.comments.info.text <ButtonPress> {focus %W}
637pack .bugreport.comments.info -expand yes -fill both
638
639frame .bugreport.cntls
640pack .bugreport.cntls -side bottom -fill x
641button .bugreport.cntls.ok -text "Ignore" -command {
642    Rappture::bugreport::deactivate
643}
644pack .bugreport.cntls.ok -side left -padx {4 20} -pady 8
645button .bugreport.cntls.send -text "Send Trouble Report" -command {
646    Rappture::bugreport::submit
647}
648pack .bugreport.cntls.send -side right -padx 4 -pady 8
649
650button .bugreport.cntls.show -text "Show Details..." \
651    -command {Rappture::bugreport::activate @SHOWDETAILS}
652pack .bugreport.cntls.show -side right
653
654
655frame .bugreport.details
656Rappture::Scroller .bugreport.details.info -xscrollmode auto -yscrollmode auto
657text .bugreport.details.info.text -width 50 -height 15 -wrap none
658.bugreport.details.info contents .bugreport.details.info.text
659pack .bugreport.details.info -expand yes -fill both
660
661frame .bugreport.xmit
662Rappture::Animicon .bugreport.xmit.icon -images {
663    circle-ball1 circle-ball2 circle-ball3 circle-ball4
664    circle-ball5 circle-ball6 circle-ball7 circle-ball8
665}
666pack .bugreport.xmit.icon -side left
667label .bugreport.xmit.title -anchor w
668pack .bugreport.xmit.title -side left -expand yes -fill x
669
670button .bugreport.done -text "Done" \
671    -command Rappture::bugreport::deactivate
672
673# this binding keeps the bugreport window on top
674bind BugReportOnTop <ButtonPress> {
675    wm deiconify %W
676    raise %W
677}
678set btags [bindtags .bugreport]
679bindtags .bugreport [linsert $btags 0 BugReportOnTop]
680
Note: See TracBrowser for help on using the repository browser.