Changeset 728 for trunk/gui/scripts/bugreport.tcl
- Timestamp:
- May 11, 2007, 1:06:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/bugreport.tcl
r727 r728 25 25 -*-helvetica-bold-r-normal-*-12-* startupFile 26 26 27 namespace eval Rappture::bugreport { # forward declaration } 27 namespace eval Rappture::bugreport { 28 # assume that if there's a problem launching a job, we should know it 29 variable reportJobFailures 1 30 } 28 31 29 32 # ---------------------------------------------------------------------- … … 63 66 .bugreport.details.info.text configure -state disabled 64 67 65 if {[info exists env(RAPPTURE_VERSION)] 66 && $env(RAPPTURE_VERSION) == "current"} { 68 if {[shouldReport for oops]} { 67 69 pack forget .bugreport.details 68 70 pack forget .bugreport.expl … … 195 197 proc Rappture::bugreport::register {stackTrace} { 196 198 global env tcl_platform 197 198 # if this is a test version, do nothing199 if {![info exists env(RAPPTURE_VERSION)]200 || $env(RAPPTURE_VERSION) != "current"} {201 return202 }203 199 204 200 package require http … … 256 252 257 253 # ---------------------------------------------------------------------- 254 # USAGE: shouldReport jobfailures <boolean> 255 # USAGE: shouldReport for ?oops|jobs? 256 # 257 # Used internally to determine whether or not this system should 258 # automatically report errors back to the hosting hub. Returns 1 259 # if the tool should, and 0 otherwise. The decision is made based 260 # on whether this is a current tool in production, whether it is 261 # being tested in a workspace, and whether the tool commonly generates 262 # problems (by pilot error in its input deck). 263 # ---------------------------------------------------------------------- 264 proc Rappture::bugreport::shouldReport {option value} { 265 global env 266 267 switch -- $option { 268 jobfailures { 269 variable reportJobFailures 270 if {![string is boolean $value]} { 271 error "bad value \"$value\": should be boolean" 272 } 273 set reportJobFailures $value 274 } 275 for { 276 # is this a tool in production? 277 if {![info exists env(RAPPTURE_VERSION)] 278 || $env(RAPPTURE_VERSION) != "current"} { 279 return 0 280 } 281 282 # is it being run within a workspace? 283 set appname [Rappture::Tool::resources -appname] 284 if {[string match {[Ww]orkspace*} $appname]} { 285 return 0 286 } 287 288 # if this is a problem launching a job and the tool 289 # expects this, then don't bother with automatic reports. 290 variable reportJobFailures 291 if {"jobs" == $value && !$reportJobFailures} { 292 return 0 293 } 294 295 # this is a real problem -- report it! 296 return 1 297 } 298 default { 299 error "bad option \"$option\": should be jobfailures or for" 300 } 301 } 302 } 303 304 # ---------------------------------------------------------------------- 258 305 # Build the bug reporting dialog 259 306 # ----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.